netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] bridge: Add bridge ifindex to bridge fdb notify msgs
@ 2014-05-28  5:39 roopa
  2014-05-28 11:24 ` Jamal Hadi Salim
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: roopa @ 2014-05-28  5:39 UTC (permalink / raw)
  To: davem, stephen, netdev; +Cc: jhs, wkok, sfeldma, shm

From: Roopa Prabhu <roopa@cumulusnetworks.com>

(This patch was previously posted as RFC at
http://patchwork.ozlabs.org/patch/352677/)

This patch adds NDA_MASTER attribute to neighbour attributes enum for
bridge/master ifindex. And adds NDA_MASTER to bridge fdb notify msgs.

Today bridge fdb notifications dont contain bridge information.
Userspace can derive it from the port information in the fdb
notification. However this is tricky in some scenarious.

Example, bridge port delete notification comes before bridge fdb
delete notifications. And we have seen problems in userspace
when using libnl where, the bridge fdb delete notification handling code
does not understand which bridge this fdb entry is part of because
the bridge and port association has already been deleted.
And these notifications (port membership and fdb) are generated on
separate rtnl groups.

Fixing the order of notifications could possibly solve the problem
for some cases (I can submit a separate patch for that).

This patch chooses to add NDA_MASTER to bridge fdb notify msgs
because it not only solves the problem described above, but also helps
userspace avoid another lookup into link msgs to derive the master index.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
---
 include/uapi/linux/neighbour.h |    1 +
 net/bridge/br_fdb.c            |    3 +++
 2 files changed, 4 insertions(+)

diff --git a/include/uapi/linux/neighbour.h b/include/uapi/linux/neighbour.h
index d3ef583..4a1d7e9 100644
--- a/include/uapi/linux/neighbour.h
+++ b/include/uapi/linux/neighbour.h
@@ -24,6 +24,7 @@ enum {
 	NDA_PORT,
 	NDA_VNI,
 	NDA_IFINDEX,
+	NDA_MASTER,
 	__NDA_MAX
 };
 
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 9203d5a..019bb93 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -565,6 +565,8 @@ static int fdb_fill_info(struct sk_buff *skb, const struct net_bridge *br,
 
 	if (nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->addr))
 		goto nla_put_failure;
+	if (nla_put_u32(skb, NDA_MASTER, br->dev->ifindex))
+		goto nla_put_failure;
 	ci.ndm_used	 = jiffies_to_clock_t(now - fdb->used);
 	ci.ndm_confirmed = 0;
 	ci.ndm_updated	 = jiffies_to_clock_t(now - fdb->updated);
@@ -586,6 +588,7 @@ static inline size_t fdb_nlmsg_size(void)
 {
 	return NLMSG_ALIGN(sizeof(struct ndmsg))
 		+ nla_total_size(ETH_ALEN) /* NDA_LLADDR */
+		+ nla_total_size(sizeof(u32)) /* NDA_MASTER */
 		+ nla_total_size(sizeof(u16)) /* NDA_VLAN */
 		+ nla_total_size(sizeof(struct nda_cacheinfo));
 }
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] bridge: Add bridge ifindex to bridge fdb notify msgs
  2014-05-28  5:39 [PATCH net-next] bridge: Add bridge ifindex to bridge fdb notify msgs roopa
@ 2014-05-28 11:24 ` Jamal Hadi Salim
  2014-06-02 20:50 ` David Miller
  2014-06-03  0:59 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: Jamal Hadi Salim @ 2014-05-28 11:24 UTC (permalink / raw)
  To: roopa, davem, stephen, netdev; +Cc: wkok, sfeldma, shm

Looks good to me - i will be testing it over the weekend.

cheers,
jamal

On 05/28/14 01:39, roopa@cumulusnetworks.com wrote:
> From: Roopa Prabhu <roopa@cumulusnetworks.com>
>
> (This patch was previously posted as RFC at
> http://patchwork.ozlabs.org/patch/352677/)
>
> This patch adds NDA_MASTER attribute to neighbour attributes enum for
> bridge/master ifindex. And adds NDA_MASTER to bridge fdb notify msgs.
>
> Today bridge fdb notifications dont contain bridge information.
> Userspace can derive it from the port information in the fdb
> notification. However this is tricky in some scenarious.
>
> Example, bridge port delete notification comes before bridge fdb
> delete notifications. And we have seen problems in userspace
> when using libnl where, the bridge fdb delete notification handling code
> does not understand which bridge this fdb entry is part of because
> the bridge and port association has already been deleted.
> And these notifications (port membership and fdb) are generated on
> separate rtnl groups.
>
> Fixing the order of notifications could possibly solve the problem
> for some cases (I can submit a separate patch for that).
>
> This patch chooses to add NDA_MASTER to bridge fdb notify msgs
> because it not only solves the problem described above, but also helps
> userspace avoid another lookup into link msgs to derive the master index.
>
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
> ---
>   include/uapi/linux/neighbour.h |    1 +
>   net/bridge/br_fdb.c            |    3 +++
>   2 files changed, 4 insertions(+)
>
> diff --git a/include/uapi/linux/neighbour.h b/include/uapi/linux/neighbour.h
> index d3ef583..4a1d7e9 100644
> --- a/include/uapi/linux/neighbour.h
> +++ b/include/uapi/linux/neighbour.h
> @@ -24,6 +24,7 @@ enum {
>   	NDA_PORT,
>   	NDA_VNI,
>   	NDA_IFINDEX,
> +	NDA_MASTER,
>   	__NDA_MAX
>   };
>
> diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
> index 9203d5a..019bb93 100644
> --- a/net/bridge/br_fdb.c
> +++ b/net/bridge/br_fdb.c
> @@ -565,6 +565,8 @@ static int fdb_fill_info(struct sk_buff *skb, const struct net_bridge *br,
>
>   	if (nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->addr))
>   		goto nla_put_failure;
> +	if (nla_put_u32(skb, NDA_MASTER, br->dev->ifindex))
> +		goto nla_put_failure;
>   	ci.ndm_used	 = jiffies_to_clock_t(now - fdb->used);
>   	ci.ndm_confirmed = 0;
>   	ci.ndm_updated	 = jiffies_to_clock_t(now - fdb->updated);
> @@ -586,6 +588,7 @@ static inline size_t fdb_nlmsg_size(void)
>   {
>   	return NLMSG_ALIGN(sizeof(struct ndmsg))
>   		+ nla_total_size(ETH_ALEN) /* NDA_LLADDR */
> +		+ nla_total_size(sizeof(u32)) /* NDA_MASTER */
>   		+ nla_total_size(sizeof(u16)) /* NDA_VLAN */
>   		+ nla_total_size(sizeof(struct nda_cacheinfo));
>   }
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] bridge: Add bridge ifindex to bridge fdb notify msgs
  2014-05-28  5:39 [PATCH net-next] bridge: Add bridge ifindex to bridge fdb notify msgs roopa
  2014-05-28 11:24 ` Jamal Hadi Salim
