From: Vlad Dogaru <ddvlad@rosedu.org>
To: Patrick McHardy <kaber@trash.net>
Cc: netdev@vger.kernel.org, Stephen Hemminger <shemminger@vyatta.com>
Subject: Re: [PATCH v3 1/3] iproute2: add support for setting device groups
Date: Wed, 2 Feb 2011 11:56:58 +0200 [thread overview]
Message-ID: <20110202095658.GK2494@cormyr> (raw)
In-Reply-To: <4D492289.8090708@trash.net>
On Wed, Feb 02, 2011 at 10:23:21AM +0100, Patrick McHardy wrote:
> On 02.02.2011 10:13, Vlad Dogaru wrote:
> > On Wed, Feb 02, 2011 at 09:56:28AM +0100, Patrick McHardy wrote:
> >> On 26.01.2011 17:41, Vlad Dogaru wrote:
> >>> Use the group keyword to specify what group the device should belong to.
> >>> Since the kernel uses numbers internally, mapping of group names to
> >>> numbers is defined in /etc/iproute2/group_map. Example usage:
> >>>
> >>> ip link set dev eth0 group default
> >>>
> >>> @@ -297,6 +299,13 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
> >>> if (get_integer(&mtu, *argv, 0))
> >>> invarg("Invalid \"mtu\" value\n", *argv);
> >>> addattr_l(&req->n, sizeof(*req), IFLA_MTU, &mtu, 4);
> >>> + } else if (strcmp(*argv, "group") == 0) {
> >>> + NEXT_ARG();
> >>> + if (group != -1)
> >>> + duparg("group", *argv);
> >>> + if (lookup_map_id(*argv, &group, GROUP_MAP))
> >>> + invarg("Invalid \"group\" value\n", *argv);
> >>> + addattr_l(&req->n, sizeof(*req), IFLA_GROUP, &group, 4);
> >>
> >> I think it would be preferrable to use a function similar to
> >> rt_realm_n2a() that can also handle plain numerical values.
> >
> > The a2n() functions are rather complex for this case: they employ
> > caching and store a table. I suppose this is because multiple calls to
> > them are possible in a single run and the correspondence has to be made
> > in both ways (a2n and n2a).
> >
> > A network group is only converted to a number at most once for each ip
> > process spawned, so storing a table is not really helpful. What could,
> > however, help is using get_integer before lookup_map_id. Only if
> > get_integer fails would we lookup the symbolic group name.
>
> Actually that's not entirely correct, the caches are (also) maintained
> to speed up batch mode, in which case there could also be multiple name
> to group mappings.
Both comments noted. I will respin the patches dropping the devgroup
keyword and implementing caching for groups.
Thanks for the feedback.
next prev parent reply other threads:[~2011-02-02 9:57 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-26 16:41 [PATCH v3 0/3] iproute2: support for device groups Vlad Dogaru
2011-01-26 16:41 ` [PATCH v3 1/3] iproute2: add support for setting " Vlad Dogaru
2011-02-02 8:56 ` Patrick McHardy
2011-02-02 9:13 ` Vlad Dogaru
2011-02-02 9:21 ` Patrick McHardy
2011-02-02 9:23 ` Patrick McHardy
2011-02-02 9:56 ` Vlad Dogaru [this message]
2011-01-26 16:41 ` [PATCH v3 2/3] iproute2: support listing devices by group Vlad Dogaru
2011-01-26 16:41 ` [PATCH v3 3/3] iproute2: support setting device parameters " Vlad Dogaru
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=20110202095658.GK2494@cormyr \
--to=ddvlad@rosedu.org \
--cc=kaber@trash.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
/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).