Commit 664de48b authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

bridge: split rcu and no-rcu cases of fdb lookup

In some cases, look up of forward database entry is done with RCU;
and for others no RCU is needed because of locking. Split the two
cases into two differnt loops (and take off inline).
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 7cd8861a
...@@ -305,7 +305,20 @@ int br_fdb_fillbuf(struct net_bridge *br, void *buf, ...@@ -305,7 +305,20 @@ int br_fdb_fillbuf(struct net_bridge *br, void *buf,
return num; return num;
} }
static inline struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head, static struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head,
const unsigned char *addr)
{
struct hlist_node *h;
struct net_bridge_fdb_entry *fdb;
hlist_for_each_entry(fdb, h, head, hlist) {
if (!compare_ether_addr(fdb->addr.addr, addr))
return fdb;
}
return NULL;
}
static struct net_bridge_fdb_entry *fdb_find_rcu(struct hlist_head *head,
const unsigned char *addr) const unsigned char *addr)
{ {
struct hlist_node *h; struct hlist_node *h;
...@@ -393,7 +406,7 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source, ...@@ -393,7 +406,7 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
source->state == BR_STATE_FORWARDING)) source->state == BR_STATE_FORWARDING))
return; return;
fdb = fdb_find(head, addr); fdb = fdb_find_rcu(head, addr);
if (likely(fdb)) { if (likely(fdb)) {
/* attempt to update an entry for a local interface */ /* attempt to update an entry for a local interface */
if (unlikely(fdb->is_local)) { if (unlikely(fdb->is_local)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment