* [PATCH v2] net: cxgb4{,vf}: convert to hw_features
From: Michał Mirosław @ 2011-04-16 16:52 UTC (permalink / raw)
To: netdev; +Cc: Dimitris Michailidis, Casey Leedom
In-Reply-To: <20110415145050.6A43913A6A@rere.qmqm.pl>
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
---
v2: cxgb4: remove now unneeded variable in t4_ethrx_handler()
cxgb4vf: fix hw/vlan_features values
drivers/net/cxgb4/cxgb4.h | 6 ---
drivers/net/cxgb4/cxgb4_main.c | 72 ++++++++---------------------------
drivers/net/cxgb4/sge.c | 4 +-
drivers/net/cxgb4vf/adapter.h | 6 ---
drivers/net/cxgb4vf/cxgb4vf_main.c | 56 +++------------------------
drivers/net/cxgb4vf/sge.c | 4 +-
6 files changed, 27 insertions(+), 121 deletions(-)
diff --git a/drivers/net/cxgb4/cxgb4.h b/drivers/net/cxgb4/cxgb4.h
index 01d49ea..bc9982a 100644
--- a/drivers/net/cxgb4/cxgb4.h
+++ b/drivers/net/cxgb4/cxgb4.h
@@ -290,7 +290,6 @@ struct port_info {
u8 port_id;
u8 tx_chan;
u8 lport; /* associated offload logical port */
- u8 rx_offload; /* CSO, etc */
u8 nqsets; /* # of qsets */
u8 first_qset; /* index of first qset */
u8 rss_mode;
@@ -298,11 +297,6 @@ struct port_info {
u16 *rss;
};
-/* port_info.rx_offload flags */
-enum {
- RX_CSO = 1 << 0,
-};
-
struct dentry;
struct work_struct;
diff --git a/drivers/net/cxgb4/cxgb4_main.c b/drivers/net/cxgb4/cxgb4_main.c
index 0af9c9f..bdc868c 100644
--- a/drivers/net/cxgb4/cxgb4_main.c
+++ b/drivers/net/cxgb4/cxgb4_main.c
@@ -1531,24 +1531,6 @@ static int set_pauseparam(struct net_device *dev,
return 0;
}
-static u32 get_rx_csum(struct net_device *dev)
-{
- struct port_info *p = netdev_priv(dev);
-
- return p->rx_offload & RX_CSO;
-}
-
-static int set_rx_csum(struct net_device *dev, u32 data)
-{
- struct port_info *p = netdev_priv(dev);
-
- if (data)
- p->rx_offload |= RX_CSO;
- else
- p->rx_offload &= ~RX_CSO;
- return 0;
-}
-
static void get_sge_param(struct net_device *dev, struct ethtool_ringparam *e)
{
const struct port_info *pi = netdev_priv(dev);
@@ -1870,36 +1852,20 @@ static int set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
return err;
}
-#define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
-
-static int set_tso(struct net_device *dev, u32 value)
-{
- if (value)
- dev->features |= TSO_FLAGS;
- else
- dev->features &= ~TSO_FLAGS;
- return 0;
-}
-
-static int set_flags(struct net_device *dev, u32 flags)
+static int cxgb_set_features(struct net_device *dev, u32 features)
{
+ const struct port_info *pi = netdev_priv(dev);
+ u32 changed = dev->features ^ features;
int err;
- unsigned long old_feat = dev->features;
- err = ethtool_op_set_flags(dev, flags, ETH_FLAG_RXHASH |
- ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN);
- if (err)
- return err;
+ if (!(changed & NETIF_F_HW_VLAN_RX))
+ return 0;
- if ((old_feat ^ dev->features) & NETIF_F_HW_VLAN_RX) {
- const struct port_info *pi = netdev_priv(dev);
-
- err = t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, -1,
- -1, -1, -1, !!(flags & ETH_FLAG_RXVLAN),
- true);
- if (err)
- dev->features = old_feat;
- }
+ err = t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, -1,
+ -1, -1, -1,
+ !!(features & NETIF_F_HW_VLAN_RX), true);
+ if (unlikely(err))
+ dev->features = features ^ NETIF_F_HW_VLAN_RX;
return err;
}
@@ -2010,10 +1976,6 @@ static struct ethtool_ops cxgb_ethtool_ops = {
.set_eeprom = set_eeprom,
.get_pauseparam = get_pauseparam,
.set_pauseparam = set_pauseparam,
- .get_rx_csum = get_rx_csum,
- .set_rx_csum = set_rx_csum,
- .set_tx_csum = ethtool_op_set_tx_ipv6_csum,
- .set_sg = ethtool_op_set_sg,
.get_link = ethtool_op_get_link,
.get_strings = get_strings,
.set_phys_id = identify_port,
@@ -2024,8 +1986,6 @@ static struct ethtool_ops cxgb_ethtool_ops = {
.get_regs = get_regs,
.get_wol = get_wol,
.set_wol = set_wol,
- .set_tso = set_tso,
- .set_flags = set_flags,
.get_rxnfc = get_rxnfc,
.get_rxfh_indir = get_rss_table,
.set_rxfh_indir = set_rss_table,
@@ -2882,6 +2842,7 @@ static const struct net_device_ops cxgb4_netdev_ops = {
.ndo_get_stats64 = cxgb_get_stats,
.ndo_set_rx_mode = cxgb_set_rxmode,
.ndo_set_mac_address = cxgb_set_mac_addr,
+ .ndo_set_features = cxgb_set_features,
.ndo_validate_addr = eth_validate_addr,
.ndo_do_ioctl = cxgb_ioctl,
.ndo_change_mtu = cxgb_change_mtu,
@@ -3564,6 +3525,7 @@ static void free_some_resources(struct adapter *adapter)
t4_fw_bye(adapter, adapter->fn);
}
+#define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
#define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | TSO_FLAGS | \
NETIF_F_IPV6_CSUM | NETIF_F_HIGHDMA)
@@ -3665,14 +3627,14 @@ static int __devinit init_one(struct pci_dev *pdev,
pi = netdev_priv(netdev);
pi->adapter = adapter;
pi->xact_addr_filt = -1;
- pi->rx_offload = RX_CSO;
pi->port_id = i;
netdev->irq = pdev->irq;
- netdev->features |= NETIF_F_SG | TSO_FLAGS;
- netdev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
- netdev->features |= NETIF_F_GRO | NETIF_F_RXHASH | highdma;
- netdev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
+ netdev->hw_features = NETIF_F_SG | TSO_FLAGS |
+ NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
+ NETIF_F_RXCSUM | NETIF_F_RXHASH |
+ NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
+ netdev->features |= netdev->hw_features | highdma;
netdev->vlan_features = netdev->features & VLAN_FEAT;
netdev->netdev_ops = &cxgb4_netdev_ops;
diff --git a/drivers/net/cxgb4/sge.c b/drivers/net/cxgb4/sge.c
index 311471b..75a4b0f 100644
--- a/drivers/net/cxgb4/sge.c
+++ b/drivers/net/cxgb4/sge.c
@@ -1556,7 +1556,6 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
{
bool csum_ok;
struct sk_buff *skb;
- struct port_info *pi;
const struct cpl_rx_pkt *pkt;
struct sge_eth_rxq *rxq = container_of(q, struct sge_eth_rxq, rspq);
@@ -1584,10 +1583,9 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
if (skb->dev->features & NETIF_F_RXHASH)
skb->rxhash = (__force u32)pkt->rsshdr.hash_val;
- pi = netdev_priv(skb->dev);
rxq->stats.pkts++;
- if (csum_ok && (pi->rx_offload & RX_CSO) &&
+ if (csum_ok && (q->netdev->features & NETIF_F_RXCSUM) &&
(pkt->l2info & htonl(RXF_UDP | RXF_TCP))) {
if (!pkt->ip_frag) {
skb->ip_summed = CHECKSUM_UNNECESSARY;
diff --git a/drivers/net/cxgb4vf/adapter.h b/drivers/net/cxgb4vf/adapter.h
index 4766b41..4fd821a 100644
--- a/drivers/net/cxgb4vf/adapter.h
+++ b/drivers/net/cxgb4vf/adapter.h
@@ -97,17 +97,11 @@ struct port_info {
u16 rss_size; /* size of VI's RSS table slice */
u8 pidx; /* index into adapter port[] */
u8 port_id; /* physical port ID */
- u8 rx_offload; /* CSO, etc. */
u8 nqsets; /* # of "Queue Sets" */
u8 first_qset; /* index of first "Queue Set" */
struct link_config link_cfg; /* physical port configuration */
};
-/* port_info.rx_offload flags */
-enum {
- RX_CSO = 1 << 0,
-};
-
/*
* Scatter Gather Engine resources for the "adapter". Our ingress and egress
* queues are organized into "Queue Sets" with one ingress and one egress
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
index c662679..4577f9b 100644
--- a/drivers/net/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -1326,30 +1326,6 @@ static void cxgb4vf_get_pauseparam(struct net_device *dev,
}
/*
- * Return whether RX Checksum Offloading is currently enabled for the device.
- */
-static u32 cxgb4vf_get_rx_csum(struct net_device *dev)
-{
- struct port_info *pi = netdev_priv(dev);
-
- return (pi->rx_offload & RX_CSO) != 0;
-}
-
-/*
- * Turn RX Checksum Offloading on or off for the device.
- */
-static int cxgb4vf_set_rx_csum(struct net_device *dev, u32 csum)
-{
- struct port_info *pi = netdev_priv(dev);
-
- if (csum)
- pi->rx_offload |= RX_CSO;
- else
- pi->rx_offload &= ~RX_CSO;
- return 0;
-}
-
-/*
* Identify the port by blinking the port's LED.
*/
static int cxgb4vf_phys_id(struct net_device *dev,
@@ -1569,18 +1545,6 @@ static void cxgb4vf_get_wol(struct net_device *dev,
*/
#define TSO_FLAGS (NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_TSO_ECN)
-/*
- * Set TCP Segmentation Offloading feature capabilities.
- */
-static int cxgb4vf_set_tso(struct net_device *dev, u32 tso)
-{
- if (tso)
- dev->features |= TSO_FLAGS;
- else
- dev->features &= ~TSO_FLAGS;
- return 0;
-}
-
static struct ethtool_ops cxgb4vf_ethtool_ops = {
.get_settings = cxgb4vf_get_settings,
.get_drvinfo = cxgb4vf_get_drvinfo,
@@ -1591,10 +1555,6 @@ static struct ethtool_ops cxgb4vf_ethtool_ops = {
.get_coalesce = cxgb4vf_get_coalesce,
.set_coalesce = cxgb4vf_set_coalesce,
.get_pauseparam = cxgb4vf_get_pauseparam,
- .get_rx_csum = cxgb4vf_get_rx_csum,
- .set_rx_csum = cxgb4vf_set_rx_csum,
- .set_tx_csum = ethtool_op_set_tx_ipv6_csum,
- .set_sg = ethtool_op_set_sg,
.get_link = ethtool_op_get_link,
.get_strings = cxgb4vf_get_strings,
.set_phys_id = cxgb4vf_phys_id,
@@ -1603,7 +1563,6 @@ static struct ethtool_ops cxgb4vf_ethtool_ops = {
.get_regs_len = cxgb4vf_get_regs_len,
.get_regs = cxgb4vf_get_regs,
.get_wol = cxgb4vf_get_wol,
- .set_tso = cxgb4vf_set_tso,
};
/*
@@ -2638,19 +2597,18 @@ static int __devinit cxgb4vf_pci_probe(struct pci_dev *pdev,
* it.
*/
pi->xact_addr_filt = -1;
- pi->rx_offload = RX_CSO;
netif_carrier_off(netdev);
netdev->irq = pdev->irq;
- netdev->features = (NETIF_F_SG | TSO_FLAGS |
- NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
- NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX |
- NETIF_F_GRO);
+ netdev->hw_features = NETIF_F_SG | TSO_FLAGS | NETIF_F_RXCSUM |
+ NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
+ netdev->vlan_features = NETIF_F_SG | TSO_FLAGS |
+ NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
+ NETIF_F_HW_VLAN_TX | NETIF_F_HIGHDMA;
+ netdev->features = netdev->hw_features |
+ NETIF_F_HW_VLAN_RX;
if (pci_using_dac)
netdev->features |= NETIF_F_HIGHDMA;
- netdev->vlan_features =
- (netdev->features &
- ~(NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX));
#ifdef HAVE_NET_DEVICE_OPS
netdev->netdev_ops = &cxgb4vf_netdev_ops;
diff --git a/drivers/net/cxgb4vf/sge.c b/drivers/net/cxgb4vf/sge.c
index bb65121..5182960 100644
--- a/drivers/net/cxgb4vf/sge.c
+++ b/drivers/net/cxgb4vf/sge.c
@@ -1555,8 +1555,8 @@ int t4vf_ethrx_handler(struct sge_rspq *rspq, const __be64 *rsp,
pi = netdev_priv(skb->dev);
rxq->stats.pkts++;
- if (csum_ok && (pi->rx_offload & RX_CSO) && !pkt->err_vec &&
- (be32_to_cpu(pkt->l2info) & (RXF_UDP|RXF_TCP))) {
+ if (csum_ok && (rspq->netdev->features & NETIF_F_RXCSUM) &&
+ !pkt->err_vec && (be32_to_cpu(pkt->l2info) & (RXF_UDP|RXF_TCP))) {
if (!pkt->ip_frag)
skb->ip_summed = CHECKSUM_UNNECESSARY;
else {
--
1.7.2.5
^ permalink raw reply related
* Re: [RFC net-next] bonding: notify when bonding device address changes
From: Stephen Hemminger @ 2011-04-16 16:18 UTC (permalink / raw)
To: Jay Vosburgh
Cc: Nicolas de Pesloüan, Michał Górny, netdev, roy,
Andy Gospodarek
In-Reply-To: <11728.1302895704@death>
On Fri, 15 Apr 2011 12:28:24 -0700
Jay Vosburgh <fubar@us.ibm.com> wrote:
> Stephen Hemminger <shemminger@vyatta.com> wrote:
>
> >When a device changes its hardware address, it needs to call the network
> >device notifiers to inform protocols.
> >
> >Compile tested only.
I did not audit that all the call sites have the proper locking.
When calling notifier, no bridge locks should be held and RTNL mutex
should be held.
^ permalink raw reply
* Re: net: Automatic IRQ siloing for network devices
From: Stephen Hemminger @ 2011-04-16 16:17 UTC (permalink / raw)
To: Neil Horman; +Cc: Ben Hutchings, netdev, davem
In-Reply-To: <20110416015938.GB2200@neilslaptop.think-freely.org>
On Fri, 15 Apr 2011 21:59:38 -0400
Neil Horman <nhorman@tuxdriver.com> wrote:
> On Fri, Apr 15, 2011 at 11:54:29PM +0100, Ben Hutchings wrote:
> > On Fri, 2011-04-15 at 16:17 -0400, Neil Horman wrote:
> > > Automatic IRQ siloing for network devices
> > >
> > > At last years netconf:
> > > http://vger.kernel.org/netconf2010.html
> > >
> > > Tom Herbert gave a talk in which he outlined some of the things we can do to
> > > improve scalability and througput in our network stack
> > >
> > > One of the big items on the slides was the notion of siloing irqs, which is the
> > > practice of setting irq affinity to a cpu or cpu set that was 'close' to the
> > > process that would be consuming data. The idea was to ensure that a hard irq
> > > for a nic (and its subsequent softirq) would execute on the same cpu as the
> > > process consuming the data, increasing cache hit rates and speeding up overall
> > > throughput.
> > >
> > > I had taken an idea away from that talk, and have finally gotten around to
> > > implementing it. One of the problems with the above approach is that its all
> > > quite manual. I.e. to properly enact this siloiong, you have to do a few things
> > > by hand:
> > >
> > > 1) decide which process is the heaviest user of a given rx queue
> > > 2) restrict the cpus which that task will run on
> > > 3) identify the irq which the rx queue in (1) maps to
> > > 4) manually set the affinity for the irq in (3) to cpus which match the cpus in
> > > (2)
> > [...]
> >
> > This presumably works well with small numbers of flows and/or large
> > numbers of queues. You could scale it up somewhat by manipulating the
> > device's flow hash indirection table, but that usually only has 128
> > entries. (Changing the indirection table is currently quite expensive,
> > though that could be changed.)
> >
> > I see RFS and accelerated RFS as the only reasonable way to scale to
> > large numbers of flows. And as part of accelerated RFS, I already did
> > the work for mapping CPUs to IRQs (note, not the other way round). If
> > IRQ affinity keeps changing then it will significantly undermine the
> > usefulness of hardware flow steering.
> >
> > Now I'm not saying that your approach is useless. There is more
> > hardware out there with flow hashing than with flow steering, and there
> > are presumably many systems with small numbers of active flows. But I
> > think we need to avoid having two features that conflict and a
> > requirement for administrators to make a careful selection between them.
> >
> > Ben.
> >
> I hear what your saying and I agree, theres no point in having features work
> against each other. That said, I'm not sure I agree that these features have to
> work against one another, nor does a sysadmin need to make a choice between the
> two. Note the third patch in this series. Making this work requires that
> network drivers wanting to participate in this affinity algorithm opt in by
> using the request_net_irq macro to attach the interrupt to the rfs affinity code
> that I added. Theres no reason that a driver which supports hardware that still
> uses flow steering can't opt out of this algorithm, and as a result irqbalance
> will still treat those interrupts as it normally does. And for those drivers
> which do opt in, irqbalance can take care of affinity assignment, using the
> provided hint. No need for sysadmin intervention.
>
> I'm sure there can be improvements made to this code, but I think theres less
> conflict between the work you've done and this code than there appears to be at
> first blush.
>
My gut feeling is that:
* kernel should default to a simple static sane irq policy without user
space. This is especially true for multi-queue devices where the default
puts all IRQ's on one cpu.
* irqbalance should do a one-shot rearrangement at boot up. It should rearrange
when new IRQ's are requested. The kernel should have capablity to notify
userspace (uevent?) when IRQ's are added or removed.
* Let scheduler make decisions about migrating processes (rather than let irqbalance
migrate IRQ's).
* irqbalance should not do the hacks it does to try and guess at network traffic.
--
^ permalink raw reply
* [PATCH net-next] bridge: fix accidental creation of sysfs directory
From: Stephen Hemminger @ 2011-04-16 16:09 UTC (permalink / raw)
To: David Miller; +Cc: netdev
Commit bb900b27a2f49b37bc38c08e656ea13048fee13b introduced a bug in net-next
because of a typo in notifier. Every device would have the sysfs
bridge directory (and files).
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
--- a/net/bridge/br_notify.c 2011-04-16 08:56:06.130218417 -0700
+++ b/net/bridge/br_notify.c 2011-04-16 08:59:30.703509541 -0700
@@ -37,7 +37,7 @@ static int br_device_event(struct notifi
int err;
/* register of bridge completed, add sysfs entries */
- if ((dev->priv_flags && IFF_EBRIDGE) && event == NETDEV_REGISTER) {
+ if ((dev->priv_flags & IFF_EBRIDGE) && event == NETDEV_REGISTER) {
br_sysfs_addbr(dev);
return NOTIFY_DONE;
}
^ permalink raw reply
* Re: r8169 misleading firmware error messages
From: Ben Hutchings @ 2011-04-16 15:34 UTC (permalink / raw)
To: Fejes József; +Cc: François Romieu, netdev
In-Reply-To: <4DA9864E.2070405@joco.name>
[-- Attachment #1: Type: text/plain, Size: 1240 bytes --]
On Sat, 2011-04-16 at 14:06 +0200, Fejes József wrote:
[...]
> I took a deeper look. It seems to me that the firmware files are not the
> usual microcode type that the device can't function without, it just
> sets up some registers, which supposedly already contain some sensible
> values, so it's more like patching.
Some of the R8169 variants have a microcontroller in the PHY running
firmware that is initially loaded from non-volatile memory (maybe
eFuse?). These blobs contain bug fixes for the original PHY firmware.
> That explains why this device still
> works without the firmware. So my actual question is this: what do I
> gain if I use the firmware, what do I lose if I don't?
[...]
The original firmware apparently is unable to establish a stable link
against some link partners.
This warning:
> W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168d-2.fw for
> module r8169
> W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168d-1.fw for
> module r8169
is purely based on the MODULE_FIRMWARE annotations, which do not
distinguish which devices might require which files.
Ben.
--
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply
* Re: r8169 misleading firmware error messages
From: Fejes József @ 2011-04-16 12:06 UTC (permalink / raw)
To: François Romieu; +Cc: netdev
In-Reply-To: <20110416110454.GC17833@electric-eye.fr.zoreil.com>
>> I see there's a condition, if an rtl_readphy returns a wrong value, it
>> doesn't even try to load the firmware and just prints the message.
>> Although this wouldn't explain why the error message disappeared
>> when the files were there.
>
> I don't get your point.
I meant this:
2233 if ((rtl_readphy(tp, 0x06) != 0xbf00) ||
2234 (rtl_apply_firmware(tp, FIRMWARE_8168D_1) < 0)) {
2235 netif_warn(tp, probe, tp->dev, "unable to apply
firmware patch\n");
2236 }
So if a user sees this warning, they don't know if the right firmware is
missing or something else is wrong with the device and it doesn't even
try to load the firmware.
>
>> Clearly, my device works without these firmware files. If my device
>> works better with them, or if there are other similar devices which
>> require it, I think there should be a configuration option to
>> disable this firmware stuff and its benefits altogether so that it
>> doesn't even report that it needs it.
>
> The driver uses netif_warn, not netif_err.
>
> I think the driver is nevrotic enough as is and I will not add
> what I consider a silly if not unusable configuration option.
>
> Feel free to send patches if you think they really add some
> value.
>
I took a deeper look. It seems to me that the firmware files are not the
usual microcode type that the device can't function without, it just
sets up some registers, which supposedly already contain some sensible
values, so it's more like patching. That explains why this device still
works without the firmware. So my actual question is this: what do I
gain if I use the firmware, what do I lose if I don't? Since the
previous kernel version, either something pretty important was moved out
of the code into the firmware file, in which case it's a bad idea not to
use them, or they add some features to an already perfectly working
device, in which case I thought it could be a good idea to make it a
configuration option. I'd just like to understand because I couldn't
find any documentation, I don't mean to question your decisions.
^ permalink raw reply
* Re: [PATCH 2/3] net: Add net device irq siloing feature
From: Neil Horman @ 2011-04-16 11:55 UTC (permalink / raw)
To: Eric Dumazet
Cc: Stephen Hemminger, netdev, davem, Dimitris Michailidis,
Thomas Gleixner, David Howells, Tom Herbert, Ben Hutchings
In-Reply-To: <1302934897.2792.6.camel@edumazet-laptop>
On Sat, Apr 16, 2011 at 08:21:37AM +0200, Eric Dumazet wrote:
> Le vendredi 15 avril 2011 à 21:52 -0700, Stephen Hemminger a écrit :
> > > On Fri, Apr 15, 2011 at 11:49:03PM +0100, Ben Hutchings wrote:
> > > > On Fri, 2011-04-15 at 16:17 -0400, Neil Horman wrote:
> > > > > Using the irq affinity infrastrucuture, we can now allow net
> > > > > devices to call
> > > > > request_irq using a new wrapper function (request_net_irq), which
> > > > > will attach a
> > > > > common affinty_update handler to each requested irq. This affinty
> > > > > update mechanism correlates each tracked irq to the flow(s) that
> > > > > said irq processes
> > > > > most frequently. The highest traffic flow is noted, marked and
> > > > > exported to user
> > > > > space via the affinity_hint proc file for each irq. In this way,
> > > > > utilities like
> > > > > irqbalance are able to determine which cpu is recieving the most
> > > > > data from each
> > > > > rx queue on a given NIC, and set irq affinity accordingly.
> > > > [...]
> > > >
> > > > Is irqbalance expected to poll the affinity hints? How often?
> > > >
> > > Yes, its done just that for quite some time. Intel added that ability
> > > at the
> > > same time they added the affinity_hint proc file. Irqbalance polls the
> > > affinity_hint file at the same time it rebalances all irqs (every 10
> > > seconds). If the affinity_hint is non-zero, irqbalance just copies it
> > > to smp_affinity for
> > > the same irq. Up until now thats been just about dead code because
> > > only ixgbe
> > > sets affinity_hint. Thats why I added the affinity_alg file, so
> > > irqbalance could do something more intellegent than just a blind copy.
> > > With the patch that
> > > I referenced I added code to irqbalance to allow it to preform
> > > different balancing methods based on the output of affinity_alg.
> > > Neil
> >
> > I hate the way more and more interfaces are becoming device driver
> > specific. It makes it impossible to build sane management infrastructure
> > and causes lots of customer and service complaints.
> >
>
> For me, the whole problem is the paradigm that we adapt IRQ to CPU were
> applications _were_ running in last seconds, while process scheduler
> might perform other choices, ie migrate task to cpu where IRQ was
> happening (the cpu calling wakeups)
>
> We can add logic to each layer, and yet not gain perfect behavior.
>
> Some kind of cooperation is neeed.
>
> Irqbalance for example is of no use in the case of a network flood
> happening on your machine, because we enter NAPI mode for several
> minutes on a single cpu. We'll need to add special logic in NAPI loop to
> force an exit to reschedule an IRQ (so that another cpu can take it)
>
Would you consider an approach whereby we, instead of updating irq affinity to
match the process that consumes data from a given irq, bias the scheduler such
that process which consume data from a given irq not be moved away from the same
core/l2 cache being fed by that flow? Do you have a suggestion for how best to
communicate that to the scheduler? It would seem that interrogating the RFS
table from the scheduler might not be well received.
Best
Neil
>
>
>
^ permalink raw reply
* Re: r8169 misleading firmware error messages
From: François Romieu @ 2011-04-16 11:04 UTC (permalink / raw)
To: Fejes József; +Cc: netdev
In-Reply-To: <4DA952D5.7030805@joco.name>
On Sat, Apr 16, 2011 at 10:27:01AM +0200, Fejes József wrote:
[...]
> So then I installed the rtl_nic firmware files, and the error
> messages were gone.
>
> How do I know if it actually tries to load the firmware at all?
Currently: remove it and the driver will tell you that it could not
load the firmware.
It's a bit rough. I'll report something through ethtool (-i).
> I see there's a condition, if an rtl_readphy returns a wrong value, it
> doesn't even try to load the firmware and just prints the message.
> Although this wouldn't explain why the error message disappeared
> when the files were there.
I don't get your point.
> Clearly, my device works without these firmware files. If my device
> works better with them, or if there are other similar devices which
> require it, I think there should be a configuration option to
> disable this firmware stuff and its benefits altogether so that it
> doesn't even report that it needs it.
The driver uses netif_warn, not netif_err.
I think the driver is nevrotic enough as is and I will not add
what I consider a silly if not unusable configuration option.
Feel free to send patches if you think they really add some
value.
--
Ueimor
^ permalink raw reply
* Re: [PATCH] r8169: Be verbose when unable to load fw patch
From: François Romieu @ 2011-04-16 11:03 UTC (permalink / raw)
To: David Miller; +Cc: bp, linux-kernel, borislav.petkov, netdev
In-Reply-To: <20110413.105737.39178380.davem@davemloft.net>
[...]
> Ok. So will you submit this yourself later or should I just
> apply this myself directly to net-2.6?
Please apply it directly.
Thanks.
--
Ueimor
^ permalink raw reply
* Re: The bonding driver should notify userspace of MAC address change
From: Nicolas de Pesloüan @ 2011-04-16 9:07 UTC (permalink / raw)
To: Jay Vosburgh; +Cc: Michał Górny, netdev, roy, Andy Gospodarek
In-Reply-To: <16422.1302903932@death>
Le 15/04/2011 23:45, Jay Vosburgh a écrit :
> Nicolas de Pesloüan<nicolas.2p.debian@gmail.com> wrote:
>
>> Agreed.
>>
>>> Is there some race window there between the register and the
>>> netif_carrier_off?
>>
>> It might be that dhcpd does not wait for link to be up before starting to send DHCP requests.
>
> It looks like it's not related to carrier state at all:
>
> #212: dhcpcd requires restart to get an IP address for bonded interface
> -----------------------+-----------------
> Reporter: mgorny@… | Owner: roy
> Type: defect | Status: new
> Priority: major | Milestone:
> Component: dhcpcd | Version: 5.1
> Resolution: | Keywords:
> -----------------------+-----------------
>
> Comment (by roy):
>
> Sorry, the above isn't too clear.
>
> dhcpcd will read the hardware address when the interface is marked IFF_UP
> or when given RTM_NEWLINK with ifi->ifi_change = ~0U, the latter being
> sent by some drivers to tell userland that an interface characteristic has
> changed - like say a hardware address - if the driver supports such a
> change whilst still up. Normal behaviour is to mark device as DOWN before
> changing hardware address. bonding does this whilst marked UP, hence this
> issue.
>
> carrier going up / down is just that, it's not a signal to re-read the
> interface characteristics.
>
>
> Now this confuses me again; I thought that running the dhcp
> client (dhcpcd) over bonding has worked for years, although I've not
> personally tried it recently. Perhaps it varies by distro. In any
> event, this behavior of bonding (setting the bond's MAC without a
> down/up flip) has never been different in my memory.
I use dhcpcd over bonding everyday on my laptop (debian/testing), for several years.
bond0 uses eth0 and wlan0 as slaves. The time to get a DHCP reply vary, mostly because the time to
register to the wifi AP is not perfectly stable. Sometimes (not very often), I need to ifdown/ifup
to get a DHCP reply. This might be due to dhcpcd reading the MAC too early and getting an all zero
MAC. I need to try and double check this, but as it happen early in the boot process and not very
often, it will be hard to diagnose.
That being said, sending a DHCP request with an all zero source MAC sounds very strange to me.
The RFC for DHCP (RFC2131) states that a DHCP server must be prepared to broadcast the reply if the
client hardware address is null.
If 'giaddr' is zero and 'ciaddr' is zero, and the broadcast bit is
set, then the server broadcasts DHCPOFFER and DHCPACK messages to
0xffffffff. If the broadcast bit is not set and 'giaddr' is zero and
'ciaddr' is zero, then the server unicasts DHCPOFFER and DHCPACK
messages to the client's hardware address and 'yiaddr' address. In
all cases, when 'giaddr' is zero, the server broadcasts any DHCPNAK
messages to 0xffffffff.
But a DHCP server must store a client identifier associated with a given dynamic IP address for the
duration of the lease, to be able to give the same IP address to the same client if this client
restarts while the lease is still valid.
If the client hardware address is all zero and the client configuration does not provide some other
user defined identifier, then the client identifier is not unique and the DHCP server should - I
think - ignore the request.
So, except if the local dhcpcd configuration contains an user defined identifier, I think dhcpcd
should wait for the MAC address to be not null before sending any requests.
Nicolas.
> I've not yet dug down to see if NETDEV_CHANGEADDR will result in
> an RTM_NEWLINK to user space. At first glance it doesn't look like it.
>
> When bonding goes link up, however, I think linkwatch_do_dev
> will issue an RTM_NEWLINK (via a call to netdev_state_change), or,
> alternately, dev_change_flags will do it at IFF_UP time.
>
> -J
>
> ---
> -Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
>
^ permalink raw reply
* r8169 misleading firmware error messages
From: Fejes József @ 2011-04-16 8:27 UTC (permalink / raw)
To: netdev
Hi,
I'm using Linux 2.6.38.3 with a Realtek 8169 card, ID: 10ec:8168
(integrated into an Intel D945GSEJT mobo). It never needed any firmware
files, and when I was using 2.6.37, it never complained about it either.
Now it does complain (but it still works perfectly):
r8169 0000:01:00.0: eth0: unable to apply firmware patch
Also when I do initramfs stuff:
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168d-2.fw for
module r8169
W: Possible missing firmware /lib/firmware/rtl_nic/rtl8168d-1.fw for
module r8169
So then I installed the rtl_nic firmware files, and the error messages
were gone.
How do I know if it actually tries to load the firmware at all? I see
there's a condition, if an rtl_readphy returns a wrong value, it doesn't
even try to load the firmware and just prints the message. Although this
wouldn't explain why the error message disappeared when the files were
there.
Clearly, my device works without these firmware files. If my device
works better with them, or if there are other similar devices which
require it, I think there should be a configuration option to disable
this firmware stuff and its benefits altogether so that it doesn't even
report that it needs it.
Best regards,
--
Fejes József
http://joco.name
^ permalink raw reply
* Re: [PATCH 2/3] net: Add net device irq siloing feature
From: Eric Dumazet @ 2011-04-16 6:21 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Neil Horman, netdev, davem, Dimitris Michailidis, Thomas Gleixner,
David Howells, Tom Herbert, Ben Hutchings
In-Reply-To: <367764507.40661.1302929544356.JavaMail.root@tahiti.vyatta.com>
Le vendredi 15 avril 2011 à 21:52 -0700, Stephen Hemminger a écrit :
> > On Fri, Apr 15, 2011 at 11:49:03PM +0100, Ben Hutchings wrote:
> > > On Fri, 2011-04-15 at 16:17 -0400, Neil Horman wrote:
> > > > Using the irq affinity infrastrucuture, we can now allow net
> > > > devices to call
> > > > request_irq using a new wrapper function (request_net_irq), which
> > > > will attach a
> > > > common affinty_update handler to each requested irq. This affinty
> > > > update mechanism correlates each tracked irq to the flow(s) that
> > > > said irq processes
> > > > most frequently. The highest traffic flow is noted, marked and
> > > > exported to user
> > > > space via the affinity_hint proc file for each irq. In this way,
> > > > utilities like
> > > > irqbalance are able to determine which cpu is recieving the most
> > > > data from each
> > > > rx queue on a given NIC, and set irq affinity accordingly.
> > > [...]
> > >
> > > Is irqbalance expected to poll the affinity hints? How often?
> > >
> > Yes, its done just that for quite some time. Intel added that ability
> > at the
> > same time they added the affinity_hint proc file. Irqbalance polls the
> > affinity_hint file at the same time it rebalances all irqs (every 10
> > seconds). If the affinity_hint is non-zero, irqbalance just copies it
> > to smp_affinity for
> > the same irq. Up until now thats been just about dead code because
> > only ixgbe
> > sets affinity_hint. Thats why I added the affinity_alg file, so
> > irqbalance could do something more intellegent than just a blind copy.
> > With the patch that
> > I referenced I added code to irqbalance to allow it to preform
> > different balancing methods based on the output of affinity_alg.
> > Neil
>
> I hate the way more and more interfaces are becoming device driver
> specific. It makes it impossible to build sane management infrastructure
> and causes lots of customer and service complaints.
>
For me, the whole problem is the paradigm that we adapt IRQ to CPU were
applications _were_ running in last seconds, while process scheduler
might perform other choices, ie migrate task to cpu where IRQ was
happening (the cpu calling wakeups)
We can add logic to each layer, and yet not gain perfect behavior.
Some kind of cooperation is neeed.
Irqbalance for example is of no use in the case of a network flood
happening on your machine, because we enter NAPI mode for several
minutes on a single cpu. We'll need to add special logic in NAPI loop to
force an exit to reschedule an IRQ (so that another cpu can take it)
^ permalink raw reply
* Re: [PATCH 2/3] net: Add net device irq siloing feature
From: Stephen Hemminger @ 2011-04-16 4:52 UTC (permalink / raw)
To: Neil Horman
Cc: netdev, davem, Dimitris Michailidis, Thomas Gleixner,
David Howells, Eric Dumazet, Tom Herbert, Ben Hutchings
In-Reply-To: <20110416014547.GA2200@neilslaptop.think-freely.org>
> On Fri, Apr 15, 2011 at 11:49:03PM +0100, Ben Hutchings wrote:
> > On Fri, 2011-04-15 at 16:17 -0400, Neil Horman wrote:
> > > Using the irq affinity infrastrucuture, we can now allow net
> > > devices to call
> > > request_irq using a new wrapper function (request_net_irq), which
> > > will attach a
> > > common affinty_update handler to each requested irq. This affinty
> > > update mechanism correlates each tracked irq to the flow(s) that
> > > said irq processes
> > > most frequently. The highest traffic flow is noted, marked and
> > > exported to user
> > > space via the affinity_hint proc file for each irq. In this way,
> > > utilities like
> > > irqbalance are able to determine which cpu is recieving the most
> > > data from each
> > > rx queue on a given NIC, and set irq affinity accordingly.
> > [...]
> >
> > Is irqbalance expected to poll the affinity hints? How often?
> >
> Yes, its done just that for quite some time. Intel added that ability
> at the
> same time they added the affinity_hint proc file. Irqbalance polls the
> affinity_hint file at the same time it rebalances all irqs (every 10
> seconds). If the affinity_hint is non-zero, irqbalance just copies it
> to smp_affinity for
> the same irq. Up until now thats been just about dead code because
> only ixgbe
> sets affinity_hint. Thats why I added the affinity_alg file, so
> irqbalance could do something more intellegent than just a blind copy.
> With the patch that
> I referenced I added code to irqbalance to allow it to preform
> different balancing methods based on the output of affinity_alg.
> Neil
I hate the way more and more interfaces are becoming device driver
specific. It makes it impossible to build sane management infrastructure
and causes lots of customer and service complaints.
^ permalink raw reply
* Re: [PATCH net-next-2.6 3/3] bonding,ipv4,ipv6,vlan: Handle NETDEV_BONDING_FAILOVER like NETDEV_NOTIFY_PEERS
From: Ben Hutchings @ 2011-04-16 2:53 UTC (permalink / raw)
To: Brian Haley
Cc: Jay Vosburgh, David Miller, Andy Gospodarek, Patrick McHardy,
netdev
In-Reply-To: <4DA8F627.5090109@hp.com>
On Fri, 2011-04-15 at 21:51 -0400, Brian Haley wrote:
> On 04/15/2011 08:30 PM, Jay Vosburgh wrote:
> > Ben Hutchings <bhutchings@solarflare.com> wrote:
> >
> >> It is undesirable for the bonding driver to be poking into higher
> >> level protocols, and notifiers provide a way to avoid that. This does
> >> mean removing the ability to configure reptitition of gratuitous ARPs
> >> and unsolicited NAs.
> >
> > In principle I think this is a good thing (getting rid of some
> > of those dependencies, duplicated code, etc).
> >
> > However, the removal of the multiple grat ARP and NAs may be an
> > issue for some users. I don't know that we can just remove this (along
> > with its API) without going through the feature removal process.
>
> Right, I don't know how many people are using these, they might not be
> happy, especially since specifying an unknown parameter will cause a
> module load to fail:
>
> --> modprobe bonding foobar=27
> FATAL: Error inserting bonding (/lib/modules/2.6.32-31-generic/kernel/drivers/net/bonding/bonding.ko): Unknown symbol in module, or unknown parameter (see dmesg)
>
> When these params are stuffed in /etc/modprobe.d/options, a reboot to
> a kernel without them will cause some swearing :)
Yes, this is a problem.
If the feature of repeated advertismenets is implemented in ipv4/ipv6
then we could propagate the parameters there, logging a warning, up to
some deprecation deadline.
> BTW, if this is accepted you need to update the documentation as well.
>
> > As I recall, the multiple gratuitous ARP stuff was added for
> > Infiniband, because it is dependent on the grat ARP for a smooth
> > failover.
> >
> > There is also currently logic to check the linkwatch link state
> > to wait for the link to go up prior to sending a grat ARP; this is also
> > for IB.
> >
> > Brian Haley added the unsolicited NAs; I've added him to the cc
> > so perhaps he (or somebody else) can comment on the necessity of keeping
> > the ability to send multiple NAs.
>
> I added it because in an IPv6-only environment I was seeing really long
> failover times on bonds. I believe this was a customer-reported issue, so
> there *might* be someone setting it, but I think my testing always showed
> one was enough to wake-up the switch.
>
> Is it useful to call netdev_bonding_change() multiple times from within
> bond_change_active_slave(), like MAX(arp, na) times?
We can't wait around to do that. And it would be abusing the notifier
based on assumptions about what other components do, which I'm trying to
get away from.
> One comment below...
[...]
> Does your change also cover this case with multiple VLAN IDs? Is that covered in
> the vlan.c code below?
[...]
Should do. I didn't specifically test multiple VLAN IDs but I'm looping
over them.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH 1/3] irq: Add registered affinity guidance infrastructure
From: Neil Horman @ 2011-04-16 2:11 UTC (permalink / raw)
To: Thomas Gleixner
Cc: netdev, davem, nhorman, Dimitris Michailidis, David Howells,
Eric Dumazet, Tom Herbert
In-Reply-To: <alpine.LFD.2.00.1104160144370.2744@localhost6.localdomain6>
On Sat, Apr 16, 2011 at 02:22:58AM +0200, Thomas Gleixner wrote:
> On Fri, 15 Apr 2011, Neil Horman wrote:
>
> > From: nhorman <nhorman@devel2.think-freely.org>
> >
> > This patch adds the needed data to the irq_desc struct, as well as the needed
> > API calls to allow the requester of an irq to register a handler function to
> > determine the affinity_hint of that irq when queried from user space.
>
> This changelog simply sucks. It does not explain the rationale for
> this churn at all.
>
It seems pretty clear to me. It allows a common function to update the value of
affinity_hint when its queried.
> Which problem is it solving?
> Why are the current interfaces not sufficient?
Did you read the initial post that I sent with it? Apparently not. Apologies,
its seems my git-send-email didn't cc everyone I expected it to:
http://marc.info/?l=linux-netdev&m=130291921026187&w=2
I'll skip the rest of your your email, and just try to turn some of your rant
into something more acceptible to you.
Neil
^ permalink raw reply
* Re: net: Automatic IRQ siloing for network devices
From: Neil Horman @ 2011-04-16 1:59 UTC (permalink / raw)
To: Ben Hutchings; +Cc: netdev, davem
In-Reply-To: <1302908069.2845.29.camel@bwh-desktop>
On Fri, Apr 15, 2011 at 11:54:29PM +0100, Ben Hutchings wrote:
> On Fri, 2011-04-15 at 16:17 -0400, Neil Horman wrote:
> > Automatic IRQ siloing for network devices
> >
> > At last years netconf:
> > http://vger.kernel.org/netconf2010.html
> >
> > Tom Herbert gave a talk in which he outlined some of the things we can do to
> > improve scalability and througput in our network stack
> >
> > One of the big items on the slides was the notion of siloing irqs, which is the
> > practice of setting irq affinity to a cpu or cpu set that was 'close' to the
> > process that would be consuming data. The idea was to ensure that a hard irq
> > for a nic (and its subsequent softirq) would execute on the same cpu as the
> > process consuming the data, increasing cache hit rates and speeding up overall
> > throughput.
> >
> > I had taken an idea away from that talk, and have finally gotten around to
> > implementing it. One of the problems with the above approach is that its all
> > quite manual. I.e. to properly enact this siloiong, you have to do a few things
> > by hand:
> >
> > 1) decide which process is the heaviest user of a given rx queue
> > 2) restrict the cpus which that task will run on
> > 3) identify the irq which the rx queue in (1) maps to
> > 4) manually set the affinity for the irq in (3) to cpus which match the cpus in
> > (2)
> [...]
>
> This presumably works well with small numbers of flows and/or large
> numbers of queues. You could scale it up somewhat by manipulating the
> device's flow hash indirection table, but that usually only has 128
> entries. (Changing the indirection table is currently quite expensive,
> though that could be changed.)
>
> I see RFS and accelerated RFS as the only reasonable way to scale to
> large numbers of flows. And as part of accelerated RFS, I already did
> the work for mapping CPUs to IRQs (note, not the other way round). If
> IRQ affinity keeps changing then it will significantly undermine the
> usefulness of hardware flow steering.
>
> Now I'm not saying that your approach is useless. There is more
> hardware out there with flow hashing than with flow steering, and there
> are presumably many systems with small numbers of active flows. But I
> think we need to avoid having two features that conflict and a
> requirement for administrators to make a careful selection between them.
>
> Ben.
>
I hear what your saying and I agree, theres no point in having features work
against each other. That said, I'm not sure I agree that these features have to
work against one another, nor does a sysadmin need to make a choice between the
two. Note the third patch in this series. Making this work requires that
network drivers wanting to participate in this affinity algorithm opt in by
using the request_net_irq macro to attach the interrupt to the rfs affinity code
that I added. Theres no reason that a driver which supports hardware that still
uses flow steering can't opt out of this algorithm, and as a result irqbalance
will still treat those interrupts as it normally does. And for those drivers
which do opt in, irqbalance can take care of affinity assignment, using the
provided hint. No need for sysadmin intervention.
I'm sure there can be improvements made to this code, but I think theres less
conflict between the work you've done and this code than there appears to be at
first blush.
Best
Neil
> --
> Ben Hutchings, Senior Software Engineer, Solarflare
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.
>
>
^ permalink raw reply
* Re: [PATCH net-next-2.6 3/3] bonding,ipv4,ipv6,vlan: Handle NETDEV_BONDING_FAILOVER like NETDEV_NOTIFY_PEERS
From: Brian Haley @ 2011-04-16 1:51 UTC (permalink / raw)
To: Jay Vosburgh
Cc: Ben Hutchings, David Miller, Andy Gospodarek, Patrick McHardy,
netdev
In-Reply-To: <22334.1302913805@death>
On 04/15/2011 08:30 PM, Jay Vosburgh wrote:
> Ben Hutchings <bhutchings@solarflare.com> wrote:
>
>> It is undesirable for the bonding driver to be poking into higher
>> level protocols, and notifiers provide a way to avoid that. This does
>> mean removing the ability to configure reptitition of gratuitous ARPs
>> and unsolicited NAs.
>
> In principle I think this is a good thing (getting rid of some
> of those dependencies, duplicated code, etc).
>
> However, the removal of the multiple grat ARP and NAs may be an
> issue for some users. I don't know that we can just remove this (along
> with its API) without going through the feature removal process.
Right, I don't know how many people are using these, they might not be
happy, especially since specifying an unknown parameter will cause a
module load to fail:
--> modprobe bonding foobar=27
FATAL: Error inserting bonding (/lib/modules/2.6.32-31-generic/kernel/drivers/net/bonding/bonding.ko): Unknown symbol in module, or unknown parameter (see dmesg)
When these params are stuffed in /etc/modprobe.d/options, a reboot to
a kernel without them will cause some swearing :)
BTW, if this is accepted you need to update the documentation as well.
> As I recall, the multiple gratuitous ARP stuff was added for
> Infiniband, because it is dependent on the grat ARP for a smooth
> failover.
>
> There is also currently logic to check the linkwatch link state
> to wait for the link to go up prior to sending a grat ARP; this is also
> for IB.
>
> Brian Haley added the unsolicited NAs; I've added him to the cc
> so perhaps he (or somebody else) can comment on the necessity of keeping
> the ability to send multiple NAs.
I added it because in an IPv6-only environment I was seeing really long
failover times on bonds. I believe this was a customer-reported issue, so
there *might* be someone setting it, but I think my testing always showed
one was enough to wake-up the switch.
Is it useful to call netdev_bonding_change() multiple times from within
bond_change_active_slave(), like MAX(arp, na) times?
One comment below...
>> -/*
>> - * Kick out a gratuitous ARP for an IP on the bonding master plus one
>> - * for each VLAN above us.
>> - *
>> - * Caller must hold curr_slave_lock for read or better
>> - */
>> -static void bond_send_gratuitous_arp(struct bonding *bond)
>> -{
>> - struct slave *slave = bond->curr_active_slave;
>> - struct vlan_entry *vlan;
>> - struct net_device *vlan_dev;
>> -
>> - pr_debug("bond_send_grat_arp: bond %s slave %s\n",
>> - bond->dev->name, slave ? slave->dev->name : "NULL");
>> -
>> - if (!slave || !bond->send_grat_arp ||
>> - test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))
>> - return;
>> -
>> - bond->send_grat_arp--;
>> -
>> - if (bond->master_ip) {
>> - bond_arp_send(slave->dev, ARPOP_REPLY, bond->master_ip,
>> - bond->master_ip, 0);
>> - }
>> -
>> - if (!bond->vlgrp)
>> - return;
>> -
>> - list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
>> - vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id);
>> - if (vlan->vlan_ip) {
>> - bond_arp_send(slave->dev, ARPOP_REPLY, vlan->vlan_ip,
>> - vlan->vlan_ip, vlan->vlan_id);
>> - }
>> - }
>> -}
Does your change also cover this case with multiple VLAN IDs? Is that covered in
the vlan.c code below?
>> diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
>> index b2ff70f..969e700 100644
>> --- a/net/8021q/vlan.c
>> +++ b/net/8021q/vlan.c
>> @@ -501,13 +501,14 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
>> return NOTIFY_BAD;
>>
>> case NETDEV_NOTIFY_PEERS:
>> + case NETDEV_BONDING_FAILOVER:
>> /* Propagate to vlan devices */
>> for (i = 0; i < VLAN_N_VID; i++) {
>> vlandev = vlan_group_get_device(grp, i);
>> if (!vlandev)
>> continue;
>>
>> - call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, vlandev);
>> + call_netdevice_notifiers(event, vlandev);
>> }
>> break;
>> }
Thanks,
-Brian
^ permalink raw reply
* Re: [PATCH 2/3] net: Add net device irq siloing feature
From: Neil Horman @ 2011-04-16 1:49 UTC (permalink / raw)
To: Ben Hutchings
Cc: netdev, davem, Dimitris Michailidis, Thomas Gleixner,
David Howells, Eric Dumazet, Tom Herbert
In-Reply-To: <1302907743.2845.23.camel@bwh-desktop>
On Fri, Apr 15, 2011 at 11:49:03PM +0100, Ben Hutchings wrote:
> On Fri, 2011-04-15 at 16:17 -0400, Neil Horman wrote:
> > Using the irq affinity infrastrucuture, we can now allow net devices to call
> > request_irq using a new wrapper function (request_net_irq), which will attach a
> > common affinty_update handler to each requested irq. This affinty update
> > mechanism correlates each tracked irq to the flow(s) that said irq processes
> > most frequently. The highest traffic flow is noted, marked and exported to user
> > space via the affinity_hint proc file for each irq. In this way, utilities like
> > irqbalance are able to determine which cpu is recieving the most data from each
> > rx queue on a given NIC, and set irq affinity accordingly.
> [...]
>
> Is irqbalance expected to poll the affinity hints? How often?
>
Yes, its done just that for quite some time. Intel added that ability at the
same time they added the affinity_hint proc file. Irqbalance polls the
affinity_hint file at the same time it rebalances all irqs (every 10 seconds).
If the affinity_hint is non-zero, irqbalance just copies it to smp_affinity for
the same irq. Up until now thats been just about dead code because only ixgbe
sets affinity_hint. Thats why I added the affinity_alg file, so irqbalance
could do something more intellegent than just a blind copy. With the patch that
I referenced I added code to irqbalance to allow it to preform different
balancing methods based on the output of affinity_alg.
Neil
> Ben.
>
> --
> Ben Hutchings, Senior Software Engineer, Solarflare
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.
>
>
^ permalink raw reply
* Re: Steps to integrate new 40G Network driver to the kernel tree
From: Ben Hutchings @ 2011-04-16 0:57 UTC (permalink / raw)
To: Joyce Yu - System Software; +Cc: netdev
In-Reply-To: <4DA8D9F6.2070908@oracle.com>
On Fri, 2011-04-15 at 16:51 -0700, Joyce Yu - System Software wrote:
> Hello,
>
> We have a new 40G network Linux driver. What are the steps to integrate
> it to the kernel tree?
Make sure it works as an addition to David Miller's net-2.6 git tree.
Send patches here for review, in <100K chunks (that's the limit for this
list). Update it based on review feedback, and repeat as necessary.
Documentation/SubmittingPatches has general advice on patches.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: Steps to integrate new 40G Network driver to the kernel tree
From: Stephen Hemminger @ 2011-04-16 0:54 UTC (permalink / raw)
To: Joyce Yu - System Software; +Cc: netdev
In-Reply-To: <4DA8D9F6.2070908@oracle.com>
On Fri, 15 Apr 2011 16:51:18 -0700
Joyce Yu - System Software <joyce.yu@oracle.com> wrote:
> Hello,
>
> We have a new 40G network Linux driver. What are the steps to integrate
> it to the kernel tree?
There is a simple well documented process.
See the file SubmittingPatches in the kernel source Documentation directory.
Network drivers should be submitted to netdev list.
^ permalink raw reply
* Re: net: Automatic IRQ siloing for network devices
From: Ben Hutchings @ 2011-04-16 0:50 UTC (permalink / raw)
To: Neil Horman; +Cc: netdev, davem
In-Reply-To: <1302908069.2845.29.camel@bwh-desktop>
On Fri, 2011-04-15 at 23:54 +0100, Ben Hutchings wrote:
> On Fri, 2011-04-15 at 16:17 -0400, Neil Horman wrote:
> > Automatic IRQ siloing for network devices
> >
> > At last years netconf:
> > http://vger.kernel.org/netconf2010.html
> >
> > Tom Herbert gave a talk in which he outlined some of the things we can do to
> > improve scalability and througput in our network stack
> >
> > One of the big items on the slides was the notion of siloing irqs, which is the
> > practice of setting irq affinity to a cpu or cpu set that was 'close' to the
> > process that would be consuming data. The idea was to ensure that a hard irq
> > for a nic (and its subsequent softirq) would execute on the same cpu as the
> > process consuming the data, increasing cache hit rates and speeding up overall
> > throughput.
> >
> > I had taken an idea away from that talk, and have finally gotten around to
> > implementing it. One of the problems with the above approach is that its all
> > quite manual. I.e. to properly enact this siloiong, you have to do a few things
> > by hand:
> >
> > 1) decide which process is the heaviest user of a given rx queue
> > 2) restrict the cpus which that task will run on
> > 3) identify the irq which the rx queue in (1) maps to
> > 4) manually set the affinity for the irq in (3) to cpus which match the cpus in
> > (2)
> [...]
>
> This presumably works well with small numbers of flows and/or large
> numbers of queues. You could scale it up somewhat by manipulating the
> device's flow hash indirection table, but that usually only has 128
> entries. (Changing the indirection table is currently quite expensive,
> though that could be changed.)
[...]
Actually, I reckon you could do a more or less generic implementation of
accelerated RFS on top of a flow hash indirection table. It would
require the drivers to provide a new function to update single table
entries, and some way to switch between automatic configuration by RFS
and manual configuration with ethtool.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* Re: [PATCH net-next-2.6 3/3] bonding,ipv4,ipv6,vlan: Handle NETDEV_BONDING_FAILOVER like NETDEV_NOTIFY_PEERS
From: Jay Vosburgh @ 2011-04-16 0:30 UTC (permalink / raw)
To: Ben Hutchings
Cc: David Miller, Andy Gospodarek, Patrick McHardy, netdev,
Brian Haley
In-Reply-To: <1302911271.2845.41.camel@bwh-desktop>
Ben Hutchings <bhutchings@solarflare.com> wrote:
>It is undesirable for the bonding driver to be poking into higher
>level protocols, and notifiers provide a way to avoid that. This does
>mean removing the ability to configure reptitition of gratuitous ARPs
>and unsolicited NAs.
In principle I think this is a good thing (getting rid of some
of those dependencies, duplicated code, etc).
However, the removal of the multiple grat ARP and NAs may be an
issue for some users. I don't know that we can just remove this (along
with its API) without going through the feature removal process.
As I recall, the multiple gratuitous ARP stuff was added for
Infiniband, because it is dependent on the grat ARP for a smooth
failover.
There is also currently logic to check the linkwatch link state
to wait for the link to go up prior to sending a grat ARP; this is also
for IB.
Brian Haley added the unsolicited NAs; I've added him to the cc
so perhaps he (or somebody else) can comment on the necessity of keeping
the ability to send multiple NAs.
-J
>Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
>---
> drivers/net/bonding/Makefile | 3 -
> drivers/net/bonding/bond_ipv6.c | 225 --------------------------------------
> drivers/net/bonding/bond_main.c | 96 ----------------
> drivers/net/bonding/bond_sysfs.c | 80 --------------
> drivers/net/bonding/bonding.h | 29 -----
> net/8021q/vlan.c | 3 +-
> net/ipv4/devinet.c | 1 +
> net/ipv6/ndisc.c | 1 +
> 8 files changed, 4 insertions(+), 434 deletions(-)
> delete mode 100644 drivers/net/bonding/bond_ipv6.c
>
>diff --git a/drivers/net/bonding/Makefile b/drivers/net/bonding/Makefile
>index 3c5c014..4c21bf6 100644
>--- a/drivers/net/bonding/Makefile
>+++ b/drivers/net/bonding/Makefile
>@@ -9,6 +9,3 @@ bonding-objs := bond_main.o bond_3ad.o bond_alb.o bond_sysfs.o bond_debugfs.o
> proc-$(CONFIG_PROC_FS) += bond_procfs.o
> bonding-objs += $(proc-y)
>
>-ipv6-$(subst m,y,$(CONFIG_IPV6)) += bond_ipv6.o
>-bonding-objs += $(ipv6-y)
>-
>diff --git a/drivers/net/bonding/bond_ipv6.c b/drivers/net/bonding/bond_ipv6.c
>deleted file mode 100644
>index 84fbd4e..0000000
>--- a/drivers/net/bonding/bond_ipv6.c
>+++ /dev/null
>@@ -1,225 +0,0 @@
>-/*
>- * Copyright(c) 2008 Hewlett-Packard Development Company, L.P.
>- *
>- * This program is free software; you can redistribute it and/or modify it
>- * under the terms of the GNU General Public License as published by the
>- * Free Software Foundation; either version 2 of the License, or
>- * (at your option) any later version.
>- *
>- * This program is distributed in the hope that it will be useful, but
>- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
>- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
>- * for more details.
>- *
>- * You should have received a copy of the GNU General Public License along
>- * with this program; if not, write to the Free Software Foundation, Inc.,
>- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
>- *
>- * The full GNU General Public License is included in this distribution in the
>- * file called LICENSE.
>- *
>- */
>-
>-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>-
>-#include <linux/types.h>
>-#include <linux/if_vlan.h>
>-#include <net/ipv6.h>
>-#include <net/ndisc.h>
>-#include <net/addrconf.h>
>-#include <net/netns/generic.h>
>-#include "bonding.h"
>-
>-/*
>- * Assign bond->master_ipv6 to the next IPv6 address in the list, or
>- * zero it out if there are none.
>- */
>-static void bond_glean_dev_ipv6(struct net_device *dev, struct in6_addr *addr)
>-{
>- struct inet6_dev *idev;
>-
>- if (!dev)
>- return;
>-
>- idev = in6_dev_get(dev);
>- if (!idev)
>- return;
>-
>- read_lock_bh(&idev->lock);
>- if (!list_empty(&idev->addr_list)) {
>- struct inet6_ifaddr *ifa
>- = list_first_entry(&idev->addr_list,
>- struct inet6_ifaddr, if_list);
>- ipv6_addr_copy(addr, &ifa->addr);
>- } else
>- ipv6_addr_set(addr, 0, 0, 0, 0);
>-
>- read_unlock_bh(&idev->lock);
>-
>- in6_dev_put(idev);
>-}
>-
>-static void bond_na_send(struct net_device *slave_dev,
>- struct in6_addr *daddr,
>- int router,
>- unsigned short vlan_id)
>-{
>- struct in6_addr mcaddr;
>- struct icmp6hdr icmp6h = {
>- .icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT,
>- };
>- struct sk_buff *skb;
>-
>- icmp6h.icmp6_router = router;
>- icmp6h.icmp6_solicited = 0;
>- icmp6h.icmp6_override = 1;
>-
>- addrconf_addr_solict_mult(daddr, &mcaddr);
>-
>- pr_debug("ipv6 na on slave %s: dest %pI6, src %pI6\n",
>- slave_dev->name, &mcaddr, daddr);
>-
>- skb = ndisc_build_skb(slave_dev, &mcaddr, daddr, &icmp6h, daddr,
>- ND_OPT_TARGET_LL_ADDR);
>-
>- if (!skb) {
>- pr_err("NA packet allocation failed\n");
>- return;
>- }
>-
>- if (vlan_id) {
>- /* The Ethernet header is not present yet, so it is
>- * too early to insert a VLAN tag. Force use of an
>- * out-of-line tag here and let dev_hard_start_xmit()
>- * insert it if the slave hardware can't.
>- */
>- skb = __vlan_hwaccel_put_tag(skb, vlan_id);
>- if (!skb) {
>- pr_err("failed to insert VLAN tag\n");
>- return;
>- }
>- }
>-
>- ndisc_send_skb(skb, slave_dev, NULL, &mcaddr, daddr, &icmp6h);
>-}
>-
>-/*
>- * Kick out an unsolicited Neighbor Advertisement for an IPv6 address on
>- * the bonding master. This will help the switch learn our address
>- * if in active-backup mode.
>- *
>- * Caller must hold curr_slave_lock for read or better
>- */
>-void bond_send_unsolicited_na(struct bonding *bond)
>-{
>- struct slave *slave = bond->curr_active_slave;
>- struct vlan_entry *vlan;
>- struct inet6_dev *idev;
>- int is_router;
>-
>- pr_debug("%s: bond %s slave %s\n", bond->dev->name,
>- __func__, slave ? slave->dev->name : "NULL");
>-
>- if (!slave || !bond->send_unsol_na ||
>- test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))
>- return;
>-
>- bond->send_unsol_na--;
>-
>- idev = in6_dev_get(bond->dev);
>- if (!idev)
>- return;
>-
>- is_router = !!idev->cnf.forwarding;
>-
>- in6_dev_put(idev);
>-
>- if (!ipv6_addr_any(&bond->master_ipv6))
>- bond_na_send(slave->dev, &bond->master_ipv6, is_router, 0);
>-
>- list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
>- if (!ipv6_addr_any(&vlan->vlan_ipv6)) {
>- bond_na_send(slave->dev, &vlan->vlan_ipv6, is_router,
>- vlan->vlan_id);
>- }
>- }
>-}
>-
>-/*
>- * bond_inet6addr_event: handle inet6addr notifier chain events.
>- *
>- * We keep track of device IPv6 addresses primarily to use as source
>- * addresses in NS probes.
>- *
>- * We track one IPv6 for the main device (if it has one).
>- */
>-static int bond_inet6addr_event(struct notifier_block *this,
>- unsigned long event,
>- void *ptr)
>-{
>- struct inet6_ifaddr *ifa = ptr;
>- struct net_device *vlan_dev, *event_dev = ifa->idev->dev;
>- struct bonding *bond;
>- struct vlan_entry *vlan;
>- struct bond_net *bn = net_generic(dev_net(event_dev), bond_net_id);
>-
>- list_for_each_entry(bond, &bn->dev_list, bond_list) {
>- if (bond->dev == event_dev) {
>- switch (event) {
>- case NETDEV_UP:
>- if (ipv6_addr_any(&bond->master_ipv6))
>- ipv6_addr_copy(&bond->master_ipv6,
>- &ifa->addr);
>- return NOTIFY_OK;
>- case NETDEV_DOWN:
>- if (ipv6_addr_equal(&bond->master_ipv6,
>- &ifa->addr))
>- bond_glean_dev_ipv6(bond->dev,
>- &bond->master_ipv6);
>- return NOTIFY_OK;
>- default:
>- return NOTIFY_DONE;
>- }
>- }
>-
>- list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
>- if (!bond->vlgrp)
>- continue;
>- vlan_dev = vlan_group_get_device(bond->vlgrp,
>- vlan->vlan_id);
>- if (vlan_dev == event_dev) {
>- switch (event) {
>- case NETDEV_UP:
>- if (ipv6_addr_any(&vlan->vlan_ipv6))
>- ipv6_addr_copy(&vlan->vlan_ipv6,
>- &ifa->addr);
>- return NOTIFY_OK;
>- case NETDEV_DOWN:
>- if (ipv6_addr_equal(&vlan->vlan_ipv6,
>- &ifa->addr))
>- bond_glean_dev_ipv6(vlan_dev,
>- &vlan->vlan_ipv6);
>- return NOTIFY_OK;
>- default:
>- return NOTIFY_DONE;
>- }
>- }
>- }
>- }
>- return NOTIFY_DONE;
>-}
>-
>-static struct notifier_block bond_inet6addr_notifier = {
>- .notifier_call = bond_inet6addr_event,
>-};
>-
>-void bond_register_ipv6_notifier(void)
>-{
>- register_inet6addr_notifier(&bond_inet6addr_notifier);
>-}
>-
>-void bond_unregister_ipv6_notifier(void)
>-{
>- unregister_inet6addr_notifier(&bond_inet6addr_notifier);
>-}
>-
>diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>index b51e021..5cd4766 100644
>--- a/drivers/net/bonding/bond_main.c
>+++ b/drivers/net/bonding/bond_main.c
>@@ -89,8 +89,6 @@
>
> static int max_bonds = BOND_DEFAULT_MAX_BONDS;
> static int tx_queues = BOND_DEFAULT_TX_QUEUES;
>-static int num_grat_arp = 1;
>-static int num_unsol_na = 1;
> static int miimon = BOND_LINK_MON_INTERV;
> static int updelay;
> static int downdelay;
>@@ -113,10 +111,6 @@ module_param(max_bonds, int, 0);
> MODULE_PARM_DESC(max_bonds, "Max number of bonded devices");
> module_param(tx_queues, int, 0);
> MODULE_PARM_DESC(tx_queues, "Max number of transmit queues (default = 16)");
>-module_param(num_grat_arp, int, 0644);
>-MODULE_PARM_DESC(num_grat_arp, "Number of gratuitous ARP packets to send on failover event");
>-module_param(num_unsol_na, int, 0644);
>-MODULE_PARM_DESC(num_unsol_na, "Number of unsolicited IPv6 Neighbor Advertisements packets to send on failover event");
> module_param(miimon, int, 0);
> MODULE_PARM_DESC(miimon, "Link check interval in milliseconds");
> module_param(updelay, int, 0);
>@@ -234,7 +228,6 @@ struct bond_parm_tbl ad_select_tbl[] = {
>
> /*-------------------------- Forward declarations ---------------------------*/
>
>-static void bond_send_gratuitous_arp(struct bonding *bond);
> static int bond_init(struct net_device *bond_dev);
> static void bond_uninit(struct net_device *bond_dev);
>
>@@ -1160,14 +1153,6 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
> bond_do_fail_over_mac(bond, new_active,
> old_active);
>
>- if (netif_running(bond->dev)) {
>- bond->send_grat_arp = bond->params.num_grat_arp;
>- bond_send_gratuitous_arp(bond);
>-
>- bond->send_unsol_na = bond->params.num_unsol_na;
>- bond_send_unsolicited_na(bond);
>- }
>-
> write_unlock_bh(&bond->curr_slave_lock);
> read_unlock(&bond->lock);
>
>@@ -2578,18 +2563,6 @@ void bond_mii_monitor(struct work_struct *work)
> if (bond->slave_cnt == 0)
> goto re_arm;
>
>- if (bond->send_grat_arp) {
>- read_lock(&bond->curr_slave_lock);
>- bond_send_gratuitous_arp(bond);
>- read_unlock(&bond->curr_slave_lock);
>- }
>-
>- if (bond->send_unsol_na) {
>- read_lock(&bond->curr_slave_lock);
>- bond_send_unsolicited_na(bond);
>- read_unlock(&bond->curr_slave_lock);
>- }
>-
> if (bond_miimon_inspect(bond)) {
> read_unlock(&bond->lock);
> rtnl_lock();
>@@ -2751,44 +2724,6 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
> }
> }
>
>-/*
>- * Kick out a gratuitous ARP for an IP on the bonding master plus one
>- * for each VLAN above us.
>- *
>- * Caller must hold curr_slave_lock for read or better
>- */
>-static void bond_send_gratuitous_arp(struct bonding *bond)
>-{
>- struct slave *slave = bond->curr_active_slave;
>- struct vlan_entry *vlan;
>- struct net_device *vlan_dev;
>-
>- pr_debug("bond_send_grat_arp: bond %s slave %s\n",
>- bond->dev->name, slave ? slave->dev->name : "NULL");
>-
>- if (!slave || !bond->send_grat_arp ||
>- test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))
>- return;
>-
>- bond->send_grat_arp--;
>-
>- if (bond->master_ip) {
>- bond_arp_send(slave->dev, ARPOP_REPLY, bond->master_ip,
>- bond->master_ip, 0);
>- }
>-
>- if (!bond->vlgrp)
>- return;
>-
>- list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
>- vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id);
>- if (vlan->vlan_ip) {
>- bond_arp_send(slave->dev, ARPOP_REPLY, vlan->vlan_ip,
>- vlan->vlan_ip, vlan->vlan_id);
>- }
>- }
>-}
>-
> static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 sip, __be32 tip)
> {
> int i;
>@@ -3255,18 +3190,6 @@ void bond_activebackup_arp_mon(struct work_struct *work)
> if (bond->slave_cnt == 0)
> goto re_arm;
>
>- if (bond->send_grat_arp) {
>- read_lock(&bond->curr_slave_lock);
>- bond_send_gratuitous_arp(bond);
>- read_unlock(&bond->curr_slave_lock);
>- }
>-
>- if (bond->send_unsol_na) {
>- read_lock(&bond->curr_slave_lock);
>- bond_send_unsolicited_na(bond);
>- read_unlock(&bond->curr_slave_lock);
>- }
>-
> if (bond_ab_arp_inspect(bond, delta_in_ticks)) {
> read_unlock(&bond->lock);
> rtnl_lock();
>@@ -3645,9 +3568,6 @@ static int bond_close(struct net_device *bond_dev)
>
> write_lock_bh(&bond->lock);
>
>- bond->send_grat_arp = 0;
>- bond->send_unsol_na = 0;
>-
> /* signal timers not to re-arm */
> bond->kill_timers = 1;
>
>@@ -4724,18 +4644,6 @@ static int bond_check_params(struct bond_params *params)
> use_carrier = 1;
> }
>
>- if (num_grat_arp < 0 || num_grat_arp > 255) {
>- pr_warning("Warning: num_grat_arp (%d) not in range 0-255 so it was reset to 1\n",
>- num_grat_arp);
>- num_grat_arp = 1;
>- }
>-
>- if (num_unsol_na < 0 || num_unsol_na > 255) {
>- pr_warning("Warning: num_unsol_na (%d) not in range 0-255 so it was reset to 1\n",
>- num_unsol_na);
>- num_unsol_na = 1;
>- }
>-
> /* reset values for 802.3ad */
> if (bond_mode == BOND_MODE_8023AD) {
> if (!miimon) {
>@@ -4925,8 +4833,6 @@ static int bond_check_params(struct bond_params *params)
> params->mode = bond_mode;
> params->xmit_policy = xmit_hashtype;
> params->miimon = miimon;
>- params->num_grat_arp = num_grat_arp;
>- params->num_unsol_na = num_unsol_na;
> params->arp_interval = arp_interval;
> params->arp_validate = arp_validate_value;
> params->updelay = updelay;
>@@ -5121,7 +5027,6 @@ static int __init bonding_init(void)
>
> register_netdevice_notifier(&bond_netdev_notifier);
> register_inetaddr_notifier(&bond_inetaddr_notifier);
>- bond_register_ipv6_notifier();
> out:
> return res;
> err:
>@@ -5136,7 +5041,6 @@ static void __exit bonding_exit(void)
> {
> unregister_netdevice_notifier(&bond_netdev_notifier);
> unregister_inetaddr_notifier(&bond_inetaddr_notifier);
>- bond_unregister_ipv6_notifier();
>
> bond_destroy_sysfs();
> bond_destroy_debugfs();
>diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
>index de87aea..259ff32 100644
>--- a/drivers/net/bonding/bond_sysfs.c
>+++ b/drivers/net/bonding/bond_sysfs.c
>@@ -874,84 +874,6 @@ static DEVICE_ATTR(ad_select, S_IRUGO | S_IWUSR,
> bonding_show_ad_select, bonding_store_ad_select);
>
> /*
>- * Show and set the number of grat ARP to send after a failover event.
>- */
>-static ssize_t bonding_show_n_grat_arp(struct device *d,
>- struct device_attribute *attr,
>- char *buf)
>-{
>- struct bonding *bond = to_bond(d);
>-
>- return sprintf(buf, "%d\n", bond->params.num_grat_arp);
>-}
>-
>-static ssize_t bonding_store_n_grat_arp(struct device *d,
>- struct device_attribute *attr,
>- const char *buf, size_t count)
>-{
>- int new_value, ret = count;
>- struct bonding *bond = to_bond(d);
>-
>- if (sscanf(buf, "%d", &new_value) != 1) {
>- pr_err("%s: no num_grat_arp value specified.\n",
>- bond->dev->name);
>- ret = -EINVAL;
>- goto out;
>- }
>- if (new_value < 0 || new_value > 255) {
>- pr_err("%s: Invalid num_grat_arp value %d not in range 0-255; rejected.\n",
>- bond->dev->name, new_value);
>- ret = -EINVAL;
>- goto out;
>- } else {
>- bond->params.num_grat_arp = new_value;
>- }
>-out:
>- return ret;
>-}
>-static DEVICE_ATTR(num_grat_arp, S_IRUGO | S_IWUSR,
>- bonding_show_n_grat_arp, bonding_store_n_grat_arp);
>-
>-/*
>- * Show and set the number of unsolicited NA's to send after a failover event.
>- */
>-static ssize_t bonding_show_n_unsol_na(struct device *d,
>- struct device_attribute *attr,
>- char *buf)
>-{
>- struct bonding *bond = to_bond(d);
>-
>- return sprintf(buf, "%d\n", bond->params.num_unsol_na);
>-}
>-
>-static ssize_t bonding_store_n_unsol_na(struct device *d,
>- struct device_attribute *attr,
>- const char *buf, size_t count)
>-{
>- int new_value, ret = count;
>- struct bonding *bond = to_bond(d);
>-
>- if (sscanf(buf, "%d", &new_value) != 1) {
>- pr_err("%s: no num_unsol_na value specified.\n",
>- bond->dev->name);
>- ret = -EINVAL;
>- goto out;
>- }
>-
>- if (new_value < 0 || new_value > 255) {
>- pr_err("%s: Invalid num_unsol_na value %d not in range 0-255; rejected.\n",
>- bond->dev->name, new_value);
>- ret = -EINVAL;
>- goto out;
>- } else
>- bond->params.num_unsol_na = new_value;
>-out:
>- return ret;
>-}
>-static DEVICE_ATTR(num_unsol_na, S_IRUGO | S_IWUSR,
>- bonding_show_n_unsol_na, bonding_store_n_unsol_na);
>-
>-/*
> * Show and set the MII monitor interval. There are two tricky bits
> * here. First, if MII monitoring is activated, then we must disable
> * ARP monitoring. Second, if the timer isn't running, we must
>@@ -1650,8 +1572,6 @@ static struct attribute *per_bond_attrs[] = {
> &dev_attr_lacp_rate.attr,
> &dev_attr_ad_select.attr,
> &dev_attr_xmit_hash_policy.attr,
>- &dev_attr_num_grat_arp.attr,
>- &dev_attr_num_unsol_na.attr,
> &dev_attr_miimon.attr,
> &dev_attr_primary.attr,
> &dev_attr_primary_reselect.attr,
>diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
>index 90736cb..77180b1 100644
>--- a/drivers/net/bonding/bonding.h
>+++ b/drivers/net/bonding/bonding.h
>@@ -149,8 +149,6 @@ struct bond_params {
> int mode;
> int xmit_policy;
> int miimon;
>- int num_grat_arp;
>- int num_unsol_na;
> int arp_interval;
> int arp_validate;
> int use_carrier;
>@@ -178,9 +176,6 @@ struct vlan_entry {
> struct list_head vlan_list;
> __be32 vlan_ip;
> unsigned short vlan_id;
>-#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
>- struct in6_addr vlan_ipv6;
>-#endif
> };
>
> struct slave {
>@@ -234,8 +229,6 @@ struct bonding {
> rwlock_t lock;
> rwlock_t curr_slave_lock;
> s8 kill_timers;
>- s8 send_grat_arp;
>- s8 send_unsol_na;
> s8 setup_by_slave;
> s8 igmp_retrans;
> #ifdef CONFIG_PROC_FS
>@@ -260,9 +253,6 @@ struct bonding {
> struct delayed_work alb_work;
> struct delayed_work ad_work;
> struct delayed_work mcast_work;
>-#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
>- struct in6_addr master_ipv6;
>-#endif
> #ifdef CONFIG_DEBUG_FS
> /* debugging suport via debugfs */
> struct dentry *debug_dir;
>@@ -459,23 +449,4 @@ extern const struct bond_parm_tbl fail_over_mac_tbl[];
> extern const struct bond_parm_tbl pri_reselect_tbl[];
> extern struct bond_parm_tbl ad_select_tbl[];
>
>-#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
>-void bond_send_unsolicited_na(struct bonding *bond);
>-void bond_register_ipv6_notifier(void);
>-void bond_unregister_ipv6_notifier(void);
>-#else
>-static inline void bond_send_unsolicited_na(struct bonding *bond)
>-{
>- return;
>-}
>-static inline void bond_register_ipv6_notifier(void)
>-{
>- return;
>-}
>-static inline void bond_unregister_ipv6_notifier(void)
>-{
>- return;
>-}
>-#endif
>-
> #endif /* _LINUX_BONDING_H */
>diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
>index b2ff70f..969e700 100644
>--- a/net/8021q/vlan.c
>+++ b/net/8021q/vlan.c
>@@ -501,13 +501,14 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
> return NOTIFY_BAD;
>
> case NETDEV_NOTIFY_PEERS:
>+ case NETDEV_BONDING_FAILOVER:
> /* Propagate to vlan devices */
> for (i = 0; i < VLAN_N_VID; i++) {
> vlandev = vlan_group_get_device(grp, i);
> if (!vlandev)
> continue;
>
>- call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, vlandev);
>+ call_netdevice_notifiers(event, vlandev);
> }
> break;
> }
>diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
>index 5345b0b..acf553f 100644
>--- a/net/ipv4/devinet.c
>+++ b/net/ipv4/devinet.c
>@@ -1203,6 +1203,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
> break;
> /* fall through */
> case NETDEV_NOTIFY_PEERS:
>+ case NETDEV_BONDING_FAILOVER:
> /* Send gratuitous ARP to notify of link change */
> inetdev_send_gratuitous_arp(dev, in_dev);
> break;
>diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
>index a51fa74c..6f7d491 100644
>--- a/net/ipv6/ndisc.c
>+++ b/net/ipv6/ndisc.c
>@@ -1746,6 +1746,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event,
> fib6_run_gc(~0UL, net);
> break;
> case NETDEV_NOTIFY_PEERS:
>+ case NETDEV_BONDING_FAILOVER:
> ndisc_send_unsol_na(dev);
> break;
> default:
>--
>1.7.4
>
>
>--
>Ben Hutchings, Senior Software Engineer, Solarflare
>Not speaking for my employer; that's the marketing department's job.
>They asked us to note that Solarflare product names are trademarked.
>
---
-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
^ permalink raw reply
* Re: [PATCH 1/3] irq: Add registered affinity guidance infrastructure
From: Thomas Gleixner @ 2011-04-16 0:22 UTC (permalink / raw)
To: Neil Horman
Cc: netdev, davem, nhorman, Dimitris Michailidis, David Howells,
Eric Dumazet, Tom Herbert
In-Reply-To: <1302898677-3833-2-git-send-email-nhorman@tuxdriver.com>
On Fri, 15 Apr 2011, Neil Horman wrote:
> From: nhorman <nhorman@devel2.think-freely.org>
>
> This patch adds the needed data to the irq_desc struct, as well as the needed
> API calls to allow the requester of an irq to register a handler function to
> determine the affinity_hint of that irq when queried from user space.
This changelog simply sucks. It does not explain the rationale for
this churn at all.
Which problem is it solving?
Why are the current interfaces not sufficient?
....
> +#ifdef CONFIG_AFFINITY_UPDATE
> +extern int setup_affinity_data(int irq, irq_affinity_init_t, void *);
yuck, irq_affinity_init_t ???
> +#ifdef CONFIG_AFFINITY_UPDATE
> +static inline int __must_check
> +request_affinity_irq(unsigned int irq, irq_handler_t handler,
> + irq_handler_t thread_fn,
> + unsigned long flags, const char *name, void *dev,
> + irq_affinity_init_t af_init, void *af_priv)
So next time we make a wrapper around request_affinity_irq() which
takes another 3 arguments?
> +{
> + int rc;
> +
> + rc = request_threaded_irq(irq, handler, thread_fn, flags, name, dev);
> + if (rc)
> + goto out;
Brilliant use case for a goto. _NOT_
> + if (af_init)
> + rc = setup_affinity_data(irq, af_init, af_priv);
> + if (rc)
> + free_irq(irq, dev);
> +
> +out:
> + return rc;
> +}
> +#else
> +#define request_affinity_irq(irq, hnd, tfn, flg, nm, dev, init, priv) \
> + request_threaded_irq(irq, hnd, NULL, flg, nm, dev)
Oh nice. tfn becomes magically NULL if that magic CONFIG switch is not
set.
> struct irq_desc;
> struct irq_data;
> +struct affin_data {
Gah. Do you think that I went to major pain to consolidate the irq
namespace just to accecpt another random one?
Also that's completely undocumented. Hint:
# grep -C1 "/\*\*" $this_file
> + void *priv;
> + char *affinity_alg;
const perhaps ?
> + void (*affin_update)(int irq, struct affin_data *ad);
> + void (*affin_cleanup)(int irq, struct affin_data *ad);
> +};
> +
> +typedef int (*irq_affinity_init_t)(int, struct affin_data*, void *);
Whee. Why do you want a typedef for that ?
> --- a/kernel/irq/Kconfig
> +++ b/kernel/irq/Kconfig
> @@ -51,6 +51,17 @@ config IRQ_PREFLOW_FASTEOI
> config IRQ_FORCED_THREADING
> bool
>
> +config AFFINITY_UPDATE
> + bool "Support irq affinity direction"
> + depends on GENERIC_HARDIRQS
Right. We need a dependency for somthing which is inside of a guarded
section which selects GENERIC_HARDIRQS.
> + ---help---
> +
> + Affinity updating adds the ability for requestors of irqs to
> + register affinity update methods against the irq in question
> + in so doing the requestor can be informed every time user space
> + queries an irq for its optimal affinity, giving the requstor the
> + chance to tell user space where the irq can be optimally handled
-ENOPARSE. I still do not understand what you are trying to solve.
> @@ -64,6 +75,5 @@ config SPARSE_IRQ
> out the interrupt descriptors in a more NUMA-friendly way. )
>
> If you don't know what to do here, say N.
> -
Unrelated
> endmenu
> endif
> diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c
> index acd599a..257ea4d 100644
> --- a/kernel/irq/manage.c
> +++ b/kernel/irq/manage.c
> @@ -1159,6 +1159,17 @@ static struct irqaction *__free_irq(unsigned int irq, void *dev_id)
>
> unregister_handler_proc(irq, action);
>
> +#ifdef CONFIG_AFFINITY_UPDATE
> + /*
> + * Have to do this after we unregister proc accessors
> + */
> + if (desc->af_data) {
> + if (desc->af_data->affin_cleanup)
> + desc->af_data->affin_cleanup(irq, desc->af_data);
> + kfree(desc->af_data);
> + desc->af_data = NULL;
> + }
> +#endif
Grr. Aside of the fact, that I think that whole thing is silly and
overengineered, please move this out of line and keep your fricking
#ifdef mess out of the main code.
> /* Make sure it's not being used on another CPU: */
> synchronize_irq(irq);
>
> @@ -1345,6 +1356,34 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler,
> }
> EXPORT_SYMBOL(request_threaded_irq);
>
> +#ifdef CONFIG_AFFINITY_UPDATE
> +int setup_affinity_data(int irq, irq_affinity_init_t af_init, void *af_priv)
That interface is completely wrong for various reasons:
1) Namespace violation: irq_....
2) This want's to be separated into a allocation and a setter function
> +{
> + struct affin_data *data;
> + struct irq_desc *desc;
> + int rc;
> +
> + desc = irq_to_desc(irq);
> + if (!desc)
> + return -ENOENT;
> +
> + data = kzalloc(sizeof(struct affin_data), GFP_KERNEL);
> + if (!data)
> + return -ENOMEM;
> +
> + rc = af_init(irq, data, af_priv);
> + if (rc) {
> + kfree(data);
> + return rc;
> + }
> +
> + desc->af_data = data;
Right, we do this unlocked of course.
> + return 0;
> +}
> +EXPORT_SYMBOL(setup_affinity_data);
No. That want's to be EXPORT_SYMBOL_GPL if at all.
> --- a/kernel/irq/proc.c
> +++ b/kernel/irq/proc.c
> @@ -42,6 +42,11 @@ static int irq_affinity_hint_proc_show(struct seq_file *m, void *v)
> if (!zalloc_cpumask_var(&mask, GFP_KERNEL))
> return -ENOMEM;
>
> +#ifdef CONFIG_AFFINITY_UPDATE
> + if (desc->af_data && desc->af_data->affin_update)
> + desc->af_data->affin_update((long)m->private, desc->af_data);
> +#endif
> +
Yikes. How the hell is this related to the changelog and to the scope
of this function?
This function shows the hint we agreed on and nothing else. We do not
call magic crap via proc.
Locking is not your favourite topic, right ?
> raw_spin_lock_irqsave(&desc->lock, flags);
> if (desc->affinity_hint)
> cpumask_copy(mask, desc->affinity_hint);
> @@ -54,6 +59,19 @@ static int irq_affinity_hint_proc_show(struct seq_file *m, void *v)
> return 0;
> }
>
> +static int irq_affinity_alg_proc_show(struct seq_file *m, void *v)
> +{
> + char *alg = "none";
> +#ifdef CONFIG_AFFINITY_UPDATE
> + struct irq_desc *desc = irq_to_desc((long)m->private);
> +
> + if (desc->af_data->affinity_alg)
> + alg = desc->af_data->affinity_alg;
> +#endif
Nice, we add the policy concept to the kernel another time. No, we
don't want policies in the kernel except there is some reasonable
explanation.
Thanks,
tglx
^ permalink raw reply
* Steps to integrate new 40G Network driver to the kernel tree
From: Joyce Yu - System Software @ 2011-04-15 23:51 UTC (permalink / raw)
To: netdev
Hello,
We have a new 40G network Linux driver. What are the steps to integrate
it to the kernel tree?
Thanks,
Joyce
^ permalink raw reply
* [PATCH net-next-2.6 3/3] bonding,ipv4,ipv6,vlan: Handle NETDEV_BONDING_FAILOVER like NETDEV_NOTIFY_PEERS
From: Ben Hutchings @ 2011-04-15 23:47 UTC (permalink / raw)
To: David Miller, Jay Vosburgh, Andy Gospodarek, Patrick McHardy; +Cc: netdev
It is undesirable for the bonding driver to be poking into higher
level protocols, and notifiers provide a way to avoid that. This does
mean removing the ability to configure reptitition of gratuitous ARPs
and unsolicited NAs.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
---
drivers/net/bonding/Makefile | 3 -
drivers/net/bonding/bond_ipv6.c | 225 --------------------------------------
drivers/net/bonding/bond_main.c | 96 ----------------
drivers/net/bonding/bond_sysfs.c | 80 --------------
drivers/net/bonding/bonding.h | 29 -----
net/8021q/vlan.c | 3 +-
net/ipv4/devinet.c | 1 +
net/ipv6/ndisc.c | 1 +
8 files changed, 4 insertions(+), 434 deletions(-)
delete mode 100644 drivers/net/bonding/bond_ipv6.c
diff --git a/drivers/net/bonding/Makefile b/drivers/net/bonding/Makefile
index 3c5c014..4c21bf6 100644
--- a/drivers/net/bonding/Makefile
+++ b/drivers/net/bonding/Makefile
@@ -9,6 +9,3 @@ bonding-objs := bond_main.o bond_3ad.o bond_alb.o bond_sysfs.o bond_debugfs.o
proc-$(CONFIG_PROC_FS) += bond_procfs.o
bonding-objs += $(proc-y)
-ipv6-$(subst m,y,$(CONFIG_IPV6)) += bond_ipv6.o
-bonding-objs += $(ipv6-y)
-
diff --git a/drivers/net/bonding/bond_ipv6.c b/drivers/net/bonding/bond_ipv6.c
deleted file mode 100644
index 84fbd4e..0000000
--- a/drivers/net/bonding/bond_ipv6.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright(c) 2008 Hewlett-Packard Development Company, L.P.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- * for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * The full GNU General Public License is included in this distribution in the
- * file called LICENSE.
- *
- */
-
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
-#include <linux/types.h>
-#include <linux/if_vlan.h>
-#include <net/ipv6.h>
-#include <net/ndisc.h>
-#include <net/addrconf.h>
-#include <net/netns/generic.h>
-#include "bonding.h"
-
-/*
- * Assign bond->master_ipv6 to the next IPv6 address in the list, or
- * zero it out if there are none.
- */
-static void bond_glean_dev_ipv6(struct net_device *dev, struct in6_addr *addr)
-{
- struct inet6_dev *idev;
-
- if (!dev)
- return;
-
- idev = in6_dev_get(dev);
- if (!idev)
- return;
-
- read_lock_bh(&idev->lock);
- if (!list_empty(&idev->addr_list)) {
- struct inet6_ifaddr *ifa
- = list_first_entry(&idev->addr_list,
- struct inet6_ifaddr, if_list);
- ipv6_addr_copy(addr, &ifa->addr);
- } else
- ipv6_addr_set(addr, 0, 0, 0, 0);
-
- read_unlock_bh(&idev->lock);
-
- in6_dev_put(idev);
-}
-
-static void bond_na_send(struct net_device *slave_dev,
- struct in6_addr *daddr,
- int router,
- unsigned short vlan_id)
-{
- struct in6_addr mcaddr;
- struct icmp6hdr icmp6h = {
- .icmp6_type = NDISC_NEIGHBOUR_ADVERTISEMENT,
- };
- struct sk_buff *skb;
-
- icmp6h.icmp6_router = router;
- icmp6h.icmp6_solicited = 0;
- icmp6h.icmp6_override = 1;
-
- addrconf_addr_solict_mult(daddr, &mcaddr);
-
- pr_debug("ipv6 na on slave %s: dest %pI6, src %pI6\n",
- slave_dev->name, &mcaddr, daddr);
-
- skb = ndisc_build_skb(slave_dev, &mcaddr, daddr, &icmp6h, daddr,
- ND_OPT_TARGET_LL_ADDR);
-
- if (!skb) {
- pr_err("NA packet allocation failed\n");
- return;
- }
-
- if (vlan_id) {
- /* The Ethernet header is not present yet, so it is
- * too early to insert a VLAN tag. Force use of an
- * out-of-line tag here and let dev_hard_start_xmit()
- * insert it if the slave hardware can't.
- */
- skb = __vlan_hwaccel_put_tag(skb, vlan_id);
- if (!skb) {
- pr_err("failed to insert VLAN tag\n");
- return;
- }
- }
-
- ndisc_send_skb(skb, slave_dev, NULL, &mcaddr, daddr, &icmp6h);
-}
-
-/*
- * Kick out an unsolicited Neighbor Advertisement for an IPv6 address on
- * the bonding master. This will help the switch learn our address
- * if in active-backup mode.
- *
- * Caller must hold curr_slave_lock for read or better
- */
-void bond_send_unsolicited_na(struct bonding *bond)
-{
- struct slave *slave = bond->curr_active_slave;
- struct vlan_entry *vlan;
- struct inet6_dev *idev;
- int is_router;
-
- pr_debug("%s: bond %s slave %s\n", bond->dev->name,
- __func__, slave ? slave->dev->name : "NULL");
-
- if (!slave || !bond->send_unsol_na ||
- test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))
- return;
-
- bond->send_unsol_na--;
-
- idev = in6_dev_get(bond->dev);
- if (!idev)
- return;
-
- is_router = !!idev->cnf.forwarding;
-
- in6_dev_put(idev);
-
- if (!ipv6_addr_any(&bond->master_ipv6))
- bond_na_send(slave->dev, &bond->master_ipv6, is_router, 0);
-
- list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
- if (!ipv6_addr_any(&vlan->vlan_ipv6)) {
- bond_na_send(slave->dev, &vlan->vlan_ipv6, is_router,
- vlan->vlan_id);
- }
- }
-}
-
-/*
- * bond_inet6addr_event: handle inet6addr notifier chain events.
- *
- * We keep track of device IPv6 addresses primarily to use as source
- * addresses in NS probes.
- *
- * We track one IPv6 for the main device (if it has one).
- */
-static int bond_inet6addr_event(struct notifier_block *this,
- unsigned long event,
- void *ptr)
-{
- struct inet6_ifaddr *ifa = ptr;
- struct net_device *vlan_dev, *event_dev = ifa->idev->dev;
- struct bonding *bond;
- struct vlan_entry *vlan;
- struct bond_net *bn = net_generic(dev_net(event_dev), bond_net_id);
-
- list_for_each_entry(bond, &bn->dev_list, bond_list) {
- if (bond->dev == event_dev) {
- switch (event) {
- case NETDEV_UP:
- if (ipv6_addr_any(&bond->master_ipv6))
- ipv6_addr_copy(&bond->master_ipv6,
- &ifa->addr);
- return NOTIFY_OK;
- case NETDEV_DOWN:
- if (ipv6_addr_equal(&bond->master_ipv6,
- &ifa->addr))
- bond_glean_dev_ipv6(bond->dev,
- &bond->master_ipv6);
- return NOTIFY_OK;
- default:
- return NOTIFY_DONE;
- }
- }
-
- list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
- if (!bond->vlgrp)
- continue;
- vlan_dev = vlan_group_get_device(bond->vlgrp,
- vlan->vlan_id);
- if (vlan_dev == event_dev) {
- switch (event) {
- case NETDEV_UP:
- if (ipv6_addr_any(&vlan->vlan_ipv6))
- ipv6_addr_copy(&vlan->vlan_ipv6,
- &ifa->addr);
- return NOTIFY_OK;
- case NETDEV_DOWN:
- if (ipv6_addr_equal(&vlan->vlan_ipv6,
- &ifa->addr))
- bond_glean_dev_ipv6(vlan_dev,
- &vlan->vlan_ipv6);
- return NOTIFY_OK;
- default:
- return NOTIFY_DONE;
- }
- }
- }
- }
- return NOTIFY_DONE;
-}
-
-static struct notifier_block bond_inet6addr_notifier = {
- .notifier_call = bond_inet6addr_event,
-};
-
-void bond_register_ipv6_notifier(void)
-{
- register_inet6addr_notifier(&bond_inet6addr_notifier);
-}
-
-void bond_unregister_ipv6_notifier(void)
-{
- unregister_inet6addr_notifier(&bond_inet6addr_notifier);
-}
-
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index b51e021..5cd4766 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -89,8 +89,6 @@
static int max_bonds = BOND_DEFAULT_MAX_BONDS;
static int tx_queues = BOND_DEFAULT_TX_QUEUES;
-static int num_grat_arp = 1;
-static int num_unsol_na = 1;
static int miimon = BOND_LINK_MON_INTERV;
static int updelay;
static int downdelay;
@@ -113,10 +111,6 @@ module_param(max_bonds, int, 0);
MODULE_PARM_DESC(max_bonds, "Max number of bonded devices");
module_param(tx_queues, int, 0);
MODULE_PARM_DESC(tx_queues, "Max number of transmit queues (default = 16)");
-module_param(num_grat_arp, int, 0644);
-MODULE_PARM_DESC(num_grat_arp, "Number of gratuitous ARP packets to send on failover event");
-module_param(num_unsol_na, int, 0644);
-MODULE_PARM_DESC(num_unsol_na, "Number of unsolicited IPv6 Neighbor Advertisements packets to send on failover event");
module_param(miimon, int, 0);
MODULE_PARM_DESC(miimon, "Link check interval in milliseconds");
module_param(updelay, int, 0);
@@ -234,7 +228,6 @@ struct bond_parm_tbl ad_select_tbl[] = {
/*-------------------------- Forward declarations ---------------------------*/
-static void bond_send_gratuitous_arp(struct bonding *bond);
static int bond_init(struct net_device *bond_dev);
static void bond_uninit(struct net_device *bond_dev);
@@ -1160,14 +1153,6 @@ void bond_change_active_slave(struct bonding *bond, struct slave *new_active)
bond_do_fail_over_mac(bond, new_active,
old_active);
- if (netif_running(bond->dev)) {
- bond->send_grat_arp = bond->params.num_grat_arp;
- bond_send_gratuitous_arp(bond);
-
- bond->send_unsol_na = bond->params.num_unsol_na;
- bond_send_unsolicited_na(bond);
- }
-
write_unlock_bh(&bond->curr_slave_lock);
read_unlock(&bond->lock);
@@ -2578,18 +2563,6 @@ void bond_mii_monitor(struct work_struct *work)
if (bond->slave_cnt == 0)
goto re_arm;
- if (bond->send_grat_arp) {
- read_lock(&bond->curr_slave_lock);
- bond_send_gratuitous_arp(bond);
- read_unlock(&bond->curr_slave_lock);
- }
-
- if (bond->send_unsol_na) {
- read_lock(&bond->curr_slave_lock);
- bond_send_unsolicited_na(bond);
- read_unlock(&bond->curr_slave_lock);
- }
-
if (bond_miimon_inspect(bond)) {
read_unlock(&bond->lock);
rtnl_lock();
@@ -2751,44 +2724,6 @@ static void bond_arp_send_all(struct bonding *bond, struct slave *slave)
}
}
-/*
- * Kick out a gratuitous ARP for an IP on the bonding master plus one
- * for each VLAN above us.
- *
- * Caller must hold curr_slave_lock for read or better
- */
-static void bond_send_gratuitous_arp(struct bonding *bond)
-{
- struct slave *slave = bond->curr_active_slave;
- struct vlan_entry *vlan;
- struct net_device *vlan_dev;
-
- pr_debug("bond_send_grat_arp: bond %s slave %s\n",
- bond->dev->name, slave ? slave->dev->name : "NULL");
-
- if (!slave || !bond->send_grat_arp ||
- test_bit(__LINK_STATE_LINKWATCH_PENDING, &slave->dev->state))
- return;
-
- bond->send_grat_arp--;
-
- if (bond->master_ip) {
- bond_arp_send(slave->dev, ARPOP_REPLY, bond->master_ip,
- bond->master_ip, 0);
- }
-
- if (!bond->vlgrp)
- return;
-
- list_for_each_entry(vlan, &bond->vlan_list, vlan_list) {
- vlan_dev = vlan_group_get_device(bond->vlgrp, vlan->vlan_id);
- if (vlan->vlan_ip) {
- bond_arp_send(slave->dev, ARPOP_REPLY, vlan->vlan_ip,
- vlan->vlan_ip, vlan->vlan_id);
- }
- }
-}
-
static void bond_validate_arp(struct bonding *bond, struct slave *slave, __be32 sip, __be32 tip)
{
int i;
@@ -3255,18 +3190,6 @@ void bond_activebackup_arp_mon(struct work_struct *work)
if (bond->slave_cnt == 0)
goto re_arm;
- if (bond->send_grat_arp) {
- read_lock(&bond->curr_slave_lock);
- bond_send_gratuitous_arp(bond);
- read_unlock(&bond->curr_slave_lock);
- }
-
- if (bond->send_unsol_na) {
- read_lock(&bond->curr_slave_lock);
- bond_send_unsolicited_na(bond);
- read_unlock(&bond->curr_slave_lock);
- }
-
if (bond_ab_arp_inspect(bond, delta_in_ticks)) {
read_unlock(&bond->lock);
rtnl_lock();
@@ -3645,9 +3568,6 @@ static int bond_close(struct net_device *bond_dev)
write_lock_bh(&bond->lock);
- bond->send_grat_arp = 0;
- bond->send_unsol_na = 0;
-
/* signal timers not to re-arm */
bond->kill_timers = 1;
@@ -4724,18 +4644,6 @@ static int bond_check_params(struct bond_params *params)
use_carrier = 1;
}
- if (num_grat_arp < 0 || num_grat_arp > 255) {
- pr_warning("Warning: num_grat_arp (%d) not in range 0-255 so it was reset to 1\n",
- num_grat_arp);
- num_grat_arp = 1;
- }
-
- if (num_unsol_na < 0 || num_unsol_na > 255) {
- pr_warning("Warning: num_unsol_na (%d) not in range 0-255 so it was reset to 1\n",
- num_unsol_na);
- num_unsol_na = 1;
- }
-
/* reset values for 802.3ad */
if (bond_mode == BOND_MODE_8023AD) {
if (!miimon) {
@@ -4925,8 +4833,6 @@ static int bond_check_params(struct bond_params *params)
params->mode = bond_mode;
params->xmit_policy = xmit_hashtype;
params->miimon = miimon;
- params->num_grat_arp = num_grat_arp;
- params->num_unsol_na = num_unsol_na;
params->arp_interval = arp_interval;
params->arp_validate = arp_validate_value;
params->updelay = updelay;
@@ -5121,7 +5027,6 @@ static int __init bonding_init(void)
register_netdevice_notifier(&bond_netdev_notifier);
register_inetaddr_notifier(&bond_inetaddr_notifier);
- bond_register_ipv6_notifier();
out:
return res;
err:
@@ -5136,7 +5041,6 @@ static void __exit bonding_exit(void)
{
unregister_netdevice_notifier(&bond_netdev_notifier);
unregister_inetaddr_notifier(&bond_inetaddr_notifier);
- bond_unregister_ipv6_notifier();
bond_destroy_sysfs();
bond_destroy_debugfs();
diff --git a/drivers/net/bonding/bond_sysfs.c b/drivers/net/bonding/bond_sysfs.c
index de87aea..259ff32 100644
--- a/drivers/net/bonding/bond_sysfs.c
+++ b/drivers/net/bonding/bond_sysfs.c
@@ -874,84 +874,6 @@ static DEVICE_ATTR(ad_select, S_IRUGO | S_IWUSR,
bonding_show_ad_select, bonding_store_ad_select);
/*
- * Show and set the number of grat ARP to send after a failover event.
- */
-static ssize_t bonding_show_n_grat_arp(struct device *d,
- struct device_attribute *attr,
- char *buf)
-{
- struct bonding *bond = to_bond(d);
-
- return sprintf(buf, "%d\n", bond->params.num_grat_arp);
-}
-
-static ssize_t bonding_store_n_grat_arp(struct device *d,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- int new_value, ret = count;
- struct bonding *bond = to_bond(d);
-
- if (sscanf(buf, "%d", &new_value) != 1) {
- pr_err("%s: no num_grat_arp value specified.\n",
- bond->dev->name);
- ret = -EINVAL;
- goto out;
- }
- if (new_value < 0 || new_value > 255) {
- pr_err("%s: Invalid num_grat_arp value %d not in range 0-255; rejected.\n",
- bond->dev->name, new_value);
- ret = -EINVAL;
- goto out;
- } else {
- bond->params.num_grat_arp = new_value;
- }
-out:
- return ret;
-}
-static DEVICE_ATTR(num_grat_arp, S_IRUGO | S_IWUSR,
- bonding_show_n_grat_arp, bonding_store_n_grat_arp);
-
-/*
- * Show and set the number of unsolicited NA's to send after a failover event.
- */
-static ssize_t bonding_show_n_unsol_na(struct device *d,
- struct device_attribute *attr,
- char *buf)
-{
- struct bonding *bond = to_bond(d);
-
- return sprintf(buf, "%d\n", bond->params.num_unsol_na);
-}
-
-static ssize_t bonding_store_n_unsol_na(struct device *d,
- struct device_attribute *attr,
- const char *buf, size_t count)
-{
- int new_value, ret = count;
- struct bonding *bond = to_bond(d);
-
- if (sscanf(buf, "%d", &new_value) != 1) {
- pr_err("%s: no num_unsol_na value specified.\n",
- bond->dev->name);
- ret = -EINVAL;
- goto out;
- }
-
- if (new_value < 0 || new_value > 255) {
- pr_err("%s: Invalid num_unsol_na value %d not in range 0-255; rejected.\n",
- bond->dev->name, new_value);
- ret = -EINVAL;
- goto out;
- } else
- bond->params.num_unsol_na = new_value;
-out:
- return ret;
-}
-static DEVICE_ATTR(num_unsol_na, S_IRUGO | S_IWUSR,
- bonding_show_n_unsol_na, bonding_store_n_unsol_na);
-
-/*
* Show and set the MII monitor interval. There are two tricky bits
* here. First, if MII monitoring is activated, then we must disable
* ARP monitoring. Second, if the timer isn't running, we must
@@ -1650,8 +1572,6 @@ static struct attribute *per_bond_attrs[] = {
&dev_attr_lacp_rate.attr,
&dev_attr_ad_select.attr,
&dev_attr_xmit_hash_policy.attr,
- &dev_attr_num_grat_arp.attr,
- &dev_attr_num_unsol_na.attr,
&dev_attr_miimon.attr,
&dev_attr_primary.attr,
&dev_attr_primary_reselect.attr,
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index 90736cb..77180b1 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -149,8 +149,6 @@ struct bond_params {
int mode;
int xmit_policy;
int miimon;
- int num_grat_arp;
- int num_unsol_na;
int arp_interval;
int arp_validate;
int use_carrier;
@@ -178,9 +176,6 @@ struct vlan_entry {
struct list_head vlan_list;
__be32 vlan_ip;
unsigned short vlan_id;
-#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
- struct in6_addr vlan_ipv6;
-#endif
};
struct slave {
@@ -234,8 +229,6 @@ struct bonding {
rwlock_t lock;
rwlock_t curr_slave_lock;
s8 kill_timers;
- s8 send_grat_arp;
- s8 send_unsol_na;
s8 setup_by_slave;
s8 igmp_retrans;
#ifdef CONFIG_PROC_FS
@@ -260,9 +253,6 @@ struct bonding {
struct delayed_work alb_work;
struct delayed_work ad_work;
struct delayed_work mcast_work;
-#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
- struct in6_addr master_ipv6;
-#endif
#ifdef CONFIG_DEBUG_FS
/* debugging suport via debugfs */
struct dentry *debug_dir;
@@ -459,23 +449,4 @@ extern const struct bond_parm_tbl fail_over_mac_tbl[];
extern const struct bond_parm_tbl pri_reselect_tbl[];
extern struct bond_parm_tbl ad_select_tbl[];
-#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
-void bond_send_unsolicited_na(struct bonding *bond);
-void bond_register_ipv6_notifier(void);
-void bond_unregister_ipv6_notifier(void);
-#else
-static inline void bond_send_unsolicited_na(struct bonding *bond)
-{
- return;
-}
-static inline void bond_register_ipv6_notifier(void)
-{
- return;
-}
-static inline void bond_unregister_ipv6_notifier(void)
-{
- return;
-}
-#endif
-
#endif /* _LINUX_BONDING_H */
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index b2ff70f..969e700 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -501,13 +501,14 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
return NOTIFY_BAD;
case NETDEV_NOTIFY_PEERS:
+ case NETDEV_BONDING_FAILOVER:
/* Propagate to vlan devices */
for (i = 0; i < VLAN_N_VID; i++) {
vlandev = vlan_group_get_device(grp, i);
if (!vlandev)
continue;
- call_netdevice_notifiers(NETDEV_NOTIFY_PEERS, vlandev);
+ call_netdevice_notifiers(event, vlandev);
}
break;
}
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c
index 5345b0b..acf553f 100644
--- a/net/ipv4/devinet.c
+++ b/net/ipv4/devinet.c
@@ -1203,6 +1203,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
break;
/* fall through */
case NETDEV_NOTIFY_PEERS:
+ case NETDEV_BONDING_FAILOVER:
/* Send gratuitous ARP to notify of link change */
inetdev_send_gratuitous_arp(dev, in_dev);
break;
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index a51fa74c..6f7d491 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -1746,6 +1746,7 @@ static int ndisc_netdev_event(struct notifier_block *this, unsigned long event,
fib6_run_gc(~0UL, net);
break;
case NETDEV_NOTIFY_PEERS:
+ case NETDEV_BONDING_FAILOVER:
ndisc_send_unsol_na(dev);
break;
default:
--
1.7.4
--
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox