[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180307044051.6357-1-sthemmin@microsoft.com>
Date: Tue, 6 Mar 2018 20:40:51 -0800
From: Stephen Hemminger <stephen@...workplumber.org>
To: davem@...emloft.net
Cc: netdev@...r.kernel.org, Stephen Hemminger <sthemmin@...rosoft.com>
Subject: [PATCH] hv_netvsc: fix multicast flags and sync
This addresses two problems with recent multicast flags synchronization.
The wrong filter value was being computed (and therefore ARP would
not work on WS2016). And the uc/mc sync logic had locking issues because
it would be called with irq disabled (reported by lockdep).
Fixes: bee9d41b37ea ("hv_netvsc: propagate rx filters to VF")
Signed-off-by: Stephen Hemminger <sthemmin@...rosoft.com>
---
drivers/net/hyperv/netvsc_drv.c | 6 ------
drivers/net/hyperv/rndis_filter.c | 23 ++++++++++++++++-------
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index cdb78eefab67..55e7b5aa1711 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -89,14 +89,8 @@ static void netvsc_change_rx_flags(struct net_device *net, int change)
static void netvsc_set_rx_mode(struct net_device *net)
{
struct net_device_context *ndev_ctx = netdev_priv(net);
- struct net_device *vf_netdev = rtnl_dereference(ndev_ctx->vf_netdev);
struct netvsc_device *nvdev = rtnl_dereference(ndev_ctx->nvdev);
- if (vf_netdev) {
- dev_uc_sync(vf_netdev, net);
- dev_mc_sync(vf_netdev, net);
- }
-
rndis_filter_update(nvdev);
}
diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c
index 8927c483c217..b8cb2c3eb303 100644
--- a/drivers/net/hyperv/rndis_filter.c
+++ b/drivers/net/hyperv/rndis_filter.c
@@ -854,19 +854,28 @@ static void rndis_set_multicast(struct work_struct *w)
{
struct rndis_device *rdev
= container_of(w, struct rndis_device, mcast_work);
+ struct net_device *ndev = rdev->ndev;
+ struct net_device_context *ndev_ctx = netdev_priv(ndev);
+ struct net_device *vf_netdev;
u32 filter = NDIS_PACKET_TYPE_DIRECTED;
- unsigned int flags = rdev->ndev->flags;
- if (flags & IFF_PROMISC) {
+ if (ndev->flags & IFF_PROMISC) {
filter = NDIS_PACKET_TYPE_PROMISCUOUS;
} else {
- if (flags & IFF_ALLMULTI)
- flags |= NDIS_PACKET_TYPE_ALL_MULTICAST;
- if (flags & IFF_BROADCAST)
- flags |= NDIS_PACKET_TYPE_BROADCAST;
+ if (ndev->flags & IFF_ALLMULTI)
+ filter |= NDIS_PACKET_TYPE_ALL_MULTICAST;
+ if (ndev->flags & IFF_BROADCAST)
+ filter |= NDIS_PACKET_TYPE_BROADCAST;
}
-
rndis_filter_set_packet_filter(rdev, filter);
+
+ rcu_read_lock();
+ vf_netdev = rcu_dereference(ndev_ctx->vf_netdev);
+ if (vf_netdev) {
+ dev_uc_sync(vf_netdev, ndev);
+ dev_mc_sync(vf_netdev, ndev);
+ }
+ rcu_read_unlock();
}
void rndis_filter_update(struct netvsc_device *nvdev)
--
2.16.1
Powered by blists - more mailing lists