H A D | bond_main.c | 212 static int bond_init(struct net_device *bond_dev); 213 static void bond_uninit(struct net_device *bond_dev); 214 static struct rtnl_link_stats64 *bond_get_stats(struct net_device *bond_dev, 282 * @bond_dev: bonding net device that got called 285 static int bond_vlan_rx_add_vid(struct net_device *bond_dev, bond_vlan_rx_add_vid() argument 288 struct bonding *bond = netdev_priv(bond_dev); bond_vlan_rx_add_vid() 315 * @bond_dev: bonding net device that got called 318 static int bond_vlan_rx_kill_vid(struct net_device *bond_dev, bond_vlan_rx_kill_vid() argument 321 struct bonding *bond = netdev_priv(bond_dev); bond_vlan_rx_kill_vid() 562 static void bond_hw_addr_flush(struct net_device *bond_dev, bond_hw_addr_flush() argument 565 struct bonding *bond = netdev_priv(bond_dev); bond_hw_addr_flush() 567 dev_uc_unsync(slave_dev, bond_dev); bond_hw_addr_flush() 568 dev_mc_unsync(slave_dev, bond_dev); bond_hw_addr_flush() 615 * @bond_dev: bond net device 620 static void bond_set_dev_addr(struct net_device *bond_dev, bond_set_dev_addr() argument 623 netdev_dbg(bond_dev, "bond_dev=%p slave_dev=%p slave_dev->addr_len=%d\n", bond_set_dev_addr() 624 bond_dev, slave_dev, slave_dev->addr_len); bond_set_dev_addr() 625 memcpy(bond_dev->dev_addr, slave_dev->dev_addr, slave_dev->addr_len); bond_set_dev_addr() 626 bond_dev->addr_assign_type = NET_ADDR_STOLEN; bond_set_dev_addr() 627 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond_dev); bond_set_dev_addr() 971 static void bond_poll_controller(struct net_device *bond_dev) bond_poll_controller() argument 973 struct bonding *bond = netdev_priv(bond_dev); bond_poll_controller() 1006 static void bond_netpoll_cleanup(struct net_device *bond_dev) bond_netpoll_cleanup() argument 1008 struct bonding *bond = netdev_priv(bond_dev); bond_netpoll_cleanup() 1041 static void bond_netpoll_cleanup(struct net_device *bond_dev) bond_netpoll_cleanup() argument 1084 struct net_device *bond_dev = bond->dev; bond_compute_features() local 1111 bond_dev->vlan_features = vlan_features; 1112 bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL; 1113 bond_dev->hard_header_len = max_hard_header_len; 1114 bond_dev->gso_max_segs = gso_max_segs; 1115 netif_set_gso_max_size(bond_dev, gso_max_size); 1117 bond_dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; 1118 if ((bond_dev->priv_flags & IFF_XMIT_DST_RELEASE_PERM) && 1120 bond_dev->priv_flags |= IFF_XMIT_DST_RELEASE; 1122 netdev_change_features(bond_dev); 1125 static void bond_setup_by_slave(struct net_device *bond_dev, bond_setup_by_slave() argument 1128 bond_dev->header_ops = slave_dev->header_ops; bond_setup_by_slave() 1130 bond_dev->type = slave_dev->type; bond_setup_by_slave() 1131 bond_dev->hard_header_len = slave_dev->hard_header_len; bond_setup_by_slave() 1132 bond_dev->addr_len = slave_dev->addr_len; bond_setup_by_slave() 1134 memcpy(bond_dev->broadcast, slave_dev->broadcast, bond_setup_by_slave() 1203 static int bond_master_upper_dev_link(struct net_device *bond_dev, bond_master_upper_dev_link() argument 1209 err = netdev_master_upper_dev_link_private(slave_dev, bond_dev, slave); bond_master_upper_dev_link() 1216 static void bond_upper_dev_unlink(struct net_device *bond_dev, bond_upper_dev_unlink() argument 1219 netdev_upper_dev_unlink(slave_dev, bond_dev); bond_upper_dev_unlink() 1304 int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) bond_enslave() argument 1306 struct bonding *bond = netdev_priv(bond_dev); bond_enslave() 1316 netdev_warn(bond_dev, "no link monitoring support for %s\n", bond_enslave() 1322 netdev_dbg(bond_dev, "Error: Device was already enslaved\n"); bond_enslave() 1326 if (bond_dev == slave_dev) { bond_enslave() 1327 netdev_err(bond_dev, "cannot enslave bond to itself.\n"); bond_enslave() 1334 netdev_dbg(bond_dev, "%s is NETIF_F_VLAN_CHALLENGED\n", bond_enslave() 1336 if (vlan_uses_dev(bond_dev)) { bond_enslave() 1337 netdev_err(bond_dev, "Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n", bond_enslave() 1338 slave_dev->name, bond_dev->name); bond_enslave() 1341 netdev_warn(bond_dev, "enslaved VLAN challenged slave %s. Adding VLANs will be blocked as long as %s is part of bond %s\n", bond_enslave() 1343 bond_dev->name); bond_enslave() 1346 netdev_dbg(bond_dev, "%s is !NETIF_F_VLAN_CHALLENGED\n", bond_enslave() 1356 netdev_err(bond_dev, "%s is up - this may be due to an out of date ifenslave\n", bond_enslave() 1370 if (bond_dev->type != slave_dev->type) { bond_enslave() 1371 netdev_dbg(bond_dev, "change device type from %d to %d\n", bond_enslave() 1372 bond_dev->type, slave_dev->type); bond_enslave() 1375 bond_dev); bond_enslave() 1378 netdev_err(bond_dev, "refused to change device type\n"); bond_enslave() 1384 dev_uc_flush(bond_dev); bond_enslave() 1385 dev_mc_flush(bond_dev); bond_enslave() 1388 bond_setup_by_slave(bond_dev, slave_dev); bond_enslave() 1390 ether_setup(bond_dev); bond_enslave() 1391 bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING; bond_enslave() 1395 bond_dev); bond_enslave() 1397 } else if (bond_dev->type != slave_dev->type) { bond_enslave() 1398 netdev_err(bond_dev, "%s ether type (%d) is different from other slaves (%d), can not enslave it\n", bond_enslave() 1399 slave_dev->name, slave_dev->type, bond_dev->type); bond_enslave() 1405 netdev_warn(bond_dev, "The slave device specified does not support setting the MAC address\n"); bond_enslave() 1410 netdev_warn(bond_dev, "Setting fail_over_mac to active for active-backup mode\n"); bond_enslave() 1412 netdev_err(bond_dev, "The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active\n"); bond_enslave() 1445 netdev_dbg(bond_dev, "Error %d calling dev_set_mtu\n", res); bond_enslave() 1460 memcpy(addr.sa_data, bond_dev->dev_addr, bond_dev->addr_len); bond_enslave() 1464 netdev_dbg(bond_dev, "Error %d calling set_mac_address\n", res); bond_enslave() 1475 netdev_dbg(bond_dev, "Opening slave %s failed\n", slave_dev->name); bond_enslave() 1497 if (bond_dev->flags & IFF_PROMISC) { bond_enslave() 1504 if (bond_dev->flags & IFF_ALLMULTI) { bond_enslave() 1510 netif_addr_lock_bh(bond_dev); bond_enslave() 1512 dev_mc_sync_multiple(slave_dev, bond_dev); bond_enslave() 1513 dev_uc_sync_multiple(slave_dev, bond_dev); bond_enslave() 1515 netif_addr_unlock_bh(bond_dev); bond_enslave() 1525 res = vlan_vids_add_by_dev(slave_dev, bond_dev); bond_enslave() 1527 netdev_err(bond_dev, "Couldn't add bond vlan ids to %s\n", bond_enslave() 1556 netdev_warn(bond_dev, "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", bond_enslave() 1560 netdev_warn(bond_dev, "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", bond_enslave() 1589 netdev_dbg(bond_dev, "Initial state of slave_dev is BOND_LINK_%s\n", bond_enslave() 1632 netdev_dbg(bond_dev, "This slave is always active in trunk mode\n"); bond_enslave() 1652 netdev_info(bond_dev, "master_dev is using netpoll, but new slave device does not support netpoll\n"); bond_enslave() 1659 if (!(bond_dev->features & NETIF_F_LRO)) bond_enslave() 1665 netdev_dbg(bond_dev, "Error %d calling netdev_rx_handler_register\n", res); bond_enslave() 1669 res = bond_master_upper_dev_link(bond_dev, slave_dev, new_slave); bond_enslave() 1671 netdev_dbg(bond_dev, "Error %d calling bond_master_upper_dev_link\n", res); bond_enslave() 1677 netdev_dbg(bond_dev, "Error %d calling bond_sysfs_slave_add\n", res); bond_enslave() 1694 netdev_info(bond_dev, "Enslaving %s as %s interface with %s link\n", bond_enslave() 1705 bond_upper_dev_unlink(bond_dev, slave_dev); bond_enslave() 1712 bond_hw_addr_flush(bond_dev, slave_dev); bond_enslave() 1714 vlan_vids_del_by_dev(slave_dev, bond_dev); bond_enslave() 1753 if (ether_addr_equal_64bits(bond_dev->dev_addr, bond_enslave() 1755 eth_hw_addr_random(bond_dev); bond_enslave() 1756 if (bond_dev->type != ARPHRD_ETHER) { bond_enslave() 1757 dev_close(bond_dev); bond_enslave() 1758 ether_setup(bond_dev); bond_enslave() 1759 bond_dev->flags |= IFF_MASTER; bond_enslave() 1760 bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING; bond_enslave() 1778 static int __bond_release_one(struct net_device *bond_dev, __bond_release_one() argument 1782 struct bonding *bond = netdev_priv(bond_dev); __bond_release_one() 1785 int old_flags = bond_dev->flags; __bond_release_one() 1786 netdev_features_t old_features = bond_dev->features; __bond_release_one() 1790 !netdev_has_upper_dev(slave_dev, bond_dev)) { __bond_release_one() 1791 netdev_dbg(bond_dev, "cannot release %s\n", __bond_release_one() 1801 netdev_info(bond_dev, "%s not enslaved\n", __bond_release_one() 1812 bond_upper_dev_unlink(bond_dev, slave_dev); __bond_release_one() 1824 netdev_info(bond_dev, "Releasing %s interface %s\n", __bond_release_one() 1834 if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) && __bond_release_one() 1836 netdev_warn(bond_dev, "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", __bond_release_one() 1838 bond_dev->name, slave_dev->name); __bond_release_one() 1868 eth_hw_addr_random(bond_dev); __bond_release_one() 1881 if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && __bond_release_one() 1883 netdev_info(bond_dev, "last VLAN challenged slave %s left bond %s - VLAN blocking is removed\n", __bond_release_one() 1884 slave_dev->name, bond_dev->name); __bond_release_one() 1886 vlan_vids_del_by_dev(slave_dev, bond_dev); __bond_release_one() 1894 * of the IFF_PROMISC flag in the bond_dev, but we need the __bond_release_one() 1906 bond_hw_addr_flush(bond_dev, slave_dev); __bond_release_one() 1932 int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) bond_release() argument 1934 return __bond_release_one(bond_dev, slave_dev, false); bond_release() 1940 static int bond_release_and_destroy(struct net_device *bond_dev, bond_release_and_destroy() argument 1943 struct bonding *bond = netdev_priv(bond_dev); bond_release_and_destroy() 1946 ret = bond_release(bond_dev, slave_dev); bond_release_and_destroy() 1948 bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; bond_release_and_destroy() 1949 netdev_info(bond_dev, "Destroying bond %s\n", bond_release_and_destroy() 1950 bond_dev->name); bond_release_and_destroy() 1952 unregister_netdevice(bond_dev); bond_release_and_destroy() 1957 static int bond_info_query(struct net_device *bond_dev, struct ifbond *info) bond_info_query() argument 1959 struct bonding *bond = netdev_priv(bond_dev); bond_info_query() 1964 static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *info) bond_slave_info_query() argument 1966 struct bonding *bond = netdev_priv(bond_dev); bond_slave_info_query() 2937 struct net_device *bond_dev) bond_master_netdev_event() 2939 struct bonding *event_bond = netdev_priv(bond_dev); bond_master_netdev_event() 2966 struct net_device *bond_dev; bond_slave_netdev_event() local 2974 bond_dev = slave->bond->dev; bond_slave_netdev_event() 2980 if (bond_dev->type != ARPHRD_ETHER) bond_slave_netdev_event() 2981 bond_release_and_destroy(bond_dev, slave_dev); bond_slave_netdev_event() 2983 bond_release(bond_dev, slave_dev); bond_slave_netdev_event() 3197 static int bond_open(struct net_device *bond_dev) bond_open() argument 3199 struct bonding *bond = netdev_priv(bond_dev); bond_open() 3250 static int bond_close(struct net_device *bond_dev) bond_close() argument 3252 struct bonding *bond = netdev_priv(bond_dev); bond_close() 3287 static struct rtnl_link_stats64 *bond_get_stats(struct net_device *bond_dev, bond_get_stats() argument 3290 struct bonding *bond = netdev_priv(bond_dev); bond_get_stats() 3316 static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd) bond_do_ioctl() argument 3318 struct bonding *bond = netdev_priv(bond_dev); bond_do_ioctl() 3329 netdev_dbg(bond_dev, "bond_ioctl: cmd=%d\n", cmd); bond_do_ioctl() 3361 res = bond_info_query(bond_dev, &k_binfo); bond_do_ioctl() 3374 res = bond_slave_info_query(bond_dev, &k_sinfo); bond_do_ioctl() 3384 net = dev_net(bond_dev); bond_do_ioctl() 3391 netdev_dbg(bond_dev, "slave_dev=%p:\n", slave_dev); bond_do_ioctl() 3396 netdev_dbg(bond_dev, "slave_dev->name=%s:\n", slave_dev->name); bond_do_ioctl() 3400 res = bond_enslave(bond_dev, slave_dev); bond_do_ioctl() 3404 res = bond_release(bond_dev, slave_dev); bond_do_ioctl() 3408 bond_set_dev_addr(bond_dev, slave_dev); bond_do_ioctl() 3423 static void bond_change_rx_flags(struct net_device *bond_dev, int change) bond_change_rx_flags() argument 3425 struct bonding *bond = netdev_priv(bond_dev); bond_change_rx_flags() 3429 bond_dev->flags & IFF_PROMISC ? 1 : -1); bond_change_rx_flags() 3433 bond_dev->flags & IFF_ALLMULTI ? 1 : -1); bond_change_rx_flags() 3436 static void bond_set_rx_mode(struct net_device *bond_dev) bond_set_rx_mode() argument 3438 struct bonding *bond = netdev_priv(bond_dev); bond_set_rx_mode() 3446 dev_uc_sync(slave->dev, bond_dev); bond_set_rx_mode() 3447 dev_mc_sync(slave->dev, bond_dev); bond_set_rx_mode() 3451 dev_uc_sync_multiple(slave->dev, bond_dev); bond_for_each_slave_rcu() 3452 dev_mc_sync_multiple(slave->dev, bond_dev); bond_for_each_slave_rcu() 3511 static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) bond_change_mtu() argument 3513 struct bonding *bond = netdev_priv(bond_dev); bond_change_mtu() 3518 netdev_dbg(bond_dev, "bond=%p, new_mtu=%d\n", bond, new_mtu); bond_change_mtu() 3521 netdev_dbg(bond_dev, "s %p c_m %p\n", bond_for_each_slave() 3535 netdev_dbg(bond_dev, "err %d %s\n", res, bond_for_each_slave() 3541 bond_dev->mtu = new_mtu; 3553 tmp_res = dev_set_mtu(rollback_slave->dev, bond_dev->mtu); bond_for_each_slave() 3555 netdev_dbg(bond_dev, "unwind err %d dev %s\n", bond_for_each_slave() 3569 static int bond_set_mac_address(struct net_device *bond_dev, void *addr) bond_set_mac_address() argument 3571 struct bonding *bond = netdev_priv(bond_dev); bond_set_mac_address() 3578 return bond_alb_set_mac_address(bond_dev, addr); bond_set_mac_address() 3581 netdev_dbg(bond_dev, "bond=%p\n", bond); bond_set_mac_address() 3594 netdev_dbg(bond_dev, "slave %p %s\n", slave, slave->dev->name); bond_for_each_slave() 3603 netdev_dbg(bond_dev, "err %d %s\n", res, slave->dev->name); bond_for_each_slave() 3609 memcpy(bond_dev->dev_addr, sa->sa_data, bond_dev->addr_len); 3613 memcpy(tmp_sa.sa_data, bond_dev->dev_addr, bond_dev->addr_len); 3614 tmp_sa.sa_family = bond_dev->type; 3625 netdev_dbg(bond_dev, "unwind err %d dev %s\n", bond_for_each_slave() 3706 static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev) bond_xmit_roundrobin() argument 3708 struct bonding *bond = netdev_priv(bond_dev); bond_xmit_roundrobin() 3732 bond_tx_drop(bond_dev, skb); bond_xmit_roundrobin() 3742 static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_dev) bond_xmit_activebackup() argument 3744 struct bonding *bond = netdev_priv(bond_dev); bond_xmit_activebackup() 3751 bond_tx_drop(bond_dev, skb); bond_xmit_activebackup() 3900 static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev) bond_xmit_broadcast() argument 3902 struct bonding *bond = netdev_priv(bond_dev); bond_xmit_broadcast() 3914 bond_dev->name, __func__); bond_for_each_slave_rcu() 3923 bond_tx_drop(bond_dev, skb); 4030 static int bond_ethtool_get_settings(struct net_device *bond_dev, bond_ethtool_get_settings() argument 4033 struct bonding *bond = netdev_priv(bond_dev); bond_ethtool_get_settings() 4060 static void bond_ethtool_get_drvinfo(struct net_device *bond_dev, bond_ethtool_get_drvinfo() argument 4112 static void bond_destructor(struct net_device *bond_dev) bond_destructor() argument 4114 struct bonding *bond = netdev_priv(bond_dev); bond_destructor() 4117 free_netdev(bond_dev); bond_destructor() 4120 void bond_setup(struct net_device *bond_dev) bond_setup() argument 4122 struct bonding *bond = netdev_priv(bond_dev); bond_setup() 4129 bond->dev = bond_dev; bond_setup() 4132 ether_setup(bond_dev); bond_setup() 4133 bond_dev->netdev_ops = &bond_netdev_ops; bond_setup() 4134 bond_dev->ethtool_ops = &bond_ethtool_ops; bond_setup() 4136 bond_dev->destructor = bond_destructor; bond_setup() 4138 SET_NETDEV_DEVTYPE(bond_dev, &bond_type); bond_setup() 4141 bond_dev->flags |= IFF_MASTER|IFF_MULTICAST; bond_setup() 4142 bond_dev->priv_flags |= IFF_BONDING | IFF_UNICAST_FLT | IFF_NO_QUEUE; bond_setup() 4143 bond_dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); bond_setup() 4146 bond_dev->features |= NETIF_F_LLTX; bond_setup() 4156 bond_dev->features |= NETIF_F_NETNS_LOCAL; bond_setup() 4158 bond_dev->hw_features = BOND_VLAN_FEATURES | bond_setup() 4163 bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); bond_setup() 4164 bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL; bond_setup() 4165 bond_dev->features |= bond_dev->hw_features; bond_setup() 4171 static void bond_uninit(struct net_device *bond_dev) bond_uninit() argument 4173 struct bonding *bond = netdev_priv(bond_dev); bond_uninit() 4178 bond_netpoll_cleanup(bond_dev); bond_uninit() 4182 __bond_release_one(bond_dev, slave->dev, true); bond_uninit() 4183 netdev_info(bond_dev, "Released all slaves\n"); bond_uninit() 4591 static int bond_init(struct net_device *bond_dev) bond_init() argument 4593 struct bonding *bond = netdev_priv(bond_dev); bond_init() 4594 struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id); bond_init() 4596 netdev_dbg(bond_dev, "Begin bond_init\n"); bond_init() 4598 bond->wq = create_singlethread_workqueue(bond_dev->name); bond_init() 4602 bond_set_lockdep_class(bond_dev); bond_init() 4611 if (is_zero_ether_addr(bond_dev->dev_addr) && bond_init() 4612 bond_dev->addr_assign_type == NET_ADDR_PERM) bond_init() 4613 eth_hw_addr_random(bond_dev); bond_init() 4630 struct net_device *bond_dev; bond_create() local 4637 bond_dev = alloc_netdev_mq(sizeof(struct bonding), bond_create() 4640 if (!bond_dev) { bond_create() 4650 bond = netdev_priv(bond_dev); bond_create() 4654 dev_net_set(bond_dev, net); bond_create() 4655 bond_dev->rtnl_link_ops = &bond_link_ops; bond_create() 4657 res = register_netdevice(bond_dev); bond_create() 4659 netif_carrier_off(bond_dev); bond_create() 4663 bond_destructor(bond_dev); bond_create() 2936 bond_master_netdev_event(unsigned long event, struct net_device *bond_dev) bond_master_netdev_event() argument
|