From: Stephen Hemminger <shemminger@vyatta•com>
To: "David S. Miller" <davem@davemloft•net>
Cc: netdev@vger•kernel.org
Subject: [PATCH 1/7] bridge: change arguments to fdb_create
Date: Mon, 04 Apr 2011 17:03:27 -0700 [thread overview]
Message-ID: <20110405000537.001922245@vyatta.com> (raw)
In-Reply-To: 20110405000326.714524584@vyatta.com
[-- Attachment #1: br-fdb-reorg.patch --]
[-- Type: text/plain, Size: 1772 bytes --]
Later patch provides ability to create non-local static entry.
To make this easier move the updating of the flag values to
after the code that creates entry.
Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>
--- a/net/bridge/br_fdb.c 2011-03-21 09:04:33.000000000 -0700
+++ b/net/bridge/br_fdb.c 2011-03-21 10:36:09.359041121 -0700
@@ -320,8 +320,7 @@ static inline struct net_bridge_fdb_entr
static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head,
struct net_bridge_port *source,
- const unsigned char *addr,
- int is_local)
+ const unsigned char *addr)
{
struct net_bridge_fdb_entry *fdb;
@@ -329,10 +328,9 @@ static struct net_bridge_fdb_entry *fdb_
if (fdb) {
memcpy(fdb->addr.addr, addr, ETH_ALEN);
fdb->dst = source;
- fdb->is_local = is_local;
- fdb->is_static = is_local;
+ fdb->is_local = 0;
+ fdb->is_static = 0;
fdb->ageing_timer = jiffies;
-
hlist_add_head_rcu(&fdb->hlist, head);
}
return fdb;
@@ -360,12 +358,15 @@ static int fdb_insert(struct net_bridge
fdb_delete(fdb);
}
- if (!fdb_create(head, source, addr, 1))
+ fdb = fdb_create(head, source, addr);
+ if (!fdb)
return -ENOMEM;
+ fdb->is_local = fdb->is_static = 1;
return 0;
}
+/* Add entry for local address of interface */
int br_fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
const unsigned char *addr)
{
@@ -407,8 +408,9 @@ void br_fdb_update(struct net_bridge *br
}
} else {
spin_lock(&br->hash_lock);
- if (!fdb_find(head, addr))
- fdb_create(head, source, addr, 0);
+ if (likely(!fdb_find(head, addr)))
+ fdb_create(head, source, addr);
+
/* else we lose race and someone else inserts
* it first, don't bother updating
*/
next prev parent reply other threads:[~2011-04-05 0:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-05 0:03 [PATCH 0/7] bridge enhancements for net-next Stephen Hemminger
2011-04-05 0:03 ` Stephen Hemminger [this message]
2011-04-05 0:03 ` [PATCH 2/7] bridge: track last used time in forwarding table Stephen Hemminger
2011-04-05 0:03 ` [PATCH 3/7] bridge: split rcu and no-rcu cases of fdb lookup Stephen Hemminger
2011-04-05 0:03 ` [PATCH 4/7] bridge: add netlink notification on forward entry changes Stephen Hemminger
2011-04-05 0:03 ` [PATCH 5/7] bridge: allow creating/deleting fdb entries via netlink Stephen Hemminger
2011-10-05 19:06 ` Kevin Wilson
2011-10-05 19:13 ` Stephen Hemminger
2011-10-05 19:36 ` Ben Hutchings
2011-04-05 0:03 ` [PATCH 6/7] bridge: allow creating bridge devices with netlink Stephen Hemminger
2011-04-05 0:03 ` [PATCH 7/7] bridge: range check STP parameters Stephen Hemminger
2011-04-05 0:23 ` [PATCH 0/7] bridge enhancements for net-next David Miller
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=20110405000537.001922245@vyatta.com \
--to=shemminger@vyatta$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/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