Lines Matching refs:bond_dev
253 static int bond_init(struct net_device *bond_dev);
254 static void bond_uninit(struct net_device *bond_dev);
255 static void bond_get_stats(struct net_device *bond_dev,
324 * @bond_dev: bonding net device that got called
328 static int bond_vlan_rx_add_vid(struct net_device *bond_dev,
331 struct bonding *bond = netdev_priv(bond_dev);
358 * @bond_dev: bonding net device that got called
362 static int bond_vlan_rx_kill_vid(struct net_device *bond_dev,
365 struct bonding *bond = netdev_priv(bond_dev);
387 struct net_device *bond_dev = xs->xso.dev;
393 if (!bond_dev)
397 bond = netdev_priv(bond_dev);
407 slave_warn(bond_dev, slave->dev, "Slave does not support ipsec offload\n");
435 struct net_device *bond_dev = bond->dev;
449 slave_warn(bond_dev, slave->dev,
460 slave_warn(bond_dev, slave->dev, "%s: failed to add SA\n", __func__);
475 struct net_device *bond_dev = xs->xso.dev;
480 if (!bond_dev)
484 bond = netdev_priv(bond_dev);
498 slave_warn(bond_dev, slave->dev, "%s: no slave xdo_dev_state_delete\n", __func__);
518 struct net_device *bond_dev = bond->dev;
537 slave_warn(bond_dev, slave->dev,
555 struct net_device *bond_dev = xs->xso.dev;
561 bond = netdev_priv(bond_dev);
823 static void bond_hw_addr_flush(struct net_device *bond_dev,
826 struct bonding *bond = netdev_priv(bond_dev);
828 dev_uc_unsync(slave_dev, bond_dev);
829 dev_mc_unsync(slave_dev, bond_dev);
875 * @bond_dev: bond net device
880 static int bond_set_dev_addr(struct net_device *bond_dev,
885 slave_dbg(bond_dev, slave_dev, "bond_dev=%p slave_dev=%p slave_dev->addr_len=%d\n",
886 bond_dev, slave_dev, slave_dev->addr_len);
887 err = dev_pre_changeaddr_notify(bond_dev, slave_dev->dev_addr, NULL);
891 memcpy(bond_dev->dev_addr, slave_dev->dev_addr, slave_dev->addr_len);
892 bond_dev->addr_assign_type = NET_ADDR_STOLEN;
893 call_netdevice_notifiers(NETDEV_CHANGEADDR, bond_dev);
1260 static void bond_poll_controller(struct net_device *bond_dev)
1262 struct bonding *bond = netdev_priv(bond_dev);
1288 static void bond_netpoll_cleanup(struct net_device *bond_dev)
1290 struct bonding *bond = netdev_priv(bond_dev);
1323 static void bond_netpoll_cleanup(struct net_device *bond_dev)
1374 struct net_device *bond_dev = bond->dev;
1411 bond_dev->hard_header_len = max_hard_header_len;
1414 bond_dev->vlan_features = vlan_features;
1415 bond_dev->hw_enc_features = enc_features | NETIF_F_GSO_ENCAP_ALL |
1420 bond_dev->hw_enc_features |= xfrm_features;
1422 bond_dev->mpls_features = mpls_features;
1423 bond_dev->gso_max_segs = gso_max_segs;
1424 netif_set_gso_max_size(bond_dev, gso_max_size);
1426 bond_dev->priv_flags &= ~IFF_XMIT_DST_RELEASE;
1427 if ((bond_dev->priv_flags & IFF_XMIT_DST_RELEASE_PERM) &&
1429 bond_dev->priv_flags |= IFF_XMIT_DST_RELEASE;
1431 netdev_change_features(bond_dev);
1434 static void bond_setup_by_slave(struct net_device *bond_dev,
1437 bool was_up = !!(bond_dev->flags & IFF_UP);
1439 dev_close(bond_dev);
1441 bond_dev->header_ops = slave_dev->header_ops;
1443 bond_dev->type = slave_dev->type;
1444 bond_dev->hard_header_len = slave_dev->hard_header_len;
1445 bond_dev->needed_headroom = slave_dev->needed_headroom;
1446 bond_dev->addr_len = slave_dev->addr_len;
1448 memcpy(bond_dev->broadcast, slave_dev->broadcast,
1452 bond_dev->flags &= ~(IFF_BROADCAST | IFF_MULTICAST);
1453 bond_dev->flags |= (IFF_POINTOPOINT | IFF_NOARP);
1456 dev_open(bond_dev, NULL);
1704 int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev,
1707 struct bonding *bond = netdev_priv(bond_dev);
1717 slave_warn(bond_dev, slave_dev, "no link monitoring support\n");
1723 slave_err(bond_dev, slave_dev,
1728 if (bond_dev == slave_dev) {
1730 netdev_err(bond_dev, "cannot enslave bond to itself.\n");
1737 slave_dbg(bond_dev, slave_dev, "is NETIF_F_VLAN_CHALLENGED\n");
1738 if (vlan_uses_dev(bond_dev)) {
1740 slave_err(bond_dev, slave_dev, "Error: cannot enslave VLAN challenged slave on VLAN enabled bond\n");
1743 slave_warn(bond_dev, slave_dev, "enslaved VLAN challenged slave. Adding VLANs will be blocked as long as it is part of bond.\n");
1746 slave_dbg(bond_dev, slave_dev, "is !NETIF_F_VLAN_CHALLENGED\n");
1750 slave_dbg(bond_dev, slave_dev, "is esp-hw-offload capable\n");
1759 slave_err(bond_dev, slave_dev, "slave is up - this may be due to an out of date ifenslave\n");
1771 if (bond_dev->type != slave_dev->type) {
1772 slave_dbg(bond_dev, slave_dev, "change device type from %d to %d\n",
1773 bond_dev->type, slave_dev->type);
1776 bond_dev);
1779 slave_err(bond_dev, slave_dev, "refused to change device type\n");
1784 dev_uc_flush(bond_dev);
1785 dev_mc_flush(bond_dev);
1788 bond_setup_by_slave(bond_dev, slave_dev);
1790 ether_setup(bond_dev);
1791 bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING;
1795 bond_dev);
1797 } else if (bond_dev->type != slave_dev->type) {
1799 slave_err(bond_dev, slave_dev, "ether type (%d) is different from other slaves (%d), can not enslave it\n",
1800 slave_dev->type, bond_dev->type);
1807 slave_warn(bond_dev, slave_dev, "Type (%d) supports only active-backup mode\n",
1815 slave_warn(bond_dev, slave_dev, "The slave device specified does not support setting the MAC address\n");
1820 slave_warn(bond_dev, slave_dev, "Setting fail_over_mac to active for active-backup mode\n");
1823 slave_err(bond_dev, slave_dev, "The slave device specified does not support setting the MAC address, but fail_over_mac is not set to active\n");
1857 slave_err(bond_dev, slave_dev, "Error %d calling dev_set_mtu\n", res);
1873 memcpy(ss.__data, bond_dev->dev_addr, bond_dev->addr_len);
1878 slave_err(bond_dev, slave_dev, "Error %d calling set_mac_address\n", res);
1889 slave_err(bond_dev, slave_dev, "Opening slave failed\n");
1906 res = vlan_vids_add_by_dev(slave_dev, bond_dev);
1908 slave_err(bond_dev, slave_dev, "Couldn't add bond vlan ids\n");
1938 slave_warn(bond_dev, slave_dev, "MII and ETHTOOL support not available for slave, and arp_interval/arp_ip_target module parameters not specified, thus bonding will not detect link failures! see bonding.txt for details\n");
1941 slave_warn(bond_dev, slave_dev, "can't get link status from slave; 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");
1975 slave_dbg(bond_dev, slave_dev, "Initial state of slave is BOND_LINK_%s\n",
2018 slave_dbg(bond_dev, slave_dev, "This slave is always active in trunk mode\n");
2037 slave_info(bond_dev, slave_dev, "master_dev is using netpoll, but new slave device does not support netpoll\n");
2044 if (!(bond_dev->features & NETIF_F_LRO))
2050 slave_dbg(bond_dev, slave_dev, "Error %d calling netdev_rx_handler_register\n", res);
2056 slave_dbg(bond_dev, slave_dev, "Error %d calling bond_master_upper_dev_link\n", res);
2062 slave_dbg(bond_dev, slave_dev, "Error %d calling bond_sysfs_slave_add\n", res);
2071 if (bond_dev->flags & IFF_PROMISC) {
2078 if (bond_dev->flags & IFF_ALLMULTI) {
2081 if (bond_dev->flags & IFF_PROMISC)
2087 if (bond_dev->flags & IFF_UP) {
2088 netif_addr_lock_bh(bond_dev);
2089 dev_mc_sync_multiple(slave_dev, bond_dev);
2090 dev_uc_sync_multiple(slave_dev, bond_dev);
2091 netif_addr_unlock_bh(bond_dev);
2112 slave_info(bond_dev, slave_dev, "Enslaving as %s interface with %s link\n",
2131 vlan_vids_del_by_dev(slave_dev, bond_dev);
2172 if (ether_addr_equal_64bits(bond_dev->dev_addr,
2174 eth_hw_addr_random(bond_dev);
2175 if (bond_dev->type != ARPHRD_ETHER) {
2176 dev_close(bond_dev);
2177 ether_setup(bond_dev);
2178 bond_dev->flags |= IFF_MASTER;
2179 bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING;
2197 static int __bond_release_one(struct net_device *bond_dev,
2201 struct bonding *bond = netdev_priv(bond_dev);
2204 int old_flags = bond_dev->flags;
2205 netdev_features_t old_features = bond_dev->features;
2209 !netdev_has_upper_dev(slave_dev, bond_dev)) {
2210 slave_dbg(bond_dev, slave_dev, "cannot release slave\n");
2219 slave_info(bond_dev, slave_dev, "interface not enslaved\n");
2244 slave_info(bond_dev, slave_dev, "Releasing %s interface\n",
2253 if (ether_addr_equal_64bits(bond_dev->dev_addr, slave->perm_hwaddr) &&
2255 slave_warn(bond_dev, slave_dev, "the permanent HWaddr of slave - %pM - is still in use by bond - set the HWaddr of slave to a different address to avoid conflicts\n",
2286 eth_hw_addr_random(bond_dev);
2298 if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) &&
2300 slave_info(bond_dev, slave_dev, "last VLAN challenged slave left bond - VLAN blocking is removed\n");
2302 vlan_vids_del_by_dev(slave_dev, bond_dev);
2310 * of the IFF_PROMISC flag in the bond_dev, but we need the
2323 bond_hw_addr_flush(bond_dev, slave_dev);
2354 int bond_release(struct net_device *bond_dev, struct net_device *slave_dev)
2356 return __bond_release_one(bond_dev, slave_dev, false, false);
2362 static int bond_release_and_destroy(struct net_device *bond_dev,
2365 struct bonding *bond = netdev_priv(bond_dev);
2368 ret = __bond_release_one(bond_dev, slave_dev, false, true);
2370 bond_dev->reg_state != NETREG_UNREGISTERING) {
2371 bond_dev->priv_flags |= IFF_DISABLE_NETPOLL;
2372 netdev_info(bond_dev, "Destroying bond\n");
2374 unregister_netdevice(bond_dev);
2379 static void bond_info_query(struct net_device *bond_dev, struct ifbond *info)
2381 struct bonding *bond = netdev_priv(bond_dev);
2385 static int bond_slave_info_query(struct net_device *bond_dev, struct ifslave *info)
2387 struct bonding *bond = netdev_priv(bond_dev);
2717 struct net_device *bond_dev = slave->bond->dev;
2719 slave_dbg(bond_dev, slave_dev, "arp %d on slave: dst %pI4 src %pI4\n",
2742 slave_dbg(bond_dev, slave_dev, "inner tag: proto %X vid %X\n",
2755 slave_dbg(bond_dev, slave_dev, "outer tag: proto %X vid %X\n",
3429 struct net_device *bond_dev)
3431 struct bonding *event_bond = netdev_priv(bond_dev);
3433 netdev_dbg(bond_dev, "%s called\n", __func__);
3441 xfrm_dev_state_flush(dev_net(bond_dev), bond_dev, true);
3459 struct net_device *bond_dev;
3470 bond_dev = slave->bond->dev;
3474 slave_dbg(bond_dev, slave_dev, "%s called\n", __func__);
3478 if (bond_dev->type != ARPHRD_ETHER)
3479 bond_release_and_destroy(bond_dev, slave_dev);
3481 __bond_release_one(bond_dev, slave_dev, false, true);
3755 static int bond_open(struct net_device *bond_dev)
3757 struct bonding *bond = netdev_priv(bond_dev);
3809 static int bond_close(struct net_device *bond_dev)
3811 struct bonding *bond = netdev_priv(bond_dev);
3824 bond_hw_addr_flush(bond_dev, slave->dev);
3830 bond_hw_addr_flush(bond_dev, slave->dev);
3906 static void bond_get_stats(struct net_device *bond_dev,
3909 struct bonding *bond = netdev_priv(bond_dev);
3918 nest_level = bond_get_lowest_level_rcu(bond_dev);
3939 static int bond_do_ioctl(struct net_device *bond_dev, struct ifreq *ifr, int cmd)
3941 struct bonding *bond = netdev_priv(bond_dev);
3952 netdev_dbg(bond_dev, "bond_ioctl: cmd=%d\n", cmd);
3984 bond_info_query(bond_dev, &k_binfo);
3996 res = bond_slave_info_query(bond_dev, &k_sinfo);
4006 net = dev_net(bond_dev);
4013 slave_dbg(bond_dev, slave_dev, "slave_dev=%p:\n", slave_dev);
4021 res = bond_enslave(bond_dev, slave_dev, NULL);
4025 res = bond_release(bond_dev, slave_dev);
4029 res = bond_set_dev_addr(bond_dev, slave_dev);
4044 static void bond_change_rx_flags(struct net_device *bond_dev, int change)
4046 struct bonding *bond = netdev_priv(bond_dev);
4050 bond_dev->flags & IFF_PROMISC ? 1 : -1);
4054 bond_dev->flags & IFF_ALLMULTI ? 1 : -1);
4057 static void bond_set_rx_mode(struct net_device *bond_dev)
4059 struct bonding *bond = netdev_priv(bond_dev);
4067 dev_uc_sync(slave->dev, bond_dev);
4068 dev_mc_sync(slave->dev, bond_dev);
4072 dev_uc_sync_multiple(slave->dev, bond_dev);
4073 dev_mc_sync_multiple(slave->dev, bond_dev);
4135 static int bond_change_mtu(struct net_device *bond_dev, int new_mtu)
4137 struct bonding *bond = netdev_priv(bond_dev);
4142 netdev_dbg(bond_dev, "bond=%p, new_mtu=%d\n", bond, new_mtu);
4145 slave_dbg(bond_dev, slave->dev, "s %p c_m %p\n",
4159 slave_dbg(bond_dev, slave->dev, "err %d setting mtu to %d\n",
4165 bond_dev->mtu = new_mtu;
4177 tmp_res = dev_set_mtu(rollback_slave->dev, bond_dev->mtu);
4179 slave_dbg(bond_dev, rollback_slave->dev, "unwind err %d\n",
4192 static int bond_set_mac_address(struct net_device *bond_dev, void *addr)
4194 struct bonding *bond = netdev_priv(bond_dev);
4201 return bond_alb_set_mac_address(bond_dev, addr);
4204 netdev_dbg(bond_dev, "%s: bond=%p\n", __func__, bond);
4217 slave_dbg(bond_dev, slave->dev, "%s: slave=%p\n",
4227 slave_dbg(bond_dev, slave->dev, "%s: err %d\n",
4234 memcpy(bond_dev->dev_addr, ss->__data, bond_dev->addr_len);
4238 memcpy(tmp_ss.__data, bond_dev->dev_addr, bond_dev->addr_len);
4239 tmp_ss.ss_family = bond_dev->type;
4251 slave_dbg(bond_dev, rollback_slave->dev, "%s: unwind err %d\n",
4366 struct net_device *bond_dev)
4368 struct bonding *bond = netdev_priv(bond_dev);
4375 return bond_tx_drop(bond_dev, skb);
4388 struct net_device *bond_dev)
4390 struct bonding *bond = netdev_priv(bond_dev);
4397 return bond_tx_drop(bond_dev, skb);
4601 struct net_device *bond_dev)
4603 struct bonding *bond = netdev_priv(bond_dev);
4622 bond_dev->name, __func__);
4637 atomic_long_inc(&bond_dev->tx_dropped);
4794 static int bond_ethtool_get_link_ksettings(struct net_device *bond_dev,
4797 struct bonding *bond = netdev_priv(bond_dev);
4829 static void bond_ethtool_get_drvinfo(struct net_device *bond_dev,
4875 static void bond_destructor(struct net_device *bond_dev)
4877 struct bonding *bond = netdev_priv(bond_dev);
4882 void bond_setup(struct net_device *bond_dev)
4884 struct bonding *bond = netdev_priv(bond_dev);
4890 bond->dev = bond_dev;
4893 ether_setup(bond_dev);
4894 bond_dev->max_mtu = ETH_MAX_MTU;
4895 bond_dev->netdev_ops = &bond_netdev_ops;
4896 bond_dev->ethtool_ops = &bond_ethtool_ops;
4898 bond_dev->needs_free_netdev = true;
4899 bond_dev->priv_destructor = bond_destructor;
4901 SET_NETDEV_DEVTYPE(bond_dev, &bond_type);
4904 bond_dev->flags |= IFF_MASTER;
4905 bond_dev->priv_flags |= IFF_BONDING | IFF_UNICAST_FLT | IFF_NO_QUEUE;
4906 bond_dev->priv_flags &= ~(IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING);
4910 bond_dev->xfrmdev_ops = &bond_xfrmdev_ops;
4916 bond_dev->features |= NETIF_F_LLTX;
4926 bond_dev->features |= NETIF_F_NETNS_LOCAL;
4928 bond_dev->hw_features = BOND_VLAN_FEATURES |
4934 bond_dev->hw_features |= NETIF_F_GSO_ENCAP_ALL | NETIF_F_GSO_UDP_L4;
4936 bond_dev->hw_features |= BOND_XFRM_FEATURES;
4938 bond_dev->features |= bond_dev->hw_features;
4939 bond_dev->features |= NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_HW_VLAN_STAG_TX;
4943 bond_dev->features &= ~BOND_XFRM_FEATURES;
4950 static void bond_uninit(struct net_device *bond_dev)
4952 struct bonding *bond = netdev_priv(bond_dev);
4957 bond_netpoll_cleanup(bond_dev);
4961 __bond_release_one(bond_dev, slave->dev, true, true);
4962 netdev_info(bond_dev, "Released all slaves\n");
5370 static int bond_init(struct net_device *bond_dev)
5372 struct bonding *bond = netdev_priv(bond_dev);
5373 struct bond_net *bn = net_generic(dev_net(bond_dev), bond_net_id);
5375 netdev_dbg(bond_dev, "Begin bond_init\n");
5377 bond->wq = alloc_ordered_workqueue(bond_dev->name, WQ_MEM_RECLAIM);
5384 netdev_lockdep_set_classes(bond_dev);
5393 if (is_zero_ether_addr(bond_dev->dev_addr) &&
5394 bond_dev->addr_assign_type == NET_ADDR_PERM)
5395 eth_hw_addr_random(bond_dev);
5412 struct net_device *bond_dev;
5419 bond_dev = alloc_netdev_mq(sizeof(struct bonding),
5422 if (!bond_dev) {
5432 bond = netdev_priv(bond_dev);
5436 dev_net_set(bond_dev, net);
5437 bond_dev->rtnl_link_ops = &bond_link_ops;
5439 res = register_netdevice(bond_dev);
5441 free_netdev(bond_dev);
5447 netif_carrier_off(bond_dev);