Lines Matching refs:vf_netdev

68 	struct net_device *vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev);  in netvsc_change_rx_flags()  local
71 if (!vf_netdev) in netvsc_change_rx_flags()
76 dev_set_promiscuity(vf_netdev, inc); in netvsc_change_rx_flags()
81 dev_set_allmulti(vf_netdev, inc); in netvsc_change_rx_flags()
88 struct net_device *vf_netdev; in netvsc_set_rx_mode() local
92 vf_netdev = rcu_dereference(ndev_ctx->vf_netdev); in netvsc_set_rx_mode()
93 if (vf_netdev) { in netvsc_set_rx_mode()
94 dev_uc_sync(vf_netdev, net); in netvsc_set_rx_mode()
95 dev_mc_sync(vf_netdev, net); in netvsc_set_rx_mode()
116 struct net_device *vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev); in netvsc_open() local
136 if (vf_netdev) { in netvsc_open()
141 ret = dev_open(vf_netdev, NULL); in netvsc_open()
145 vf_netdev->name, ret); in netvsc_open()
202 struct net_device *vf_netdev in netvsc_close() local
203 = rtnl_dereference(net_device_ctx->vf_netdev); in netvsc_close()
223 if (vf_netdev) in netvsc_close()
224 dev_close(vf_netdev); in netvsc_close()
299 struct net_device *vf_netdev; in netvsc_select_queue() local
303 vf_netdev = rcu_dereference(ndc->vf_netdev); in netvsc_select_queue()
304 if (vf_netdev) { in netvsc_select_queue()
305 const struct net_device_ops *vf_ops = vf_netdev->netdev_ops; in netvsc_select_queue()
308 txq = vf_ops->ndo_select_queue(vf_netdev, skb, sb_dev); in netvsc_select_queue()
310 txq = netdev_pick_tx(vf_netdev, skb, NULL); in netvsc_select_queue()
449 static int netvsc_vf_xmit(struct net_device *net, struct net_device *vf_netdev, in netvsc_vf_xmit() argument
456 skb->dev = vf_netdev; in netvsc_vf_xmit()
482 struct net_device *vf_netdev; in netvsc_xmit() local
491 vf_netdev = rcu_dereference_bh(net_device_ctx->vf_netdev); in netvsc_xmit()
492 if (vf_netdev && netif_running(vf_netdev) && in netvsc_xmit()
493 netif_carrier_ok(vf_netdev) && !netpoll_tx_running(net) && in netvsc_xmit()
495 return netvsc_vf_xmit(net, vf_netdev, skb); in netvsc_xmit()
1177 struct net_device *vf_netdev; in netvsc_get_link_ksettings() local
1179 vf_netdev = rtnl_dereference(ndc->vf_netdev); in netvsc_get_link_ksettings()
1181 if (vf_netdev) in netvsc_get_link_ksettings()
1182 return __ethtool_get_link_ksettings(vf_netdev, cmd); in netvsc_get_link_ksettings()
1195 struct net_device *vf_netdev = rtnl_dereference(ndc->vf_netdev); in netvsc_set_link_ksettings() local
1197 if (vf_netdev) { in netvsc_set_link_ksettings()
1198 if (!vf_netdev->ethtool_ops->set_link_ksettings) in netvsc_set_link_ksettings()
1201 return vf_netdev->ethtool_ops->set_link_ksettings(vf_netdev, in netvsc_set_link_ksettings()
1212 struct net_device *vf_netdev = rtnl_dereference(ndevctx->vf_netdev); in netvsc_change_mtu() local
1227 if (vf_netdev) { in netvsc_change_mtu()
1228 ret = dev_set_mtu(vf_netdev, mtu); in netvsc_change_mtu()
1249 if (vf_netdev) in netvsc_change_mtu()
1250 dev_set_mtu(vf_netdev, orig_mtu); in netvsc_change_mtu()
1405 struct net_device *vf_netdev = rtnl_dereference(ndc->vf_netdev); in netvsc_set_mac_addr() local
1417 if (vf_netdev) { in netvsc_set_mac_addr()
1418 err = dev_set_mac_address(vf_netdev, addr, NULL); in netvsc_set_mac_addr()
1426 } else if (vf_netdev) { in netvsc_set_mac_addr()
1429 dev_set_mac_address(vf_netdev, addr, NULL); in netvsc_set_mac_addr()
1933 struct net_device *vf_netdev = rtnl_dereference(ndevctx->vf_netdev); in netvsc_set_features() local
1961 if (!vf_netdev) in netvsc_set_features()
1964 vf_netdev->wanted_features = features; in netvsc_set_features()
1965 netdev_update_features(vf_netdev); in netvsc_set_features()
2148 static struct net_device *get_netvsc_byref(struct net_device *vf_netdev) in get_netvsc_byref() argument
2153 dev = netdev_master_upper_dev_get(vf_netdev); in get_netvsc_byref()
2192 static int netvsc_vf_join(struct net_device *vf_netdev, in netvsc_vf_join() argument
2198 ret = netdev_rx_handler_register(vf_netdev, in netvsc_vf_join()
2201 netdev_err(vf_netdev, in netvsc_vf_join()
2207 ret = netdev_master_upper_dev_link(vf_netdev, ndev, in netvsc_vf_join()
2210 netdev_err(vf_netdev, in netvsc_vf_join()
2222 call_netdevice_notifiers(NETDEV_JOIN, vf_netdev); in netvsc_vf_join()
2224 netdev_info(vf_netdev, "joined to %s\n", ndev->name); in netvsc_vf_join()
2228 netdev_rx_handler_unregister(vf_netdev); in netvsc_vf_join()
2234 struct net_device *vf_netdev) in __netvsc_vf_setup() argument
2239 ret = dev_set_mtu(vf_netdev, ndev->mtu); in __netvsc_vf_setup()
2241 netdev_warn(vf_netdev, in __netvsc_vf_setup()
2245 dev_change_flags(vf_netdev, ndev->flags | IFF_SLAVE, NULL); in __netvsc_vf_setup()
2249 dev_uc_sync(vf_netdev, ndev); in __netvsc_vf_setup()
2250 dev_mc_sync(vf_netdev, ndev); in __netvsc_vf_setup()
2254 ret = dev_open(vf_netdev, NULL); in __netvsc_vf_setup()
2256 netdev_warn(vf_netdev, in __netvsc_vf_setup()
2269 struct net_device *vf_netdev; in netvsc_vf_setup() local
2276 vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev); in netvsc_vf_setup()
2277 if (vf_netdev) in netvsc_vf_setup()
2278 __netvsc_vf_setup(ndev, vf_netdev); in netvsc_vf_setup()
2286 static struct net_device *get_netvsc_byslot(const struct net_device *vf_netdev) in get_netvsc_byslot() argument
2288 struct device *parent = vf_netdev->dev.parent; in get_netvsc_byslot()
2299 netdev_notice(vf_netdev, "no PCI slot information\n"); in get_netvsc_byslot()
2304 netdev_notice(vf_netdev, "Invalid vf serial:%s\n", in get_netvsc_byslot()
2317 if (ndev->addr_len != vf_netdev->addr_len || in get_netvsc_byslot()
2318 memcmp(ndev->perm_addr, vf_netdev->perm_addr, in get_netvsc_byslot()
2335 if (ether_addr_equal(vf_netdev->perm_addr, ndev->perm_addr) || in get_netvsc_byslot()
2336 ether_addr_equal(vf_netdev->dev_addr, ndev->perm_addr)) in get_netvsc_byslot()
2340 netdev_notice(vf_netdev, in get_netvsc_byslot()
2345 static int netvsc_prepare_bonding(struct net_device *vf_netdev) in netvsc_prepare_bonding() argument
2349 ndev = get_netvsc_byslot(vf_netdev); in netvsc_prepare_bonding()
2354 vf_netdev->flags |= IFF_SLAVE; in netvsc_prepare_bonding()
2358 static int netvsc_register_vf(struct net_device *vf_netdev, int context) in netvsc_register_vf() argument
2366 if (vf_netdev->addr_len != ETH_ALEN) in netvsc_register_vf()
2369 ndev = get_netvsc_byslot(vf_netdev); in netvsc_register_vf()
2375 if (!netvsc_dev || rtnl_dereference(net_device_ctx->vf_netdev)) in netvsc_register_vf()
2382 if (!net_eq(dev_net(ndev), dev_net(vf_netdev))) { in netvsc_register_vf()
2383 ret = dev_change_net_namespace(vf_netdev, in netvsc_register_vf()
2386 netdev_err(vf_netdev, in netvsc_register_vf()
2390 netdev_info(vf_netdev, in netvsc_register_vf()
2396 netdev_info(ndev, "VF registering: %s\n", vf_netdev->name); in netvsc_register_vf()
2398 if (netvsc_vf_join(vf_netdev, ndev, context) != 0) in netvsc_register_vf()
2401 dev_hold(vf_netdev); in netvsc_register_vf()
2402 rcu_assign_pointer(net_device_ctx->vf_netdev, vf_netdev); in netvsc_register_vf()
2404 if (ndev->needed_headroom < vf_netdev->needed_headroom) in netvsc_register_vf()
2405 ndev->needed_headroom = vf_netdev->needed_headroom; in netvsc_register_vf()
2407 vf_netdev->wanted_features = ndev->features; in netvsc_register_vf()
2408 netdev_update_features(vf_netdev); in netvsc_register_vf()
2411 netvsc_vf_setxdp(vf_netdev, prog); in netvsc_register_vf()
2426 static int netvsc_vf_changed(struct net_device *vf_netdev, unsigned long event) in netvsc_vf_changed() argument
2435 vf_is_up = netif_running(vf_netdev); in netvsc_vf_changed()
2437 ndev = get_netvsc_byref(vf_netdev); in netvsc_vf_changed()
2459 vf_is_up ? "to" : "from", vf_netdev->name, ret); in netvsc_vf_changed()
2463 vf_is_up ? "to" : "from", vf_netdev->name); in netvsc_vf_changed()
2469 static int netvsc_unregister_vf(struct net_device *vf_netdev) in netvsc_unregister_vf() argument
2474 ndev = get_netvsc_byref(vf_netdev); in netvsc_unregister_vf()
2481 netdev_info(ndev, "VF unregistering: %s\n", vf_netdev->name); in netvsc_unregister_vf()
2483 netvsc_vf_setxdp(vf_netdev, NULL); in netvsc_unregister_vf()
2486 netdev_rx_handler_unregister(vf_netdev); in netvsc_unregister_vf()
2487 netdev_upper_dev_unlink(vf_netdev, ndev); in netvsc_unregister_vf()
2488 RCU_INIT_POINTER(net_device_ctx->vf_netdev, NULL); in netvsc_unregister_vf()
2489 dev_put(vf_netdev); in netvsc_unregister_vf()
2520 struct net_device *net = NULL, *vf_netdev; in netvsc_probe() local
2643 for_each_netdev(dev_net(net), vf_netdev) { in netvsc_probe()
2644 ret = check_dev_is_matching_vf(vf_netdev); in netvsc_probe()
2648 if (net != get_netvsc_byslot(vf_netdev)) in netvsc_probe()
2651 netvsc_prepare_bonding(vf_netdev); in netvsc_probe()
2652 netvsc_register_vf(vf_netdev, VF_REG_IN_PROBE); in netvsc_probe()
2653 __netvsc_vf_setup(net, vf_netdev); in netvsc_probe()
2678 struct net_device *vf_netdev, *net; in netvsc_remove() local
2702 vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev); in netvsc_remove()
2703 if (vf_netdev) in netvsc_remove()
2704 netvsc_unregister_vf(vf_netdev); in netvsc_remove()
2805 struct net_device *vf_netdev; in netvsc_event_set_vf_ns() local
2808 vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev); in netvsc_event_set_vf_ns()
2809 if (!vf_netdev) in netvsc_event_set_vf_ns()
2812 if (!net_eq(dev_net(ndev), dev_net(vf_netdev))) { in netvsc_event_set_vf_ns()
2813 ret = dev_change_net_namespace(vf_netdev, dev_net(ndev), in netvsc_event_set_vf_ns()
2816 netdev_err(vf_netdev, in netvsc_event_set_vf_ns()
2820 netdev_info(vf_netdev, in netvsc_event_set_vf_ns()