public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: roopa@cumulusnetworks•com
To: davem@davemloft•net, stephen@networkplumber•org, netdev@vger•kernel.org
To: roopa@cumulusnetworks•com
Cc: nolan@cumulusnetworks•com, shm@cumulusnetworks•com,
	wkok@cumulusnetworks•com
Subject: [PATCH net-next] bridge: Add fdb dst check during fdb update
Date: Sat, 13 Apr 2013 21:58:49 -0700	[thread overview]
Message-ID: <1365915529-8317-1-git-send-email-roopa@cumulusnetworks.com> (raw)

From: roopa <roopa@cumulusnetworks•com>

Current bridge fdb update code does not seem to update the port
during fdb update. This patch adds a check for fdb dst (port)
change during fdb update. Also rearranges the call to
fdb_notify to send only one notification for create and update.

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks•com>
---
 net/bridge/br_fdb.c |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index c581f12..7a7d920 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -615,6 +615,7 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
 	struct net_bridge *br = source->br;
 	struct hlist_head *head = &br->hash[br_mac_hash(addr, vid)];
 	struct net_bridge_fdb_entry *fdb;
+	int notify = 0;
 
 	fdb = fdb_find(head, addr, vid);
 	if (fdb == NULL) {
@@ -624,7 +625,7 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
 		fdb = fdb_create(head, source, addr, vid);
 		if (!fdb)
 			return -ENOMEM;
-		fdb_notify(br, fdb, RTM_NEWNEIGH);
+		notify = 1;
 	} else {
 		if (flags & NLM_F_EXCL)
 			return -EEXIST;
@@ -638,7 +639,15 @@ static int fdb_add_entry(struct net_bridge_port *source, const __u8 *addr,
 			fdb->is_static = 1;
 		} else
 			fdb->is_local = fdb->is_static = 0;
+		notify = 1;
+	}
+
+	if (fdb->dst != source) {
+		fdb->dst = source;
+		notify = 1;
+	}
 
+	if (notify) {
 		fdb->updated = fdb->used = jiffies;
 		fdb_notify(br, fdb, RTM_NEWNEIGH);
 	}
-- 
1.7.10.4

             reply	other threads:[~2013-04-14  5:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-14  4:58 roopa [this message]
2013-04-14 15:00 ` [PATCH net-next] bridge: Add fdb dst check during fdb update 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=1365915529-8317-1-git-send-email-roopa@cumulusnetworks.com \
    --to=roopa@cumulusnetworks$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=nolan@cumulusnetworks$(echo .)com \
    --cc=shm@cumulusnetworks$(echo .)com \
    --cc=stephen@networkplumber$(echo .)org \
    --cc=wkok@cumulusnetworks$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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