Skip to contentSkip to conversation

hv_netvsc: fix multicast flags and sync

PATCH Superseded Stephen Hemminger 1 participant 2 messages Mar 7, 2018

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
---
 drivers/net/hyperv/netvsc_drv.c   |  6 ------
 drivers/net/hyperv/rndis_filter.c | 23 ++++++++++++++++-------
 2 files changed, 16 insertions(+), 13 deletions(-)
drivers/net/hyperv/netvsc_drv.c +0 -6
index cdb78eefab67..55e7b5aa1711 100644
@@ -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);
 }
 
drivers/net/hyperv/rndis_filter.c +16 -7
index 8927c483c217..b8cb2c3eb303 100644
@@ -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)
Signature · 1 line
2.16.1
#1 lore raw
Quoted 8 lines · On Tue, 6 Mar 2018 20:40:51 -0800 Stephen Hemminger…

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")

---

Self NAK

Have a better fix, want to split this up.