All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] veth: check for NAPI instead of xdp_prog before xmit of XDP frame
@ 2021-04-16 15:47 Toke Høiland-Jørgensen
  2021-04-16 15:59 ` Jesper Dangaard Brouer
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Toke Høiland-Jørgensen @ 2021-04-16 15:47 UTC (permalink / raw)
  To: David S. Miller
  Cc: Toke Høiland-Jørgensen, Jakub Kicinski,
	Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
	John Fastabend, Paolo Abeni, netdev, bpf

The recent patch that tied enabling of veth NAPI to the GRO flag also has
the nice side effect that a veth device can be the target of an
XDP_REDIRECT without an XDP program needing to be loaded on the peer
device. However, the patch adding this extra NAPI mode didn't actually
change the check in veth_xdp_xmit() to also look at the new NAPI pointer,
so let's fix that.

Fixes: 6788fa154546 ("veth: allow enabling NAPI even without XDP")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
 drivers/net/veth.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 15b2e3923c47..bdb7ce3cb054 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -486,11 +486,10 @@ static int veth_xdp_xmit(struct net_device *dev, int n,
 
 	rcv_priv = netdev_priv(rcv);
 	rq = &rcv_priv->rq[veth_select_rxq(rcv)];
-	/* Non-NULL xdp_prog ensures that xdp_ring is initialized on receive
-	 * side. This means an XDP program is loaded on the peer and the peer
-	 * device is up.
+	/* The napi pointer is set if NAPI is enabled, which ensures that
+	 * xdp_ring is initialized on receive side and the peer device is up.
 	 */
-	if (!rcu_access_pointer(rq->xdp_prog))
+	if (!rcu_access_pointer(rq->napi))
 		goto out;
 
 	max_len = rcv->mtu + rcv->hard_header_len + VLAN_HLEN;
-- 
2.31.1


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

* Re: [PATCH net-next] veth: check for NAPI instead of xdp_prog before xmit of XDP frame
  2021-04-16 15:47 [PATCH net-next] veth: check for NAPI instead of xdp_prog before xmit of XDP frame Toke Høiland-Jørgensen
@ 2021-04-16 15:59 ` Jesper Dangaard Brouer
  2021-04-16 17:52 ` Paolo Abeni
  2021-04-16 22:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Jesper Dangaard Brouer @ 2021-04-16 15:59 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen
  Cc: brouer, David S. Miller, Jakub Kicinski, Alexei Starovoitov,
	Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
	Paolo Abeni, netdev, bpf

On Fri, 16 Apr 2021 17:47:45 +0200
Toke Høiland-Jørgensen <toke@redhat.com> wrote:

> The recent patch that tied enabling of veth NAPI to the GRO flag also has
> the nice side effect that a veth device can be the target of an
> XDP_REDIRECT without an XDP program needing to be loaded on the peer
> device. However, the patch adding this extra NAPI mode didn't actually
> change the check in veth_xdp_xmit() to also look at the new NAPI pointer,
> so let's fix that.
> 
> Fixes: 6788fa154546 ("veth: allow enabling NAPI even without XDP")
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> ---
>  drivers/net/veth.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>

Very happy to see this strange requirement of loading an xdp_prog on
the veth peer (inside the netns) being lifted.  Multiple people/users
have hit this issue and complained.  Thanks for the followup to fix
this! :-)

> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index 15b2e3923c47..bdb7ce3cb054 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -486,11 +486,10 @@ static int veth_xdp_xmit(struct net_device *dev, int n,
>  
>  	rcv_priv = netdev_priv(rcv);
>  	rq = &rcv_priv->rq[veth_select_rxq(rcv)];
> -	/* Non-NULL xdp_prog ensures that xdp_ring is initialized on receive
> -	 * side. This means an XDP program is loaded on the peer and the peer
> -	 * device is up.
> +	/* The napi pointer is set if NAPI is enabled, which ensures that
> +	 * xdp_ring is initialized on receive side and the peer device is up.
>  	 */
> -	if (!rcu_access_pointer(rq->xdp_prog))
> +	if (!rcu_access_pointer(rq->napi))
>  		goto out;
>  
>  	max_len = rcv->mtu + rcv->hard_header_len + VLAN_HLEN;



-- 
Best regards,
  Jesper Dangaard Brouer
  MSc.CS, Principal Kernel Engineer at Red Hat
  LinkedIn: http://www.linkedin.com/in/brouer


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

* Re: [PATCH net-next] veth: check for NAPI instead of xdp_prog before xmit of XDP frame
  2021-04-16 15:47 [PATCH net-next] veth: check for NAPI instead of xdp_prog before xmit of XDP frame Toke Høiland-Jørgensen
  2021-04-16 15:59 ` Jesper Dangaard Brouer
