2005-04-16 16:20:36 -06:00
|
|
|
/*
|
|
|
|
* Bond several ethernet interfaces into a Cisco, running 'Etherchannel'.
|
|
|
|
*
|
|
|
|
* Portions are (c) Copyright 1995 Simon "Guru Aleph-Null" Janes
|
|
|
|
* NCM: Network and Communications Management, Inc.
|
|
|
|
*
|
|
|
|
* BUT, I'm the one who modified it for ethernet, so:
|
|
|
|
* (c) Copyright 1999, Thomas Davis, tadavis@lbl.gov
|
|
|
|
*
|
|
|
|
* This software may be used and distributed according to the terms
|
|
|
|
* of the GNU Public License, incorporated herein by reference.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LINUX_BONDING_H
|
|
|
|
#define _LINUX_BONDING_H
|
|
|
|
|
|
|
|
#include <linux/timer.h>
|
|
|
|
#include <linux/proc_fs.h>
|
|
|
|
#include <linux/if_bonding.h>
|
2010-10-13 10:01:50 -06:00
|
|
|
#include <linux/cpumask.h>
|
bonding: send IPv6 neighbor advertisement on failover
This patch adds better IPv6 failover support for bonding devices,
especially when in active-backup mode and there are only IPv6 addresses
configured, as reported by Alex Sidorenko.
- Creates a new file, net/drivers/bonding/bond_ipv6.c, for the
IPv6-specific routines. Both regular bonds and VLANs over bonds
are supported.
- Adds a new tunable, num_unsol_na, to limit the number of unsolicited
IPv6 Neighbor Advertisements that are sent on a failover event.
Default is 1.
- Creates two new IPv6 neighbor discovery functions:
ndisc_build_skb()
ndisc_send_skb()
These were required to support VLANs since we have to be able to
add the VLAN id to the skb since ndisc_send_na() and friends
shouldn't be asked to do this. These two routines are basically
__ndisc_send() split into two pieces, in a slightly different order.
- Updates Documentation/networking/bonding.txt and bumps the rev of bond
support to 3.4.0.
On failover, this new code will generate one packet:
- An unsolicited IPv6 Neighbor Advertisement, which helps the switch
learn that the address has moved to the new slave.
Testing has shown that sending just the NA results in pretty good
behavior when in active-back mode, I saw no lost ping packets for example.
Signed-off-by: Brian Haley <brian.haley@hp.com>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-11-04 18:51:14 -07:00
|
|
|
#include <linux/in6.h>
|
2011-02-17 16:43:32 -07:00
|
|
|
#include <linux/netpoll.h>
|
2005-04-16 16:20:36 -06:00
|
|
|
#include "bond_3ad.h"
|
|
|
|
#include "bond_alb.h"
|
|
|
|
|
2010-06-02 02:40:18 -06:00
|
|
|
#define DRV_VERSION "3.7.0"
|
|
|
|
#define DRV_RELDATE "June 2, 2010"
|
2005-04-16 16:20:36 -06:00
|
|
|
#define DRV_NAME "bonding"
|
|
|
|
#define DRV_DESCRIPTION "Ethernet Channel Bonding Driver"
|
|
|
|
|
2011-03-06 14:58:46 -07:00
|
|
|
#define bond_version DRV_DESCRIPTION ": v" DRV_VERSION " (" DRV_RELDATE ")\n"
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
#define BOND_MAX_ARP_TARGETS 16
|
|
|
|
|
|
|
|
#define IS_UP(dev) \
|
|
|
|
((((dev)->flags & IFF_UP) == IFF_UP) && \
|
|
|
|
netif_running(dev) && \
|
|
|
|
netif_carrier_ok(dev))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Checks whether bond is ready for transmit.
|
|
|
|
*
|
|
|
|
* Caller must hold bond->lock
|
|
|
|
*/
|
|
|
|
#define BOND_IS_OK(bond) \
|
|
|
|
(((bond)->dev->flags & IFF_UP) && \
|
|
|
|
netif_running((bond)->dev) && \
|
|
|
|
((bond)->slave_cnt > 0))
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Checks whether slave is ready for transmit.
|
|
|
|
*/
|
|
|
|
#define SLAVE_IS_OK(slave) \
|
|
|
|
(((slave)->dev->flags & IFF_UP) && \
|
|
|
|
netif_running((slave)->dev) && \
|
|
|
|
((slave)->link == BOND_LINK_UP) && \
|
2011-03-11 20:14:37 -07:00
|
|
|
bond_is_active_slave(slave))
|
2005-04-16 16:20:36 -06:00
|
|
|
|
|
|
|
|
|
|
|
#define USES_PRIMARY(mode) \
|
|
|
|
(((mode) == BOND_MODE_ACTIVEBACKUP) || \
|
|
|
|
((mode) == BOND_MODE_TLB) || \
|
|
|
|
((mode) == BOND_MODE_ALB))
|
|
|
|
|
2010-06-02 02:40:18 -06:00
|
|
|
#define TX_QUEUE_OVERRIDE(mode) \
|
|
|
|
(((mode) == BOND_MODE_ACTIVEBACKUP) || \
|
|
|
|
((mode) == BOND_MODE_ROUNDROBIN))
|
2005-04-16 16:20:36 -06:00
|
|
|
/*
|
|
|
|
* Less bad way to call ioctl from within the kernel; this needs to be
|
|
|
|
* done some other way to get the call out of interrupt context.
|
|
|
|
* Needs "ioctl" variable to be supplied by calling context.
|
|
|
|
*/
|
|
|
|
#define IOCTL(dev, arg, cmd) ({ \
|
|
|
|
int res = 0; \
|
|
|
|
mm_segment_t fs = get_fs(); \
|
|
|
|
set_fs(get_ds()); \
|
|
|
|
res = ioctl(dev, arg, cmd); \
|
|
|
|
set_fs(fs); \
|
|
|
|
res; })
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bond_for_each_slave_from - iterate the slaves list from a starting point
|
|
|
|
* @bond: the bond holding this list.
|
|
|
|
* @pos: current slave.
|
|
|
|
* @cnt: counter for max number of moves
|
|
|
|
* @start: starting point.
|
|
|
|
*
|
|
|
|
* Caller must hold bond->lock
|
|
|
|
*/
|
|
|
|
#define bond_for_each_slave_from(bond, pos, cnt, start) \
|
|
|
|
for (cnt = 0, pos = start; \
|
|
|
|
cnt < (bond)->slave_cnt; \
|
|
|
|
cnt++, pos = (pos)->next)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bond_for_each_slave_from_to - iterate the slaves list from start point to stop point
|
|
|
|
* @bond: the bond holding this list.
|
|
|
|
* @pos: current slave.
|
|
|
|
* @cnt: counter for number max of moves
|
|
|
|
* @start: start point.
|
|
|
|
* @stop: stop point.
|
|
|
|
*
|
|
|
|
* Caller must hold bond->lock
|
|
|
|
*/
|
|
|
|
#define bond_for_each_slave_from_to(bond, pos, cnt, start, stop) \
|
|
|
|
for (cnt = 0, pos = start; \
|
|
|
|
((cnt < (bond)->slave_cnt) && (pos != (stop)->next)); \
|
|
|
|
cnt++, pos = (pos)->next)
|
|
|
|
|
|
|
|
/**
|
|
|
|
* bond_for_each_slave - iterate the slaves list from head
|
|
|
|
* @bond: the bond holding this list.
|
|
|
|
* @pos: current slave.
|
|
|
|
* @cnt: counter for max number of moves
|
|
|
|
*
|
|
|
|
* Caller must hold bond->lock
|
|
|
|
*/
|
|
|
|
#define bond_for_each_slave(bond, pos, cnt) \
|
|
|
|
bond_for_each_slave_from(bond, pos, cnt, (bond)->first_slave)
|
|
|
|
|
|
|
|
|
2010-10-13 10:01:50 -06:00
|
|
|
#ifdef CONFIG_NET_POLL_CONTROLLER
|
net: Convert netpoll blocking api in bonding driver to be a counter
A while back I made some changes to enable netpoll in the bonding driver. Among
them was a per-cpu flag that indicated we were in a path that held locks which
could cause the netpoll path to block in during tx, and as such the tx path
should queue the frame for later use. This appears to have given rise to a
regression. If one of those paths on which we hold the per-cpu flag yields the
cpu, its possible for us to come back on a different cpu, leading to us clearing
a different flag than we set. This results in odd netpoll drops, and BUG
backtraces appearing in the log, as we check to make sure that we only clear set
bits, and only set clear bits. I had though briefly about changing the
offending paths so that they wouldn't sleep, but looking at my origional work
more closely, it doesn't appear that a per-cpu flag is warranted. We alrady
gate the checking of this flag on IFF_IN_NETPOLL, so we don't hit this in the
normal tx case anyway. And practically speaking, the normal use case for
netpoll is to only have one client anyway, so we're not going to erroneously
queue netpoll frames when its actually safe to do so. As such, lets just
convert that per-cpu flag to an atomic counter. It fixes the rescheduling bugs,
is equivalent from a performance perspective and actually eliminates some code
in the process.
Tested by the reporter and myself, successfully
Reported-by: Liang Zheng <lzheng@redhat.com>
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: David S. Miller <davem@davemloft.net>
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-06 02:05:50 -07:00
|
|
|
extern atomic_t netpoll_block_tx;
|
2010-10-13 10:01:50 -06:00
|
|
|
|
|
|
|
static inline void block_netpoll_tx(void)
|
|
|
|
{
|
net: Convert netpoll blocking api in bonding driver to be a counter
A while back I made some changes to enable netpoll in the bonding driver. Among
them was a per-cpu flag that indicated we were in a path that held locks which
could cause the netpoll path to block in during tx, and as such the tx path
should queue the frame for later use. This appears to have given rise to a
regression. If one of those paths on which we hold the per-cpu flag yields the
cpu, its possible for us to come back on a different cpu, leading to us clearing
a different flag than we set. This results in odd netpoll drops, and BUG
backtraces appearing in the log, as we check to make sure that we only clear set
bits, and only set clear bits. I had though briefly about changing the
offending paths so that they wouldn't sleep, but looking at my origional work
more closely, it doesn't appear that a per-cpu flag is warranted. We alrady
gate the checking of this flag on IFF_IN_NETPOLL, so we don't hit this in the
normal tx case anyway. And practically speaking, the normal use case for
netpoll is to only have one client anyway, so we're not going to erroneously
queue netpoll frames when its actually safe to do so. As such, lets just
convert that per-cpu flag to an atomic counter. It fixes the rescheduling bugs,
is equivalent from a performance perspective and actually eliminates some code
in the process.
Tested by the reporter and myself, successfully
Reported-by: Liang Zheng <lzheng@redhat.com>
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: David S. Miller <davem@davemloft.net>
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-06 02:05:50 -07:00
|
|
|
atomic_inc(&netpoll_block_tx);
|
2010-10-13 10:01:50 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline void unblock_netpoll_tx(void)
|
|
|
|
{
|
net: Convert netpoll blocking api in bonding driver to be a counter
A while back I made some changes to enable netpoll in the bonding driver. Among
them was a per-cpu flag that indicated we were in a path that held locks which
could cause the netpoll path to block in during tx, and as such the tx path
should queue the frame for later use. This appears to have given rise to a
regression. If one of those paths on which we hold the per-cpu flag yields the
cpu, its possible for us to come back on a different cpu, leading to us clearing
a different flag than we set. This results in odd netpoll drops, and BUG
backtraces appearing in the log, as we check to make sure that we only clear set
bits, and only set clear bits. I had though briefly about changing the
offending paths so that they wouldn't sleep, but looking at my origional work
more closely, it doesn't appear that a per-cpu flag is warranted. We alrady
gate the checking of this flag on IFF_IN_NETPOLL, so we don't hit this in the
normal tx case anyway. And practically speaking, the normal use case for
netpoll is to only have one client anyway, so we're not going to erroneously
queue netpoll frames when its actually safe to do so. As such, lets just
convert that per-cpu flag to an atomic counter. It fixes the rescheduling bugs,
is equivalent from a performance perspective and actually eliminates some code
in the process.
Tested by the reporter and myself, successfully
Reported-by: Liang Zheng <lzheng@redhat.com>
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: David S. Miller <davem@davemloft.net>
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-06 02:05:50 -07:00
|
|
|
atomic_dec(&netpoll_block_tx);
|
2010-10-13 10:01:50 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline int is_netpoll_tx_blocked(struct net_device *dev)
|
|
|
|
{
|
2011-02-17 16:43:33 -07:00
|
|
|
if (unlikely(netpoll_tx_running(dev)))
|
net: Convert netpoll blocking api in bonding driver to be a counter
A while back I made some changes to enable netpoll in the bonding driver. Among
them was a per-cpu flag that indicated we were in a path that held locks which
could cause the netpoll path to block in during tx, and as such the tx path
should queue the frame for later use. This appears to have given rise to a
regression. If one of those paths on which we hold the per-cpu flag yields the
cpu, its possible for us to come back on a different cpu, leading to us clearing
a different flag than we set. This results in odd netpoll drops, and BUG
backtraces appearing in the log, as we check to make sure that we only clear set
bits, and only set clear bits. I had though briefly about changing the
offending paths so that they wouldn't sleep, but looking at my origional work
more closely, it doesn't appear that a per-cpu flag is warranted. We alrady
gate the checking of this flag on IFF_IN_NETPOLL, so we don't hit this in the
normal tx case anyway. And practically speaking, the normal use case for
netpoll is to only have one client anyway, so we're not going to erroneously
queue netpoll frames when its actually safe to do so. As such, lets just
convert that per-cpu flag to an atomic counter. It fixes the rescheduling bugs,
is equivalent from a performance perspective and actually eliminates some code
in the process.
Tested by the reporter and myself, successfully
Reported-by: Liang Zheng <lzheng@redhat.com>
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: David S. Miller <davem@davemloft.net>
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2010-12-06 02:05:50 -07:00
|
|
|
return atomic_read(&netpoll_block_tx);
|
2010-10-13 10:01:50 -06:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
#define block_netpoll_tx()
|
|
|
|
#define unblock_netpoll_tx()
|
|
|
|
#define is_netpoll_tx_blocked(dev) (0)
|
|
|
|
#endif
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
struct bond_params {
|
|
|
|
int mode;
|
2005-06-26 15:54:11 -06:00
|
|
|
int xmit_policy;
|
2005-04-16 16:20:36 -06:00
|
|
|
int miimon;
|
2008-05-17 22:10:12 -06:00
|
|
|
int num_grat_arp;
|
bonding: send IPv6 neighbor advertisement on failover
This patch adds better IPv6 failover support for bonding devices,
especially when in active-backup mode and there are only IPv6 addresses
configured, as reported by Alex Sidorenko.
- Creates a new file, net/drivers/bonding/bond_ipv6.c, for the
IPv6-specific routines. Both regular bonds and VLANs over bonds
are supported.
- Adds a new tunable, num_unsol_na, to limit the number of unsolicited
IPv6 Neighbor Advertisements that are sent on a failover event.
Default is 1.
- Creates two new IPv6 neighbor discovery functions:
ndisc_build_skb()
ndisc_send_skb()
These were required to support VLANs since we have to be able to
add the VLAN id to the skb since ndisc_send_na() and friends
shouldn't be asked to do this. These two routines are basically
__ndisc_send() split into two pieces, in a slightly different order.
- Updates Documentation/networking/bonding.txt and bumps the rev of bond
support to 3.4.0.
On failover, this new code will generate one packet:
- An unsolicited IPv6 Neighbor Advertisement, which helps the switch
learn that the address has moved to the new slave.
Testing has shown that sending just the NA results in pretty good
behavior when in active-back mode, I saw no lost ping packets for example.
Signed-off-by: Brian Haley <brian.haley@hp.com>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-11-04 18:51:14 -07:00
|
|
|
int num_unsol_na;
|
2005-04-16 16:20:36 -06:00
|
|
|
int arp_interval;
|
2006-09-22 22:54:53 -06:00
|
|
|
int arp_validate;
|
2005-04-16 16:20:36 -06:00
|
|
|
int use_carrier;
|
2007-10-09 20:57:24 -06:00
|
|
|
int fail_over_mac;
|
2005-04-16 16:20:36 -06:00
|
|
|
int updelay;
|
|
|
|
int downdelay;
|
|
|
|
int lacp_fast;
|
2008-11-04 18:51:16 -07:00
|
|
|
int ad_select;
|
2005-04-16 16:20:36 -06:00
|
|
|
char primary[IFNAMSIZ];
|
2009-09-24 21:28:09 -06:00
|
|
|
int primary_reselect;
|
2007-08-22 18:06:58 -06:00
|
|
|
__be32 arp_targets[BOND_MAX_ARP_TARGETS];
|
2010-06-02 02:40:18 -06:00
|
|
|
int tx_queues;
|
2010-06-02 02:39:21 -06:00
|
|
|
int all_slaves_active;
|
2010-10-05 08:23:59 -06:00
|
|
|
int resend_igmp;
|
2005-04-16 16:20:36 -06:00
|
|
|
};
|
|
|
|
|
2005-11-09 11:35:44 -07:00
|
|
|
struct bond_parm_tbl {
|
|
|
|
char *modename;
|
|
|
|
int mode;
|
|
|
|
};
|
|
|
|
|
2008-01-17 17:25:01 -07:00
|
|
|
#define BOND_MAX_MODENAME_LEN 20
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
struct vlan_entry {
|
|
|
|
struct list_head vlan_list;
|
2007-08-22 18:06:58 -06:00
|
|
|
__be32 vlan_ip;
|
2005-04-16 16:20:36 -06:00
|
|
|
unsigned short vlan_id;
|
bonding: send IPv6 neighbor advertisement on failover
This patch adds better IPv6 failover support for bonding devices,
especially when in active-backup mode and there are only IPv6 addresses
configured, as reported by Alex Sidorenko.
- Creates a new file, net/drivers/bonding/bond_ipv6.c, for the
IPv6-specific routines. Both regular bonds and VLANs over bonds
are supported.
- Adds a new tunable, num_unsol_na, to limit the number of unsolicited
IPv6 Neighbor Advertisements that are sent on a failover event.
Default is 1.
- Creates two new IPv6 neighbor discovery functions:
ndisc_build_skb()
ndisc_send_skb()
These were required to support VLANs since we have to be able to
add the VLAN id to the skb since ndisc_send_na() and friends
shouldn't be asked to do this. These two routines are basically
__ndisc_send() split into two pieces, in a slightly different order.
- Updates Documentation/networking/bonding.txt and bumps the rev of bond
support to 3.4.0.
On failover, this new code will generate one packet:
- An unsolicited IPv6 Neighbor Advertisement, which helps the switch
learn that the address has moved to the new slave.
Testing has shown that sending just the NA results in pretty good
behavior when in active-back mode, I saw no lost ping packets for example.
Signed-off-by: Brian Haley <brian.haley@hp.com>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-11-04 18:51:14 -07:00
|
|
|
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
|
|
|
|
struct in6_addr vlan_ipv6;
|
|
|
|
#endif
|
2005-04-16 16:20:36 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
struct slave {
|
2005-11-09 11:36:50 -07:00
|
|
|
struct net_device *dev; /* first - useful for panic debug */
|
2005-04-16 16:20:36 -06:00
|
|
|
struct slave *next;
|
|
|
|
struct slave *prev;
|
2006-09-22 22:52:51 -06:00
|
|
|
int delay;
|
2007-01-29 13:08:38 -07:00
|
|
|
unsigned long jiffies;
|
|
|
|
unsigned long last_arp_rx;
|
2005-04-16 16:20:36 -06:00
|
|
|
s8 link; /* one of BOND_LINK_XXXX */
|
2008-05-17 22:10:13 -06:00
|
|
|
s8 new_link;
|
2011-03-11 20:14:37 -07:00
|
|
|
u8 backup; /* indicates backup slave. Value corresponds with
|
|
|
|
BOND_STATE_ACTIVE and BOND_STATE_BACKUP */
|
2007-10-09 20:43:41 -06:00
|
|
|
u32 original_mtu;
|
2005-04-16 16:20:36 -06:00
|
|
|
u32 link_failure_count;
|
2009-09-01 00:31:18 -06:00
|
|
|
u8 perm_hwaddr[ETH_ALEN];
|
2005-04-16 16:20:36 -06:00
|
|
|
u16 speed;
|
|
|
|
u8 duplex;
|
2010-06-02 02:40:18 -06:00
|
|
|
u16 queue_id;
|
2005-04-16 16:20:36 -06:00
|
|
|
struct ad_slave_info ad_info; /* HUGE - better to dynamically alloc */
|
|
|
|
struct tlb_slave_info tlb_info;
|
2011-02-17 16:43:32 -07:00
|
|
|
#ifdef CONFIG_NET_POLL_CONTROLLER
|
|
|
|
struct netpoll *np;
|
|
|
|
#endif
|
2005-04-16 16:20:36 -06:00
|
|
|
};
|
|
|
|
|
2008-05-17 22:10:13 -06:00
|
|
|
/*
|
|
|
|
* Link pseudo-state only used internally by monitors
|
|
|
|
*/
|
|
|
|
#define BOND_LINK_NOCHANGE -1
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
/*
|
|
|
|
* Here are the locking policies for the two bonding locks:
|
|
|
|
*
|
|
|
|
* 1) Get bond->lock when reading/writing slave list.
|
|
|
|
* 2) Get bond->curr_slave_lock when reading/writing bond->curr_active_slave.
|
|
|
|
* (It is unnecessary when the write-lock is put with bond->lock.)
|
|
|
|
* 3) When we lock with bond->curr_slave_lock, we must lock with bond->lock
|
|
|
|
* beforehand.
|
|
|
|
*/
|
|
|
|
struct bonding {
|
2005-11-09 11:36:50 -07:00
|
|
|
struct net_device *dev; /* first - useful for panic debug */
|
2005-04-16 16:20:36 -06:00
|
|
|
struct slave *first_slave;
|
|
|
|
struct slave *curr_active_slave;
|
|
|
|
struct slave *current_arp_slave;
|
|
|
|
struct slave *primary_slave;
|
2009-09-24 21:28:09 -06:00
|
|
|
bool force_primary;
|
2005-04-16 16:20:36 -06:00
|
|
|
s32 slave_cnt; /* never change this value outside the attach/detach wrappers */
|
|
|
|
rwlock_t lock;
|
|
|
|
rwlock_t curr_slave_lock;
|
|
|
|
s8 kill_timers;
|
2007-10-09 20:43:42 -06:00
|
|
|
s8 send_grat_arp;
|
bonding: send IPv6 neighbor advertisement on failover
This patch adds better IPv6 failover support for bonding devices,
especially when in active-backup mode and there are only IPv6 addresses
configured, as reported by Alex Sidorenko.
- Creates a new file, net/drivers/bonding/bond_ipv6.c, for the
IPv6-specific routines. Both regular bonds and VLANs over bonds
are supported.
- Adds a new tunable, num_unsol_na, to limit the number of unsolicited
IPv6 Neighbor Advertisements that are sent on a failover event.
Default is 1.
- Creates two new IPv6 neighbor discovery functions:
ndisc_build_skb()
ndisc_send_skb()
These were required to support VLANs since we have to be able to
add the VLAN id to the skb since ndisc_send_na() and friends
shouldn't be asked to do this. These two routines are basically
__ndisc_send() split into two pieces, in a slightly different order.
- Updates Documentation/networking/bonding.txt and bumps the rev of bond
support to 3.4.0.
On failover, this new code will generate one packet:
- An unsolicited IPv6 Neighbor Advertisement, which helps the switch
learn that the address has moved to the new slave.
Testing has shown that sending just the NA results in pretty good
behavior when in active-back mode, I saw no lost ping packets for example.
Signed-off-by: Brian Haley <brian.haley@hp.com>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-11-04 18:51:14 -07:00
|
|
|
s8 send_unsol_na;
|
2007-10-09 20:43:43 -06:00
|
|
|
s8 setup_by_slave;
|
2010-10-05 08:23:59 -06:00
|
|
|
s8 igmp_retrans;
|
2005-04-16 16:20:36 -06:00
|
|
|
#ifdef CONFIG_PROC_FS
|
|
|
|
struct proc_dir_entry *proc_entry;
|
|
|
|
char proc_file_name[IFNAMSIZ];
|
|
|
|
#endif /* CONFIG_PROC_FS */
|
|
|
|
struct list_head bond_list;
|
2010-04-01 15:22:57 -06:00
|
|
|
struct netdev_hw_addr_list mc_list;
|
2009-10-22 22:09:24 -06:00
|
|
|
int (*xmit_hash_policy)(struct sk_buff *, int);
|
2007-08-22 18:06:58 -06:00
|
|
|
__be32 master_ip;
|
2005-04-16 16:20:36 -06:00
|
|
|
u16 flags;
|
2007-10-17 18:37:47 -06:00
|
|
|
u16 rr_tx_counter;
|
2005-04-16 16:20:36 -06:00
|
|
|
struct ad_bond_info ad_info;
|
|
|
|
struct alb_bond_info alb_info;
|
|
|
|
struct bond_params params;
|
|
|
|
struct list_head vlan_list;
|
|
|
|
struct vlan_group *vlgrp;
|
2006-09-22 22:54:53 -06:00
|
|
|
struct packet_type arp_mon_pt;
|
2007-10-17 18:37:45 -06:00
|
|
|
struct workqueue_struct *wq;
|
|
|
|
struct delayed_work mii_work;
|
|
|
|
struct delayed_work arp_work;
|
|
|
|
struct delayed_work alb_work;
|
|
|
|
struct delayed_work ad_work;
|
2010-10-05 08:23:57 -06:00
|
|
|
struct delayed_work mcast_work;
|
bonding: send IPv6 neighbor advertisement on failover
This patch adds better IPv6 failover support for bonding devices,
especially when in active-backup mode and there are only IPv6 addresses
configured, as reported by Alex Sidorenko.
- Creates a new file, net/drivers/bonding/bond_ipv6.c, for the
IPv6-specific routines. Both regular bonds and VLANs over bonds
are supported.
- Adds a new tunable, num_unsol_na, to limit the number of unsolicited
IPv6 Neighbor Advertisements that are sent on a failover event.
Default is 1.
- Creates two new IPv6 neighbor discovery functions:
ndisc_build_skb()
ndisc_send_skb()
These were required to support VLANs since we have to be able to
add the VLAN id to the skb since ndisc_send_na() and friends
shouldn't be asked to do this. These two routines are basically
__ndisc_send() split into two pieces, in a slightly different order.
- Updates Documentation/networking/bonding.txt and bumps the rev of bond
support to 3.4.0.
On failover, this new code will generate one packet:
- An unsolicited IPv6 Neighbor Advertisement, which helps the switch
learn that the address has moved to the new slave.
Testing has shown that sending just the NA results in pretty good
behavior when in active-back mode, I saw no lost ping packets for example.
Signed-off-by: Brian Haley <brian.haley@hp.com>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-11-04 18:51:14 -07:00
|
|
|
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
|
|
|
|
struct in6_addr master_ipv6;
|
|
|
|
#endif
|
2010-12-09 08:17:13 -07:00
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
/* debugging suport via debugfs */
|
|
|
|
struct dentry *debug_dir;
|
|
|
|
#endif /* CONFIG_DEBUG_FS */
|
2005-04-16 16:20:36 -06:00
|
|
|
};
|
|
|
|
|
2011-03-11 20:14:35 -07:00
|
|
|
#define bond_slave_get_rcu(dev) \
|
|
|
|
((struct slave *) rcu_dereference(dev->rx_handler_data))
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
/**
|
|
|
|
* Returns NULL if the net_device does not belong to any of the bond's slaves
|
|
|
|
*
|
|
|
|
* Caller must hold bond lock for read
|
|
|
|
*/
|
2011-02-23 00:40:33 -07:00
|
|
|
static inline struct slave *bond_get_slave_by_dev(struct bonding *bond,
|
|
|
|
struct net_device *slave_dev)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
|
|
|
struct slave *slave = NULL;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
bond_for_each_slave(bond, slave, i) {
|
|
|
|
if (slave->dev == slave_dev) {
|
2010-12-10 11:54:11 -07:00
|
|
|
return slave;
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-02-23 00:40:33 -07:00
|
|
|
return NULL;
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
2006-01-05 23:45:42 -07:00
|
|
|
static inline struct bonding *bond_get_bond_by_slave(struct slave *slave)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
|
|
|
if (!slave || !slave->dev->master) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2010-11-15 04:12:25 -07:00
|
|
|
return netdev_priv(slave->dev->master);
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
2008-12-10 00:07:13 -07:00
|
|
|
static inline bool bond_is_lb(const struct bonding *bond)
|
|
|
|
{
|
2009-12-03 00:58:21 -07:00
|
|
|
return (bond->params.mode == BOND_MODE_TLB ||
|
|
|
|
bond->params.mode == BOND_MODE_ALB);
|
2008-12-10 00:07:13 -07:00
|
|
|
}
|
|
|
|
|
2011-03-11 20:14:37 -07:00
|
|
|
static inline void bond_set_active_slave(struct slave *slave)
|
|
|
|
{
|
|
|
|
slave->backup = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void bond_set_backup_slave(struct slave *slave)
|
|
|
|
{
|
|
|
|
slave->backup = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline int bond_slave_state(struct slave *slave)
|
|
|
|
{
|
|
|
|
return slave->backup;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool bond_is_active_slave(struct slave *slave)
|
|
|
|
{
|
|
|
|
return !bond_slave_state(slave);
|
|
|
|
}
|
|
|
|
|
2009-09-24 21:28:09 -06:00
|
|
|
#define BOND_PRI_RESELECT_ALWAYS 0
|
|
|
|
#define BOND_PRI_RESELECT_BETTER 1
|
|
|
|
#define BOND_PRI_RESELECT_FAILURE 2
|
|
|
|
|
2008-05-17 22:10:14 -06:00
|
|
|
#define BOND_FOM_NONE 0
|
|
|
|
#define BOND_FOM_ACTIVE 1
|
|
|
|
#define BOND_FOM_FOLLOW 2
|
|
|
|
|
2006-09-22 22:54:53 -06:00
|
|
|
#define BOND_ARP_VALIDATE_NONE 0
|
|
|
|
#define BOND_ARP_VALIDATE_ACTIVE (1 << BOND_STATE_ACTIVE)
|
|
|
|
#define BOND_ARP_VALIDATE_BACKUP (1 << BOND_STATE_BACKUP)
|
|
|
|
#define BOND_ARP_VALIDATE_ALL (BOND_ARP_VALIDATE_ACTIVE | \
|
|
|
|
BOND_ARP_VALIDATE_BACKUP)
|
|
|
|
|
2006-12-12 09:24:39 -07:00
|
|
|
static inline int slave_do_arp_validate(struct bonding *bond,
|
|
|
|
struct slave *slave)
|
2006-09-22 22:54:53 -06:00
|
|
|
{
|
2011-03-11 20:14:37 -07:00
|
|
|
return bond->params.arp_validate & (1 << bond_slave_state(slave));
|
2006-09-22 22:54:53 -06:00
|
|
|
}
|
|
|
|
|
2006-12-12 09:24:39 -07:00
|
|
|
static inline unsigned long slave_last_rx(struct bonding *bond,
|
2007-01-29 13:08:38 -07:00
|
|
|
struct slave *slave)
|
2006-09-22 22:54:53 -06:00
|
|
|
{
|
|
|
|
if (slave_do_arp_validate(bond, slave))
|
|
|
|
return slave->last_arp_rx;
|
|
|
|
|
|
|
|
return slave->dev->last_rx;
|
|
|
|
}
|
|
|
|
|
2011-02-17 16:43:32 -07:00
|
|
|
#ifdef CONFIG_NET_POLL_CONTROLLER
|
|
|
|
static inline void bond_netpoll_send_skb(const struct slave *slave,
|
|
|
|
struct sk_buff *skb)
|
|
|
|
{
|
|
|
|
struct netpoll *np = slave->np;
|
|
|
|
|
|
|
|
if (np)
|
|
|
|
netpoll_send_skb(np, skb);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
static inline void bond_netpoll_send_skb(const struct slave *slave,
|
|
|
|
struct sk_buff *skb)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-01-05 23:45:42 -07:00
|
|
|
static inline void bond_set_slave_inactive_flags(struct slave *slave)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2008-11-13 00:37:49 -07:00
|
|
|
struct bonding *bond = netdev_priv(slave->dev->master);
|
2009-05-26 23:42:36 -06:00
|
|
|
if (!bond_is_lb(bond))
|
2011-03-11 20:14:37 -07:00
|
|
|
bond_set_backup_slave(slave);
|
2010-06-02 02:39:21 -06:00
|
|
|
if (!bond->params.all_slaves_active)
|
|
|
|
slave->dev->priv_flags |= IFF_SLAVE_INACTIVE;
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
2006-01-05 23:45:42 -07:00
|
|
|
static inline void bond_set_slave_active_flags(struct slave *slave)
|
2005-04-16 16:20:36 -06:00
|
|
|
{
|
2011-03-11 20:14:37 -07:00
|
|
|
bond_set_active_slave(slave);
|
2011-03-16 02:45:23 -06:00
|
|
|
slave->dev->priv_flags &= ~IFF_SLAVE_INACTIVE;
|
2005-04-16 16:20:36 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
struct vlan_entry *bond_next_vlan(struct bonding *bond, struct vlan_entry *curr);
|
|
|
|
int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb, struct net_device *slave_dev);
|
2009-10-29 08:18:26 -06:00
|
|
|
int bond_create(struct net *net, const char *name);
|
2005-11-09 11:36:41 -07:00
|
|
|
int bond_create_sysfs(void);
|
|
|
|
void bond_destroy_sysfs(void);
|
2009-10-29 08:18:22 -06:00
|
|
|
void bond_prepare_sysfs_group(struct bonding *bond);
|
2005-11-09 11:36:41 -07:00
|
|
|
int bond_create_slave_symlinks(struct net_device *master, struct net_device *slave);
|
|
|
|
void bond_destroy_slave_symlinks(struct net_device *master, struct net_device *slave);
|
2005-11-09 11:35:51 -07:00
|
|
|
int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev);
|
|
|
|
int bond_release(struct net_device *bond_dev, struct net_device *slave_dev);
|
2007-10-17 18:37:45 -06:00
|
|
|
void bond_mii_monitor(struct work_struct *);
|
|
|
|
void bond_loadbalance_arp_mon(struct work_struct *);
|
|
|
|
void bond_activebackup_arp_mon(struct work_struct *);
|
2005-11-09 11:35:51 -07:00
|
|
|
void bond_set_mode_ops(struct bonding *bond, int mode);
|
2008-12-10 00:10:17 -07:00
|
|
|
int bond_parse_parm(const char *mode_arg, const struct bond_parm_tbl *tbl);
|
2005-11-09 11:35:51 -07:00
|
|
|
void bond_select_active_slave(struct bonding *bond);
|
|
|
|
void bond_change_active_slave(struct bonding *bond, struct slave *new_active);
|
2006-09-22 22:54:53 -06:00
|
|
|
void bond_register_arp(struct bonding *);
|
|
|
|
void bond_unregister_arp(struct bonding *);
|
2010-12-09 08:17:13 -07:00
|
|
|
void bond_create_debugfs(void);
|
|
|
|
void bond_destroy_debugfs(void);
|
|
|
|
void bond_debug_register(struct bonding *bond);
|
|
|
|
void bond_debug_unregister(struct bonding *bond);
|
|
|
|
void bond_debug_reregister(struct bonding *bond);
|
2005-04-16 16:20:36 -06:00
|
|
|
|
2009-10-29 08:18:26 -06:00
|
|
|
struct bond_net {
|
|
|
|
struct net * net; /* Associated network namespace */
|
|
|
|
struct list_head dev_list;
|
|
|
|
#ifdef CONFIG_PROC_FS
|
|
|
|
struct proc_dir_entry * proc_dir;
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2011-03-06 14:58:46 -07:00
|
|
|
#ifdef CONFIG_PROC_FS
|
|
|
|
void bond_create_proc_entry(struct bonding *bond);
|
|
|
|
void bond_remove_proc_entry(struct bonding *bond);
|
|
|
|
void bond_create_proc_dir(struct bond_net *bn);
|
|
|
|
void bond_destroy_proc_dir(struct bond_net *bn);
|
|
|
|
#else
|
|
|
|
static inline void bond_create_proc_entry(struct bonding *bond)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void bond_remove_proc_entry(struct bonding *bond)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void bond_create_proc_dir(struct bond_net *bn)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline void bond_destroy_proc_dir(struct bond_net *bn)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2008-09-14 09:56:12 -06:00
|
|
|
/* exported from bond_main.c */
|
2009-10-29 08:18:26 -06:00
|
|
|
extern int bond_net_id;
|
2008-12-10 00:10:38 -07:00
|
|
|
extern const struct bond_parm_tbl bond_lacp_tbl[];
|
|
|
|
extern const struct bond_parm_tbl bond_mode_tbl[];
|
|
|
|
extern const struct bond_parm_tbl xmit_hashtype_tbl[];
|
|
|
|
extern const struct bond_parm_tbl arp_validate_tbl[];
|
|
|
|
extern const struct bond_parm_tbl fail_over_mac_tbl[];
|
2009-09-24 21:28:09 -06:00
|
|
|
extern const struct bond_parm_tbl pri_reselect_tbl[];
|
2008-12-26 00:58:57 -07:00
|
|
|
extern struct bond_parm_tbl ad_select_tbl[];
|
|
|
|
|
bonding: send IPv6 neighbor advertisement on failover
This patch adds better IPv6 failover support for bonding devices,
especially when in active-backup mode and there are only IPv6 addresses
configured, as reported by Alex Sidorenko.
- Creates a new file, net/drivers/bonding/bond_ipv6.c, for the
IPv6-specific routines. Both regular bonds and VLANs over bonds
are supported.
- Adds a new tunable, num_unsol_na, to limit the number of unsolicited
IPv6 Neighbor Advertisements that are sent on a failover event.
Default is 1.
- Creates two new IPv6 neighbor discovery functions:
ndisc_build_skb()
ndisc_send_skb()
These were required to support VLANs since we have to be able to
add the VLAN id to the skb since ndisc_send_na() and friends
shouldn't be asked to do this. These two routines are basically
__ndisc_send() split into two pieces, in a slightly different order.
- Updates Documentation/networking/bonding.txt and bumps the rev of bond
support to 3.4.0.
On failover, this new code will generate one packet:
- An unsolicited IPv6 Neighbor Advertisement, which helps the switch
learn that the address has moved to the new slave.
Testing has shown that sending just the NA results in pretty good
behavior when in active-back mode, I saw no lost ping packets for example.
Signed-off-by: Brian Haley <brian.haley@hp.com>
Signed-off-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
2008-11-04 18:51:14 -07:00
|
|
|
#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
|
|
|
|
|
2005-04-16 16:20:36 -06:00
|
|
|
#endif /* _LINUX_BONDING_H */
|