netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hv_netvsc: fix multicast flags and sync
@ 2018-03-07  4:40 Stephen Hemminger
  2018-03-07 18:48 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2018-03-07  4:40 UTC (permalink / raw)
  To: davem; +Cc: netdev, 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")
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hv_netvsc: fix multicast flags and sync
  2018-03-07  4:40 [PATCH] hv_netvsc: fix multicast flags and sync Stephen Hemminger
@ 2018-03-07 18:48 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2018-03-07 18:48 UTC (permalink / raw)
  To: davem; +Cc: netdev, Stephen Hemminger

On Tue,  6 Mar 2018 20:40:51 -0800
Stephen Hemminger <stephen@networkplumber.org> wrote:

> 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@microsoft.com>
> ---

Self NAK

Have a better fix, want to split this up.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-07 18:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-07  4:40 [PATCH] hv_netvsc: fix multicast flags and sync Stephen Hemminger
2018-03-07 18:48 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).