@ 2021-04-16 17:52 ` Paolo Abeni
  2021-04-16 22:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Paolo Abeni @ 2021-04-16 17:52 UTC (permalink / raw)
  To: Toke Høiland-Jørgensen, David S. Miller
  Cc: Jakub Kicinski, Alexei Starovoitov, Daniel Borkmann,
	Jesper Dangaard Brouer, John Fastabend, netdev, bpf

On Fri, 2021-04-16 at 17:47 +0200, Toke Høiland-Jørgensen wrote:
> The recent patch that tied enabling of veth NAPI to the GRO flag also has
> the nice side effect that a veth device can be the target of an
> XDP_REDIRECT without an XDP program needing to be loaded on the peer
> device. However, the patch adding this extra NAPI mode didn't actually
> change the check in veth_xdp_xmit() to also look at the new NAPI pointer,
> so let's fix that.
> 
> Fixes: 6788fa154546 ("veth: allow enabling NAPI even without XDP")
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> ---
>  drivers/net/veth.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index 15b2e3923c47..bdb7ce3cb054 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -486,11 +486,10 @@ static int veth_xdp_xmit(struct net_device *dev, int n,
>  
>  	rcv_priv = netdev_priv(rcv);
>  	rq = &rcv_priv->rq[veth_select_rxq(rcv)];
> -	/* Non-NULL xdp_prog ensures that xdp_ring is initialized on receive
> -	 * side. This means an XDP program is loaded on the peer and the peer
> -	 * device is up.
> +	/* The napi pointer is set if NAPI is enabled, which ensures that
> +	 * xdp_ring is initialized on receive side and the peer device is up.
>  	 */
> -	if (!rcu_access_pointer(rq->xdp_prog))
> +	if (!rcu_access_pointer(rq->napi))
>  		goto out;
>  
>  	max_len = rcv->mtu + rcv->hard_header_len + VLAN_HLEN;

Acked-by: Paolo Abeni <pabeni@redhat.com>

Thanks for the quick turn-around!


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

* Re: [PATCH net-next] veth: check for NAPI instead of xdp_prog before xmit of XDP frame
  2021-04-16 15:47 [PATCH net-next] veth: check for NAPI instead of xdp_prog before xmit of XDP frame Toke Høiland-Jørgensen
  2021-04-16 15:59 ` Jesper Dangaard Brouer
  2021-04-16 17:52 ` Paolo Abeni
@ 2021-04-16 22:50 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-04-16 22:50 UTC (permalink / raw)
  To: =?utf-8?b?VG9rZSBIw7hpbGFuZC1Kw7hyZ2Vuc2VuIDx0b2tlQHJlZGhhdC5jb20+?=
  Cc: davem, kuba, ast, daniel, hawk, john.fastabend, pabeni, netdev, bpf

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

On Fri, 16 Apr 2021 17:47:45 +0200 you wrote:
> The recent patch that tied enabling of veth NAPI to the GRO flag also has
> the nice side effect that a veth device can be the target of an
> XDP_REDIRECT without an XDP program needing to be loaded on the peer
> device. However, the patch adding this extra NAPI mode didn't actually
> change the check in veth_xdp_xmit() to also look at the new NAPI pointer,
> so let's fix that.
> 
> [...]

Here is the summary with links:
  - [net-next] veth: check for NAPI instead of xdp_prog before xmit of XDP frame
    https://git.kernel.org/netdev/net-next/c/0e672f306a28

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



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

end of thread, other threads:[~2021-04-16 22:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-16 15:47 [PATCH net-next] veth: check for NAPI instead of xdp_prog before xmit of XDP frame Toke Høiland-Jørgensen
2021-04-16 15:59 ` Jesper Dangaard Brouer
2021-04-16 17:52 ` Paolo Abeni
2021-04-16 22:50 ` patchwork-bot+netdevbpf

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.