- 论坛徽章:
- 0
|
- void br_fdb_cleanup (unsigned long _data)
- {
- struct net_bridge * br = (struct net_bridge *) _data;
- unsigned long delay = hold_time(br);
- int i;
- unsigned long now = jiffies;
- /*
- * of cough, rover is more appreciated.
- */
- unsigned long cnt = 0;
-
- //spin_lock_bh(&br->hash_lock);
- for (i = 0; i < BR_HASH_SIZE; i++) {
- struct net_bridge_fdb_entry * f;
- struct hlist_node *h, *n;
- spin_lock_bh(slock(i));
- hlist_for_each_entry_safe(f, h, n, &br->hash[i], hlist) {
- ++cnt;
- if (!f->is_static &&
- time_before_eq(f->ageing_timer + delay, now /* jiffies */)) {
- --cnt;
- fdb_delete(f);
- }
- }
- spin_unlock_bh(slock(i));
- }
- //spin_unlock_bh(&br->hash_lock);
- if ((cnt >> 3) > BR_HASH_SIZE)
- cnt = HZ / 10;
- else if ((cnt >> 2) > BR_HASH_SIZE)
- cnt = HZ / 2;
- else
- cnt = HZ;
- mod_timer(&br->gc_timer, jiffies + cnt /* HZ/10 */);
- }
复制代码
[ 本帖最后由 sisi8408 于 2007-2-12 16:00 编辑 ] |
|