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