Skip to content

Commit bee9d41

Browse files
shemmingerdavem330
authored andcommitted
hv_netvsc: propagate rx filters to VF
The netvsc device should propagate filters to the SR-IOV VF device (if present). The flags also need to be propagated to the VF device as well. This only really matters on local Hyper-V since Azure does not support multiple addresses. Signed-off-by: Stephen Hemminger <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 009f766 commit bee9d41

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

drivers/net/hyperv/netvsc_drv.c

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,36 @@ static int debug = -1;
6666
module_param(debug, int, S_IRUGO);
6767
MODULE_PARM_DESC(debug, "Debug level (0=none,...,16=all)");
6868

69-
static void netvsc_set_multicast_list(struct net_device *net)
69+
static void netvsc_change_rx_flags(struct net_device *net, int change)
7070
{
71-
struct net_device_context *net_device_ctx = netdev_priv(net);
72-
struct netvsc_device *nvdev = rtnl_dereference(net_device_ctx->nvdev);
71+
struct net_device_context *ndev_ctx = netdev_priv(net);
72+
struct net_device *vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev);
73+
int inc;
74+
75+
if (!vf_netdev)
76+
return;
77+
78+
if (change & IFF_PROMISC) {
79+
inc = (net->flags & IFF_PROMISC) ? 1 : -1;
80+
dev_set_promiscuity(vf_netdev, inc);
81+
}
82+
83+
if (change & IFF_ALLMULTI) {
84+
inc = (net->flags & IFF_ALLMULTI) ? 1 : -1;
85+
dev_set_allmulti(vf_netdev, inc);
86+
}
87+
}
88+
89+
static void netvsc_set_rx_mode(struct net_device *net)
90+
{
91+
struct net_device_context *ndev_ctx = netdev_priv(net);
92+
struct net_device *vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev);
93+
struct netvsc_device *nvdev = rtnl_dereference(ndev_ctx->nvdev);
94+
95+
if (vf_netdev) {
96+
dev_uc_sync(vf_netdev, net);
97+
dev_mc_sync(vf_netdev, net);
98+
}
7399

74100
rndis_filter_update(nvdev);
75101
}
@@ -1586,7 +1612,8 @@ static const struct net_device_ops device_ops = {
15861612
.ndo_open = netvsc_open,
15871613
.ndo_stop = netvsc_close,
15881614
.ndo_start_xmit = netvsc_start_xmit,
1589-
.ndo_set_rx_mode = netvsc_set_multicast_list,
1615+
.ndo_change_rx_flags = netvsc_change_rx_flags,
1616+
.ndo_set_rx_mode = netvsc_set_rx_mode,
15901617
.ndo_change_mtu = netvsc_change_mtu,
15911618
.ndo_validate_addr = eth_validate_addr,
15921619
.ndo_set_mac_address = netvsc_set_mac_addr,
@@ -1817,6 +1844,11 @@ static void __netvsc_vf_setup(struct net_device *ndev,
18171844
netdev_warn(vf_netdev,
18181845
"unable to change mtu to %u\n", ndev->mtu);
18191846

1847+
/* set multicast etc flags on VF */
1848+
dev_change_flags(vf_netdev, ndev->flags | IFF_SLAVE);
1849+
dev_uc_sync(vf_netdev, ndev);
1850+
dev_mc_sync(vf_netdev, ndev);
1851+
18201852
if (netif_running(ndev)) {
18211853
ret = dev_open(vf_netdev);
18221854
if (ret)

0 commit comments

Comments
 (0)