X-Git-Url: http://pilppa.org/gitweb/gitweb.cgi?a=blobdiff_plain;f=net%2Fbridge%2Fbr_fdb.c;h=eb57502bb2641b7087b50a8c2577699f3b3ab388;hb=0a7606c121d58c1831805262c5b764e181429e7d;hp=91b017016d5bcbdd240770f9528706439b91a5f7;hpb=2d56d3c43cc97ae48586745556f5a5b564d61582;p=linux-2.6-omap-h63xx.git diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c index 91b017016d5..eb57502bb26 100644 --- a/net/bridge/br_fdb.c +++ b/net/bridge/br_fdb.c @@ -36,7 +36,7 @@ int __init br_fdb_init(void) br_fdb_cache = kmem_cache_create("bridge_fdb_cache", sizeof(struct net_bridge_fdb_entry), 0, - SLAB_HWCACHE_ALIGN, NULL, NULL); + SLAB_HWCACHE_ALIGN, NULL); if (!br_fdb_cache) return -ENOMEM; @@ -121,6 +121,7 @@ void br_fdb_cleanup(unsigned long _data) { struct net_bridge *br = (struct net_bridge *)_data; unsigned long delay = hold_time(br); + unsigned long next_timer = jiffies + br->forward_delay; int i; spin_lock_bh(&br->hash_lock); @@ -129,14 +130,21 @@ void br_fdb_cleanup(unsigned long _data) struct hlist_node *h, *n; hlist_for_each_entry_safe(f, h, n, &br->hash[i], hlist) { - if (!f->is_static && - time_before_eq(f->ageing_timer + delay, jiffies)) + unsigned long this_timer; + if (f->is_static) + continue; + this_timer = f->ageing_timer + delay; + if (time_before_eq(this_timer, jiffies)) fdb_delete(f); + else if (this_timer < next_timer) + next_timer = this_timer; } } spin_unlock_bh(&br->hash_lock); - mod_timer(&br->gc_timer, jiffies + HZ/10); + /* Add HZ/4 to ensure we round the jiffies upwards to be after the next + * timer, otherwise we might round down and will have no-op run. */ + mod_timer(&br->gc_timer, round_jiffies(next_timer + HZ/4)); } /* Completely flush all dynamic entries in forwarding database.*/ @@ -376,6 +384,11 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source, if (hold_time(br) == 0) return; + /* ignore packets unless we are using this port */ + if (!(source->state == BR_STATE_LEARNING || + source->state == BR_STATE_FORWARDING)) + return; + fdb = fdb_find(head, addr); if (likely(fdb)) { /* attempt to update an entry for a local interface */