public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta•com>
To: "David S. Miller" <davem@davemloft•net>
Cc: netdev@vger•kernel.org
Subject: [PATCH 2/7] bridge: track last used time in forwarding table
Date: Mon, 04 Apr 2011 17:03:28 -0700	[thread overview]
Message-ID: <20110405000537.094334160@vyatta.com> (raw)
In-Reply-To: 20110405000326.714524584@vyatta.com

[-- Attachment #1: br-fdb-used.patch --]
[-- Type: text/plain, Size: 2660 bytes --]

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>

---
 net/bridge/br_fdb.c     |   10 +++++-----
 net/bridge/br_input.c   |    5 +++--
 net/bridge/br_private.h |    3 ++-
 3 files changed, 10 insertions(+), 8 deletions(-)

--- a/net/bridge/br_fdb.c	2011-04-03 09:39:13.000000000 -0700
+++ b/net/bridge/br_fdb.c	2011-04-03 09:39:21.221199041 -0700
@@ -62,7 +62,7 @@ static inline int has_expired(const stru
 				  const struct net_bridge_fdb_entry *fdb)
 {
 	return !fdb->is_static &&
-		time_before_eq(fdb->ageing_timer + hold_time(br), jiffies);
+		time_before_eq(fdb->updated + hold_time(br), jiffies);
 }
 
 static inline int br_mac_hash(const unsigned char *mac)
@@ -140,7 +140,7 @@ void br_fdb_cleanup(unsigned long _data)
 			unsigned long this_timer;
 			if (f->is_static)
 				continue;
-			this_timer = f->ageing_timer + delay;
+			this_timer = f->updated + delay;
 			if (time_before_eq(this_timer, jiffies))
 				fdb_delete(f);
 			else if (time_before(this_timer, next_timer))
@@ -293,7 +293,7 @@ int br_fdb_fillbuf(struct net_bridge *br
 
 			fe->is_local = f->is_local;
 			if (!f->is_static)
-				fe->ageing_timer_value = jiffies_to_clock_t(jiffies - f->ageing_timer);
+				fe->ageing_timer_value = jiffies_to_clock_t(jiffies - f->updated);
 			++fe;
 			++num;
 		}
@@ -330,7 +330,7 @@ static struct net_bridge_fdb_entry *fdb_
 		fdb->dst = source;
 		fdb->is_local = 0;
 		fdb->is_static = 0;
-		fdb->ageing_timer = jiffies;
+		fdb->updated = fdb->used = jiffies;
 		hlist_add_head_rcu(&fdb->hlist, head);
 	}
 	return fdb;
@@ -404,7 +404,7 @@ void br_fdb_update(struct net_bridge *br
 		} else {
 			/* fastpath: update of existing entry */
 			fdb->dst = source;
-			fdb->ageing_timer = jiffies;
+			fdb->updated = jiffies;
 		}
 	} else {
 		spin_lock(&br->hash_lock);
--- a/net/bridge/br_input.c	2011-04-01 11:30:16.000000000 -0700
+++ b/net/bridge/br_input.c	2011-04-03 09:39:21.221199041 -0700
@@ -98,9 +98,10 @@ int br_handle_frame_finish(struct sk_buf
 	}
 
 	if (skb) {
-		if (dst)
+		if (dst) {
+			dst->used = jiffies;
 			br_forward(dst->dst, skb, skb2);
-		else
+		} else
 			br_flood_forward(br, skb, skb2);
 	}
 
--- a/net/bridge/br_private.h	2011-04-01 11:30:16.000000000 -0700
+++ b/net/bridge/br_private.h	2011-04-03 09:39:21.221199041 -0700
@@ -64,7 +64,8 @@ struct net_bridge_fdb_entry
 	struct net_bridge_port		*dst;
 
 	struct rcu_head			rcu;
-	unsigned long			ageing_timer;
+	unsigned long			updated;
+	unsigned long			used;
 	mac_addr			addr;
 	unsigned char			is_local;
 	unsigned char			is_static;



  parent reply	other threads:[~2011-04-05  0:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05  0:03 [PATCH 0/7] bridge enhancements for net-next Stephen Hemminger
2011-04-05  0:03 ` [PATCH 1/7] bridge: change arguments to fdb_create Stephen Hemminger
2011-04-05  0:03 ` Stephen Hemminger [this message]
2011-04-05  0:03 ` [PATCH 3/7] bridge: split rcu and no-rcu cases of fdb lookup Stephen Hemminger
2011-04-05  0:03 ` [PATCH 4/7] bridge: add netlink notification on forward entry changes Stephen Hemminger
2011-04-05  0:03 ` [PATCH 5/7] bridge: allow creating/deleting fdb entries via netlink Stephen Hemminger
2011-10-05 19:06   ` Kevin Wilson
2011-10-05 19:13     ` Stephen Hemminger
2011-10-05 19:36       ` Ben Hutchings
2011-04-05  0:03 ` [PATCH 6/7] bridge: allow creating bridge devices with netlink Stephen Hemminger
2011-04-05  0:03 ` [PATCH 7/7] bridge: range check STP parameters Stephen Hemminger
2011-04-05  0:23 ` [PATCH 0/7] bridge enhancements for net-next David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110405000537.094334160@vyatta.com \
    --to=shemminger@vyatta$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox