aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Vosburgh <fubar@us.ibm.com>2008-11-03 21:16:50 -0500
committerDavid S. Miller <davem@davemloft.net>2008-11-03 21:16:50 -0500
commit6cf3f41e6c08bca6641a695449791c38a25f35ff (patch)
treea4e173960afe6712c112b3ddea1f229a695b7089
parent24f8b2385e03a4f4c8dac513d03b5eaa475822b9 (diff)
bonding, net: Move last_rx update into bonding recv logic
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> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bonding/bond_main.c2
-rw-r--r--drivers/net/bonding/bond_sysfs.c3
-rw-r--r--include/linux/if.h1
-rw-r--r--include/linux/netdevice.h32
4 files changed, 24 insertions, 14 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 56c823c175fe..39575d764974 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)
4564 bond_dev->tx_queue_len = 0; 4564 bond_dev->tx_queue_len = 0;
4565 bond_dev->flags |= IFF_MASTER|IFF_MULTICAST; 4565 bond_dev->flags |= IFF_MASTER|IFF_MULTICAST;
4566 bond_dev->priv_flags |= IFF_BONDING; 4566 bond_dev->priv_flags |= IFF_BONDING;
4567 if (bond->params.arp_interval)
4568 bond_dev->priv_flags |= IFF_MASTER_ARPMON;
4567 4569
4568 /* At first, we block adding VLANs. That's the only way to 4570 /* At first, we block adding VLANs. That's the only way to
4569 * prevent problems that occur when adding VLANs over an 4571 * 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 296a865b75d2..e400d7dfdfc8 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,
620 ": %s: Setting ARP monitoring interval to %d.\n", 620 ": %s: Setting ARP monitoring interval to %d.\n",
621 bond->dev->name, new_value); 621 bond->dev->name, new_value);
622 bond->params.arp_interval = new_value; 622 bond->params.arp_interval = new_value;
623 if (bond->params.arp_interval)
624 bond->dev->priv_flags |= IFF_MASTER_ARPMON;
623 if (bond->params.miimon) { 625 if (bond->params.miimon) {
624 printk(KERN_INFO DRV_NAME 626 printk(KERN_INFO DRV_NAME
625 ": %s: ARP monitoring cannot be used with MII monitoring. " 627 ": %s: ARP monitoring cannot be used with MII monitoring. "
@@ -1039,6 +1041,7 @@ static ssize_t bonding_store_miimon(struct device *d,
1039 "ARP monitoring. Disabling ARP monitoring...\n", 1041 "ARP monitoring. Disabling ARP monitoring...\n",
1040 bond->dev->name); 1042 bond->dev->name);
1041 bond->params.arp_interval = 0; 1043 bond->params.arp_interval = 0;
1044 bond->dev->priv_flags &= ~IFF_MASTER_ARPMON;
1042 if (bond->params.arp_validate) { 1045 if (bond->params.arp_validate) {
1043 bond_unregister_arp(bond); 1046 bond_unregister_arp(bond);
1044 bond->params.arp_validate = 1047 bond->params.arp_validate =
diff --git a/include/linux/if.h b/include/linux/if.h
index 65246846c844..2a6e29620a96 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -65,6 +65,7 @@
65#define IFF_BONDING 0x20 /* bonding master or slave */ 65#define IFF_BONDING 0x20 /* bonding master or slave */
66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ 66#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */ 67#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */
68#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */
68 69
69#define IF_GET_IFACE 0x0001 /* for querying only */ 70#define IF_GET_IFACE 0x0001 /* for querying only */
70#define IF_GET_PROTO 0x0002 71#define IF_GET_PROTO 0x0002
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9d77b1d7dca8..f1b0dbe58464 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)
1742 struct net_device *dev = skb->dev; 1742 struct net_device *dev = skb->dev;
1743 struct net_device *master = dev->master; 1743 struct net_device *master = dev->master;
1744 1744
1745 if (master && 1745 if (master) {
1746 (dev->priv_flags & IFF_SLAVE_INACTIVE)) { 1746 if (master->priv_flags & IFF_MASTER_ARPMON)
1747 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && 1747 dev->last_rx = jiffies;
1748 skb->protocol == __constant_htons(ETH_P_ARP)) 1748
1749 return 0; 1749 if (dev->priv_flags & IFF_SLAVE_INACTIVE) {
1750 1750 if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
1751 if (master->priv_flags & IFF_MASTER_ALB) { 1751 skb->protocol == __constant_htons(ETH_P_ARP))
1752 if (skb->pkt_type != PACKET_BROADCAST &&
1753 skb->pkt_type != PACKET_MULTICAST)
1754 return 0; 1752 return 0;
1755 }
1756 if (master->priv_flags & IFF_MASTER_8023AD &&
1757 skb->protocol == __constant_htons(ETH_P_SLOW))
1758 return 0;
1759 1753
1760 return 1; 1754 if (master->priv_flags & IFF_MASTER_ALB) {
1755 if (skb->pkt_type != PACKET_BROADCAST &&
1756 skb->pkt_type != PACKET_MULTICAST)
1757 return 0;
1758 }
1759 if (master->priv_flags & IFF_MASTER_8023AD &&
1760 skb->protocol == __constant_htons(ETH_P_SLOW))
1761 return 0;
1762
1763 return 1;
1764 }
1761 } 1765 }
1762 return 0; 1766 return 0;
1763} 1767}