Commit 6cf3f41e authored by Jay Vosburgh's avatar Jay Vosburgh Committed by David S. Miller

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: default avatarJay Vosburgh <fubar@us.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 24f8b238
...@@ -4564,6 +4564,8 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params) ...@@ -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->tx_queue_len = 0;
bond_dev->flags |= IFF_MASTER|IFF_MULTICAST; bond_dev->flags |= IFF_MASTER|IFF_MULTICAST;
bond_dev->priv_flags |= IFF_BONDING; 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 /* At first, we block adding VLANs. That's the only way to
* prevent problems that occur when adding VLANs over an * prevent problems that occur when adding VLANs over an
......
...@@ -620,6 +620,8 @@ static ssize_t bonding_store_arp_interval(struct device *d, ...@@ -620,6 +620,8 @@ static ssize_t bonding_store_arp_interval(struct device *d,
": %s: Setting ARP monitoring interval to %d.\n", ": %s: Setting ARP monitoring interval to %d.\n",
bond->dev->name, new_value); bond->dev->name, new_value);
bond->params.arp_interval = new_value; bond->params.arp_interval = new_value;
if (bond->params.arp_interval)
bond->dev->priv_flags |= IFF_MASTER_ARPMON;
if (bond->params.miimon) { if (bond->params.miimon) {
printk(KERN_INFO DRV_NAME printk(KERN_INFO DRV_NAME
": %s: ARP monitoring cannot be used with MII monitoring. " ": %s: ARP monitoring cannot be used with MII monitoring. "
...@@ -1039,6 +1041,7 @@ static ssize_t bonding_store_miimon(struct device *d, ...@@ -1039,6 +1041,7 @@ static ssize_t bonding_store_miimon(struct device *d,
"ARP monitoring. Disabling ARP monitoring...\n", "ARP monitoring. Disabling ARP monitoring...\n",
bond->dev->name); bond->dev->name);
bond->params.arp_interval = 0; bond->params.arp_interval = 0;
bond->dev->priv_flags &= ~IFF_MASTER_ARPMON;
if (bond->params.arp_validate) { if (bond->params.arp_validate) {
bond_unregister_arp(bond); bond_unregister_arp(bond);
bond->params.arp_validate = bond->params.arp_validate =
......
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
#define IFF_BONDING 0x20 /* bonding master or slave */ #define IFF_BONDING 0x20 /* bonding master or slave */
#define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */
#define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */ #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_IFACE 0x0001 /* for querying only */
#define IF_GET_PROTO 0x0002 #define IF_GET_PROTO 0x0002
......
...@@ -1742,8 +1742,11 @@ static inline int skb_bond_should_drop(struct sk_buff *skb) ...@@ -1742,8 +1742,11 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
struct net_device *dev = skb->dev; struct net_device *dev = skb->dev;
struct net_device *master = dev->master; struct net_device *master = dev->master;
if (master && if (master) {
(dev->priv_flags & IFF_SLAVE_INACTIVE)) { 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) && if ((dev->priv_flags & IFF_SLAVE_NEEDARP) &&
skb->protocol == __constant_htons(ETH_P_ARP)) skb->protocol == __constant_htons(ETH_P_ARP))
return 0; return 0;
...@@ -1759,6 +1762,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb) ...@@ -1759,6 +1762,7 @@ static inline int skb_bond_should_drop(struct sk_buff *skb)
return 1; return 1;
} }
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment