From: Cong Wang <amwang@redhat.com>
To: Thomas Graf <tgraf@suug.ch>
Cc: netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
Herbert Xu <herbert@gondor.hengli.com.au>,
Jesper Dangaard Brouer <brouer@redhat.com>,
Stephen Hemminger <shemminger@vyatta.com>,
"David S. Miller" <davem@davemloft.net>
Subject: Re: [Bridge] [PATCH net-next v1 2/2] bridge: export multicast database via netlink
Date: Fri, 30 Nov 2012 23:00:52 +0800 [thread overview]
Message-ID: <1354287652.19865.10.camel@cr0> (raw)
In-Reply-To: <20121130112618.GF30697@casper.infradead.org>
On Fri, 2012-11-30 at 11:26 +0000, Thomas Graf wrote:
> On 11/30/12 at 05:58pm, Cong Wang wrote:
> > +
> > + nest = nla_nest_start(skb, MDBA_ROUTER);
> > + if (nest == NULL)
> > + return -EMSGSIZE;
> > +
> > + hlist_for_each_entry_rcu(p, n, &br->router_list, rlist) {
> > + if (p && nla_put_u16(skb, MDBA_BRPORT_NO, p->port_no))
> > + goto fail;
> > + }
>
> port_no 0 is reserved, right?
>
> We can reduce message size here and make it easier to extend by
> using p->port_no as the attribute id by doing something like this:
>
> hlist_for_each_entry_rcu(p, n, &br->router_list, rlist)
> if (nla_put_flag(skb, p->port_no))
> goto fail;
>
> This will result in an empty attribute body for now and if you ever
> need to include more data you can simply start putting attributes
> insde that empty body and old users will continue to function.
I don't understand this. nla_put_flag() is used to put a flag (only one
bit set) into a netlink message, so why should we use it to put
p->port_no here? And why port_no 0 matters here?
[...]
> > +
> > + cb->seq = mdb->seq;
>
> I'm not sure how this is supposed to worl. cb->seq may not change
> throughout the complete dump process or the dump will be interrupted
> and the user is required to restart.
>
> Each bridge will have its own mdb resulting in a differing seq.
>
So I should use net->dev_base_seq + mdb->seq ?
All of the rest suggestions are taken by me.
Thanks for your detailed review!
WARNING: multiple messages have this Message-ID (diff)
From: Cong Wang <amwang@redhat.com>
To: Thomas Graf <tgraf@suug.ch>
Cc: netdev@vger.kernel.org, bridge@lists.linux-foundation.org,
Herbert Xu <herbert@gondor.hengli.com.au>,
Stephen Hemminger <shemminger@vyatta.com>,
"David S. Miller" <davem@davemloft.net>,
Jesper Dangaard Brouer <brouer@redhat.com>
Subject: Re: [PATCH net-next v1 2/2] bridge: export multicast database via netlink
Date: Fri, 30 Nov 2012 23:00:52 +0800 [thread overview]
Message-ID: <1354287652.19865.10.camel@cr0> (raw)
In-Reply-To: <20121130112618.GF30697@casper.infradead.org>
On Fri, 2012-11-30 at 11:26 +0000, Thomas Graf wrote:
> On 11/30/12 at 05:58pm, Cong Wang wrote:
> > +
> > + nest = nla_nest_start(skb, MDBA_ROUTER);
> > + if (nest == NULL)
> > + return -EMSGSIZE;
> > +
> > + hlist_for_each_entry_rcu(p, n, &br->router_list, rlist) {
> > + if (p && nla_put_u16(skb, MDBA_BRPORT_NO, p->port_no))
> > + goto fail;
> > + }
>
> port_no 0 is reserved, right?
>
> We can reduce message size here and make it easier to extend by
> using p->port_no as the attribute id by doing something like this:
>
> hlist_for_each_entry_rcu(p, n, &br->router_list, rlist)
> if (nla_put_flag(skb, p->port_no))
> goto fail;
>
> This will result in an empty attribute body for now and if you ever
> need to include more data you can simply start putting attributes
> insde that empty body and old users will continue to function.
I don't understand this. nla_put_flag() is used to put a flag (only one
bit set) into a netlink message, so why should we use it to put
p->port_no here? And why port_no 0 matters here?
[...]
> > +
> > + cb->seq = mdb->seq;
>
> I'm not sure how this is supposed to worl. cb->seq may not change
> throughout the complete dump process or the dump will be interrupted
> and the user is required to restart.
>
> Each bridge will have its own mdb resulting in a differing seq.
>
So I should use net->dev_base_seq + mdb->seq ?
All of the rest suggestions are taken by me.
Thanks for your detailed review!
next prev parent reply other threads:[~2012-11-30 15:00 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-30 9:58 [Bridge] [PATCH net-next v1 1/2] bridge: export port_no and port_id via IFA_INFO_DATA Cong Wang
2012-11-30 9:58 ` Cong Wang
2012-11-30 9:58 ` [Bridge] [PATCH net-next v1 2/2] bridge: export multicast database via netlink Cong Wang
2012-11-30 9:58 ` Cong Wang
2012-11-30 11:26 ` [Bridge] " Thomas Graf
2012-11-30 11:26 ` Thomas Graf
2012-11-30 15:00 ` Cong Wang [this message]
2012-11-30 15:00 ` Cong Wang
2012-11-30 15:27 ` [Bridge] " Thomas Graf
2012-11-30 15:27 ` Thomas Graf
2012-12-01 3:56 ` [Bridge] " Cong Wang
2012-12-01 3:56 ` Cong Wang
2012-11-30 9:58 ` [Bridge] [PATCH iproute2 v1] Add mdb command to bridge Cong Wang
2012-11-30 9:58 ` Cong Wang
2012-11-30 10:54 ` [Bridge] " Thomas Graf
2012-11-30 10:54 ` Thomas Graf
2012-11-30 14:50 ` [Bridge] " Cong Wang
2012-11-30 14:50 ` Cong Wang
2012-11-30 10:18 ` [Bridge] [PATCH net-next v1 1/2] bridge: export port_no and port_id via IFA_INFO_DATA Thomas Graf
2012-11-30 10:18 ` Thomas Graf
2012-11-30 14:51 ` [Bridge] " Cong Wang
2012-11-30 14:51 ` Cong Wang
2012-11-30 15:52 ` [Bridge] " Stephen Hemminger
2012-11-30 15:52 ` Stephen Hemminger
2012-12-01 3:53 ` [Bridge] " Cong Wang
2012-12-01 3:53 ` Cong Wang
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=1354287652.19865.10.camel@cr0 \
--to=amwang@redhat.com \
--cc=bridge@lists.linux-foundation.org \
--cc=brouer@redhat.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.hengli.com.au \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.com \
--cc=tgraf@suug.ch \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.