aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2011-04-04 10:03:27 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-04 20:22:25 -0400
commit03e9b64b89243ccc6f8f48f5955a5a78a8ca1431 (patch)
tree5ab589f74076a17cea2b08aca5ce4354cde32142 /net/bridge
parent0545a3037773512d3448557ba048cebb73b3e4af (diff)
bridge: change arguments to fdb_create
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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_fdb.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 88485cc74dc3..70bd0bf04099 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -320,8 +320,7 @@ static inline struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head,
320 320
321static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head, 321static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head,
322 struct net_bridge_port *source, 322 struct net_bridge_port *source,
323 const unsigned char *addr, 323 const unsigned char *addr)
324 int is_local)
325{ 324{
326 struct net_bridge_fdb_entry *fdb; 325 struct net_bridge_fdb_entry *fdb;
327 326
@@ -329,10 +328,9 @@ static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head,
329 if (fdb) { 328 if (fdb) {
330 memcpy(fdb->addr.addr, addr, ETH_ALEN); 329 memcpy(fdb->addr.addr, addr, ETH_ALEN);
331 fdb->dst = source; 330 fdb->dst = source;
332 fdb->is_local = is_local; 331 fdb->is_local = 0;
333 fdb->is_static = is_local; 332 fdb->is_static = 0;
334 fdb->ageing_timer = jiffies; 333 fdb->ageing_timer = jiffies;
335
336 hlist_add_head_rcu(&fdb->hlist, head); 334 hlist_add_head_rcu(&fdb->hlist, head);
337 } 335 }
338 return fdb; 336 return fdb;
@@ -360,12 +358,15 @@ static int fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
360 fdb_delete(fdb); 358 fdb_delete(fdb);
361 } 359 }
362 360
363 if (!fdb_create(head, source, addr, 1)) 361 fdb = fdb_create(head, source, addr);
362 if (!fdb)
364 return -ENOMEM; 363 return -ENOMEM;
365 364
365 fdb->is_local = fdb->is_static = 1;
366 return 0; 366 return 0;
367} 367}
368 368
369/* Add entry for local address of interface */
369int br_fdb_insert(struct net_bridge *br, struct net_bridge_port *source, 370int br_fdb_insert(struct net_bridge *br, struct net_bridge_port *source,
370 const unsigned char *addr) 371 const unsigned char *addr)
371{ 372{
@@ -407,8 +408,9 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
407 } 408 }
408 } else { 409 } else {
409 spin_lock(&br->hash_lock); 410 spin_lock(&br->hash_lock);
410 if (!fdb_find(head, addr)) 411 if (likely(!fdb_find(head, addr)))
411 fdb_create(head, source, addr, 0); 412 fdb_create(head, source, addr);
413
412 /* else we lose race and someone else inserts 414 /* else we lose race and someone else inserts
413 * it first, don't bother updating 415 * it first, don't bother updating
414 */ 416 */