diff mbox series

[net] veth: Update XDP feature set when bringing up device

Message ID 20230911135826.722295-1-toke@redhat.com (mailing list archive)
State Accepted
Commit 7a6102aa6df0d5d032b4cbc51935d1d4cda17254
Delegated to: Netdev Maintainers
Headers show
Series [net] veth: Update XDP feature set when bringing up device | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1340 this patch: 1340
netdev/cc_maintainers success CCed 14 of 14 maintainers
netdev/build_clang success Errors and warnings before: 1363 this patch: 1363
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 1363 this patch: 1363
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Toke Høiland-Jørgensen Sept. 11, 2023, 1:58 p.m. UTC
There's an early return in veth_set_features() if the device is in a down
state, which leads to the XDP feature flags not being updated when enabling
GRO while the device is down. Which in turn leads to XDP_REDIRECT not
working, because the redirect code now checks the flags.

Fix this by updating the feature flags after bringing the device up.

Before this patch:

NETDEV_XDP_ACT_BASIC:		yes
NETDEV_XDP_ACT_REDIRECT:	yes
NETDEV_XDP_ACT_NDO_XMIT:	no
NETDEV_XDP_ACT_XSK_ZEROCOPY:	no
NETDEV_XDP_ACT_HW_OFFLOAD:	no
NETDEV_XDP_ACT_RX_SG:		yes
NETDEV_XDP_ACT_NDO_XMIT_SG:	no

After this patch:

NETDEV_XDP_ACT_BASIC:		yes
NETDEV_XDP_ACT_REDIRECT:	yes
NETDEV_XDP_ACT_NDO_XMIT:	yes
NETDEV_XDP_ACT_XSK_ZEROCOPY:	no
NETDEV_XDP_ACT_HW_OFFLOAD:	no
NETDEV_XDP_ACT_RX_SG:		yes
NETDEV_XDP_ACT_NDO_XMIT_SG:	yes

Fixes: fccca038f300 ("veth: take into account device reconfiguration for xdp_features flag")
Fixes: 66c0e13ad236 ("drivers: net: turn on XDP features")
Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
---
 drivers/net/veth.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Paolo Abeni Sept. 12, 2023, 10:07 a.m. UTC | #1
Hi,

On Mon, 2023-09-11 at 15:58 +0200, Toke Høiland-Jørgensen wrote:
> There's an early return in veth_set_features() if the device is in a down
> state, which leads to the XDP feature flags not being updated when enabling
> GRO while the device is down. Which in turn leads to XDP_REDIRECT not
> working, because the redirect code now checks the flags.
> 
> Fix this by updating the feature flags after bringing the device up.
> 
> Before this patch:
> 
> NETDEV_XDP_ACT_BASIC:		yes
> NETDEV_XDP_ACT_REDIRECT:	yes
> NETDEV_XDP_ACT_NDO_XMIT:	no
> NETDEV_XDP_ACT_XSK_ZEROCOPY:	no
> NETDEV_XDP_ACT_HW_OFFLOAD:	no
> NETDEV_XDP_ACT_RX_SG:		yes
> NETDEV_XDP_ACT_NDO_XMIT_SG:	no
> 
> After this patch:
> 
> NETDEV_XDP_ACT_BASIC:		yes
> NETDEV_XDP_ACT_REDIRECT:	yes
> NETDEV_XDP_ACT_NDO_XMIT:	yes
> NETDEV_XDP_ACT_XSK_ZEROCOPY:	no
> NETDEV_XDP_ACT_HW_OFFLOAD:	no
> NETDEV_XDP_ACT_RX_SG:		yes
> NETDEV_XDP_ACT_NDO_XMIT_SG:	yes
> 
> Fixes: fccca038f300 ("veth: take into account device reconfiguration for xdp_features flag")
> Fixes: 66c0e13ad236 ("drivers: net: turn on XDP features")
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> ---
>  drivers/net/veth.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> index 9c6f4f83f22b..0deefd1573cf 100644
> --- a/drivers/net/veth.c
> +++ b/drivers/net/veth.c
> @@ -1446,6 +1446,8 @@ static int veth_open(struct net_device *dev)
>  		netif_carrier_on(peer);
>  	}
>  
> +	veth_set_xdp_features(dev);
> +
>  	return 0;
>  }

The patch LGTM, thanks!

I think it would be nice to add some specific self-tests here. Could
you please consider following-up with them?

Thanks,

Paolo
Toke Høiland-Jørgensen Sept. 12, 2023, 12:54 p.m. UTC | #2
Paolo Abeni <pabeni@redhat.com> writes:

