• Home
  • Raw
  • Download

Lines Matching refs:bond_dev

209 static int bond_init(struct net_device *bond_dev);
210 static void bond_uninit(struct net_device *bond_dev);
211 static struct rtnl_link_stats64 *bond_get_stats(struct net_device *bond_dev,
280 static int bond_vlan_rx_add_vid(struct net_device *bond_dev, in bond_vlan_rx_add_vid() argument
283 struct bonding *bond = netdev_priv(bond_dev); in bond_vlan_rx_add_vid()
313 static int bond_vlan_rx_kill_vid(struct net_device *bond_dev, in bond_vlan_rx_kill_vid() argument
316 struct bonding *bond = netdev_priv(bond_dev); in bond_vlan_rx_kill_vid()
557 static void bond_hw_addr_flush(struct net_device *bond_dev, in bond_hw_addr_flush() argument
560 struct bonding *bond = netdev_priv(bond_dev); in bond_hw_addr_flush()
562 dev_uc_unsync(slave_dev, bond_dev); in bond_hw_addr_flush()
563 dev_mc_unsync(slave_dev, bond_dev); in bond_hw_addr_flush()
615 static void bond_set_dev_addr(struct net_device *bond_dev, in bond_set_dev_addr() argument
618 netdev_dbg(bond_dev, "bond_dev=%p slave_dev=%p slave_dev->addr_len=%d\n", in bond_set_dev_addr()
619 bond_dev, slave_dev, slave_dev->addr_len); in bond_set_dev_addr()
620 memcpy(bond_dev->dev_addr, slave_dev->dev_addr, slave_dev->addr_len); in bond_set_dev_addr()
621 bond_dev->addr_assign_type = NET_ADDR_STOLEN; in bond_set_dev_addr()
622 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond_dev); in bond_set_dev_addr()
948 static void bond_poll_controller(struct net_device *bond_dev) in bond_poll_controller() argument
952 static void bond_netpoll_cleanup(struct net_device *bond_dev) in bond_netpoll_cleanup() argument
954 struct bonding *bond = netdev_priv(bond_dev); in bond_netpoll_cleanup()
987 static void bond_netpoll_cleanup(struct net_device *bond_dev) in bond_netpoll_cleanup() argument
1029 struct net_device *bond_dev = bond->dev; in bond_compute_features() local
1056 bond_dev->vlan_features = vlan_features; in bond_compute_features()
1057 bond_dev->hw_enc_features = enc_features; in bond_compute_features()
1058 bond_dev->hard_header_len = max_hard_header_len; in bond_compute_features()
1059 bond_dev->gso_max_segs = gso_max_segs; in bond_compute_features()
1060 netif_set_gso_max_size(bond_dev, gso_max_size); in bond_compute_features()
1062 bond_dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; in bond_compute_features()
1063 if ((bond_dev->priv_flags & IFF_XMIT_DST_RELEASE_PERM) && in bond_compute_features()
1065 bond_dev->priv_flags |= IFF_XMIT_DST_RELEASE; in bond_compute_features()
1067 netdev_change_features(bond_dev); in bond_compute_features()
1070 static void bond_setup_by_slave(struct net_device *bond_dev, in bond_setup_by_slave() argument
1073 bond_dev->header_ops = slave_dev->header_ops; in bond_setup_by_slave()
1075 bond_dev->type = slave_dev->type; in bond_setup_by_slave()
1076 bond_dev->hard_header_len = slave_dev->hard_header_len; in bond_setup_by_slave()
1077 bond_dev->addr_len = slave_dev->addr_len; in bond_setup_by_slave()
1079 memcpy(bond_dev->broadcast, slave_dev->broadcast, in bond_setup_by_slave()
1148 static int bond_master_upper_dev_link(struct net_device *bond_dev, in bond_master_upper_dev_link() argument
1154 err = netdev_master_upper_dev_link_private(slave_dev, bond_dev, slave); in bond_master_upper_dev_link()
1161 static void bond_upper_dev_unlink(struct net_device *bond_dev, in bond_upper_dev_unlink() argument
1164 netdev_upper_dev_unlink(slave_dev, bond_dev); in bond_upper_dev_unlink()
1199 int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev) in bond_enslave() argument
1201 struct bonding *bond = netdev_priv(bond_dev); in bond_enslave()
1211 netdev_warn(bond_dev, "no link monitoring support for %s\n", in bond_enslave()
1217 netdev_dbg(bond_dev, "Error: Device was already enslaved\n"); in bond_enslave()
1221 if (bond_dev == slave_dev) { in bond_enslave()
1222 netdev_err(bond_dev, "cannot enslave bond to itself.\n"); in bond_enslave()
1229 netdev_dbg(bond_dev, "%s is NETIF_F_VLAN_CHALLENGED\n", in bond_enslave()
1231 if (vlan_uses_dev(bond_dev)) { in bond_enslave()
1232 netdev_err(bond_dev, "Error: cannot enslave VLAN challenged slave %s on VLAN enabled bond %s\n", in bond_enslave()
1233 slave_dev->name, bond_dev->name); in bond_enslave()
1236 …netdev_warn(bond_dev, "enslaved VLAN challenged slave %s. Adding VLANs will be blocked as long as … in bond_enslave()
1238 bond_dev->name); in bond_enslave()
1241 netdev_dbg(bond_dev, "%s is !NETIF_F_VLAN_CHALLENGED\n", in bond_enslave()
1251 netdev_err(bond_dev, "%s is up - this may be due to an out of date ifenslave\n", in bond_enslave()
1265 if (bond_dev->type != slave_dev->type) { in bond_enslave()
1266 netdev_dbg(bond_dev, "change device type from %d to %d\n", in bond_enslave()
1267 bond_dev->type, slave_dev->type); in bond_enslave()
1270 bond_dev); in bond_enslave()
1273 netdev_err(bond_dev, "refused to change device type\n"); in bond_enslave()
1279 dev_uc_flush(bond_dev); in bond_enslave()
1280 dev_mc_flush(bond_dev); in bond_enslave()
1283 bond_setup_by_slave(bond_dev, slave_dev); in bond_enslave()
1285 ether_setup(bond_dev); in bond_enslave()
1286 bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING; in bond_enslave()
1290 bond_dev); in bond_enslave()
1292 } else if (bond_dev->type != slave_dev->type) { in bond_enslave()
1293 …netdev_err(bond_dev, "%s ether type (%d) is different from other slaves (%d), can not enslave it\n… in bond_enslave()
1294 slave_dev->name, slave_dev->type, bond_dev->type); in bond_enslave()
1300 netdev_warn(bond_dev, "The slave device specified does not support setting the MAC address\n"); in bond_enslave()
1305 netdev_warn(bond_dev, "Setting fail_over_mac to active for active-backup mode\n"); in bond_enslave()
1307 …netdev_err(bond_dev, "The slave device specified does not support setting the MAC address, but fai… in bond_enslave()
1340 netdev_dbg(bond_dev, "Error %d calling dev_set_mtu\n", res); in bond_enslave()
1355 memcpy(addr.sa_data, bond_dev->dev_addr, bond_dev->addr_len); in bond_enslave()
1359 netdev_dbg(bond_dev, "Error %d calling set_mac_address\n", res); in bond_enslave()
1370 netdev_dbg(bond_dev, "Opening slave %s failed\n", slave_dev->name); in bond_enslave()
1392 if (bond_dev->flags & IFF_PROMISC) { in bond_enslave()
1399 if (bond_dev->flags & IFF_ALLMULTI) { in bond_enslave()
1405 netif_addr_lock_bh(bond_dev); in bond_enslave()
1407 dev_mc_sync_multiple(slave_dev, bond_dev); in bond_enslave()
1408 dev_uc_sync_multiple(slave_dev, bond_dev); in bond_enslave()
1410 netif_addr_unlock_bh(bond_dev); in bond_enslave()
1420 res = vlan_vids_add_by_dev(slave_dev, bond_dev); in bond_enslave()
1422 netdev_err(bond_dev, "Couldn't add bond vlan ids to %s\n", in bond_enslave()
1451 …netdev_warn(bond_dev, "MII and ETHTOOL support not available for interface %s, and arp_interval/ar… in bond_enslave()
1455 …netdev_warn(bond_dev, "can't get link status from interface %s; the network driver associated with… in bond_enslave()
1481 netdev_dbg(bond_dev, "Initial state of slave_dev is BOND_LINK_%s\n", in bond_enslave()
1524 netdev_dbg(bond_dev, "This slave is always active in trunk mode\n"); in bond_enslave()
1544 …netdev_info(bond_dev, "master_dev is using netpoll, but new slave device does not support netpoll\… in bond_enslave()
1554 netdev_dbg(bond_dev, "Error %d calling netdev_rx_handler_register\n", res); in bond_enslave()
1558 res = bond_master_upper_dev_link(bond_dev, slave_dev, new_slave); in bond_enslave()
1560 netdev_dbg(bond_dev, "Error %d calling bond_master_upper_dev_link\n", res); in bond_enslave()
1566 netdev_dbg(bond_dev, "Error %d calling bond_sysfs_slave_add\n", res); in bond_enslave()
1583 netdev_info(bond_dev, "Enslaving %s as %s interface with %s link\n", in bond_enslave()
1593 bond_upper_dev_unlink(bond_dev, slave_dev); in bond_enslave()
1600 bond_hw_addr_flush(bond_dev, slave_dev); in bond_enslave()
1602 vlan_vids_del_by_dev(slave_dev, bond_dev); in bond_enslave()
1641 ether_addr_equal_64bits(bond_dev->dev_addr, slave_dev->dev_addr)) in bond_enslave()
1642 eth_hw_addr_random(bond_dev); in bond_enslave()
1658 static int __bond_release_one(struct net_device *bond_dev, in __bond_release_one() argument
1662 struct bonding *bond = netdev_priv(bond_dev); in __bond_release_one()
1665 int old_flags = bond_dev->flags; in __bond_release_one()
1666 netdev_features_t old_features = bond_dev->features; in __bond_release_one()
1670 !netdev_has_upper_dev(slave_dev, bond_dev)) { in __bond_release_one()
1671 netdev_err(bond_dev, "cannot release %s\n", in __bond_release_one()
1681 netdev_info(bond_dev, "%s not enslaved\n", in __bond_release_one()
1692 bond_upper_dev_unlink(bond_dev, slave_dev); in __bond_release_one()
1704 netdev_info(bond_dev, "Releasing %s interface %s\n", in __bond_release_one()
1714 if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) && in __bond_release_one()
1716 …netdev_warn(bond_dev, "the permanent HWaddr of %s - %pM - is still in use by %s - set the HWaddr o… in __bond_release_one()
1718 bond_dev->name, slave_dev->name); in __bond_release_one()
1748 eth_hw_addr_random(bond_dev); in __bond_release_one()
1761 if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && in __bond_release_one()
1763 netdev_info(bond_dev, "last VLAN challenged slave %s left bond %s - VLAN blocking is removed\n", in __bond_release_one()
1764 slave_dev->name, bond_dev->name); in __bond_release_one()
1766 vlan_vids_del_by_dev(slave_dev, bond_dev); in __bond_release_one()
1786 bond_hw_addr_flush(bond_dev, slave_dev); in __bond_release_one()
1812 int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) in bond_release() argument
1814 return __bond_release_one(bond_dev, slave_dev, false); in bond_release()
1820 static int bond_release_and_destroy(struct net_device *bond_dev, in bond_release_and_destroy() argument
1823 struct bonding *bond = netdev_priv(bond_dev); in bond_release_and_destroy()
1826 ret = bond_release(bond_dev, slave_dev); in bond_release_and_destroy()
1828 bond_dev->priv_flags |= IFF_DISABLE_NETPOLL; in bond_release_and_destroy()
1829 netdev_info(bond_dev, "Destroying bond %s\n", in bond_release_and_destroy()
1830 bond_dev->name); in bond_release_and_destroy()
1832 unregister_netdevice(bond_dev); in bond_release_and_destroy()
1837 static int bond_info_query(struct net_device *bond_dev, struct ifbond *info) in bond_info_query() argument
1839 struct bonding *bond = netdev_priv(bond_dev); in bond_info_query()
1848 static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *info) in bond_slave_info_query() argument
1850 struct bonding *bond = netdev_priv(bond_dev); in bond_slave_info_query()
2808 struct net_device *bond_dev) in bond_master_netdev_event() argument
2810 struct bonding *event_bond = netdev_priv(bond_dev); in bond_master_netdev_event()
2837 struct net_device *bond_dev; in bond_slave_netdev_event() local
2847 bond_dev = slave->bond->dev; in bond_slave_netdev_event()
2853 if (bond_dev->type != ARPHRD_ETHER) in bond_slave_netdev_event()
2854 bond_release_and_destroy(bond_dev, slave_dev); in bond_slave_netdev_event()
2856 bond_release(bond_dev, slave_dev); in bond_slave_netdev_event()
3077 static int bond_open(struct net_device *bond_dev) in bond_open() argument
3079 struct bonding *bond = netdev_priv(bond_dev); in bond_open()
3130 static int bond_close(struct net_device *bond_dev) in bond_close() argument
3132 struct bonding *bond = netdev_priv(bond_dev); in bond_close()
3143 static struct rtnl_link_stats64 *bond_get_stats(struct net_device *bond_dev, in bond_get_stats() argument
3146 struct bonding *bond = netdev_priv(bond_dev); in bond_get_stats()
3192 static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd) in bond_do_ioctl() argument
3194 struct bonding *bond = netdev_priv(bond_dev); in bond_do_ioctl()
3205 netdev_dbg(bond_dev, "bond_ioctl: cmd=%d\n", cmd); in bond_do_ioctl()
3237 res = bond_info_query(bond_dev, &k_binfo); in bond_do_ioctl()
3250 res = bond_slave_info_query(bond_dev, &k_sinfo); in bond_do_ioctl()
3260 net = dev_net(bond_dev); in bond_do_ioctl()
3267 netdev_dbg(bond_dev, "slave_dev=%p:\n", slave_dev); in bond_do_ioctl()
3272 netdev_dbg(bond_dev, "slave_dev->name=%s:\n", slave_dev->name); in bond_do_ioctl()
3276 res = bond_enslave(bond_dev, slave_dev); in bond_do_ioctl()
3280 res = bond_release(bond_dev, slave_dev); in bond_do_ioctl()
3284 bond_set_dev_addr(bond_dev, slave_dev); in bond_do_ioctl()
3299 static void bond_change_rx_flags(struct net_device *bond_dev, int change) in bond_change_rx_flags() argument
3301 struct bonding *bond = netdev_priv(bond_dev); in bond_change_rx_flags()
3305 bond_dev->flags & IFF_PROMISC ? 1 : -1); in bond_change_rx_flags()
3309 bond_dev->flags & IFF_ALLMULTI ? 1 : -1); in bond_change_rx_flags()
3312 static void bond_set_rx_mode(struct net_device *bond_dev) in bond_set_rx_mode() argument
3314 struct bonding *bond = netdev_priv(bond_dev); in bond_set_rx_mode()
3322 dev_uc_sync(slave->dev, bond_dev); in bond_set_rx_mode()
3323 dev_mc_sync(slave->dev, bond_dev); in bond_set_rx_mode()
3327 dev_uc_sync_multiple(slave->dev, bond_dev); in bond_set_rx_mode()
3328 dev_mc_sync_multiple(slave->dev, bond_dev); in bond_set_rx_mode()
3387 static int bond_change_mtu(struct net_device *bond_dev, int new_mtu) in bond_change_mtu() argument
3389 struct bonding *bond = netdev_priv(bond_dev); in bond_change_mtu()
3394 netdev_dbg(bond_dev, "bond=%p, new_mtu=%d\n", bond, new_mtu); in bond_change_mtu()
3397 netdev_dbg(bond_dev, "s %p c_m %p\n", in bond_change_mtu()
3411 netdev_dbg(bond_dev, "err %d %s\n", res, in bond_change_mtu()
3417 bond_dev->mtu = new_mtu; in bond_change_mtu()
3429 tmp_res = dev_set_mtu(rollback_slave->dev, bond_dev->mtu); in bond_change_mtu()
3431 netdev_dbg(bond_dev, "unwind err %d dev %s\n", in bond_change_mtu()
3445 static int bond_set_mac_address(struct net_device *bond_dev, void *addr) in bond_set_mac_address() argument
3447 struct bonding *bond = netdev_priv(bond_dev); in bond_set_mac_address()
3454 return bond_alb_set_mac_address(bond_dev, addr); in bond_set_mac_address()
3457 netdev_dbg(bond_dev, "bond=%p\n", bond); in bond_set_mac_address()
3470 netdev_dbg(bond_dev, "slave %p %s\n", slave, slave->dev->name); in bond_set_mac_address()
3479 netdev_dbg(bond_dev, "err %d %s\n", res, slave->dev->name); in bond_set_mac_address()
3485 memcpy(bond_dev->dev_addr, sa->sa_data, bond_dev->addr_len); in bond_set_mac_address()
3489 memcpy(tmp_sa.sa_data, bond_dev->dev_addr, bond_dev->addr_len); in bond_set_mac_address()
3490 tmp_sa.sa_family = bond_dev->type; in bond_set_mac_address()
3501 netdev_dbg(bond_dev, "unwind err %d dev %s\n", in bond_set_mac_address()
3582 static int bond_xmit_roundrobin(struct sk_buff *skb, struct net_device *bond_dev) in bond_xmit_roundrobin() argument
3584 struct bonding *bond = netdev_priv(bond_dev); in bond_xmit_roundrobin()
3618 static int bond_xmit_activebackup(struct sk_buff *skb, struct net_device *bond_dev) in bond_xmit_activebackup() argument
3620 struct bonding *bond = netdev_priv(bond_dev); in bond_xmit_activebackup()
3779 static int bond_xmit_broadcast(struct sk_buff *skb, struct net_device *bond_dev) in bond_xmit_broadcast() argument
3781 struct bonding *bond = netdev_priv(bond_dev); in bond_xmit_broadcast()
3793 bond_dev->name, __func__); in bond_xmit_broadcast()
3909 static int bond_ethtool_get_settings(struct net_device *bond_dev, in bond_ethtool_get_settings() argument
3912 struct bonding *bond = netdev_priv(bond_dev); in bond_ethtool_get_settings()
3939 static void bond_ethtool_get_drvinfo(struct net_device *bond_dev, in bond_ethtool_get_drvinfo() argument
3984 static void bond_destructor(struct net_device *bond_dev) in bond_destructor() argument
3986 struct bonding *bond = netdev_priv(bond_dev); in bond_destructor()
3989 free_netdev(bond_dev); in bond_destructor()
3992 void bond_setup(struct net_device *bond_dev) in bond_setup() argument
3994 struct bonding *bond = netdev_priv(bond_dev); in bond_setup()
4000 bond->dev = bond_dev; in bond_setup()
4003 ether_setup(bond_dev); in bond_setup()
4004 bond_dev->netdev_ops = &bond_netdev_ops; in bond_setup()
4005 bond_dev->ethtool_ops = &bond_ethtool_ops; in bond_setup()
4007 bond_dev->destructor = bond_destructor; in bond_setup()
4009 SET_NETDEV_DEVTYPE(bond_dev, &bond_type); in bond_setup()
4012 bond_dev->tx_queue_len = 0; in bond_setup()
4013 bond_dev->flags |= IFF_MASTER|IFF_MULTICAST; in bond_setup()
4014 bond_dev->priv_flags |= IFF_BONDING | IFF_UNICAST_FLT; in bond_setup()
4015 bond_dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING); in bond_setup()
4018 bond_dev->features |= NETIF_F_LLTX; in bond_setup()
4028 bond_dev->features |= NETIF_F_NETNS_LOCAL; in bond_setup()
4030 bond_dev->hw_features = BOND_VLAN_FEATURES | in bond_setup()
4035 bond_dev->hw_features &= ~(NETIF_F_ALL_CSUM & ~NETIF_F_HW_CSUM); in bond_setup()
4036 bond_dev->hw_features |= NETIF_F_GSO_UDP_TUNNEL; in bond_setup()
4037 bond_dev->features |= bond_dev->hw_features; in bond_setup()
4043 static void bond_uninit(struct net_device *bond_dev) in bond_uninit() argument
4045 struct bonding *bond = netdev_priv(bond_dev); in bond_uninit()
4050 bond_netpoll_cleanup(bond_dev); in bond_uninit()
4054 __bond_release_one(bond_dev, slave->dev, true); in bond_uninit()
4055 netdev_info(bond_dev, "Released all slaves\n"); in bond_uninit()
4440 static int bond_init(struct net_device *bond_dev) in bond_init() argument
4442 struct bonding *bond = netdev_priv(bond_dev); in bond_init()
4443 struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id); in bond_init()
4445 netdev_dbg(bond_dev, "Begin bond_init\n"); in bond_init()
4447 bond->wq = create_singlethread_workqueue(bond_dev->name); in bond_init()
4451 bond_set_lockdep_class(bond_dev); in bond_init()
4460 if (is_zero_ether_addr(bond_dev->dev_addr) && in bond_init()
4461 bond_dev->addr_assign_type == NET_ADDR_PERM) in bond_init()
4462 eth_hw_addr_random(bond_dev); in bond_init()
4479 struct net_device *bond_dev; in bond_create() local
4484 bond_dev = alloc_netdev_mq(sizeof(struct bonding), in bond_create()
4487 if (!bond_dev) { in bond_create()
4493 dev_net_set(bond_dev, net); in bond_create()
4494 bond_dev->rtnl_link_ops = &bond_link_ops; in bond_create()
4496 res = register_netdevice(bond_dev); in bond_create()
4498 netif_carrier_off(bond_dev); in bond_create()
4502 bond_destructor(bond_dev); in bond_create()