From: Rich Lane <rich.lane@bigswitch.com>
To: "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v2] cfgfile: support looking up sections by index
Date: Wed, 10 Feb 2016 11:13:15 -0800 [thread overview]
Message-ID: <CAGSMBPP1KV2wEthhjyvvxN=xP10cPYY8WOPS3X3De9eTm6FyOA@mail.gmail.com> (raw)
In-Reply-To: <3EB4FA525960D640B5BDFFD6A3D891264794DACE@IRSMSX108.ger.corp.intel.com>
On Tue, Feb 2, 2016 at 7:10 AM, Dumitrescu, Cristian <
cristian.dumitrescu@intel.com> wrote:
>
>
> > -----Original Message-----
> > From: Rich Lane [mailto:rich.lane@bigswitch.com]
> > Sent: Tuesday, January 19, 2016 4:42 AM
> > To: dev@dpdk.org
> > Cc: Dumitrescu, Cristian <cristian.dumitrescu@intel.com>; Panu
> Matilainen
> > <pmatilai@redhat.com>
> > Subject: [PATCH v2] cfgfile: support looking up sections by index
> >
> > This is useful when sections have duplicate names.
>
> Hi Rich,
>
> You are right, I can see this is needed to allow multiple sections with
> identical name in the same configuration file. When sections with the same
> name are not allowed, then this is not needed, as the current API is
> sufficient.
>
> To me, having several sections with the same name does not look like a
> good idea, in fact it might look like an application design flaw, as
> differentiating between sections with the same name can only done based on
> the position of the section in the configuration file, which is an error
> prone option. Some examples:
> 1. While maintaining a large config file, keeping a specific section at a
> fixed position quickly becomes a pain, and shifting the position of the
> section up or down can completely change the application behavior;
> 2. Using basic pre-processors (like CPP or M4) or scripts, the master
> configuration file can include other configuration files, with the
> inclusion of each decided at run-time based on application command line
> parameters, so the position of certain sections is actually not known until
> run-time.
>
> Can you provide some examples when having multiple sections with the same
> name is a key requirement?
>
My application uses a config file to assign RX/TX queues to cores. Ports
and cores have names (e.g. "core.fwd0"), but there's no reason to name
queues. The order of the queue sections is unimportant.
> A straight forward workaround to having multiple sections with the same
> name is to add a number to the name of each such section. Using the current
> API, all the sections with the same prefix name can be read gracefully. As
> an example, the ip_pipeline application allows multiple sections with the
> same name prefix but a different number prefix:
> PIPELINE0, PIPELINE1, ...
> LINK0, LINK1, ...
> MEMPOOL0, MEMPOOL1, ...
> RXQ0.0, RXQ0.1, RXQ1.0, ...
> TXQ0.0, TXQ0.1, TXQ1.0, ...
>
> Is there a reason why this approach is not acceptable for your application?
>
It is less usable. The person writing the config file must generate those
suffixes which are irrelevant to what they're trying to express. The sole
effect is to add another source of errors.
Additionally, this API allows reading a config file in linear instead of
quadratic time (wrt number of sections). While my config files aren't long
enough to make this a requirement it certainly seems desirable.
next prev parent reply other threads:[~2016-02-10 19:13 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-17 3:58 [dpdk-dev] [PATCH] " Rich Lane
2016-01-18 12:58 ` Panu Matilainen
2016-01-19 4:41 ` [dpdk-dev] [PATCH v2] " Rich Lane
2016-01-21 7:42 ` Panu Matilainen
2016-02-02 15:10 ` Dumitrescu, Cristian
2016-02-10 19:13 ` Rich Lane [this message]
2016-02-10 19:12 ` [dpdk-dev] [PATCH v3] " Rich Lane
2016-02-16 20:48 ` Dumitrescu, Cristian
2016-02-16 22:58 ` [dpdk-dev] [PATCH v4] " Rich Lane
2016-02-19 15:18 ` Dumitrescu, Cristian
2016-02-22 20:30 ` [dpdk-dev] [PATCH v5] " Rich Lane
2016-02-23 0:12 ` Dumitrescu, Cristian
2016-02-25 20:43 ` [dpdk-dev] [PATCH v6] " Rich Lane
2016-02-25 20:49 ` Dumitrescu, Cristian
2016-02-29 10:29 ` Thomas Monjalon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAGSMBPP1KV2wEthhjyvvxN=xP10cPYY8WOPS3X3De9eTm6FyOA@mail.gmail.com' \
--to=rich.lane@bigswitch.com \
--cc=cristian.dumitrescu@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).