34 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
36 #include <linux/kernel.h>
37 #include <linux/module.h>
38 #include <linux/types.h>
39 #include <linux/fcntl.h>
41 #include <linux/ptrace.h>
46 #include <linux/tcp.h>
47 #include <linux/udp.h>
48 #include <linux/slab.h>
49 #include <linux/string.h>
52 #include <linux/socket.h>
53 #include <linux/ctype.h>
55 #include <linux/bitops.h>
59 #include <linux/errno.h>
60 #include <linux/netdevice.h>
62 #include <linux/igmp.h>
66 #include <linux/rtnetlink.h>
68 #include <linux/if_ether.h>
70 #include <linux/mii.h>
71 #include <linux/ethtool.h>
72 #include <linux/if_vlan.h>
87 #define BOND_LINK_MON_INTERV 0
88 #define BOND_LINK_ARP_INTERV 0
92 static int num_peer_notif = 1;
96 static int use_carrier = 1;
99 static char *primary_reselect;
100 static char *lacp_rate;
101 static int min_links;
102 static char *ad_select;
103 static char *xmit_hash_policy;
106 static char *arp_validate;
107 static char *fail_over_mac;
108 static int all_slaves_active = 0;
118 "failover event (alias of num_unsol_na)");
121 "failover event (alias of num_grat_arp)");
131 "0 for off, 1 for on (default)");
134 "1 for active-backup, 2 for balance-xor, "
135 "3 for broadcast, 4 for 802.3ad, 5 for balance-tlb, "
136 "6 for balance-alb");
142 "0 for always (default), "
143 "1 for only if speed of primary is "
145 "2 for only on active slave "
148 MODULE_PARM_DESC(lacp_rate,
"LACPDU tx rate to request from 802.3ad partner; "
149 "0 for slow, 1 for fast");
152 "0 for stable (default), 1 for bandwidth, "
158 MODULE_PARM_DESC(xmit_hash_policy,
"balance-xor and 802.3ad hashing method; "
159 "0 for layer 2 (default), 1 for layer 3+4, "
167 "0 for none (default), 1 for active, "
168 "2 for backup, 3 for all");
171 "the same MAC; 0 for none (default), "
172 "1 for active, 2 for follow");
175 "by setting active flag for all slaves; "
176 "0 for never (default), 1 for always.");
183 #ifdef CONFIG_NET_POLL_CONTROLLER
190 static int arp_ip_count;
250 static int bond_init(
struct net_device *bond_dev);
251 static void bond_uninit(
struct net_device *bond_dev);
257 static const char *names[] = {
282 static int bond_add_vlan(
struct bonding *bond,
unsigned short vlan_id)
287 (bond ? bond->
dev->name :
"None"), vlan_id);
302 pr_debug(
"added VLAN ID %d on bond %s\n", vlan_id, bond->
dev->name);
314 static int bond_del_vlan(
struct bonding *bond,
unsigned short vlan_id)
319 pr_debug(
"bond: %s, vlan id %d\n", bond->
dev->name, vlan_id);
325 if (vlan->
vlan_id == vlan_id) {
328 if (bond_is_lb(bond))
331 pr_debug(
"removed VLAN ID %d from bond %s\n",
332 vlan_id, bond->
dev->name);
341 pr_debug(
"couldn't find VLAN ID %d in bond %s\n",
342 vlan_id, bond->
dev->name);
395 skb->
dev = slave_dev;
402 bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb);
433 struct bonding *bond = netdev_priv(bond_dev);
443 res = bond_add_vlan(bond, vid);
445 pr_err(
"%s: Error: Failed to add vlan id %d\n",
446 bond_dev->
name, vid);
468 struct bonding *bond = netdev_priv(bond_dev);
475 res = bond_del_vlan(bond, vid);
477 pr_err(
"%s: Error: Failed to remove vlan id %d\n",
478 bond_dev->name, vid);
485 static void bond_add_vlans_on_slave(
struct bonding *bond,
struct net_device *slave_dev)
493 pr_warning(
"%s: Failed to add vlan id %d to device %s\n",
499 static void bond_del_vlans_from_slave(
struct bonding *bond,
520 static int bond_set_carrier(
struct bonding *bond)
533 if (!netif_carrier_ok(bond->
dev)) {
542 if (netif_carrier_ok(bond->
dev)) {
555 static void bond_update_speed_duplex(
struct slave *slave)
569 slave_speed = ethtool_cmd_speed(&ecmd);
570 if (slave_speed == 0 || slave_speed == ((
__u32) -1))
573 switch (ecmd.duplex) {
581 slave->
speed = slave_speed;
582 slave->
duplex = ecmd.duplex;
603 static int bond_check_dev_link(
struct bonding *bond,
611 if (!reporting && !netif_running(slave_dev))
614 if (bond->
params.use_carrier)
622 link = slave_dev->
ethtool_ops->get_link(slave_dev);
667 static int bond_set_promiscuity(
struct bonding *bond,
int inc)
691 static int bond_set_allmulti(
struct bonding *bond,
int inc)
716 static void bond_mc_add(
struct bonding *bond,
void *
addr)
739 if (bond->curr_active_slave)
740 dev_mc_del(bond->curr_active_slave->dev, addr);
751 static void __bond_resend_igmp_join_requests(
struct net_device *dev)
753 struct in_device *in_dev;
756 in_dev = __in_dev_get_rcu(dev);
767 static void bond_resend_igmp_join_requests(
struct bonding *bond)
769 struct net_device *bond_dev, *vlan_dev, *master_dev;
774 bond_dev = bond->
dev;
777 __bond_resend_igmp_join_requests(bond_dev);
783 master_dev = bond_dev->
master;
787 __bond_resend_igmp_join_requests(master_dev);
796 __bond_resend_igmp_join_requests(vlan_dev);
805 static void bond_resend_igmp_join_requests_delayed(
struct work_struct *
work)
809 bond_resend_igmp_join_requests(bond);
815 static void bond_mc_list_flush(
struct net_device *bond_dev,
818 struct bonding *bond = netdev_priv(bond_dev);
839 static void bond_mc_swap(
struct bonding *bond,
struct slave *new_active,
840 struct slave *old_active)
893 switch (bond->params.fail_over_mac) {
896 memcpy(bond->dev->dev_addr, new_active->dev->dev_addr,
897 new_active->dev->addr_len);
921 saddr.sa_family = new_active->dev->type;
924 saddr.sa_family = bond->dev->type;
929 pr_err(
"%s: Error %d setting MAC of slave %s\n",
930 bond->dev->name, -rv, new_active->dev->name);
938 saddr.sa_family = old_active->
dev->type;
942 pr_err(
"%s: Error %d setting MAC of slave %s\n",
943 bond->dev->name, -rv, new_active->dev->name);
949 pr_err(
"%s: bond_do_fail_over_mac impossible: bad policy %d\n",
950 bond->dev->name, bond->params.fail_over_mac);
956 static bool bond_should_change_active(
struct bonding *bond)
982 static struct slave *bond_find_best_slave(
struct bonding *bond)
984 struct slave *new_active, *old_active;
985 struct slave *bestslave =
NULL;
986 int mintime = bond->
params.updelay;
1000 bond_should_change_active(bond)) {
1005 old_active = new_active;
1013 if (new_active->
delay < mintime) {
1014 mintime = new_active->
delay;
1015 bestslave = new_active;
1023 static bool bond_should_notify_peers(
struct bonding *bond)
1027 pr_debug(
"bond_should_notify_peers: bond %s slave %s\n",
1028 bond->
dev->name, slave ? slave->
dev->name :
"NULL");
1058 if (old_active == new_active)
1066 pr_info(
"%s: making interface %s the new active one %d ms earlier.\n",
1067 bond->
dev->name, new_active->
dev->name,
1071 new_active->
delay = 0;
1077 if (bond_is_lb(bond))
1081 pr_info(
"%s: making interface %s the new active one.\n",
1082 bond->
dev->name, new_active->
dev->name);
1088 bond_mc_swap(bond, new_active, old_active);
1090 if (bond_is_lb(bond)) {
1093 bond_set_slave_inactive_flags(old_active);
1095 bond_set_slave_active_flags(new_active);
1102 bond_set_slave_inactive_flags(old_active);
1105 bool should_notify_peers =
false;
1107 bond_set_slave_active_flags(new_active);
1109 if (bond->
params.fail_over_mac)
1110 bond_do_fail_over_mac(bond, new_active,
1113 if (netif_running(bond->
dev)) {
1115 bond->
params.num_peer_notif;
1116 should_notify_peers =
1117 bond_should_notify_peers(bond);
1124 if (should_notify_peers)
1137 if (netif_running(bond->
dev) && (bond->
params.resend_igmp > 0) &&
1158 struct slave *best_slave;
1161 best_slave = bond_find_best_slave(bond);
1164 rv = bond_set_carrier(bond);
1168 if (netif_carrier_ok(bond->
dev)) {
1169 pr_info(
"%s: first active interface up!\n",
1172 pr_info(
"%s: now running without any active interface !\n",
1185 static void bond_attach_slave(
struct bonding *bond,
struct slave *new_slave)
1188 new_slave->
next = new_slave;
1189 new_slave->
prev = new_slave;
1194 new_slave->
next->prev = new_slave;
1195 new_slave->
prev->next = new_slave;
1211 static void bond_detach_slave(
struct bonding *bond,
struct slave *slave)
1232 #ifdef CONFIG_NET_POLL_CONTROLLER
1233 static inline int slave_enable_netpoll(
struct slave *slave)
1252 static inline void slave_disable_netpoll(
struct slave *slave)
1254 struct netpoll *np = slave->np;
1262 static inline bool slave_dev_support_netpoll(
struct net_device *slave_dev)
1266 if (!slave_dev->
netdev_ops->ndo_poll_controller)
1271 static void bond_poll_controller(
struct net_device *bond_dev)
1275 static void __bond_netpoll_cleanup(
struct bonding *bond)
1277 struct slave *slave;
1282 slave_disable_netpoll(slave);
1286 struct bonding *bond = netdev_priv(bond_dev);
1289 __bond_netpoll_cleanup(bond);
1295 struct bonding *bond = netdev_priv(dev);
1296 struct slave *slave;
1301 err = slave_enable_netpoll(slave);
1303 __bond_netpoll_cleanup(bond);
1313 return bond->
dev->npinfo;
1317 static inline int slave_enable_netpoll(
struct slave *slave)
1321 static inline void slave_disable_netpoll(
struct slave *slave)
1324 static void bond_netpoll_cleanup(
struct net_device *bond_dev)
1331 static int bond_sethwaddr(
struct net_device *bond_dev,
1334 pr_debug(
"bond_dev=%p\n", bond_dev);
1335 pr_debug(
"slave_dev=%p\n", slave_dev);
1344 struct slave *slave;
1345 struct bonding *bond = netdev_priv(dev);
1363 slave->
dev->features,
1372 #define BOND_VLAN_FEATURES (NETIF_F_ALL_CSUM | NETIF_F_SG | \
1373 NETIF_F_FRAGLIST | NETIF_F_ALL_TSO | \
1374 NETIF_F_HIGHDMA | NETIF_F_LRO)
1376 static void bond_compute_features(
struct bonding *bond)
1378 struct slave *slave;
1381 unsigned short max_hard_header_len =
ETH_HLEN;
1396 dst_release_flag &= slave->
dev->priv_flags;
1397 if (slave->
dev->hard_header_len > max_hard_header_len)
1398 max_hard_header_len = slave->
dev->hard_header_len;
1400 gso_max_size =
min(gso_max_size, slave->
dev->gso_max_size);
1401 gso_max_segs =
min(gso_max_segs, slave->
dev->gso_max_segs);
1408 netif_set_gso_max_size(bond_dev, gso_max_size);
1411 bond_dev->
priv_flags = flags | dst_release_flag;
1418 static void bond_setup_by_slave(
struct net_device *bond_dev,
1421 struct bonding *bond = netdev_priv(bond_dev);
1437 static bool bond_should_deliver_exact_match(
struct sk_buff *
skb,
1438 struct slave *slave,
1441 if (bond_is_slave_inactive(slave)) {
1454 struct slave *slave;
1469 if (bond->
params.arp_interval)
1474 ret = recv_probe(skb, bond, slave);
1481 if (bond_should_deliver_exact_match(skb, slave, bond)) {
1492 skb->
data - skb_mac_header(skb)))) {
1505 struct bonding *bond = netdev_priv(bond_dev);
1507 struct slave *new_slave =
NULL;
1515 pr_warning(
"%s: Warning: no link monitoring support for %s\n",
1521 pr_debug(
"Error, Device was already enslaved\n");
1528 pr_debug(
"%s: NETIF_F_VLAN_CHALLENGED\n", slave_dev->
name);
1530 pr_err(
"%s: Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n",
1534 pr_warning(
"%s: Warning: enslaved VLAN challenged slave %s. Adding VLANs will be blocked as long as %s is part of bond %s\n",
1539 pr_debug(
"%s: ! NETIF_F_VLAN_CHALLENGED\n", slave_dev->
name);
1549 pr_err(
"%s is up. This may be due to an out of date ifenslave.\n",
1552 goto err_undo_flags;
1563 if (bond_dev->
type != slave_dev->
type) {
1564 pr_debug(
"%s: change device type from %d to %d\n",
1570 res = notifier_to_errno(res);
1572 pr_err(
"%s: refused to change device type\n",
1575 goto err_undo_flags;
1583 bond_setup_by_slave(bond_dev, slave_dev);
1592 }
else if (bond_dev->
type != slave_dev->
type) {
1593 pr_err(
"%s ether type (%d) is different from other slaves (%d), can not enslave it.\n",
1597 goto err_undo_flags;
1602 pr_warning(
"%s: Warning: The first slave device specified does not support setting the MAC address. Setting fail_over_mac to active.",
1606 pr_err(
"%s: Error: The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active.\n",
1609 goto err_undo_flags;
1617 if (is_zero_ether_addr(bond->
dev->dev_addr))
1622 new_slave = kzalloc(
sizeof(
struct slave),
GFP_KERNEL);
1625 goto err_undo_flags;
1638 pr_debug(
"Error %d calling dev_set_mtu\n", res);
1649 if (!bond->
params.fail_over_mac) {
1658 pr_debug(
"Error %d calling set_mac_address\n", res);
1659 goto err_restore_mtu;
1665 pr_debug(
"Error %d calling netdev_set_bond_master\n", res);
1666 goto err_restore_mac;
1672 pr_debug(
"Opening slave %s failed\n", slave_dev->
name);
1673 goto err_unset_master;
1676 new_slave->
bond = bond;
1677 new_slave->
dev = slave_dev;
1680 if (bond_is_lb(bond)) {
1709 netif_addr_lock_bh(bond_dev);
1713 netif_addr_unlock_bh(bond_dev);
1723 bond_add_vlans_on_slave(bond, slave_dev);
1727 bond_attach_slave(bond, new_slave);
1729 new_slave->
delay = 0;
1734 bond_compute_features(bond);
1741 if (bond->
params.miimon && !bond->
params.use_carrier) {
1742 link_reporting = bond_check_dev_link(bond, slave_dev, 1);
1744 if ((link_reporting == -1) && !bond->
params.arp_interval) {
1754 pr_warning(
"%s: Warning: MII and ETHTOOL support not available for interface %s, and arp_interval/arp_ip_target module parameters not specified, thus bonding will not detect link failures! see bonding.txt for details.\n",
1756 }
else if (link_reporting == -1) {
1758 pr_warning(
"%s: Warning: can't get link status from interface %s; the network driver associated with this interface does not support MII or ETHTOOL link status reporting, thus miimon has no effect on this interface.\n",
1764 if (bond->
params.miimon) {
1765 if (bond_check_dev_link(bond, slave_dev, 0) ==
BMSR_LSTATUS) {
1766 if (bond->
params.updelay) {
1775 }
else if (bond->
params.arp_interval) {
1776 new_slave->
link = (netif_carrier_ok(slave_dev) ?
1784 pr_debug(
"Initial state of slave_dev is BOND_LINK_%s\n",
1788 bond_update_speed_duplex(new_slave);
1800 switch (bond->
params.mode) {
1802 bond_set_slave_inactive_flags(new_slave);
1810 bond_set_slave_inactive_flags(new_slave);
1827 bond_set_active_slave(new_slave);
1828 bond_set_slave_inactive_flags(new_slave);
1832 pr_debug(
"This slave is always active in trunk mode\n");
1835 bond_set_active_slave(new_slave);
1849 bond_set_carrier(bond);
1851 #ifdef CONFIG_NET_POLL_CONTROLLER
1852 slave_dev->npinfo = bond_netpoll_info(bond);
1853 if (slave_dev->npinfo) {
1854 if (slave_enable_netpoll(new_slave)) {
1856 pr_info(
"Error, %s: master_dev is using netpoll, "
1857 "but new slave device does not support netpoll.\n",
1874 pr_debug(
"Error %d calling netdev_rx_handler_register\n", res);
1875 goto err_dest_symlinks;
1878 pr_info(
"%s: enslaving %s as a%s interface with a%s link.\n",
1880 bond_is_active_slave(new_slave) ?
"n active" :
" backup",
1892 bond_detach_slave(bond, new_slave);
1902 if (!bond->
params.fail_over_mac) {
1919 bond_compute_features(bond);
1937 struct bonding *bond = netdev_priv(bond_dev);
1938 struct slave *slave, *oldcurrent;
1944 (slave_dev->
master != bond_dev)) {
1945 pr_err(
"%s: Error: cannot release %s.\n",
1954 slave = bond_get_slave_by_dev(bond, slave_dev);
1957 pr_info(
"%s: %s not enslaved\n",
1972 if (!bond->
params.fail_over_mac) {
1975 pr_warning(
"%s: Warning: the permanent HWaddr of %s - %pM - is still in use by %s. Set the HWaddr of %s to a different address to avoid conflicts.\n",
1989 pr_info(
"%s: releasing %s interface %s\n",
1991 bond_is_active_slave(slave) ?
"active" :
"backup",
1999 bond_detach_slave(bond, slave);
2004 if (oldcurrent == slave)
2007 if (bond_is_lb(bond)) {
2018 if (oldcurrent == slave) {
2036 bond_set_carrier(bond);
2044 if (bond_vlan_used(bond)) {
2045 pr_warning(
"%s: Warning: clearing HW address of %s while it still has VLANs.\n",
2047 pr_warning(
"%s: When re-adding slaves, make sure the bond's HW address matches its VLANs'.\n",
2058 bond_compute_features(bond);
2061 pr_info(
"%s: last VLAN challenged slave %s left bond %s. VLAN blocking is removed\n",
2067 bond_del_vlans_from_slave(bond, slave_dev);
2083 netif_addr_lock_bh(bond_dev);
2084 bond_mc_list_flush(bond_dev, slave_dev);
2085 netif_addr_unlock_bh(bond_dev);
2090 slave_disable_netpoll(slave);
2115 static int bond_release_and_destroy(
struct net_device *bond_dev,
2118 struct bonding *bond = netdev_priv(bond_dev);
2122 if ((ret == 0) && (bond->
slave_cnt == 0)) {
2124 pr_info(
"%s: destroying bond %s.\n",
2126 unregister_netdevice(bond_dev);
2134 static int bond_release_all(
struct net_device *bond_dev)
2136 struct bonding *bond = netdev_priv(bond_dev);
2137 struct slave *slave;
2159 slave_dev = slave->
dev;
2160 bond_detach_slave(bond, slave);
2174 if (bond_is_lb(bond)) {
2182 bond_del_vlans_from_slave(bond, slave_dev);
2198 netif_addr_lock_bh(bond_dev);
2199 bond_mc_list_flush(bond_dev, slave_dev);
2200 netif_addr_unlock_bh(bond_dev);
2205 slave_disable_netpoll(slave);
2210 if (!bond->
params.fail_over_mac) {
2213 addr.sa_family = slave_dev->
type;
2229 if (bond_vlan_used(bond)) {
2230 pr_warning(
"%s: Warning: clearing HW address of %s while it still has VLANs.\n",
2232 pr_warning(
"%s: When re-adding slaves, make sure the bond's HW address matches its VLANs'.\n",
2236 pr_info(
"%s: released all slaves\n", bond_dev->
name);
2241 bond_compute_features(bond);
2259 struct bonding *bond = netdev_priv(bond_dev);
2260 struct slave *old_active =
NULL;
2261 struct slave *new_active =
NULL;
2277 new_active = bond_get_slave_by_dev(bond, slave_dev);
2282 if (new_active && (new_active == old_active)) {
2306 struct bonding *bond = netdev_priv(bond_dev);
2320 struct bonding *bond = netdev_priv(bond_dev);
2321 struct slave *slave;
2331 info->
state = bond_slave_state(slave);
2345 static int bond_miimon_inspect(
struct bonding *bond)
2347 struct slave *slave;
2349 bool ignore_updelay;
2356 link_state = bond_check_dev_link(bond, slave->
dev, 0);
2358 switch (slave->
link) {
2366 pr_info(
"%s: link status down for %sinterface %s, disabling it in %d ms.\n",
2370 (bond_is_active_slave(slave) ?
2371 "active " :
"backup ") :
"",
2383 pr_info(
"%s: link status up again after %d ms for interface %s.\n",
2391 if (slave->
delay <= 0) {
2408 pr_info(
"%s: link status up for interface %s, enabling it in %d ms.\n",
2409 bond->
dev->name, slave->
dev->name,
2410 ignore_updelay ? 0 :
2418 pr_info(
"%s: link status down again after %d ms for interface %s.\n",
2430 if (slave->
delay <= 0) {
2433 ignore_updelay =
false;
2445 static void bond_miimon_commit(
struct bonding *bond)
2447 struct slave *slave;
2461 bond_set_backup_slave(slave);
2464 bond_set_active_slave(slave);
2467 bond_set_backup_slave(slave);
2470 bond_update_speed_duplex(slave);
2472 pr_info(
"%s: link status definitely up for interface %s, %u Mbps %s duplex.\n",
2473 bond->
dev->name, slave->
dev->name,
2480 if (bond_is_lb(bond))
2498 bond_set_slave_inactive_flags(slave);
2500 pr_info(
"%s: link status definitely down for interface %s, disabling it\n",
2501 bond->
dev->name, slave->
dev->name);
2507 if (bond_is_lb(bond))
2517 pr_err(
"%s: invalid new link %d on slave %s\n",
2534 bond_set_carrier(bond);
2549 bool should_notify_peers =
false;
2550 unsigned long delay;
2559 should_notify_peers = bond_should_notify_peers(bond);
2561 if (bond_miimon_inspect(bond)) {
2568 should_notify_peers =
false;
2574 bond_miimon_commit(bond);
2587 if (should_notify_peers) {
2604 if (ip == bond_confirm_addr(bond->
dev, 0, ip))
2611 if (vlan_dev && ip == bond_confirm_addr(vlan_dev, 0, ip))
2623 static void bond_arp_send(
struct net_device *slave_dev,
int arp_op,
__be32 dest_ip,
__be32 src_ip,
unsigned short vlan_id)
2627 pr_debug(
"arp %d on slave %s: dst %x src %x vid %d\n", arp_op,
2628 slave_dev->
name, dest_ip, src_ip, vlan_id);
2634 pr_err(
"ARP packet allocation failed\n");
2638 skb = vlan_put_tag(skb, vlan_id);
2640 pr_err(
"failed to insert VLAN tag\n");
2648 static void bond_arp_send_all(
struct bonding *bond,
struct slave *slave)
2660 pr_debug(
"basa: target %x\n", targets[i]);
2661 if (!bond_vlan_used(bond)) {
2662 pr_debug(
"basa: empty vlan: arp_send\n");
2663 addr = bond_confirm_addr(bond->
dev, targets[i], 0);
2674 rt = ip_route_output(dev_net(bond->
dev), targets[i], 0,
2678 pr_warning(
"%s: no route to arp_ip_target %pI4\n",
2679 bond->
dev->name, &targets[i]);
2687 if (rt->
dst.dev == bond->
dev) {
2689 pr_debug(
"basa: rtdev == bond->dev: arp_send\n");
2690 addr = bond_confirm_addr(bond->
dev, targets[i], 0);
2702 if (vlan_dev == rt->
dst.dev) {
2704 pr_debug(
"basa: vlan match on %s %d\n",
2705 vlan_dev->
name, vlan_id);
2710 if (vlan_id && vlan_dev) {
2712 addr = bond_confirm_addr(vlan_dev, targets[i], 0);
2719 pr_warning(
"%s: no path to arp_ip_target %pI4 via rt.dev %s\n",
2720 bond->
dev->name, &targets[i],
2721 rt->
dst.dev ? rt->
dst.dev->name :
"NULL");
2727 static void bond_validate_arp(
struct bonding *bond,
struct slave *slave,
__be32 sip,
__be32 tip)
2733 pr_debug(
"bva: sip %pI4 tip %pI4 t[%d] %pI4 bhti(tip) %d\n",
2734 &sip, &tip, i, &targets[i],
2735 bond_has_this_ip(bond, tip));
2736 if (sip == targets[i]) {
2737 if (bond_has_this_ip(bond, tip))
2744 static int bond_arp_rcv(
const struct sk_buff *skb,
struct bonding *bond,
2745 struct slave *slave)
2748 unsigned char *arp_ptr;
2756 alen = arp_hdr_len(bond->
dev);
2758 pr_debug(
"bond_arp_rcv: bond %s skb->dev %s\n",
2759 bond->
dev->name, skb->
dev->name);
2761 if (alen > skb_headlen(skb)) {
2769 if (arp->
ar_hln != bond->
dev->addr_len ||
2777 arp_ptr = (
unsigned char *)(arp + 1);
2778 arp_ptr += bond->
dev->addr_len;
2779 memcpy(&sip, arp_ptr, 4);
2780 arp_ptr += 4 + bond->
dev->addr_len;
2781 memcpy(&tip, arp_ptr, 4);
2783 pr_debug(
"bond_arp_rcv: %s %s/%d av %d sv %d sip %pI4 tip %pI4\n",
2784 bond->
dev->name, slave->
dev->name, bond_slave_state(slave),
2785 bond->
params.arp_validate, slave_do_arp_validate(bond, slave),
2796 if (bond_is_active_slave(slave))
2797 bond_validate_arp(bond, slave, sip, tip);
2799 bond_validate_arp(bond, slave, tip, sip);
2819 struct slave *slave, *oldcurrent;
2820 int do_failover = 0;
2821 int delta_in_ticks, extra_ticks;
2827 extra_ticks = delta_in_ticks / 2;
2849 trans_start - delta_in_ticks,
2850 trans_start + delta_in_ticks + extra_ticks) &&
2852 slave->
dev->last_rx - delta_in_ticks,
2853 slave->
dev->last_rx + delta_in_ticks + extra_ticks)) {
2856 bond_set_active_slave(slave);
2864 pr_info(
"%s: link status definitely up for interface %s, ",
2869 pr_info(
"%s: interface %s is now up\n",
2882 trans_start - delta_in_ticks,
2883 trans_start + 2 * delta_in_ticks + extra_ticks) ||
2885 slave->
dev->last_rx - delta_in_ticks,
2886 slave->
dev->last_rx + 2 * delta_in_ticks + extra_ticks)) {
2889 bond_set_backup_slave(slave);
2894 pr_info(
"%s: interface %s is now down.\n",
2898 if (slave == oldcurrent)
2911 bond_arp_send_all(bond, slave);
2925 if (bond->
params.arp_interval)
2939 static int bond_ab_arp_inspect(
struct bonding *bond,
int delta_in_ticks)
2941 struct slave *slave;
2943 unsigned long trans_start;
2951 extra_ticks = delta_in_ticks / 2;
2958 slave_last_rx(bond, slave) - delta_in_ticks,
2959 slave_last_rx(bond, slave) + delta_in_ticks + extra_ticks)) {
2974 slave->
jiffies - delta_in_ticks,
2975 slave->
jiffies + 2 * delta_in_ticks + extra_ticks))
2991 if (!bond_is_active_slave(slave) &&
2994 slave_last_rx(bond, slave) - delta_in_ticks,
2995 slave_last_rx(bond, slave) + 3 * delta_in_ticks + extra_ticks)) {
3008 if (bond_is_active_slave(slave) &&
3010 trans_start - delta_in_ticks,
3011 trans_start + 2 * delta_in_ticks + extra_ticks) ||
3013 slave_last_rx(bond, slave) - delta_in_ticks,
3014 slave_last_rx(bond, slave) + 2 * delta_in_ticks + extra_ticks))) {
3030 static void bond_ab_arp_commit(
struct bonding *bond,
int delta_in_ticks)
3032 struct slave *slave;
3034 unsigned long trans_start;
3045 trans_start - delta_in_ticks,
3046 trans_start + delta_in_ticks + delta_in_ticks / 2)) ||
3050 bond_set_slave_inactive_flags(
3055 pr_info(
"%s: link status definitely up for interface %s.\n",
3056 bond->
dev->name, slave->
dev->name);
3071 bond_set_slave_inactive_flags(slave);
3073 pr_info(
"%s: link status definitely down for interface %s, disabling it\n",
3074 bond->
dev->name, slave->
dev->name);
3084 pr_err(
"%s: impossible: new_link %d on slave %s\n",
3099 bond_set_carrier(bond);
3107 static void bond_ab_arp_probe(
struct bonding *bond)
3109 struct slave *slave;
3115 pr_info(
"PROBE: c_arp %s && cas %s BAD\n",
3144 bond_set_slave_active_flags(slave);
3145 bond_arp_send_all(bond, slave);
3163 bond_set_slave_inactive_flags(slave);
3165 pr_info(
"%s: backup interface %s is now down.\n",
3166 bond->
dev->name, slave->
dev->name);
3175 bool should_notify_peers =
false;
3185 should_notify_peers = bond_should_notify_peers(bond);
3187 if (bond_ab_arp_inspect(bond, delta_in_ticks)) {
3194 should_notify_peers =
false;
3200 bond_ab_arp_commit(bond, delta_in_ticks);
3207 bond_ab_arp_probe(bond);
3210 if (bond->
params.arp_interval)
3215 if (should_notify_peers) {
3232 static int bond_event_changename(
struct bonding *bond)
3242 static int bond_master_netdev_event(
unsigned long event,
3245 struct bonding *event_bond = netdev_priv(bond_dev);
3249 return bond_event_changename(event_bond);
3263 static int bond_slave_netdev_event(
unsigned long event,
3267 struct bonding *bond = netdev_priv(bond_dev);
3268 struct slave *slave =
NULL;
3274 bond_release_and_destroy(bond_dev, slave_dev);
3281 slave = bond_get_slave_by_dev(bond, slave_dev);
3286 bond_update_speed_duplex(slave);
3289 if (old_speed != slave->
speed)
3291 if (old_duplex != slave->
duplex)
3322 bond_compute_features(bond);
3340 unsigned long event,
void *
ptr)
3344 pr_debug(
"event_dev: %s, event: %lx\n",
3345 event_dev ? event_dev->
name :
"None",
3353 return bond_master_netdev_event(event, event_dev);
3358 return bond_slave_netdev_event(event, event_dev);
3365 .notifier_call = bond_netdev_event,
3373 static int bond_xmit_hash_policy_l2(
struct sk_buff *skb,
int count)
3387 static int bond_xmit_hash_policy_l23(
struct sk_buff *skb,
int count)
3396 skb_network_header_len(skb) >=
sizeof(*iph)) {
3398 return ((
ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
3401 skb_network_header_len(skb) >=
sizeof(*ipv6h)) {
3402 ipv6h = ipv6_hdr(skb);
3403 s = &ipv6h->saddr.s6_addr32[0];
3404 d = &ipv6h->daddr.s6_addr32[0];
3405 v6hash = (s[1] ^
d[1]) ^ (s[2] ^
d[2]) ^ (s[3] ^ d[3]);
3406 v6hash ^= (v6hash >> 24) ^ (v6hash >> 16) ^ (v6hash >> 8);
3410 return bond_xmit_hash_policy_l2(skb, count);
3418 static int bond_xmit_hash_policy_l34(
struct sk_buff *skb,
int count)
3427 skb_network_header_len(skb) >=
sizeof(*iph)) {
3429 if (!ip_is_fragment(iph) &&
3432 (skb_headlen(skb) - skb_network_offset(skb) >=
3433 iph->ihl *
sizeof(
u32) +
sizeof(*layer4hdr) * 2)) {
3434 layer4hdr = (
__be16 *)((
u32 *)iph + iph->ihl);
3435 layer4_xor =
ntohs(*layer4hdr ^ *(layer4hdr + 1));
3437 return (layer4_xor ^
3440 skb_network_header_len(skb) >=
sizeof(*ipv6h)) {
3441 ipv6h = ipv6_hdr(skb);
3444 (skb_headlen(skb) - skb_network_offset(skb) >=
3445 sizeof(*ipv6h) +
sizeof(*layer4hdr) * 2)) {
3446 layer4hdr = (
__be16 *)(ipv6h + 1);
3447 layer4_xor =
ntohs(*layer4hdr ^ *(layer4hdr + 1));
3449 s = &ipv6h->
saddr.s6_addr32[0];
3450 d = &ipv6h->
daddr.s6_addr32[0];
3451 layer4_xor ^= (s[1] ^ d[1]) ^ (s[2] ^ d[2]) ^ (s[3] ^ d[3]);
3452 layer4_xor ^= (layer4_xor >> 24) ^ (layer4_xor >> 16) ^
3454 return layer4_xor %
count;
3457 return bond_xmit_hash_policy_l2(skb, count);
3462 static void bond_work_init_all(
struct bonding *bond)
3465 bond_resend_igmp_join_requests_delayed);
3475 static void bond_work_cancel_all(
struct bonding *bond)
3484 static int bond_open(
struct net_device *bond_dev)
3486 struct bonding *bond = netdev_priv(bond_dev);
3487 struct slave *slave;
3497 bond_set_slave_inactive_flags(slave);
3499 bond_set_slave_active_flags(slave);
3506 bond_work_init_all(bond);
3508 if (bond_is_lb(bond)) {
3520 if (bond->
params.arp_interval) {
3522 if (bond->
params.arp_validate)
3536 static int bond_close(
struct net_device *bond_dev)
3538 struct bonding *bond = netdev_priv(bond_dev);
3544 bond_work_cancel_all(bond);
3545 if (bond_is_lb(bond)) {
3559 struct bonding *bond = netdev_priv(bond_dev);
3561 struct slave *slave;
3564 memset(stats, 0,
sizeof(*stats));
3614 pr_debug(
"bond_ioctl: master=%s, cmd=%d\n", bond_dev->
name, cmd);
3635 struct bonding *bond = netdev_priv(bond_dev);
3639 if (netif_carrier_ok(bond->
dev))
3654 res = bond_info_query(bond_dev, &k_binfo);
3667 res = bond_slave_info_query(bond_dev, &k_sinfo);
3683 pr_debug(
"slave_dev=%p:\n", slave_dev);
3700 res = bond_sethwaddr(bond_dev, slave_dev);
3704 res = bond_ioctl_change_active(bond_dev, slave_dev);
3716 static bool bond_addr_in_mc_list(
unsigned char *addr,
3723 if (!
memcmp(ha->addr, addr, addrlen))
3731 struct bonding *bond = netdev_priv(bond_dev);
3734 bond_set_promiscuity(bond,
3735 bond_dev->flags & IFF_PROMISC ? 1 : -1);
3738 bond_set_allmulti(bond,
3739 bond_dev->flags & IFF_ALLMULTI ? 1 : -1);
3742 static void bond_set_multicast_list(
struct net_device *bond_dev)
3744 struct bonding *bond = netdev_priv(bond_dev);
3752 found = bond_addr_in_mc_list(ha->
addr, &bond->
mc_list,
3755 bond_mc_add(bond, ha->
addr);
3760 found = bond_addr_in_mc_list(ha->
addr, &bond_dev->
mc,
3763 bond_mc_del(bond, ha->
addr);
3774 static int bond_neigh_init(
struct neighbour *
n)
3785 slave_ops = slave->
dev->netdev_ops;
3802 n->
parms->neigh_cleanup =
parms.neigh_cleanup;
3804 if (!
parms.neigh_setup)
3807 return parms.neigh_setup(n);
3815 static int bond_neigh_setup(
struct net_device *dev,
3826 static int bond_change_mtu(
struct net_device *bond_dev,
int new_mtu)
3828 struct bonding *bond = netdev_priv(bond_dev);
3829 struct slave *slave, *stop_at;
3833 pr_debug(
"bond=%p, name=%s, new_mtu=%d\n", bond,
3834 (bond_dev ? bond_dev->
name :
"None"), new_mtu);
3855 slave->
dev->netdev_ops->ndo_change_mtu);
3873 bond_dev->
mtu = new_mtu;
3886 tmp_res, slave->
dev->name);
3900 static int bond_set_mac_address(
struct net_device *bond_dev,
void *addr)
3902 struct bonding *bond = netdev_priv(bond_dev);
3904 struct slave *slave, *stop_at;
3913 bond, bond_dev ? bond_dev->
name :
"None");
3922 if (!is_valid_ether_addr(sa->
sa_data))
3942 pr_debug(
"slave %p %s\n", slave, slave->
dev->name);
3969 tmp_sa.sa_family = bond_dev->
type;
3979 tmp_res, slave->
dev->name);
3986 static int bond_xmit_roundrobin(
struct sk_buff *skb,
struct net_device *bond_dev)
3988 struct bonding *bond = netdev_priv(bond_dev);
3989 struct slave *slave, *start_at;
3990 int i, slave_no, res = 1;
3991 struct iphdr *iph = ip_hdr(skb);
4028 bond_is_active_slave(slave)) {
4048 static int bond_xmit_activebackup(
struct sk_buff *skb,
struct net_device *bond_dev)
4050 struct bonding *bond = netdev_priv(bond_dev);
4075 struct bonding *bond = netdev_priv(bond_dev);
4076 struct slave *slave, *start_at;
4094 bond_is_active_slave(slave)) {
4111 static int bond_xmit_broadcast(
struct sk_buff *skb,
struct net_device *bond_dev)
4113 struct bonding *bond = netdev_priv(bond_dev);
4114 struct slave *slave, *start_at;
4129 bond_is_active_slave(slave)) {
4133 pr_err(
"%s: Error: bond_xmit_broadcast(): skb_clone() failed\n",
4144 tx_dev = slave->
dev;
4162 static void bond_set_xmit_hash_policy(
struct bonding *bond)
4164 switch (bond->
params.xmit_policy) {
4181 static inline int bond_slave_override(
struct bonding *bond,
4185 struct slave *slave =
NULL;
4186 struct slave *check_slave;
4194 slave = check_slave;
4217 u16 txq = skb_rx_queue_recorded(skb) ? skb_get_rx_queue(skb) : 0;
4234 struct bonding *bond = netdev_priv(dev);
4237 if (!bond_slave_override(bond, skb))
4241 switch (bond->
params.mode) {
4243 return bond_xmit_roundrobin(skb, dev);
4245 return bond_xmit_activebackup(skb, dev);
4247 return bond_xmit_xor(skb, dev);
4249 return bond_xmit_broadcast(skb, dev);
4257 pr_err(
"%s: Error: Unknown bonding mode %d\n",
4267 struct bonding *bond = netdev_priv(dev);
4280 ret = __bond_start_xmit(skb, dev);
4302 bond_set_xmit_hash_policy(bond);
4307 bond_set_xmit_hash_policy(bond);
4315 pr_err(
"%s: Error: Unknown bonding mode %d\n",
4316 bond_dev->
name, mode);
4321 static void bond_ethtool_get_drvinfo(
struct net_device *bond_dev,
4329 static const struct ethtool_ops bond_ethtool_ops = {
4330 .get_drvinfo = bond_ethtool_get_drvinfo,
4335 .ndo_init = bond_init,
4336 .ndo_uninit = bond_uninit,
4337 .ndo_open = bond_open,
4338 .ndo_stop = bond_close,
4339 .ndo_start_xmit = bond_start_xmit,
4340 .ndo_select_queue = bond_select_queue,
4341 .ndo_get_stats64 = bond_get_stats,
4342 .ndo_do_ioctl = bond_do_ioctl,
4343 .ndo_change_rx_flags = bond_change_rx_flags,
4344 .ndo_set_rx_mode = bond_set_multicast_list,
4345 .ndo_change_mtu = bond_change_mtu,
4346 .ndo_set_mac_address = bond_set_mac_address,
4347 .ndo_neigh_setup = bond_neigh_setup,
4348 .ndo_vlan_rx_add_vid = bond_vlan_rx_add_vid,
4349 .ndo_vlan_rx_kill_vid = bond_vlan_rx_kill_vid,
4350 #ifdef CONFIG_NET_POLL_CONTROLLER
4351 .ndo_netpoll_setup = bond_netpoll_setup,
4352 .ndo_netpoll_cleanup = bond_netpoll_cleanup,
4353 .ndo_poll_controller = bond_poll_controller,
4357 .ndo_fix_features = bond_fix_features,
4360 static void bond_destructor(
struct net_device *bond_dev)
4362 struct bonding *bond = netdev_priv(bond_dev);
4368 static void bond_setup(
struct net_device *bond_dev)
4370 struct bonding *bond = netdev_priv(bond_dev);
4376 bond->
params = bonding_defaults;
4379 bond->
dev = bond_dev;
4427 static void bond_uninit(
struct net_device *bond_dev)
4429 struct bonding *bond = netdev_priv(bond_dev);
4432 bond_netpoll_cleanup(bond_dev);
4435 bond_release_all(bond_dev);
4439 bond_work_cancel_all(bond);
4461 int modeint = -1,
i, rv;
4464 for (p = (
char *)buf; *
p; p++)
4469 rv =
sscanf(buf,
"%20s", modestr);
4471 rv =
sscanf(buf,
"%d", &modeint);
4477 if (modeint == tbl[i].
mode)
4479 if (
strcmp(modestr, tbl[i].modename) == 0)
4488 int arp_validate_value, fail_over_mac_value, primary_reselect_value;
4495 if (bond_mode == -1) {
4496 pr_err(
"Error: Invalid bonding mode \"%s\"\n",
4502 if (xmit_hash_policy) {
4505 pr_info(
"xmit_hash_policy param is irrelevant in mode %s\n",
4510 if (xmit_hashtype == -1) {
4511 pr_err(
"Error: Invalid xmit_hash_policy \"%s\"\n",
4512 xmit_hash_policy ==
NULL ?
"NULL" :
4521 pr_info(
"lacp_rate param is irrelevant in mode %s\n",
4525 if (lacp_fast == -1) {
4526 pr_err(
"Error: Invalid lacp rate \"%s\"\n",
4527 lacp_rate ==
NULL ?
"NULL" : lacp_rate);
4536 pr_err(
"Error: Invalid ad_select \"%s\"\n",
4537 ad_select ==
NULL ?
"NULL" : ad_select);
4542 pr_warning(
"ad_select param only affects 802.3ad mode\n");
4548 if (max_bonds < 0) {
4549 pr_warning(
"Warning: max_bonds (%d) not in range %d-%d, so it was reset to BOND_DEFAULT_MAX_BONDS (%d)\n",
4555 pr_warning(
"Warning: miimon module parameter (%d), not in range 0-%d, so it was reset to %d\n",
4561 pr_warning(
"Warning: updelay module parameter (%d), not in range 0-%d, so it was reset to 0\n",
4566 if (downdelay < 0) {
4567 pr_warning(
"Warning: downdelay module parameter (%d), not in range 0-%d, so it was reset to 0\n",
4572 if ((use_carrier != 0) && (use_carrier != 1)) {
4573 pr_warning(
"Warning: use_carrier module parameter (%d), not of valid value (0/1), so it was set to 1\n",
4578 if (num_peer_notif < 0 || num_peer_notif > 255) {
4579 pr_warning(
"Warning: num_grat_arp/num_unsol_na (%d) not in range 0-255 so it was reset to 1\n",
4587 pr_warning(
"Warning: miimon must be specified, otherwise bonding will not detect link failure, speed and duplex which are essential for 802.3ad operation\n");
4593 if (tx_queues < 1 || tx_queues > 255) {
4594 pr_warning(
"Warning: tx_queues (%d) should be between "
4595 "1 and 255, resetting to %d\n",
4600 if ((all_slaves_active != 0) && (all_slaves_active != 1)) {
4601 pr_warning(
"Warning: all_slaves_active module parameter (%d), "
4602 "not of valid value (0/1), so it was set to "
4603 "0\n", all_slaves_active);
4604 all_slaves_active = 0;
4607 if (resend_igmp < 0 || resend_igmp > 255) {
4608 pr_warning(
"Warning: resend_igmp (%d) should be between "
4609 "0 and 255, resetting to %d\n",
4618 pr_warning(
"Warning: miimon must be specified, otherwise bonding will not detect link failure and link speed which are essential for TLB/ALB load balancing\n");
4625 pr_notice(
"In ALB mode you might experience client disconnections upon reconnection of a link if the bonding module updelay parameter (%d msec) is incompatible with the forwarding delay time of the switch\n",
4630 if (updelay || downdelay) {
4634 pr_warning(
"Warning: miimon module parameter not set and updelay (%d) or downdelay (%d) module parameter is set; updelay and downdelay have no effect unless miimon is set\n",
4635 updelay, downdelay);
4640 pr_warning(
"Warning: miimon (%d) and arp_interval (%d) can't be used simultaneously, disabling ARP monitoring\n",
4641 miimon, arp_interval);
4645 if ((updelay % miimon) != 0) {
4646 pr_warning(
"Warning: updelay (%d) is not a multiple of miimon (%d), updelay rounded to %d ms\n",
4648 (updelay / miimon) * miimon);
4653 if ((downdelay % miimon) != 0) {
4654 pr_warning(
"Warning: downdelay (%d) is not a multiple of miimon (%d), downdelay rounded to %d ms\n",
4656 (downdelay / miimon) * miimon);
4659 downdelay /= miimon;
4662 if (arp_interval < 0) {
4663 pr_warning(
"Warning: arp_interval module parameter (%d) , not in range 0-%d, so it was reset to %d\n",
4668 for (arp_ip_count = 0;
4674 if (!
isdigit(arp_ip_target[arp_ip_count][0]) ||
4676 pr_warning(
"Warning: bad arp_ip_target module parameter (%s), ARP monitoring will not be performed\n",
4677 arp_ip_target[arp_ip_count]);
4680 arp_target[arp_ip_count] =
ip;
4684 if (arp_interval && !arp_ip_count) {
4686 pr_warning(
"Warning: arp_interval module parameter (%d) specified without providing an arp_ip_target parameter, arp_interval was reset to 0\n",
4693 pr_err(
"arp_validate only supported in active-backup mode\n");
4696 if (!arp_interval) {
4697 pr_err(
"arp_validate requires arp_interval\n");
4703 if (arp_validate_value == -1) {
4704 pr_err(
"Error: invalid arp_validate \"%s\"\n",
4705 arp_validate ==
NULL ?
"NULL" : arp_validate);
4709 arp_validate_value = 0;
4712 pr_info(
"MII link monitoring set to %d ms\n", miimon);
4713 }
else if (arp_interval) {
4716 pr_info(
"ARP monitoring set to %d ms, validate %s, with %d target(s):",
4718 arp_validate_tbl[arp_validate_value].modename,
4721 for (i = 0; i < arp_ip_count; i++)
4722 pr_info(
" %s", arp_ip_target[i]);
4726 }
else if (max_bonds) {
4730 pr_debug(
"Warning: either miimon or arp_interval and arp_ip_target module parameters must be specified, otherwise bonding will not detect link failures! see bonding.txt for details.\n");
4737 pr_warning(
"Warning: %s primary device specified but has no effect in %s mode\n",
4742 if (
primary && primary_reselect) {
4745 if (primary_reselect_value == -1) {
4746 pr_err(
"Error: Invalid primary_reselect \"%s\"\n",
4748 NULL ?
"NULL" : primary_reselect);
4755 if (fail_over_mac) {
4758 if (fail_over_mac_value == -1) {
4759 pr_err(
"Error: invalid fail_over_mac \"%s\"\n",
4760 arp_validate ==
NULL ?
"NULL" : arp_validate);
4765 pr_warning(
"Warning: fail_over_mac only affects active-backup mode.\n");
4771 params->
mode = bond_mode;
4803 static void bond_set_lockdep_class_one(
struct net_device *dev,
4808 &bonding_netdev_xmit_lock_key);
4811 static void bond_set_lockdep_class(
struct net_device *dev)
4814 &bonding_netdev_addr_lock_key);
4815 netdev_for_each_tx_queue(dev, bond_set_lockdep_class_one,
NULL);
4822 static int bond_init(
struct net_device *bond_dev)
4824 struct bonding *bond = netdev_priv(bond_dev);
4843 bond_set_lockdep_class(bond_dev);
4855 static int bond_validate(
struct nlattr *
tb[],
struct nlattr *data[])
4858 if (nla_len(tb[IFLA_ADDRESS]) !=
ETH_ALEN)
4860 if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
4866 static unsigned int bond_get_num_tx_queues(
void)
4873 .priv_size =
sizeof(
struct bonding),
4874 .
setup = bond_setup,
4875 .validate = bond_validate,
4876 .get_num_tx_queues = bond_get_num_tx_queues,
4877 .get_num_rx_queues = bond_get_num_tx_queues,
4894 name ? name :
"bond%d",
4895 bond_setup, tx_queues);
4897 pr_err(
"%s: eek! can't alloc netdev!\n", name);
4902 dev_net_set(bond_dev, net);
4911 bond_destructor(bond_dev);
4937 .init = bond_net_init,
4938 .exit = bond_net_exit,
4943 static int __init bonding_init(
void)
4950 res = bond_check_params(&bonding_defaults);
4964 for (i = 0; i < max_bonds; i++) {
4981 static void __exit bonding_exit(
void)
4990 #ifdef CONFIG_NET_POLL_CONTROLLER