diff mbox

vxlan: Update vxlan fdb 'used' field after each usage.

Message ID 1368723943.14093.4.camel@sridhar.usor.ibm.com
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Sridhar Samudrala May 16, 2013, 5:05 p.m. UTC
Fix some instances where vxlan fdb 'used' field is not updated after the entry 
is used.

Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>

---



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller May 16, 2013, 10 p.m. UTC | #1
From: Sridhar Samudrala <sri@us.ibm.com>
Date: Thu, 16 May 2013 10:05:43 -0700

> Fix some instances where vxlan fdb 'used' field is not updated after the entry 
> is used.
> 
> Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>

Please just put the ->used update into vxlan_find_mac().

Thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sridhar Samudrala May 16, 2013, 10:22 p.m. UTC | #2
On Thu, 2013-05-16 at 15:00 -0700, David Miller wrote:
> From: Sridhar Samudrala <sri@us.ibm.com>
> Date: Thu, 16 May 2013 10:05:43 -0700
> 
> > Fix some instances where vxlan fdb 'used' field is not updated after the entry 
> > is used.
> > 
> > Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
> 
> Please just put the ->used update into vxlan_find_mac().

I thought of doing it that way, but i found that there is a call
to vxlan_find_mac() in vxlan_fdb_create() where the fdb entry
gets updated, but it not really used.

Also in other cases, the fdb entry may not be used even if
vxlan_find_mac() returns an entry because of other conditions.

I guess it depends on how we define the 'used' field.

Thanks
Sridhar

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller May 17, 2013, 8:31 a.m. UTC | #3
From: Sridhar Samudrala <sri@us.ibm.com>
Date: Thu, 16 May 2013 15:22:44 -0700

> On Thu, 2013-05-16 at 15:00 -0700, David Miller wrote:
>> From: Sridhar Samudrala <sri@us.ibm.com>
>> Date: Thu, 16 May 2013 10:05:43 -0700
>> 
>> > Fix some instances where vxlan fdb 'used' field is not updated after the entry 
>> > is used.
>> > 
>> > Signed-off-by: Sridhar Samudrala <sri@us.ibm.com>
>> 
>> Please just put the ->used update into vxlan_find_mac().
> 
> I thought of doing it that way, but i found that there is a call
> to vxlan_find_mac() in vxlan_fdb_create() where the fdb entry
> gets updated, but it not really used.
> 
> Also in other cases, the fdb entry may not be used even if
> vxlan_find_mac() returns an entry because of other conditions.
> 
> I guess it depends on how we define the 'used' field.

Make a new __vxlan_find_mac() or similar that doesn't update
->used, and invoke it from vxlan_fdb_create().
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index ba81f3c..3bfa6c4 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -814,6 +814,7 @@  static int arp_reduce(struct net_device *dev, struct sk_buff *skb)
 
 		f = vxlan_find_mac(vxlan, n->ha);
 		if (f && f->remote.remote_ip == htonl(INADDR_ANY)) {
+			f->used = jiffies;
 			/* bridge-local neighbor */
 			neigh_release(n);
 			goto out;
@@ -1118,6 +1119,7 @@  static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	if (f && (f->flags & NTF_ROUTER) && (vxlan->flags & VXLAN_F_RSC) &&
 	    ntohs(eth->h_proto) == ETH_P_IP) {
+		f->used = jiffies;
 		did_rsc = route_shortcircuit(dev, skb);
 		if (did_rsc)
 			f = vxlan_find_mac(vxlan, eth->h_dest);
@@ -1130,8 +1132,10 @@  static netdev_tx_t vxlan_xmit(struct sk_buff *skb, struct net_device *dev)
 		    (vxlan->flags & VXLAN_F_L2MISS) &&
 		    !is_multicast_ether_addr(eth->h_dest))
 			vxlan_fdb_miss(vxlan, eth->h_dest);
-	} else
+	} else {
+		f->used = jiffies;
 		rdst0 = &f->remote;
+	}
 
 	rc = NETDEV_TX_OK;