* [PATCH net] bonding: do not report NETDEV_XDP_ACT_XSK_ZEROCOPY
@ 2024-02-05 12:30 Magnus Karlsson
2024-02-05 13:08 ` Toke Høiland-Jørgensen
0 siblings, 1 reply; 5+ messages in thread
From: Magnus Karlsson @ 2024-02-05 12:30 UTC (permalink / raw)
To: magnus.karlsson, bjorn, ast, daniel, netdev, maciej.fijalkowski,
kuba, toke, pabeni, davem, j.vosburgh, andy, hawk, john.fastabend,
edumazet
Cc: bpf, Prashant Batra
From: Magnus Karlsson <magnus.karlsson@intel.com>
Do not report the XDP capability NETDEV_XDP_ACT_XSK_ZEROCOPY as the
bonding driver does not support XDP and AF_XDP in zero-copy mode even
if the real NIC drivers do.
Fixes: cb9e6e584d58 ("bonding: add xdp_features support")
Reported-by: Prashant Batra <prbatra.mail@gmail.com>
Link: https://lore.kernel.org/all/CAJ8uoz2ieZCopgqTvQ9ZY6xQgTbujmC6XkMTamhp68O-h_-rLg@mail.gmail.com/T/
Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
---
drivers/net/bonding/bond_main.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 4e0600c7b050..79a37bed097b 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1819,6 +1819,8 @@ void bond_xdp_set_features(struct net_device *bond_dev)
bond_for_each_slave(bond, slave, iter)
val &= slave->dev->xdp_features;
+ val &= ~NETDEV_XDP_ACT_XSK_ZEROCOPY;
+
xdp_set_features_flag(bond_dev, val);
}
@@ -5910,8 +5912,10 @@ void bond_setup(struct net_device *bond_dev)
bond_dev->features |= BOND_XFRM_FEATURES;
#endif /* CONFIG_XFRM_OFFLOAD */
- if (bond_xdp_check(bond))
+ if (bond_xdp_check(bond)) {
bond_dev->xdp_features = NETDEV_XDP_ACT_MASK;
+ bond_dev->xdp_features &= ~NETDEV_XDP_ACT_XSK_ZEROCOPY;
+ }
}
/* Destroy a bonding device.
base-commit: fdeba0b57d61b40a708de361294fde3e1495588d
--
2.42.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] bonding: do not report NETDEV_XDP_ACT_XSK_ZEROCOPY
2024-02-05 12:30 [PATCH net] bonding: do not report NETDEV_XDP_ACT_XSK_ZEROCOPY Magnus Karlsson
@ 2024-02-05 13:08 ` Toke Høiland-Jørgensen
2024-02-06 9:55 ` Magnus Karlsson
0 siblings, 1 reply; 5+ messages in thread
From: Toke Høiland-Jørgensen @ 2024-02-05 13:08 UTC (permalink / raw)
To: Magnus Karlsson, magnus.karlsson, bjorn, ast, daniel, netdev,
maciej.fijalkowski, kuba, pabeni, davem, j.vosburgh, andy, hawk,
john.fastabend, edumazet
Cc: bpf, Prashant Batra
Magnus Karlsson <magnus.karlsson@gmail.com> writes:
> From: Magnus Karlsson <magnus.karlsson@intel.com>
>
> Do not report the XDP capability NETDEV_XDP_ACT_XSK_ZEROCOPY as the
> bonding driver does not support XDP and AF_XDP in zero-copy mode even
> if the real NIC drivers do.
>
> Fixes: cb9e6e584d58 ("bonding: add xdp_features support")
> Reported-by: Prashant Batra <prbatra.mail@gmail.com>
> Link: https://lore.kernel.org/all/CAJ8uoz2ieZCopgqTvQ9ZY6xQgTbujmC6XkMTamhp68O-h_-rLg@mail.gmail.com/T/
> Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
> ---
> drivers/net/bonding/bond_main.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index 4e0600c7b050..79a37bed097b 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -1819,6 +1819,8 @@ void bond_xdp_set_features(struct net_device *bond_dev)
> bond_for_each_slave(bond, slave, iter)
> val &= slave->dev->xdp_features;
>
> + val &= ~NETDEV_XDP_ACT_XSK_ZEROCOPY;
> +
> xdp_set_features_flag(bond_dev, val);
> }
>
> @@ -5910,8 +5912,10 @@ void bond_setup(struct net_device *bond_dev)
> bond_dev->features |= BOND_XFRM_FEATURES;
> #endif /* CONFIG_XFRM_OFFLOAD */
>
> - if (bond_xdp_check(bond))
> + if (bond_xdp_check(bond)) {
> bond_dev->xdp_features = NETDEV_XDP_ACT_MASK;
> + bond_dev->xdp_features &= ~NETDEV_XDP_ACT_XSK_ZEROCOPY;
> + }
Shouldn't we rather drop this assignment completely? It makes no sense
to default to all features, it should default to none...
-Toke
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] bonding: do not report NETDEV_XDP_ACT_XSK_ZEROCOPY
2024-02-05 13:08 ` Toke Høiland-Jørgensen
@ 2024-02-06 9:55 ` Magnus Karlsson
2024-02-06 15:16 ` Lorenzo Bianconi
0 siblings, 1 reply; 5+ messages in thread
From: Magnus Karlsson @ 2024-02-06 9:55 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: magnus.karlsson, bjorn, ast, daniel, netdev, maciej.fijalkowski,
kuba, pabeni, davem, j.vosburgh, andy, hawk, john.fastabend,
edumazet, bpf, Prashant Batra, Lorenzo Bianconi
On Mon, 5 Feb 2024 at 14:08, Toke Høiland-Jørgensen <toke@redhat.com> wrote:
>
> Magnus Karlsson <magnus.karlsson@gmail.com> writes:
>
> > From: Magnus Karlsson <magnus.karlsson@intel.com>
> >
> > Do not report the XDP capability NETDEV_XDP_ACT_XSK_ZEROCOPY as the
> > bonding driver does not support XDP and AF_XDP in zero-copy mode even
> > if the real NIC drivers do.
> >
> > Fixes: cb9e6e584d58 ("bonding: add xdp_features support")
> > Reported-by: Prashant Batra <prbatra.mail@gmail.com>
> > Link: https://lore.kernel.org/all/CAJ8uoz2ieZCopgqTvQ9ZY6xQgTbujmC6XkMTamhp68O-h_-rLg@mail.gmail.com/T/
> > Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
> > ---
> > drivers/net/bonding/bond_main.c | 6 +++++-
> > 1 file changed, 5 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> > index 4e0600c7b050..79a37bed097b 100644
> > --- a/drivers/net/bonding/bond_main.c
> > +++ b/drivers/net/bonding/bond_main.c
> > @@ -1819,6 +1819,8 @@ void bond_xdp_set_features(struct net_device *bond_dev)
> > bond_for_each_slave(bond, slave, iter)
> > val &= slave->dev->xdp_features;
> >
> > + val &= ~NETDEV_XDP_ACT_XSK_ZEROCOPY;
> > +
> > xdp_set_features_flag(bond_dev, val);
> > }
> >
> > @@ -5910,8 +5912,10 @@ void bond_setup(struct net_device *bond_dev)
> > bond_dev->features |= BOND_XFRM_FEATURES;
> > #endif /* CONFIG_XFRM_OFFLOAD */
> >
> > - if (bond_xdp_check(bond))
> > + if (bond_xdp_check(bond)) {
> > bond_dev->xdp_features = NETDEV_XDP_ACT_MASK;
> > + bond_dev->xdp_features &= ~NETDEV_XDP_ACT_XSK_ZEROCOPY;
> > + }
>
> Shouldn't we rather drop this assignment completely? It makes no sense
> to default to all features, it should default to none...
Good point. Seems the bond device defaults to supporting everything
before a device is bonded to it, but I might have misunderstood
something. Lorenzo, could you enlighten us please?
Thanks: Magnus
> -Toke
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] bonding: do not report NETDEV_XDP_ACT_XSK_ZEROCOPY
2024-02-06 9:55 ` Magnus Karlsson
@ 2024-02-06 15:16 ` Lorenzo Bianconi
2024-02-06 15:56 ` Magnus Karlsson
0 siblings, 1 reply; 5+ messages in thread
From: Lorenzo Bianconi @ 2024-02-06 15:16 UTC (permalink / raw)
To: Magnus Karlsson
Cc: Toke Høiland-Jørgensen, magnus.karlsson, bjorn, ast,
daniel, netdev, maciej.fijalkowski, kuba, pabeni, davem,
j.vosburgh, andy, hawk, john.fastabend, edumazet, bpf,
Prashant Batra
[-- Attachment #1: Type: text/plain, Size: 2340 bytes --]
> On Mon, 5 Feb 2024 at 14:08, Toke Høiland-Jørgensen <toke@redhat.com> wrote:
> >
> > Magnus Karlsson <magnus.karlsson@gmail.com> writes:
> >
> > > From: Magnus Karlsson <magnus.karlsson@intel.com>
> > >
> > > Do not report the XDP capability NETDEV_XDP_ACT_XSK_ZEROCOPY as the
> > > bonding driver does not support XDP and AF_XDP in zero-copy mode even
> > > if the real NIC drivers do.
> > >
> > > Fixes: cb9e6e584d58 ("bonding: add xdp_features support")
> > > Reported-by: Prashant Batra <prbatra.mail@gmail.com>
> > > Link: https://lore.kernel.org/all/CAJ8uoz2ieZCopgqTvQ9ZY6xQgTbujmC6XkMTamhp68O-h_-rLg@mail.gmail.com/T/
> > > Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
> > > ---
> > > drivers/net/bonding/bond_main.c | 6 +++++-
> > > 1 file changed, 5 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> > > index 4e0600c7b050..79a37bed097b 100644
> > > --- a/drivers/net/bonding/bond_main.c
> > > +++ b/drivers/net/bonding/bond_main.c
> > > @@ -1819,6 +1819,8 @@ void bond_xdp_set_features(struct net_device *bond_dev)
> > > bond_for_each_slave(bond, slave, iter)
> > > val &= slave->dev->xdp_features;
> > >
> > > + val &= ~NETDEV_XDP_ACT_XSK_ZEROCOPY;
> > > +
> > > xdp_set_features_flag(bond_dev, val);
> > > }
> > >
> > > @@ -5910,8 +5912,10 @@ void bond_setup(struct net_device *bond_dev)
> > > bond_dev->features |= BOND_XFRM_FEATURES;
> > > #endif /* CONFIG_XFRM_OFFLOAD */
> > >
> > > - if (bond_xdp_check(bond))
> > > + if (bond_xdp_check(bond)) {
> > > bond_dev->xdp_features = NETDEV_XDP_ACT_MASK;
> > > + bond_dev->xdp_features &= ~NETDEV_XDP_ACT_XSK_ZEROCOPY;
> > > + }
> >
> > Shouldn't we rather drop this assignment completely? It makes no sense
> > to default to all features, it should default to none...
>
> Good point. Seems the bond device defaults to supporting everything
> before a device is bonded to it, but I might have misunderstood
> something. Lorenzo, could you enlighten us please?
ack, I agree we can get rid of it since the xdp features will be calculated
again as soon as a new device is added to the bond.
Regards,
Lorenzo
>
> Thanks: Magnus
>
> > -Toke
> >
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] bonding: do not report NETDEV_XDP_ACT_XSK_ZEROCOPY
2024-02-06 15:16 ` Lorenzo Bianconi
@ 2024-02-06 15:56 ` Magnus Karlsson
0 siblings, 0 replies; 5+ messages in thread
From: Magnus Karlsson @ 2024-02-06 15:56 UTC (permalink / raw)
To: Lorenzo Bianconi
Cc: Toke Høiland-Jørgensen, magnus.karlsson, bjorn, ast,
daniel, netdev, maciej.fijalkowski, kuba, pabeni, davem,
j.vosburgh, andy, hawk, john.fastabend, edumazet, bpf,
Prashant Batra
On Tue, 6 Feb 2024 at 16:16, Lorenzo Bianconi <lorenzo@kernel.org> wrote:
>
> > On Mon, 5 Feb 2024 at 14:08, Toke Høiland-Jørgensen <toke@redhat.com> wrote:
> > >
> > > Magnus Karlsson <magnus.karlsson@gmail.com> writes:
> > >
> > > > From: Magnus Karlsson <magnus.karlsson@intel.com>
> > > >
> > > > Do not report the XDP capability NETDEV_XDP_ACT_XSK_ZEROCOPY as the
> > > > bonding driver does not support XDP and AF_XDP in zero-copy mode even
> > > > if the real NIC drivers do.
> > > >
> > > > Fixes: cb9e6e584d58 ("bonding: add xdp_features support")
> > > > Reported-by: Prashant Batra <prbatra.mail@gmail.com>
> > > > Link: https://lore.kernel.org/all/CAJ8uoz2ieZCopgqTvQ9ZY6xQgTbujmC6XkMTamhp68O-h_-rLg@mail.gmail.com/T/
> > > > Signed-off-by: Magnus Karlsson <magnus.karlsson@intel.com>
> > > > ---
> > > > drivers/net/bonding/bond_main.c | 6 +++++-
> > > > 1 file changed, 5 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> > > > index 4e0600c7b050..79a37bed097b 100644
> > > > --- a/drivers/net/bonding/bond_main.c
> > > > +++ b/drivers/net/bonding/bond_main.c
> > > > @@ -1819,6 +1819,8 @@ void bond_xdp_set_features(struct net_device *bond_dev)
> > > > bond_for_each_slave(bond, slave, iter)
> > > > val &= slave->dev->xdp_features;
> > > >
> > > > + val &= ~NETDEV_XDP_ACT_XSK_ZEROCOPY;
> > > > +
> > > > xdp_set_features_flag(bond_dev, val);
> > > > }
> > > >
> > > > @@ -5910,8 +5912,10 @@ void bond_setup(struct net_device *bond_dev)
> > > > bond_dev->features |= BOND_XFRM_FEATURES;
> > > > #endif /* CONFIG_XFRM_OFFLOAD */
> > > >
> > > > - if (bond_xdp_check(bond))
> > > > + if (bond_xdp_check(bond)) {
> > > > bond_dev->xdp_features = NETDEV_XDP_ACT_MASK;
> > > > + bond_dev->xdp_features &= ~NETDEV_XDP_ACT_XSK_ZEROCOPY;
> > > > + }
> > >
> > > Shouldn't we rather drop this assignment completely? It makes no sense
> > > to default to all features, it should default to none...
> >
> > Good point. Seems the bond device defaults to supporting everything
> > before a device is bonded to it, but I might have misunderstood
> > something. Lorenzo, could you enlighten us please?
>
> ack, I agree we can get rid of it since the xdp features will be calculated
> again as soon as a new device is added to the bond.
Thanks. Will spin a v2.
> Regards,
> Lorenzo
>
> >
> > Thanks: Magnus
> >
> > > -Toke
> > >
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-02-06 15:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-05 12:30 [PATCH net] bonding: do not report NETDEV_XDP_ACT_XSK_ZEROCOPY Magnus Karlsson
2024-02-05 13:08 ` Toke Høiland-Jørgensen
2024-02-06 9:55 ` Magnus Karlsson
2024-02-06 15:16 ` Lorenzo Bianconi
2024-02-06 15:56 ` Magnus Karlsson
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).