> Hi,
>
> On Mon, 2023-09-11 at 15:58 +0200, Toke Høiland-Jørgensen wrote:
>> There's an early return in veth_set_features() if the device is in a down
>> state, which leads to the XDP feature flags not being updated when enabling
>> GRO while the device is down. Which in turn leads to XDP_REDIRECT not
>> working, because the redirect code now checks the flags.
>> 
>> Fix this by updating the feature flags after bringing the device up.
>> 
>> Before this patch:
>> 
>> NETDEV_XDP_ACT_BASIC:		yes
>> NETDEV_XDP_ACT_REDIRECT:	yes
>> NETDEV_XDP_ACT_NDO_XMIT:	no
>> NETDEV_XDP_ACT_XSK_ZEROCOPY:	no
>> NETDEV_XDP_ACT_HW_OFFLOAD:	no
>> NETDEV_XDP_ACT_RX_SG:		yes
>> NETDEV_XDP_ACT_NDO_XMIT_SG:	no
>> 
>> After this patch:
>> 
>> NETDEV_XDP_ACT_BASIC:		yes
>> NETDEV_XDP_ACT_REDIRECT:	yes
>> NETDEV_XDP_ACT_NDO_XMIT:	yes
>> NETDEV_XDP_ACT_XSK_ZEROCOPY:	no
>> NETDEV_XDP_ACT_HW_OFFLOAD:	no
>> NETDEV_XDP_ACT_RX_SG:		yes
>> NETDEV_XDP_ACT_NDO_XMIT_SG:	yes
>> 
>> Fixes: fccca038f300 ("veth: take into account device reconfiguration for xdp_features flag")
>> Fixes: 66c0e13ad236 ("drivers: net: turn on XDP features")
>> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>> ---
>>  drivers/net/veth.c | 2 ++
>>  1 file changed, 2 insertions(+)
>> 
>> diff --git a/drivers/net/veth.c b/drivers/net/veth.c
>> index 9c6f4f83f22b..0deefd1573cf 100644
>> --- a/drivers/net/veth.c
>> +++ b/drivers/net/veth.c
>> @@ -1446,6 +1446,8 @@ static int veth_open(struct net_device *dev)
>>  		netif_carrier_on(peer);
>>  	}
>>  
>> +	veth_set_xdp_features(dev);
>> +
>>  	return 0;
>>  }
>
> The patch LGTM, thanks!
>
> I think it would be nice to add some specific self-tests here. Could
> you please consider following-up with them?

Sure! Do you want me to resubmit this as well, or are you just going to
apply it as-is and do the selftest as a follow-up?

-Toke
Paolo Abeni Sept. 12, 2023, 1:10 p.m. UTC | #3
On Tue, 2023-09-12 at 14:54 +0200, Toke Høiland-Jørgensen wrote:
> Paolo Abeni <pabeni@redhat.com> writes:
> 
> > Hi,
> > 
> > On Mon, 2023-09-11 at 15:58 +0200, Toke Høiland-Jørgensen wrote:
> > > There's an early return in veth_set_features() if the device is in a down
> > > state, which leads to the XDP feature flags not being updated when enabling
> > > GRO while the device is down. Which in turn leads to XDP_REDIRECT not
> > > working, because the redirect code now checks the flags.
> > > 
> > > Fix this by updating the feature flags after bringing the device up.
> > > 
> > > Before this patch:
> > > 
> > > NETDEV_XDP_ACT_BASIC:		yes
> > > NETDEV_XDP_ACT_REDIRECT:	yes
> > > NETDEV_XDP_ACT_NDO_XMIT:	no
> > > NETDEV_XDP_ACT_XSK_ZEROCOPY:	no
> > > NETDEV_XDP_ACT_HW_OFFLOAD:	no
> > > NETDEV_XDP_ACT_RX_SG:		yes
> > > NETDEV_XDP_ACT_NDO_XMIT_SG:	no
> > > 
> > > After this patch:
> > > 
> > > NETDEV_XDP_ACT_BASIC:		yes
> > > NETDEV_XDP_ACT_REDIRECT:	yes
> > > NETDEV_XDP_ACT_NDO_XMIT:	yes
> > > NETDEV_XDP_ACT_XSK_ZEROCOPY:	no
> > > NETDEV_XDP_ACT_HW_OFFLOAD:	no
> > > NETDEV_XDP_ACT_RX_SG:		yes
> > > NETDEV_XDP_ACT_NDO_XMIT_SG:	yes
> > > 
> > > Fixes: fccca038f300 ("veth: take into account device reconfiguration for xdp_features flag")
> > > Fixes: 66c0e13ad236 ("drivers: net: turn on XDP features")
> > > Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
> > > ---
> > >  drivers/net/veth.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/drivers/net/veth.c b/drivers/net/veth.c
> > > index 9c6f4f83f22b..0deefd1573cf 100644
> > > --- a/drivers/net/veth.c
> > > +++ b/drivers/net/veth.c
> > > @@ -1446,6 +1446,8 @@ static int veth_open(struct net_device *dev)
> > >  		netif_carrier_on(peer);
> > >  	}
> > >  
> > > +	veth_set_xdp_features(dev);
> > > +
> > >  	return 0;
> > >  }
> > 
> > The patch LGTM, thanks!
> > 
> > I think it would be nice to add some specific self-tests here. Could
> > you please consider following-up with them?
> 
> Sure! Do you want me to resubmit this as well, or are you just going to
> apply it as-is and do the selftest as a follow-up?

