From: Jay Vosburgh <fubar@us.ibm.com>
To: David Miller <davem@davemloft.net>
Cc: shemminger@vyatta.com, dada1@cosmosbay.com, zbr@ioremap.net,
ilpo.jarvinen@helsinki.fi, rjw@sisk.pl, mingo@elte.hu,
s0mbre@tservice.net.ru, a.p.zijlstra@chello.nl,
linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
efault@gmx.de, akpm@linux-foundation.org
Subject: [PATCH net-next-2.6] bonding, net: Move last_rx update into bonding recv logic
Date: Mon, 03 Nov 2008 18:13:09 -0800 [thread overview]
Message-ID: <20247.1225764789@death.nxdomain.ibm.com> (raw)
In-Reply-To: <20081101.214008.201420949.davem@davemloft.net>
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;
}
next prev parent reply other threads:[~2008-11-04 2:13 UTC|newest]
Thread overview: 94+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-09 23:17 [tbench regression fixes]: digging out smelly deadmen Evgeniy Polyakov
2008-10-10 5:40 ` Peter Zijlstra
2008-10-10 8:09 ` Evgeniy Polyakov
2008-10-10 9:15 ` Ingo Molnar
2008-10-10 11:31 ` Evgeniy Polyakov
2008-10-10 11:40 ` Ingo Molnar
2008-10-10 13:25 ` Evgeniy Polyakov
2008-10-10 11:42 ` Ingo Molnar
2008-10-10 11:55 ` Evgeniy Polyakov
2008-10-10 11:57 ` Ingo Molnar
2008-10-24 22:25 ` Rafael J. Wysocki
2008-10-24 23:31 ` David Miller
2008-10-25 4:05 ` Mike Galbraith
2008-10-25 5:15 ` David Miller
2008-10-25 5:53 ` Mike Galbraith
2008-10-25 11:13 ` Rafael J. Wysocki
2008-10-26 3:55 ` David Miller
2008-10-26 11:33 ` Rafael J. Wysocki
2008-10-25 3:37 ` Mike Galbraith
2008-10-25 5:16 ` David Miller
2008-10-25 5:58 ` Mike Galbraith
2008-10-25 6:53 ` Mike Galbraith
2008-10-25 7:24 ` David Miller
2008-10-25 7:52 ` Mike Galbraith
2008-10-25 23:10 ` Jiri Kosina
2008-10-26 8:46 ` Mike Galbraith
2008-10-26 9:00 ` Peter Zijlstra
2008-10-26 9:11 ` Andrew Morton
2008-10-26 9:27 ` Evgeniy Polyakov
2008-10-26 9:34 ` Andrew Morton
2008-10-26 10:05 ` Evgeniy Polyakov
2008-10-27 2:34 ` David Miller
2008-10-27 9:30 ` Ingo Molnar
2008-10-27 9:57 ` David Miller
2008-10-26 10:23 ` Mike Galbraith
2008-10-26 19:03 ` Jiri Kosina
2008-10-27 9:29 ` Mike Galbraith
2008-10-27 10:42 ` Jiri Kosina
2008-10-27 11:27 ` Ingo Molnar
2008-10-27 11:33 ` Alan Cox
2008-10-27 12:06 ` Mike Galbraith
2008-10-27 13:42 ` Jiri Kosina
2008-10-27 14:17 ` Mike Galbraith
2008-10-27 18:33 ` Ingo Molnar
2008-10-27 19:39 ` Evgeniy Polyakov
2008-10-27 19:48 ` David Miller
2008-10-28 10:24 ` Mike Galbraith
2008-10-28 10:37 ` Ingo Molnar
2008-10-28 10:57 ` Mike Galbraith
2008-10-28 11:02 ` Ingo Molnar
2008-10-28 14:00 ` Mike Galbraith
2008-10-28 15:22 ` Mike Galbraith
2008-10-29 9:14 ` Evgeniy Polyakov
2008-10-29 9:50 ` Evgeniy Polyakov
2008-11-01 12:51 ` Paolo Ciarrocchi
2008-10-29 9:59 ` Nick Piggin
2008-10-26 9:15 ` Mike Galbraith
2008-10-25 7:19 ` David Miller
2008-10-25 7:33 ` Mike Galbraith
2008-10-27 17:26 ` Rick Jones
2008-10-27 19:11 ` Mike Galbraith
2008-10-27 19:18 ` Rick Jones
2008-10-27 19:44 ` Mike Galbraith
2008-10-26 11:29 ` Evgeniy Polyakov
2008-10-26 12:23 ` Evgeniy Polyakov
2008-10-30 18:15 ` Stephen Hemminger
2008-10-30 18:40 ` Evgeniy Polyakov
2008-10-30 18:43 ` Eric Dumazet
2008-10-30 18:56 ` Eric Dumazet
2008-10-30 19:01 ` Ilpo Järvinen
2008-10-31 7:52 ` David Miller
2008-10-31 9:40 ` Ilpo Järvinen
2008-10-31 9:51 ` David Miller
2008-10-31 10:42 ` Ilpo Järvinen
2008-10-31 10:45 ` Eric Dumazet
2008-10-31 11:01 ` Ilpo Järvinen
2008-10-31 11:10 ` Eric Dumazet
2008-10-31 11:15 ` Ilpo Järvinen
2008-10-31 19:57 ` Stephen Hemminger
2008-10-31 20:10 ` Evgeniy Polyakov
2008-10-31 21:03 ` Eric Dumazet
2008-10-31 21:18 ` Evgeniy Polyakov
2008-10-31 23:51 ` David Miller
2008-10-31 23:56 ` Stephen Hemminger
2008-11-01 0:16 ` Jay Vosburgh
2008-11-02 4:40 ` David Miller
2008-11-04 2:13 ` Jay Vosburgh [this message]
2008-11-04 2:17 ` [PATCH net-next-2.6] bonding, net: Move last_rx update into bonding recv logic David Miller
2008-10-10 10:13 ` [tbench regression fixes]: digging out smelly deadmen Mike Galbraith
2008-10-11 13:13 ` Evgeniy Polyakov
2008-10-11 14:39 ` Peter Zijlstra
2008-10-11 18:13 ` Mike Galbraith
2008-10-12 6:02 ` Mike Galbraith
2008-10-12 6:33 ` Mike Galbraith
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20247.1225764789@death.nxdomain.ibm.com \
--to=fubar@us.ibm.com \
--cc=a.p.zijlstra@chello.nl \
--cc=akpm@linux-foundation.org \
--cc=dada1@cosmosbay.com \
--cc=davem@davemloft.net \
--cc=efault@gmx.de \
--cc=ilpo.jarvinen@helsinki.fi \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=netdev@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=s0mbre@tservice.net.ru \
--cc=shemminger@vyatta.com \
--cc=zbr@ioremap.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).