@ 2014-06-02 20:50 ` David Miller
  2014-06-02 22:18   ` Jamal Hadi Salim
  2014-06-03  0:59 ` David Miller
  2 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2014-06-02 20:50 UTC (permalink / raw)
  To: roopa; +Cc: stephen, netdev, jhs, wkok, sfeldma, shm


Jamal, how did the testing go?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] bridge: Add bridge ifindex to bridge fdb notify msgs
  2014-06-02 20:50 ` David Miller
@ 2014-06-02 22:18   ` Jamal Hadi Salim
  0 siblings, 0 replies; 5+ messages in thread
From: Jamal Hadi Salim @ 2014-06-02 22:18 UTC (permalink / raw)
  To: David Miller, roopa; +Cc: stephen, netdev, wkok, sfeldma, shm

On 06/02/14 16:50, David Miller wrote:
>
> Jamal, how did the testing go?
>

Works as advertised.

Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>

cheers,
jamal

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] bridge: Add bridge ifindex to bridge fdb notify msgs
  2014-05-28  5:39 [PATCH net-next] bridge: Add bridge ifindex to bridge fdb notify msgs roopa
  2014-05-28 11:24 ` Jamal Hadi Salim
  2014-06-02 20:50 ` David Miller
@ 2014-06-03  0:59 ` David Miller
  2 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2014-06-03  0:59 UTC (permalink / raw)
  To: roopa; +Cc: stephen, netdev, jhs, wkok, sfeldma, shm

From: roopa@cumulusnetworks.com
Date: Tue, 27 May 2014 22:39:37 -0700

> From: Roopa Prabhu <roopa@cumulusnetworks.com>
> 
> (This patch was previously posted as RFC at
> http://patchwork.ozlabs.org/patch/352677/)
> 
> This patch adds NDA_MASTER attribute to neighbour attributes enum for
> bridge/master ifindex. And adds NDA_MASTER to bridge fdb notify msgs.
> 
> Today bridge fdb notifications dont contain bridge information.
> Userspace can derive it from the port information in the fdb
> notification. However this is tricky in some scenarious.
> 
> Example, bridge port delete notification comes before bridge fdb
> delete notifications. And we have seen problems in userspace
> when using libnl where, the bridge fdb delete notification handling code
> does not understand which bridge this fdb entry is part of because
> the bridge and port association has already been deleted.
> And these notifications (port membership and fdb) are generated on
> separate rtnl groups.
> 
> Fixing the order of notifications could possibly solve the problem
> for some cases (I can submit a separate patch for that).
> 
> This patch chooses to add NDA_MASTER to bridge fdb notify msgs
> because it not only solves the problem described above, but also helps
> userspace avoid another lookup into link msgs to derive the master index.
> 
> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-06-03  0:59 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-28  5:39 [PATCH net-next] bridge: Add bridge ifindex to bridge fdb notify msgs roopa
2014-05-28 11:24 ` Jamal Hadi Salim
2014-06-02 20:50 ` David Miller
2014-06-02 22:18   ` Jamal Hadi Salim
2014-06-03  0:59 ` David Miller

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).