aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2011-04-04 10:03:28 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-04 20:22:26 -0400
commit7cd8861ab0d907430bbea0af93bc41aee0437efc (patch)
treeed6f9689447b01dc81212705d015186f17774f23 /net/bridge
parent03e9b64b89243ccc6f8f48f5955a5a78a8ca1431 (diff)
bridge: track last used time in forwarding table
Adds tracking the last used time in forwarding table. Rename ageing_timer to updated to better describe it. 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.c10
-rw-r--r--net/bridge/br_input.c5
-rw-r--r--net/bridge/br_private.h3
3 files changed, 10 insertions, 8 deletions
diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index 70bd0bf04099..b39135285f83 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -62,7 +62,7 @@ static inline int has_expired(const struct net_bridge *br,
62 const struct net_bridge_fdb_entry *fdb) 62 const struct net_bridge_fdb_entry *fdb)
63{ 63{
64 return !fdb->is_static && 64 return !fdb->is_static &&
65 time_before_eq(fdb->ageing_timer + hold_time(br), jiffies); 65 time_before_eq(fdb->updated + hold_time(br), jiffies);
66} 66}
67 67
68static inline int br_mac_hash(const unsigned char *mac) 68static inline int br_mac_hash(const unsigned char *mac)
@@ -140,7 +140,7 @@ void br_fdb_cleanup(unsigned long _data)
140 unsigned long this_timer; 140 unsigned long this_timer;
141 if (f->is_static) 141 if (f->is_static)
142 continue; 142 continue;
143 this_timer = f->ageing_timer + delay; 143 this_timer = f->updated + delay;
144 if (time_before_eq(this_timer, jiffies)) 144 if (time_before_eq(this_timer, jiffies))
145 fdb_delete(f); 145 fdb_delete(f);
146 else if (time_before(this_timer, next_timer)) 146 else if (time_before(this_timer, next_timer))
@@ -293,7 +293,7 @@ int br_fdb_fillbuf(struct net_bridge *br, void *buf,
293 293
294 fe->is_local = f->is_local; 294 fe->is_local = f->is_local;
295 if (!f->is_static) 295 if (!f->is_static)
296 fe->ageing_timer_value = jiffies_to_clock_t(jiffies - f->ageing_timer); 296 fe->ageing_timer_value = jiffies_to_clock_t(jiffies - f->updated);
297 ++fe; 297 ++fe;
298 ++num; 298 ++num;
299 } 299 }
@@ -330,7 +330,7 @@ static struct net_bridge_fdb_entry *fdb_create(struct hlist_head *head,
330 fdb->dst = source; 330 fdb->dst = source;
331 fdb->is_local = 0; 331 fdb->is_local = 0;
332 fdb->is_static = 0; 332 fdb->is_static = 0;
333 fdb->ageing_timer = jiffies; 333 fdb->updated = fdb->used = jiffies;
334 hlist_add_head_rcu(&fdb->hlist, head); 334 hlist_add_head_rcu(&fdb->hlist, head);
335 } 335 }
336 return fdb; 336 return fdb;
@@ -404,7 +404,7 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
404 } else { 404 } else {
405 /* fastpath: update of existing entry */ 405 /* fastpath: update of existing entry */
406 fdb->dst = source; 406 fdb->dst = source;
407 fdb->ageing_timer = jiffies; 407 fdb->updated = jiffies;
408 } 408 }
409 } else { 409 } else {
410 spin_lock(&br->hash_lock); 410 spin_lock(&br->hash_lock);
diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index e2160792e1bc..785932d7ad32 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -98,9 +98,10 @@ int br_handle_frame_finish(struct sk_buff *skb)
98 } 98 }
99 99
100 if (skb) { 100 if (skb) {
101 if (dst) 101 if (dst) {
102 dst->used = jiffies;
102 br_forward(dst->dst, skb, skb2); 103 br_forward(dst->dst, skb, skb2);
103 else 104 } else
104 br_flood_forward(br, skb, skb2); 105 br_flood_forward(br, skb, skb2);
105 } 106 }
106 107
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 387013d33745..a0e6b94c515b 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -64,7 +64,8 @@ struct net_bridge_fdb_entry
64 struct net_bridge_port *dst; 64 struct net_bridge_port *dst;
65 65
66 struct rcu_head rcu; 66 struct rcu_head rcu;
67 unsigned long ageing_timer; 67 unsigned long updated;
68 unsigned long used;
68 mac_addr addr; 69 mac_addr addr;
69 unsigned char is_local; 70 unsigned char is_local;
70 unsigned char is_static; 71 unsigned char is_static;