]>
Commit | Line | Data |
---|---|---|
82094b55 AF |
1 | From: Jay Vosburgh <fubar@us.ibm.com> |
2 | Date: Tue, 4 Nov 2008 02:16:50 +0000 (-0800) | |
3 | Subject: bonding, net: Move last_rx update into bonding recv logic | |
4 | Patch-mainline: v2.6.29-rc1 | |
5 | Git-commit: 6cf3f41e6c08bca6641a695449791c38a25f35ff | |
6 | References: bnc#532443 | |
7 | ||
8 | bonding, net: Move last_rx update into bonding recv logic | |
9 | ||
10 | The only user of the net_device->last_rx field is bonding. | |
11 | This patch adds a conditional update of last_rx to the bonding special | |
12 | logic in skb_bond_should_drop, causing last_rx to only be updated when | |
13 | the ARP monitor is running. | |
14 | ||
15 | This frees network device drivers from the necessity of | |
16 | updating last_rx, which can have cache line thrash issues. | |
17 | ||
18 | Signed-off-by: Jay Vosburgh <fubar@us.ibm.com> | |
19 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
20 | Acked-by: Jeff Mahoney <jeffm@suse.com> | |
21 | --- | |
22 | ||
23 | drivers/net/bonding/bond_main.c | 2 ++ | |
24 | drivers/net/bonding/bond_sysfs.c | 3 +++ | |
25 | include/linux/if.h | 1 + | |
26 | include/linux/netdevice.h | 32 ++++++++++++++++++-------------- | |
27 | 4 files changed, 24 insertions(+), 14 deletions(-) | |
28 | ||
29 | diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c | |
30 | index 56c823c..39575d7 100644 | |
31 | --- a/drivers/net/bonding/bond_main.c | |
32 | +++ b/drivers/net/bonding/bond_main.c | |
33 | @@ -4564,6 +4564,8 @@ static int bond_init(struct net_device *bond_dev, struct bond_params *params) | |
34 | bond_dev->tx_queue_len = 0; | |
35 | bond_dev->flags |= IFF_MASTER|IFF_MULTICAST; | |
36 | bond_dev->priv_flags |= IFF_BONDING; | |
37 | + if (bond->params.arp_interval) | |
38 | + bond_dev->priv_flags |= IFF_MASTER_ARPMON; | |
39 | ||
40 | /* At first, we block adding VLANs. That's the only way to | |
41 | * prevent problems that occur when adding VLANs over an | |
42 | diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c | |
43 | index 296a865..e400d7d 100644 | |
44 | --- a/drivers/net/bonding/bond_sysfs.c | |
45 | +++ b/drivers/net/bonding/bond_sysfs.c | |
46 | @@ -620,6 +620,8 @@ static ssize_t bonding_store_arp_interval(struct device *d, | |
47 | ": %s: Setting ARP monitoring interval to %d.\n", | |
48 | bond->dev->name, new_value); | |
49 | bond->params.arp_interval = new_value; | |
50 | + if (bond->params.arp_interval) | |
51 | + bond->dev->priv_flags |= IFF_MASTER_ARPMON; | |
52 | if (bond->params.miimon) { | |
53 | printk(KERN_INFO DRV_NAME | |
54 | ": %s: ARP monitoring cannot be used with MII monitoring. " | |
55 | @@ -1039,6 +1041,7 @@ static ssize_t bonding_store_miimon(struct device *d, | |
56 | "ARP monitoring. Disabling ARP monitoring...\n", | |
57 | bond->dev->name); | |
58 | bond->params.arp_interval = 0; | |
59 | + bond->dev->priv_flags &= ~IFF_MASTER_ARPMON; | |
60 | if (bond->params.arp_validate) { | |
61 | bond_unregister_arp(bond); | |
62 | bond->params.arp_validate = | |
63 | diff --git a/include/linux/if.h b/include/linux/if.h | |
64 | index 6524684..2a6e296 100644 | |
65 | --- a/include/linux/if.h | |
66 | +++ b/include/linux/if.h | |
67 | @@ -65,6 +65,7 @@ | |
68 | #define IFF_BONDING 0x20 /* bonding master or slave */ | |
69 | #define IFF_SLAVE_NEEDARP 0x40 /* need ARPs for validation */ | |
70 | #define IFF_ISATAP 0x80 /* ISATAP interface (RFC4214) */ | |
71 | +#define IFF_MASTER_ARPMON 0x100 /* bonding master, ARP mon in use */ | |
72 | ||
73 | #define IF_GET_IFACE 0x0001 /* for querying only */ | |
74 | #define IF_GET_PROTO 0x0002 | |
75 | diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h | |
76 | index 9d77b1d..f1b0dbe 100644 | |
77 | --- a/include/linux/netdevice.h | |
78 | +++ b/include/linux/netdevice.h | |
79 | @@ -1742,22 +1742,26 @@ static inline int skb_bond_should_drop(struct sk_buff *skb) | |
80 | struct net_device *dev = skb->dev; | |
81 | struct net_device *master = dev->master; | |
82 | ||
83 | - if (master && | |
84 | - (dev->priv_flags & IFF_SLAVE_INACTIVE)) { | |
85 | - if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && | |
86 | - skb->protocol == __constant_htons(ETH_P_ARP)) | |
87 | - return 0; | |
88 | - | |
89 | - if (master->priv_flags & IFF_MASTER_ALB) { | |
90 | - if (skb->pkt_type != PACKET_BROADCAST && | |
91 | - skb->pkt_type != PACKET_MULTICAST) | |
92 | + if (master) { | |
93 | + if (master->priv_flags & IFF_MASTER_ARPMON) | |
94 | + dev->last_rx = jiffies; | |
95 | + | |
96 | + if (dev->priv_flags & IFF_SLAVE_INACTIVE) { | |
97 | + if ((dev->priv_flags & IFF_SLAVE_NEEDARP) && | |
98 | + skb->protocol == __constant_htons(ETH_P_ARP)) | |
99 | return 0; | |
100 | - } | |
101 | - if (master->priv_flags & IFF_MASTER_8023AD && | |
102 | - skb->protocol == __constant_htons(ETH_P_SLOW)) | |
103 | - return 0; | |
104 | ||
105 | - return 1; | |
106 | + if (master->priv_flags & IFF_MASTER_ALB) { | |
107 | + if (skb->pkt_type != PACKET_BROADCAST && | |
108 | + skb->pkt_type != PACKET_MULTICAST) | |
109 | + return 0; | |
110 | + } | |
111 | + if (master->priv_flags & IFF_MASTER_8023AD && | |
112 | + skb->protocol == __constant_htons(ETH_P_SLOW)) | |
113 | + return 0; | |
114 | + | |
115 | + return 1; | |
116 | + } | |
117 | } | |
118 | return 0; | |
119 | } |