Lines Matching refs:bond_dev
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,
285 static int bond_vlan_rx_add_vid(struct net_device *bond_dev, in bond_vlan_rx_add_vid() argument
288 struct bonding *bond = netdev_priv(bond_dev); in bond_vlan_rx_add_vid()
318 static int bond_vlan_rx_kill_vid(struct net_device *bond_dev, in bond_vlan_rx_kill_vid() argument
321 struct bonding *bond = netdev_priv(bond_dev); in bond_vlan_rx_kill_vid()
562 static void bond_hw_addr_flush(struct net_device *bond_dev, in bond_hw_addr_flush() argument
565 struct bonding *bond = netdev_priv(bond_dev); in bond_hw_addr_flush()
567 dev_uc_unsync(slave_dev, bond_dev); in bond_hw_addr_flush()
568 dev_mc_unsync(slave_dev, bond_dev); in bond_hw_addr_flush()
620 static void bond_set_dev_addr(struct net_device *bond_dev, in bond_set_dev_addr() argument
623 netdev_dbg(bond_dev, "bond_dev=%p slave_dev=%p slave_dev->addr_len=%d\n", in bond_set_dev_addr()
624 bond_dev, slave_dev, slave_dev->addr_len); in bond_set_dev_addr()
625 memcpy(bond_dev->dev_addr, slave_dev->dev_addr, slave_dev->addr_len); in bond_set_dev_addr()
626 bond_dev->addr_assign_type = NET_ADDR_STOLEN; in bond_set_dev_addr()
627 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond_dev); in bond_set_dev_addr()
953 static void bond_poll_controller(struct net_device *bond_dev) in bond_poll_controller() argument
955 struct bonding *bond = netdev_priv(bond_dev); in bond_poll_controller()
990 static void bond_netpoll_cleanup(struct net_device *bond_dev) in bond_netpoll_cleanup() argument
992 struct bonding *bond = netdev_priv(bond_dev); in bond_netpoll_cleanup()
1025 static void bond_netpoll_cleanup(struct net_device *bond_dev) in bond_netpoll_cleanup() argument
1071 struct net_device *bond_dev = bond->dev; in bond_compute_features() local
1098 bond_dev->vlan_features = vlan_features; in bond_compute_features()
1099 bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL; in bond_compute_features()
1100 bond_dev->hard_header_len = max_hard_header_len; in bond_compute_features()
1101 bond_dev->gso_max_segs = gso_max_segs; in bond_compute_features()
1102 netif_set_gso_max_size(bond_dev, gso_max_size); in bond_compute_features()
1104 bond_dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; in bond_compute_features()
1105 if ((bond_dev->priv_flags & IFF_XMIT_DST_RELEASE_PERM) && in bond_compute_features()
1107 bond_dev->priv_flags |= IFF_XMIT_DST_RELEASE; in bond_compute_features()
1109 netdev_change_features(bond_dev); in bond_compute_features()
1112 static void bond_setup_by_slave(struct net_device *bond_dev, in bond_setup_by_slave() argument
1115 bond_dev->header_ops = slave_dev->header_ops; in bond_setup_by_slave()
1117 bond_dev->type = slave_dev->type; in bond_setup_by_slave()
1118 bond_dev->hard_header_len = slave_dev->hard_header_len; in bond_setup_by_slave()
1119 bond_dev->addr_len = slave_dev->addr_len; in bond_setup_by_slave()
1121 memcpy(bond_dev->broadcast, slave_dev->broadcast, in bond_setup_by_slave()
1190 static int bond_master_upper_dev_link(struct net_device *bond_dev, in bond_master_upper_dev_link() argument
1196 err = netdev_master_upper_dev_link_private(slave_dev, bond_dev, slave); in bond_master_upper_dev_link()
1203 static void bond_upper_dev_unlink(struct net_device *bond_dev, in bond_upper_dev_unlink() argument
1206 netdev_upper_dev_unlink(slave_dev, bond_dev); in bond_upper_dev_unlink()
1291 int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) in bond_enslave() argument
1293 struct bonding *bond = netdev_priv(bond_dev); in bond_enslave()
1303 netdev_warn(bond_dev, "no link monitoring support for %s\n", in bond_enslave()
1309 netdev_dbg(bond_dev, "Error: Device was already enslaved\n"); in bond_enslave()
1313 if (bond_dev == slave_dev) { in bond_enslave()
1314 netdev_err(bond_dev, "cannot enslave bond to itself.\n"); in bond_enslave()
1321 netdev_dbg(bond_dev, "%s is NETIF_F_VLAN_CHALLENGED\n", in bond_enslave()
1323 if (vlan_uses_dev(bond_dev)) { in bond_enslave()
1324 netdev_err(bond_dev, "Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n", in bond_enslave()
1325 slave_dev->name, bond_dev->name); in bond_enslave()
1328 …netdev_warn(bond_dev, "enslaved VLAN challenged slave %s. Adding VLANs will be blocked as long as … in bond_enslave()
1330 bond_dev->name); in bond_enslave()
1333 netdev_dbg(bond_dev, "%s is !NETIF_F_VLAN_CHALLENGED\n", in bond_enslave()
1343 netdev_err(bond_dev, "%s is up - this may be due to an out of date ifenslave\n", in bond_enslave()
1357 if (bond_dev->type != slave_dev->type) { in bond_enslave()
1358 netdev_dbg(bond_dev, "change device type from %d to %d\n", in bond_enslave()
1359 bond_dev->type, slave_dev->type); in bond_enslave()
1362 bond_dev); in bond_enslave()
1365 netdev_err(bond_dev, "refused to change device type\n"); in bond_enslave()
1371 dev_uc_flush(bond_dev); in bond_enslave()
1372 dev_mc_flush(bond_dev); in bond_enslave()
1375 bond_setup_by_slave(bond_dev, slave_dev); in bond_enslave()
1377 ether_setup(bond_dev); in bond_enslave()
1378 bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING; in bond_enslave()
1382 bond_dev); in bond_enslave()
1384 } else if (bond_dev->type != slave_dev->type) { in bond_enslave()
1385 …netdev_err(bond_dev, "%s ether type (%d) is different from other slaves (%d), can not enslave it\n… in bond_enslave()
1386 slave_dev->name, slave_dev->type, bond_dev->type); in bond_enslave()
1392 netdev_warn(bond_dev, "The slave device specified does not support setting the MAC address\n"); in bond_enslave()
1397 netdev_warn(bond_dev, "Setting fail_over_mac to active for active-backup mode\n"); in bond_enslave()
1399 …netdev_err(bond_dev, "The slave device specified does not support setting the MAC address, but fai… in bond_enslave()
1432 netdev_dbg(bond_dev, "Error %d calling dev_set_mtu\n", res); in bond_enslave()
1447 memcpy(addr.sa_data, bond_dev->dev_addr, bond_dev->addr_len); in bond_enslave()
1451 netdev_dbg(bond_dev, "Error %d calling set_mac_address\n", res); in bond_enslave()
1462 netdev_dbg(bond_dev, "Opening slave %s failed\n", slave_dev->name); in bond_enslave()
1484 if (bond_dev->flags & IFF_PROMISC) { in bond_enslave()
1491 if (bond_dev->flags & IFF_ALLMULTI) { in bond_enslave()
1497 netif_addr_lock_bh(bond_dev); in bond_enslave()
1499 dev_mc_sync_multiple(slave_dev, bond_dev); in bond_enslave()
1500 dev_uc_sync_multiple(slave_dev, bond_dev); in bond_enslave()
1502 netif_addr_unlock_bh(bond_dev); in bond_enslave()
1512 res = vlan_vids_add_by_dev(slave_dev, bond_dev); in bond_enslave()
1514 netdev_err(bond_dev, "Couldn't add bond vlan ids to %s\n", in bond_enslave()
1543 …netdev_warn(bond_dev, "MII and ETHTOOL support not available for interface %s, and arp_interval/ar… in bond_enslave()
1547 …netdev_warn(bond_dev, "can't get link status from interface %s; the network driver associated with… in bond_enslave()
1576 netdev_dbg(bond_dev, "Initial state of slave_dev is BOND_LINK_%s\n", in bond_enslave()
1619 netdev_dbg(bond_dev, "This slave is always active in trunk mode\n"); in bond_enslave()
1639 …netdev_info(bond_dev, "master_dev is using netpoll, but new slave device does not support netpoll\… in bond_enslave()
1646 if (!(bond_dev->features & NETIF_F_LRO)) in bond_enslave()
1652 netdev_dbg(bond_dev, "Error %d calling netdev_rx_handler_register\n", res); in bond_enslave()
1656 res = bond_master_upper_dev_link(bond_dev, slave_dev, new_slave); in bond_enslave()
1658 netdev_dbg(bond_dev, "Error %d calling bond_master_upper_dev_link\n", res); in bond_enslave()
1664 netdev_dbg(bond_dev, "Error %d calling bond_sysfs_slave_add\n", res); in bond_enslave()
1681 netdev_info(bond_dev, "Enslaving %s as %s interface with %s link\n", in bond_enslave()
1692 bond_upper_dev_unlink(bond_dev, slave_dev); in bond_enslave()
1699 bond_hw_addr_flush(bond_dev, slave_dev); in bond_enslave()
1701 vlan_vids_del_by_dev(slave_dev, bond_dev); in bond_enslave()
1740 ether_addr_equal_64bits(bond_dev->dev_addr, slave_dev->dev_addr)) in bond_enslave()
1741 eth_hw_addr_random(bond_dev); in bond_enslave()
1757 static int __bond_release_one(struct net_device *bond_dev, in __bond_release_one() argument
1761 struct bonding *bond = netdev_priv(bond_dev); in __bond_release_one()
1764 int old_flags = bond_dev->flags; in __bond_release_one()
1765 netdev_features_t old_features = bond_dev->features; in __bond_release_one()
1769 !netdev_has_upper_dev(slave_dev, bond_dev)) { in __bond_release_one()
1770 netdev_dbg(bond_dev, "cannot release %s\n", in __bond_release_one()
1780 netdev_info(bond_dev, "%s not enslaved\n", in __bond_release_one()
1791 bond_upper_dev_unlink(bond_dev, slave_dev); in __bond_release_one()
1803 netdev_info(bond_dev, "Releasing %s interface %s\n", in __bond_release_one()
1813 if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) && in __bond_release_one()
1815 …netdev_warn(bond_dev, "the permanent HWaddr of %s - %pM - is still in use by %s - set the HWaddr o… in __bond_release_one()
1817 bond_dev->name, slave_dev->name); in __bond_release_one()
1847 eth_hw_addr_random(bond_dev); in __bond_release_one()
1860 if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && in __bond_release_one()
1862 netdev_info(bond_dev, "last VLAN challenged slave %s left bond %s - VLAN blocking is removed\n", in __bond_release_one()
1863 slave_dev->name, bond_dev->name); in __bond_release_one()
1865 vlan_vids_del_by_dev(slave_dev, bond_dev); in __bond_release_one()
1885 bond_hw_addr_flush(bond_dev, slave_dev); in __bond_release_one()
1911 int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) in bond_release() argument
1913 return __bond_release_one(bond_dev, slave_dev, false); in bond_release()
1919 static int bond_release_and_destroy(struct net_device *bond_dev, in bond_release_and_destroy() argument
1922 struct bonding *bond = netdev_priv(bond_dev); in bond_release_and_destroy()
1925 ret = bond_release(bond_dev, slave_dev); in bond_release_and_destroy()
1927 bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; in bond_release_and_destroy()
1928 netdev_info(bond_dev, "Destroying bond %s\n", in bond_release_and_destroy()
1929 bond_dev->name); in bond_release_and_destroy()
1931 unregister_netdevice(bond_dev); in bond_release_and_destroy()
1936 static int bond_info_query(struct net_device *bond_dev, struct ifbond *info) in bond_info_query() argument
1938 struct bonding *bond = netdev_priv(bond_dev); in bond_info_query()
1943 static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *info) in bond_slave_info_query() argument
1945 struct bonding *bond = netdev_priv(bond_dev); in bond_slave_info_query()
2916 struct net_device *bond_dev) in bond_master_netdev_event() argument
2918 struct bonding *event_bond = netdev_priv(bond_dev); in bond_master_netdev_event()
2945 struct net_device *bond_dev; in bond_slave_netdev_event() local
2955 bond_dev = slave->bond->dev; in bond_slave_netdev_event()
2961 if (bond_dev->type != ARPHRD_ETHER) in bond_slave_netdev_event()
2962 bond_release_and_destroy(bond_dev, slave_dev); in bond_slave_netdev_event()
2964 bond_release(bond_dev, slave_dev); in bond_slave_netdev_event()
3183 static int bond_open(struct net_device *bond_dev) in bond_open() argument
3185 struct bonding *bond = netdev_priv(bond_dev); in bond_open()
3236 static int bond_close(struct net_device *bond_dev) in bond_close() argument
3238 struct bonding *bond = netdev_priv(bond_dev); in bond_close()
3249 static struct rtnl_link_stats64 *bond_get_stats(struct net_device *bond_dev, in bond_get_stats() argument
3252 struct bonding *bond = netdev_priv(bond_dev); in bond_get_stats()
3298 static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd) in bond_do_ioctl() argument
3300 struct bonding *bond = netdev_priv(bond_dev); in bond_do_ioctl()
3311 netdev_dbg(bond_dev, "bond_ioctl: cmd=%d\n", cmd); in bond_do_ioctl()
3343 res = bond_info_query(bond_dev, &k_binfo); in bond_do_ioctl()
3356 res = bond_slave_info_query(bond_dev, &k_sinfo); in bond_do_ioctl()
3366 net = dev_net(bond_dev); in bond_do_ioctl()
3373 netdev_dbg(bond_dev, "slave_dev=%p:\n", slave_dev); in bond_do_ioctl()
3378 netdev_dbg(bond_dev, "slave_dev->name=%s:\n", slave_dev->name); in bond_do_ioctl()
3382 res = bond_enslave(bond_dev, slave_dev); in bond_do_ioctl()
3386 res = bond_release(bond_dev, slave_dev); in bond_do_ioctl()
3390 bond_set_dev_addr(bond_dev, slave_dev); in bond_do_ioctl()
3405 static void bond_change_rx_flags(struct net_device *bond_dev, int change) in bond_change_rx_flags() argument
3407 struct bonding *bond = netdev_priv(bond_dev); in bond_change_rx_flags()
3411 bond_dev->flags & IFF_PROMISC ? 1 : -1); in bond_change_rx_flags()
3415 bond_dev->flags & IFF_ALLMULTI ? 1 : -1); in bond_change_rx_flags()
3418 static void bond_set_rx_mode(struct net_device *bond_dev) in bond_set_rx_mode() argument
3420 struct bonding *bond = netdev_priv(bond_dev); in bond_set_rx_mode()
3428 dev_uc_sync(slave->dev, bond_dev); in bond_set_rx_mode()
3429 dev_mc_sync(slave->dev, bond_dev); in bond_set_rx_mode()
3433 dev_uc_sync_multiple(slave->dev, bond_dev); in bond_set_rx_mode()
3434 dev_mc_sync_multiple(slave->dev, bond_dev); in bond_set_rx_mode()
3493 static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) in bond_change_mtu() argument
3495 struct bonding *bond = netdev_priv(bond_dev); in bond_change_mtu()
3500 netdev_dbg(bond_dev, "bond=%p, new_mtu=%d\n", bond, new_mtu); in bond_change_mtu()
3503 netdev_dbg(bond_dev, "s %p c_m %p\n", in bond_change_mtu()
3517 netdev_dbg(bond_dev, "err %d %s\n", res, in bond_change_mtu()
3523 bond_dev->mtu = new_mtu; in bond_change_mtu()
3535 tmp_res = dev_set_mtu(rollback_slave->dev, bond_dev->mtu); in bond_change_mtu()
3537 netdev_dbg(bond_dev, "unwind err %d dev %s\n", in bond_change_mtu()
3551 static int bond_set_mac_address(struct net_device *bond_dev, void *addr) in bond_set_mac_address() argument
3553 struct bonding *bond = netdev_priv(bond_dev); in bond_set_mac_address()
3560 return bond_alb_set_mac_address(bond_dev, addr); in bond_set_mac_address()
3563 netdev_dbg(bond_dev, "bond=%p\n", bond); in bond_set_mac_address()
3576 netdev_dbg(bond_dev, "slave %p %s\n", slave, slave->dev->name); in bond_set_mac_address()
3585 netdev_dbg(bond_dev, "err %d %s\n", res, slave->dev->name); in bond_set_mac_address()
3591 memcpy(bond_dev->dev_addr, sa->sa_data, bond_dev->addr_len); in bond_set_mac_address()
3595 memcpy(tmp_sa.sa_data, bond_dev->dev_addr, bond_dev->addr_len); in bond_set_mac_address()
3596 tmp_sa.sa_family = bond_dev->type; in bond_set_mac_address()
3607 netdev_dbg(bond_dev, "unwind err %d dev %s\n", in bond_set_mac_address()
3688 static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev) in bond_xmit_roundrobin() argument
3690 struct bonding *bond = netdev_priv(bond_dev); in bond_xmit_roundrobin()
3714 bond_tx_drop(bond_dev, skb); in bond_xmit_roundrobin()
3724 static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_dev) in bond_xmit_activebackup() argument
3726 struct bonding *bond = netdev_priv(bond_dev); in bond_xmit_activebackup()
3733 bond_tx_drop(bond_dev, skb); in bond_xmit_activebackup()
3884 static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev) in bond_xmit_broadcast() argument
3886 struct bonding *bond = netdev_priv(bond_dev); in bond_xmit_broadcast()
3898 bond_dev->name, __func__); in bond_xmit_broadcast()
3907 bond_tx_drop(bond_dev, skb); in bond_xmit_broadcast()
4014 static int bond_ethtool_get_settings(struct net_device *bond_dev, in bond_ethtool_get_settings() argument
4017 struct bonding *bond = netdev_priv(bond_dev); in bond_ethtool_get_settings()
4044 static void bond_ethtool_get_drvinfo(struct net_device *bond_dev, in bond_ethtool_get_drvinfo() argument
4092 static void bond_destructor(struct net_device *bond_dev) in bond_destructor() argument
4094 struct bonding *bond = netdev_priv(bond_dev); in bond_destructor()
4097 free_netdev(bond_dev); in bond_destructor()
4100 void bond_setup(struct net_device *bond_dev) in bond_setup() argument
4102 struct bonding *bond = netdev_priv(bond_dev); in bond_setup()
4108 bond->dev = bond_dev; in bond_setup()
4111 ether_setup(bond_dev); in bond_setup()
4112 bond_dev->netdev_ops = &bond_netdev_ops; in bond_setup()
4113 bond_dev->ethtool_ops = &bond_ethtool_ops; in bond_setup()
4115 bond_dev->destructor = bond_destructor; in bond_setup()
4117 SET_NETDEV_DEVTYPE(bond_dev, &bond_type); in bond_setup()
4120 bond_dev->tx_queue_len = 0; in bond_setup()
4121 bond_dev->flags |= IFF_MASTER|IFF_MULTICAST; in bond_setup()
4122 bond_dev->priv_flags |= IFF_BONDING | IFF_UNICAST_FLT; in bond_setup()
4123 bond_dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); in bond_setup()
4126 bond_dev->features |= NETIF_F_LLTX; in bond_setup()
4136 bond_dev->features |= NETIF_F_NETNS_LOCAL; in bond_setup()
4138 bond_dev->hw_features = BOND_VLAN_FEATURES | in bond_setup()
4143 bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); in bond_setup()
4144 bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL; in bond_setup()
4145 bond_dev->features |= bond_dev->hw_features; in bond_setup()
4151 static void bond_uninit(struct net_device *bond_dev) in bond_uninit() argument
4153 struct bonding *bond = netdev_priv(bond_dev); in bond_uninit()
4158 bond_netpoll_cleanup(bond_dev); in bond_uninit()
4162 __bond_release_one(bond_dev, slave->dev, true); in bond_uninit()
4163 netdev_info(bond_dev, "Released all slaves\n"); in bond_uninit()
4548 static int bond_init(struct net_device *bond_dev) in bond_init() argument
4550 struct bonding *bond = netdev_priv(bond_dev); in bond_init()
4551 struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id); in bond_init()
4553 netdev_dbg(bond_dev, "Begin bond_init\n"); in bond_init()
4555 bond->wq = create_singlethread_workqueue(bond_dev->name); in bond_init()
4559 bond_set_lockdep_class(bond_dev); in bond_init()
4568 if (is_zero_ether_addr(bond_dev->dev_addr) && in bond_init()
4569 bond_dev->addr_assign_type == NET_ADDR_PERM) in bond_init()
4570 eth_hw_addr_random(bond_dev); in bond_init()
4587 struct net_device *bond_dev; in bond_create() local
4594 bond_dev = alloc_netdev_mq(sizeof(struct bonding), in bond_create()
4597 if (!bond_dev) { in bond_create()
4607 bond = netdev_priv(bond_dev); in bond_create()
4611 dev_net_set(bond_dev, net); in bond_create()
4612 bond_dev->rtnl_link_ops = &bond_link_ops; in bond_create()
4614 res = register_netdevice(bond_dev); in bond_create()
4616 netif_carrier_off(bond_dev); in bond_create()
4620 bond_destructor(bond_dev); in bond_create()