netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] netvsc: fix net poll mode
@ 2017-05-12 20:03 Stephen Hemminger
  2017-05-12 21:15 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Stephen Hemminger @ 2017-05-12 20:03 UTC (permalink / raw)
  To: davem; +Cc: netdev, Stephen Hemminger

The ndo_poll_controller function needs to schedule NAPI to pick
up arriving packets and send completions. Otherwise no data
will ever be received.

Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
---
 drivers/net/hyperv/netvsc_drv.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
index 4421a6d00375..e487ccea251c 100644
--- a/drivers/net/hyperv/netvsc_drv.c
+++ b/drivers/net/hyperv/netvsc_drv.c
@@ -1158,11 +1158,20 @@ netvsc_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
 }
 
 #ifdef CONFIG_NET_POLL_CONTROLLER
-static void netvsc_poll_controller(struct net_device *net)
+static void netvsc_poll_controller(struct net_device *dev)
 {
-	/* As netvsc_start_xmit() works synchronous we don't have to
-	 * trigger anything here.
-	 */
+	struct net_device_context *ndc = netdev_priv(dev);
+	struct netvsc_device *ndev = rtnl_dereference(ndc->nvdev);
+	int i;
+
+	if (!ndev)
+		return;
+
+	for (i = 0; i < ndev->num_chn; i++) {
+		struct netvsc_channel *nvchan = &ndev->chan_table[i];
+
+		napi_schedule(&nvchan->napi);
+	}
 }
 #endif
 
-- 
2.11.0

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

* Re: [PATCH net] netvsc: fix net poll mode
  2017-05-12 20:03 [PATCH net] netvsc: fix net poll mode Stephen Hemminger
@ 2017-05-12 21:15 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2017-05-12 21:15 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: davem, netdev, Stephen Hemminger

On Fri, 2017-05-12 at 13:03 -0700, Stephen Hemminger wrote:
> The ndo_poll_controller function needs to schedule NAPI to pick
> up arriving packets and send completions. Otherwise no data
> will ever be received.
> 
> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
> ---
>  drivers/net/hyperv/netvsc_drv.c | 17 +++++++++++++----
>  1 file changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c
> index 4421a6d00375..e487ccea251c 100644
> --- a/drivers/net/hyperv/netvsc_drv.c
> +++ b/drivers/net/hyperv/netvsc_drv.c
> @@ -1158,11 +1158,20 @@ netvsc_get_rxnfc(struct net_device *dev, struct ethtool_rxnfc *info,
>  }
>  
>  #ifdef CONFIG_NET_POLL_CONTROLLER
> -static void netvsc_poll_controller(struct net_device *net)
> +static void netvsc_poll_controller(struct net_device *dev)
>  {
> -	/* As netvsc_start_xmit() works synchronous we don't have to
> -	 * trigger anything here.
> -	 */
> +	struct net_device_context *ndc = netdev_priv(dev);
> +	struct netvsc_device *ndev = rtnl_dereference(ndc->nvdev);


rtnl_dereference() can not possibly be used in an ndo_poll_controller()

You would certainly trigger a lockdep issue here if you compile a kernel
with enough debugging support.

CONFIG_PROVE_RCU=y
CONFIG_PROVE_RCU_REPEATEDLY=y
CONFIG_SPARSE_RCU_POINTER=y

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

end of thread, other threads:[~2017-05-12 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-12 20:03 [PATCH net] netvsc: fix net poll mode Stephen Hemminger
2017-05-12 21:15 ` Eric Dumazet

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