[PATCH net-next-2.6] bonding, net: Move last_rx update into bonding recv logic

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Jay Vosburgh
Date: Monday, November 3, 2008 - 7:13 pm

The only user of the net_device->last_rx field is bonding.  This
patch adds a conditional update of last_rx to the bonding special logic
in skb_bond_should_drop, causing last_rx to only be updated when the ARP
monitor is running.

	This frees network device drivers from the necessity of updating
last_rx, which can have cache line thrash issues.

Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 56c823c..39575d7 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4564,6 +4564,8 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params)
 	bond_dev->tx_queue_len = 0;
 	bond_dev->flags |= IFF_MASTER|IFF_MULTICAST;
 	bond_dev->priv_flags |= IFF_BONDING;
+	if (bond->params.arp_interval)
+		bond_dev->priv_flags |= IFF_MASTER_ARPMON;
 
 	/* At first, we block adding VLANs. That's the only way to
 	 * prevent problems that occur when adding VLANs over an
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index 296a865..e400d7d 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -620,6 +620,8 @@ static ssize_t bonding_store_arp_interval(struct device *d,
 	       ": %s: Setting ARP monitoring interval to %d.\n",
 	       bond->dev->name, new_value);
 	bond->params.arp_interval = new_value;
+	if (bond->params.arp_interval)
+		bond->dev->priv_flags |= IFF_MASTER_ARPMON;
 	if (bond->params.miimon) {
 		printk(KERN_INFO DRV_NAME
 		       ": %s: ARP monitoring cannot be used with MII monitoring. "
@@ -1039,6 +1041,7 @@ static ssize_t bonding_store_miimon(struct device *d,
 			       "ARP monitoring. Disabling ARP monitoring...\n",
 			       bond->dev->name);
 			bond->params.arp_interval = 0;
+			bond->dev->priv_flags &= ~IFF_MASTER_ARPMON;
 			if (bond->params.arp_validate) {
 				bond_unregister_arp(bond);
 				bond->params.arp_validate =
diff --git a/include/linux/if.h b/include/linux/if.h
index 6524684..2a6e296 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -65,6 +65,7 @@
 #define IFF_BONDING	0x20		/* bonding master or slave	*/
 #define IFF_SLAVE_NEEDARP 0x40		/* need ARPs for validation	*/
 #define IFF_ISATAP	0x80		/* ISATAP interface (RFC4214)	*/
+#define IFF_MASTER_ARPMON 0x100		/* bonding master, ARP mon in use */
 
 #define IF_GET_IFACE	0x0001		/* for querying only */
 #define IF_GET_PROTO	0x0002
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9d77b1d..f1b0dbe 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1742,22 +1742,26 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
 	struct net_device *dev = skb->dev;
 	struct net_device *master = dev->master;
 
-	if (master &&
-	    (dev->priv_flags & IFF_SLAVE_INACTIVE)) {
-		if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
-		    skb->protocol == __constant_htons(ETH_P_ARP))
-			return 0;
-
-		if (master->priv_flags & IFF_MASTER_ALB) {
-			if (skb->pkt_type != PACKET_BROADCAST &&
-			    skb->pkt_type != PACKET_MULTICAST)
+	if (master) {
+		if (master->priv_flags & IFF_MASTER_ARPMON)
+			dev->last_rx = jiffies;
+
+		if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
+			if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
+			    skb->protocol == __constant_htons(ETH_P_ARP))
 				return 0;
-		}
-		if (master->priv_flags & IFF_MASTER_8023AD &&
-		    skb->protocol == __constant_htons(ETH_P_SLOW))
-			return 0;
 
-		return 1;
+			if (master->priv_flags & IFF_MASTER_ALB) {
+				if (skb->pkt_type != PACKET_BROADCAST &&
+				    skb->pkt_type != PACKET_MULTICAST)
+					return 0;
+			}
+			if (master->priv_flags & IFF_MASTER_8023AD &&
+			    skb->protocol == __constant_htons(ETH_P_SLOW))
+				return 0;
+
+			return 1;
+		}
 	}
 	return 0;
 }
--
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
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Thu Oct 9, 4:17 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Peter Zijlstra, (Thu Oct 9, 10:40 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Fri Oct 10, 1:09 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Fri Oct 10, 3:13 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Fri Oct 10, 4:31 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Fri Oct 10, 4:55 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Fri Oct 10, 6:25 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Sat Oct 11, 6:13 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Peter Zijlstra, (Sat Oct 11, 7:39 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Sat Oct 11, 11:13 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Sat Oct 11, 11:02 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Sat Oct 11, 11:33 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Rafael J. Wysocki, (Fri Oct 24, 3:25 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Fri Oct 24, 8:37 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Fri Oct 24, 9:05 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Fri Oct 24, 10:53 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Fri Oct 24, 10:58 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Fri Oct 24, 11:53 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Sat Oct 25, 12:33 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Sat Oct 25, 12:52 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Rafael J. Wysocki, (Sat Oct 25, 4:13 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Sun Oct 26, 1:46 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Peter Zijlstra, (Sun Oct 26, 2:00 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Sun Oct 26, 2:15 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Sun Oct 26, 2:27 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Sun Oct 26, 3:05 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Sun Oct 26, 3:23 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Sun Oct 26, 4:29 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Rafael J. Wysocki, (Sun Oct 26, 4:33 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Sun Oct 26, 5:23 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Mon Oct 27, 2:29 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Mon Oct 27, 5:06 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Mon Oct 27, 7:17 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Mon Oct 27, 12:11 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Mon Oct 27, 12:39 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Mon Oct 27, 12:44 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Tue Oct 28, 3:24 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Tue Oct 28, 3:57 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Tue Oct 28, 7:00 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Mike Galbraith, (Tue Oct 28, 8:22 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Wed Oct 29, 2:14 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Wed Oct 29, 2:50 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Stephen Hemminger, (Thu Oct 30, 11:15 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Thu Oct 30, 11:40 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Ilpo Järvinen, (Thu Oct 30, 12:01 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Ilpo Järvinen, (Fri Oct 31, 2:40 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Ilpo Järvinen, (Fri Oct 31, 3:42 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Ilpo Järvinen, (Fri Oct 31, 4:01 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Ilpo Järvinen, (Fri Oct 31, 4:15 am)
Re: [tbench regression fixes]: digging out smelly deadmen., Stephen Hemminger, (Fri Oct 31, 12:57 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Fri Oct 31, 1:10 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Evgeniy Polyakov, (Fri Oct 31, 2:18 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Stephen Hemminger, (Fri Oct 31, 4:56 pm)
Re: [tbench regression fixes]: digging out smelly deadmen., Paolo Ciarrocchi, (Sat Nov 1, 5:51 am)
[PATCH net-next-2.6] bonding, net: Move last_rx update int ..., Jay Vosburgh, (Mon Nov 3, 7:13 pm)