I think the latter is simpler and works for me. The self-test could
target net-next, the fix is going to land there shortly after -net.

Thanks!

Paolo
Toke Høiland-Jørgensen Sept. 12, 2023, 1:15 p.m. UTC | #4
Paolo Abeni <pabeni@redhat.com> writes:

> On Tue, 2023-09-12 at 14:54 +0200, Toke Høiland-Jørgensen wrote:
>> Paolo Abeni <pabeni@redhat.com> writes:
>> 
>> > Hi,
>> > 
>> > On Mon, 2023-09-11 at 15:58 +0200, Toke Høiland-Jørgensen wrote:
>> > > There's an early return in veth_set_features() if the device is in a down
>> > > state, which leads to the XDP feature flags not being updated when enabling
>> > > GRO while the device is down. Which in turn leads to XDP_REDIRECT not
>> > > working, because the redirect code now checks the flags.
>> > > 
>> > > Fix this by updating the feature flags after bringing the device up.
>> > > 
>> > > Before this patch:
>> > > 
>> > > NETDEV_XDP_ACT_BASIC:		yes
>> > > NETDEV_XDP_ACT_REDIRECT:	yes
>> > > NETDEV_XDP_ACT_NDO_XMIT:	no
>> > > NETDEV_XDP_ACT_XSK_ZEROCOPY:	no
>> > > NETDEV_XDP_ACT_HW_OFFLOAD:	no
>> > > NETDEV_XDP_ACT_RX_SG:		yes
>> > > NETDEV_XDP_ACT_NDO_XMIT_SG:	no
>> > > 
>> > > After this patch:
>> > > 
>> > > NETDEV_XDP_ACT_BASIC:		yes
>> > > NETDEV_XDP_ACT_REDIRECT:	yes
>> > > NETDEV_XDP_ACT_NDO_XMIT:	yes
>> > > NETDEV_XDP_ACT_XSK_ZEROCOPY:	no
>> > > NETDEV_XDP_ACT_HW_OFFLOAD:	no
>> > > NETDEV_XDP_ACT_RX_SG:		yes
>> > > NETDEV_XDP_ACT_NDO_XMIT_SG:	yes
>> > > 
>> > > Fixes: fccca038f300 ("veth: take into account device reconfiguration for xdp_features flag")
>> > > Fixes: 66c0e13ad236 ("drivers: net: turn on XDP features")
>> > > Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
>> > > ---
>> > >  drivers/net/veth.c | 2 ++
>> > >  1 file changed, 2 insertions(+)
>> > > 
>> > > diff --git a/drivers/net/veth.c b/drivers/net/veth.c
>> > > index 9c6f4f83f22b..0deefd1573cf 100644
>> > > --- a/drivers/net/veth.c
>> > > +++ b/drivers/net/veth.c
>> > > @@ -1446,6 +1446,8 @@ static int veth_open(struct net_device *dev)
>> > >  		netif_carrier_on(peer);
>> > >  	}
>> > >  
>> > > +	veth_set_xdp_features(dev);
>> > > +
>> > >  	return 0;
>> > >  }
>> > 
>> > The patch LGTM, thanks!
>> > 
>> > I think it would be nice to add some specific self-tests here. Could
>> > you please consider following-up with them?
>> 
>> Sure! Do you want me to resubmit this as well, or are you just going to
>> apply it as-is and do the selftest as a follow-up?
>
> I think the latter is simpler and works for me. The self-test could
> target net-next, the fix is going to land there shortly after -net.

ACK, SGTM!

-Toke
patchwork-bot+netdevbpf@kernel.org Sept. 12, 2023, 2:40 p.m. UTC | #5
Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:

On Mon, 11 Sep 2023 15:58:25 +0200 you wrote:
> There's an early return in veth_set_features() if the device is in a down
> state, which leads to the XDP feature flags not being updated when enabling
> GRO while the device is down. Which in turn leads to XDP_REDIRECT not
> working, because the redirect code now checks the flags.
> 
> Fix this by updating the feature flags after bringing the device up.
> 
> [...]

Here is the summary with links:
  - [net] veth: Update XDP feature set when bringing up device
    https://git.kernel.org/netdev/net/c/7a6102aa6df0

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 9c6f4f83f22b..0deefd1573cf 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -1446,6 +1446,8 @@  static int veth_open(struct net_device *dev)
 		netif_carrier_on(peer);
 	}
 
+	veth_set_xdp_features(dev);
+
 	return 0;
 }