* [PATCHv2 net-next 0/3] Bonding: returns detailed error about XDP failures
@ 2024-10-17 2:06 Hangbin Liu
2024-10-17 2:06 ` [PATCHv2 net-next 1/3] bonding: return detailed error when loading native XDP fails Hangbin Liu
` (3 more replies)
0 siblings, 4 replies; 15+ messages in thread
From: Hangbin Liu @ 2024-10-17 2:06 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
John Fastabend, Jiri Pirko, Sebastian Andrzej Siewior,
Lorenzo Bianconi, Andrii Nakryiko, Jussi Maki, Jay Vosburgh,
Andy Gospodarek, Jonathan Corbet, Andrew Lunn, linux-doc,
linux-kernel, bpf, Hangbin Liu
Based on discussion[1], this patch set returns detailed error about XDP
failures. And update bonding document about XDP supports.
v2: update the title in the doc (Nikolay Aleksandrov)
[1] https://lore.kernel.org/netdev/8088f2a7-3ab1-4a1e-996d-c15703da13cc@blackwall.org/
Hangbin Liu (3):
bonding: return detailed error when loading native XDP fails
bonding: use correct return value
Documentation: bonding: add XDP support explanation
Documentation/networking/bonding.rst | 12 ++++++++++++
drivers/net/bonding/bond_main.c | 7 +++++--
2 files changed, 17 insertions(+), 2 deletions(-)
--
2.46.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCHv2 net-next 1/3] bonding: return detailed error when loading native XDP fails
2024-10-17 2:06 [PATCHv2 net-next 0/3] Bonding: returns detailed error about XDP failures Hangbin Liu
@ 2024-10-17 2:06 ` Hangbin Liu
2024-10-17 14:45 ` Toke Høiland-Jørgensen
2024-10-17 2:06 ` [PATCHv2 net-next 2/3] bonding: use correct return value Hangbin Liu
` (2 subsequent siblings)
3 siblings, 1 reply; 15+ messages in thread
From: Hangbin Liu @ 2024-10-17 2:06 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
John Fastabend, Jiri Pirko, Sebastian Andrzej Siewior,
Lorenzo Bianconi, Andrii Nakryiko, Jussi Maki, Jay Vosburgh,
Andy Gospodarek, Jonathan Corbet, Andrew Lunn, linux-doc,
linux-kernel, bpf, Hangbin Liu, Nikolay Aleksandrov
Bonding only supports native XDP for specific modes, which can lead to
confusion for users regarding why XDP loads successfully at times and
fails at others. This patch enhances error handling by returning detailed
error messages, providing users with clearer insights into the specific
reasons for the failure when loading native XDP.
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
drivers/net/bonding/bond_main.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index b1bffd8e9a95..f0f76b6ac8be 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -5676,8 +5676,11 @@ static int bond_xdp_set(struct net_device *dev, struct bpf_prog *prog,
ASSERT_RTNL();
- if (!bond_xdp_check(bond))
+ if (!bond_xdp_check(bond)) {
+ BOND_NL_ERR(dev, extack,
+ "No native XDP support for the current bonding mode");
return -EOPNOTSUPP;
+ }
old_prog = bond->xdp_prog;
bond->xdp_prog = prog;
--
2.46.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCHv2 net-next 2/3] bonding: use correct return value
2024-10-17 2:06 [PATCHv2 net-next 0/3] Bonding: returns detailed error about XDP failures Hangbin Liu
2024-10-17 2:06 ` [PATCHv2 net-next 1/3] bonding: return detailed error when loading native XDP fails Hangbin Liu
@ 2024-10-17 2:06 ` Hangbin Liu
2024-10-17 14:47 ` Toke Høiland-Jørgensen
2024-10-17 2:06 ` [PATCHv2 net-next 3/3] Documentation: bonding: add XDP support explanation Hangbin Liu
2024-10-17 8:40 ` [PATCHv2 net-next 0/3] Bonding: returns detailed error about XDP failures Nikolay Aleksandrov
3 siblings, 1 reply; 15+ messages in thread
From: Hangbin Liu @ 2024-10-17 2:06 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
John Fastabend, Jiri Pirko, Sebastian Andrzej Siewior,
Lorenzo Bianconi, Andrii Nakryiko, Jussi Maki, Jay Vosburgh,
Andy Gospodarek, Jonathan Corbet, Andrew Lunn, linux-doc,
linux-kernel, bpf, Hangbin Liu, Nikolay Aleksandrov
When a slave already has an XDP program loaded, the correct return value
should be -EEXIST instead of -EOPNOTSUPP.
Fixes: 9e2ee5c7e7c3 ("net, bonding: Add XDP support to the bonding driver")
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
drivers/net/bonding/bond_main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index f0f76b6ac8be..6887a867fe8b 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -5699,7 +5699,7 @@ static int bond_xdp_set(struct net_device *dev, struct bpf_prog *prog,
if (dev_xdp_prog_count(slave_dev) > 0) {
SLAVE_NL_ERR(dev, slave_dev, extack,
"Slave has XDP program loaded, please unload before enslaving");
- err = -EOPNOTSUPP;
+ err = -EEXIST;
goto err;
}
--
2.46.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCHv2 net-next 3/3] Documentation: bonding: add XDP support explanation
2024-10-17 2:06 [PATCHv2 net-next 0/3] Bonding: returns detailed error about XDP failures Hangbin Liu
2024-10-17 2:06 ` [PATCHv2 net-next 1/3] bonding: return detailed error when loading native XDP fails Hangbin Liu
2024-10-17 2:06 ` [PATCHv2 net-next 2/3] bonding: use correct return value Hangbin Liu
@ 2024-10-17 2:06 ` Hangbin Liu
2024-10-17 8:42 ` Nikolay Aleksandrov
2024-10-17 8:40 ` [PATCHv2 net-next 0/3] Bonding: returns detailed error about XDP failures Nikolay Aleksandrov
3 siblings, 1 reply; 15+ messages in thread
From: Hangbin Liu @ 2024-10-17 2:06 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
John Fastabend, Jiri Pirko, Sebastian Andrzej Siewior,
Lorenzo Bianconi, Andrii Nakryiko, Jussi Maki, Jay Vosburgh,
Andy Gospodarek, Jonathan Corbet, Andrew Lunn, linux-doc,
linux-kernel, bpf, Hangbin Liu
Add document about which modes have native XDP support.
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
Documentation/networking/bonding.rst | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/Documentation/networking/bonding.rst b/Documentation/networking/bonding.rst
index e774b48de9f5..5c4a83005025 100644
--- a/Documentation/networking/bonding.rst
+++ b/Documentation/networking/bonding.rst
@@ -2916,6 +2916,18 @@ from the bond (``ifenslave -d bond0 eth0``). The bonding driver will
then restore the MAC addresses that the slaves had before they were
enslaved.
+9. What bonding modes support native XDP?
+------------------------------------------
+
+Currently, only the following bonding modes support native XDP:
+ * balance-rr (0)
+ * active-backup (1)
+ * balance-xor (2)
+ * 802.3ad (4)
+
+Note that the vlan+srcmac hash policy does not support native XDP.
+For other bonding modes, the XDP program must be loaded with generic mode.
+
16. Resources and Links
=======================
--
2.46.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCHv2 net-next 0/3] Bonding: returns detailed error about XDP failures
2024-10-17 2:06 [PATCHv2 net-next 0/3] Bonding: returns detailed error about XDP failures Hangbin Liu
` (2 preceding siblings ...)
2024-10-17 2:06 ` [PATCHv2 net-next 3/3] Documentation: bonding: add XDP support explanation Hangbin Liu
@ 2024-10-17 8:40 ` Nikolay Aleksandrov
2024-10-17 9:26 ` Hangbin Liu
3 siblings, 1 reply; 15+ messages in thread
From: Nikolay Aleksandrov @ 2024-10-17 8:40 UTC (permalink / raw)
To: Hangbin Liu, netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
John Fastabend, Jiri Pirko, Sebastian Andrzej Siewior,
Lorenzo Bianconi, Andrii Nakryiko, Jussi Maki, Jay Vosburgh,
Andy Gospodarek, Jonathan Corbet, Andrew Lunn, linux-doc,
linux-kernel, bpf
On 17/10/2024 05:06, Hangbin Liu wrote:
> Based on discussion[1], this patch set returns detailed error about XDP
> failures. And update bonding document about XDP supports.
>
> v2: update the title in the doc (Nikolay Aleksandrov)
>
> [1] https://lore.kernel.org/netdev/8088f2a7-3ab1-4a1e-996d-c15703da13cc@blackwall.org/
>
> Hangbin Liu (3):
> bonding: return detailed error when loading native XDP fails
> bonding: use correct return value
> Documentation: bonding: add XDP support explanation
>
> Documentation/networking/bonding.rst | 12 ++++++++++++
> drivers/net/bonding/bond_main.c | 7 +++++--
> 2 files changed, 17 insertions(+), 2 deletions(-)
>
Please CC reviewers when sending new versions. I was CCed on patches 1 and 2
probably due to the tag, but wasn't on patch 3 and had to search for
the series.
Thanks,
Nik
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 net-next 3/3] Documentation: bonding: add XDP support explanation
2024-10-17 2:06 ` [PATCHv2 net-next 3/3] Documentation: bonding: add XDP support explanation Hangbin Liu
@ 2024-10-17 8:42 ` Nikolay Aleksandrov
0 siblings, 0 replies; 15+ messages in thread
From: Nikolay Aleksandrov @ 2024-10-17 8:42 UTC (permalink / raw)
To: Hangbin Liu, netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
John Fastabend, Jiri Pirko, Sebastian Andrzej Siewior,
Lorenzo Bianconi, Andrii Nakryiko, Jussi Maki, Jay Vosburgh,
Andy Gospodarek, Jonathan Corbet, Andrew Lunn, linux-doc,
linux-kernel, bpf
On 17/10/2024 05:06, Hangbin Liu wrote:
> Add document about which modes have native XDP support.
>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
> Documentation/networking/bonding.rst | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/Documentation/networking/bonding.rst b/Documentation/networking/bonding.rst
> index e774b48de9f5..5c4a83005025 100644
> --- a/Documentation/networking/bonding.rst
> +++ b/Documentation/networking/bonding.rst
> @@ -2916,6 +2916,18 @@ from the bond (``ifenslave -d bond0 eth0``). The bonding driver will
> then restore the MAC addresses that the slaves had before they were
> enslaved.
>
> +9. What bonding modes support native XDP?
> +------------------------------------------
> +
> +Currently, only the following bonding modes support native XDP:
If there's a new version please consider dropping this sentence.
It just repeats the title above in a different way.
> + * balance-rr (0)
> + * active-backup (1)
> + * balance-xor (2)
> + * 802.3ad (4)
> +
> +Note that the vlan+srcmac hash policy does not support native XDP.
> +For other bonding modes, the XDP program must be loaded with generic mode.
> +
> 16. Resources and Links
> =======================
>
Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 net-next 0/3] Bonding: returns detailed error about XDP failures
2024-10-17 8:40 ` [PATCHv2 net-next 0/3] Bonding: returns detailed error about XDP failures Nikolay Aleksandrov
@ 2024-10-17 9:26 ` Hangbin Liu
0 siblings, 0 replies; 15+ messages in thread
From: Hangbin Liu @ 2024-10-17 9:26 UTC (permalink / raw)
To: Nikolay Aleksandrov
Cc: netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Jiri Pirko,
Sebastian Andrzej Siewior, Lorenzo Bianconi, Andrii Nakryiko,
Jussi Maki, Jay Vosburgh, Andy Gospodarek, Jonathan Corbet,
Andrew Lunn, linux-doc, linux-kernel, bpf
On Thu, Oct 17, 2024 at 11:40:34AM +0300, Nikolay Aleksandrov wrote:
> Please CC reviewers when sending new versions. I was CCed on patches 1 and 2
> probably due to the tag, but wasn't on patch 3 and had to search for
> the series.
Oh, sorry for the inconvenient. I thought you are in the cc list. Next time I
will do double check.
Hangbin
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 net-next 1/3] bonding: return detailed error when loading native XDP fails
2024-10-17 2:06 ` [PATCHv2 net-next 1/3] bonding: return detailed error when loading native XDP fails Hangbin Liu
@ 2024-10-17 14:45 ` Toke Høiland-Jørgensen
0 siblings, 0 replies; 15+ messages in thread
From: Toke Høiland-Jørgensen @ 2024-10-17 14:45 UTC (permalink / raw)
To: Hangbin Liu, netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
John Fastabend, Jiri Pirko, Sebastian Andrzej Siewior,
Lorenzo Bianconi, Andrii Nakryiko, Jussi Maki, Jay Vosburgh,
Andy Gospodarek, Jonathan Corbet, Andrew Lunn, linux-doc,
linux-kernel, bpf, Hangbin Liu, Nikolay Aleksandrov
Hangbin Liu <liuhangbin@gmail.com> writes:
> Bonding only supports native XDP for specific modes, which can lead to
> confusion for users regarding why XDP loads successfully at times and
> fails at others. This patch enhances error handling by returning detailed
> error messages, providing users with clearer insights into the specific
> reasons for the failure when loading native XDP.
>
> Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 net-next 2/3] bonding: use correct return value
2024-10-17 2:06 ` [PATCHv2 net-next 2/3] bonding: use correct return value Hangbin Liu
@ 2024-10-17 14:47 ` Toke Høiland-Jørgensen
2024-10-18 0:46 ` Hangbin Liu
0 siblings, 1 reply; 15+ messages in thread
From: Toke Høiland-Jørgensen @ 2024-10-17 14:47 UTC (permalink / raw)
To: Hangbin Liu, netdev
Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
Alexei Starovoitov, Daniel Borkmann, Jesper Dangaard Brouer,
John Fastabend, Jiri Pirko, Sebastian Andrzej Siewior,
Lorenzo Bianconi, Andrii Nakryiko, Jussi Maki, Jay Vosburgh,
Andy Gospodarek, Jonathan Corbet, Andrew Lunn, linux-doc,
linux-kernel, bpf, Hangbin Liu, Nikolay Aleksandrov
Hangbin Liu <liuhangbin@gmail.com> writes:
> When a slave already has an XDP program loaded, the correct return value
> should be -EEXIST instead of -EOPNOTSUPP.
>
> Fixes: 9e2ee5c7e7c3 ("net, bonding: Add XDP support to the bonding driver")
> Reviewed-by: Nikolay Aleksandrov <razor@blackwall.org>
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
> drivers/net/bonding/bond_main.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> index f0f76b6ac8be..6887a867fe8b 100644
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -5699,7 +5699,7 @@ static int bond_xdp_set(struct net_device *dev, struct bpf_prog *prog,
> if (dev_xdp_prog_count(slave_dev) > 0) {
> SLAVE_NL_ERR(dev, slave_dev, extack,
> "Slave has XDP program loaded, please unload before enslaving");
> - err = -EOPNOTSUPP;
> + err = -EEXIST;
Hmm, this has been UAPI since kernel 5.15, so can we really change it
now? What's the purpose of changing it, anyway?
-Toke
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 net-next 2/3] bonding: use correct return value
2024-10-17 14:47 ` Toke Høiland-Jørgensen
@ 2024-10-18 0:46 ` Hangbin Liu
2024-10-18 9:41 ` Simon Horman
0 siblings, 1 reply; 15+ messages in thread
From: Hangbin Liu @ 2024-10-18 0:46 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Jiri Pirko,
Sebastian Andrzej Siewior, Lorenzo Bianconi, Andrii Nakryiko,
Jussi Maki, Jay Vosburgh, Andy Gospodarek, Jonathan Corbet,
Andrew Lunn, linux-doc, linux-kernel, bpf, Nikolay Aleksandrov
On Thu, Oct 17, 2024 at 04:47:19PM +0200, Toke Høiland-Jørgensen wrote:
> > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> > index f0f76b6ac8be..6887a867fe8b 100644
> > --- a/drivers/net/bonding/bond_main.c
> > +++ b/drivers/net/bonding/bond_main.c
> > @@ -5699,7 +5699,7 @@ static int bond_xdp_set(struct net_device *dev, struct bpf_prog *prog,
> > if (dev_xdp_prog_count(slave_dev) > 0) {
> > SLAVE_NL_ERR(dev, slave_dev, extack,
> > "Slave has XDP program loaded, please unload before enslaving");
> > - err = -EOPNOTSUPP;
> > + err = -EEXIST;
>
> Hmm, this has been UAPI since kernel 5.15, so can we really change it
> now? What's the purpose of changing it, anyway?
I just think it should return EXIST when the error is "Slave has XDP program
loaded". No special reason. If all others think we should not change it, I
can drop this patch.
Thanks
Hangbin
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 net-next 2/3] bonding: use correct return value
2024-10-18 0:46 ` Hangbin Liu
@ 2024-10-18 9:41 ` Simon Horman
2024-10-18 11:29 ` Toke Høiland-Jørgensen
0 siblings, 1 reply; 15+ messages in thread
From: Simon Horman @ 2024-10-18 9:41 UTC (permalink / raw)
To: Hangbin Liu
Cc: Toke Høiland-Jørgensen, netdev, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Alexei Starovoitov,
Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
Jiri Pirko, Sebastian Andrzej Siewior, Lorenzo Bianconi,
Andrii Nakryiko, Jussi Maki, Jay Vosburgh, Andy Gospodarek,
Jonathan Corbet, Andrew Lunn, linux-doc, linux-kernel, bpf,
Nikolay Aleksandrov
On Fri, Oct 18, 2024 at 12:46:18AM +0000, Hangbin Liu wrote:
> On Thu, Oct 17, 2024 at 04:47:19PM +0200, Toke Høiland-Jørgensen wrote:
> > > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> > > index f0f76b6ac8be..6887a867fe8b 100644
> > > --- a/drivers/net/bonding/bond_main.c
> > > +++ b/drivers/net/bonding/bond_main.c
> > > @@ -5699,7 +5699,7 @@ static int bond_xdp_set(struct net_device *dev, struct bpf_prog *prog,
> > > if (dev_xdp_prog_count(slave_dev) > 0) {
> > > SLAVE_NL_ERR(dev, slave_dev, extack,
> > > "Slave has XDP program loaded, please unload before enslaving");
> > > - err = -EOPNOTSUPP;
> > > + err = -EEXIST;
> >
> > Hmm, this has been UAPI since kernel 5.15, so can we really change it
> > now? What's the purpose of changing it, anyway?
>
> I just think it should return EXIST when the error is "Slave has XDP program
> loaded". No special reason. If all others think we should not change it, I
> can drop this patch.
Hi Toke,
Could you add some colour to what extent user's might rely on this error code?
Basically I think that if they do then we shouldn't change this.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 net-next 2/3] bonding: use correct return value
2024-10-18 9:41 ` Simon Horman
@ 2024-10-18 11:29 ` Toke Høiland-Jørgensen
2024-10-18 14:21 ` Simon Horman
0 siblings, 1 reply; 15+ messages in thread
From: Toke Høiland-Jørgensen @ 2024-10-18 11:29 UTC (permalink / raw)
To: Simon Horman, Hangbin Liu
Cc: netdev, David S. Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Jiri Pirko,
Sebastian Andrzej Siewior, Lorenzo Bianconi, Andrii Nakryiko,
Jussi Maki, Jay Vosburgh, Andy Gospodarek, Jonathan Corbet,
Andrew Lunn, linux-doc, linux-kernel, bpf, Nikolay Aleksandrov
Simon Horman <horms@kernel.org> writes:
> On Fri, Oct 18, 2024 at 12:46:18AM +0000, Hangbin Liu wrote:
>> On Thu, Oct 17, 2024 at 04:47:19PM +0200, Toke Høiland-Jørgensen wrote:
>> > > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
>> > > index f0f76b6ac8be..6887a867fe8b 100644
>> > > --- a/drivers/net/bonding/bond_main.c
>> > > +++ b/drivers/net/bonding/bond_main.c
>> > > @@ -5699,7 +5699,7 @@ static int bond_xdp_set(struct net_device *dev, struct bpf_prog *prog,
>> > > if (dev_xdp_prog_count(slave_dev) > 0) {
>> > > SLAVE_NL_ERR(dev, slave_dev, extack,
>> > > "Slave has XDP program loaded, please unload before enslaving");
>> > > - err = -EOPNOTSUPP;
>> > > + err = -EEXIST;
>> >
>> > Hmm, this has been UAPI since kernel 5.15, so can we really change it
>> > now? What's the purpose of changing it, anyway?
>>
>> I just think it should return EXIST when the error is "Slave has XDP program
>> loaded". No special reason. If all others think we should not change it, I
>> can drop this patch.
>
> Hi Toke,
>
> Could you add some colour to what extent user's might rely on this error code?
>
> Basically I think that if they do then we shouldn't change this.
Well, that's the trouble with UAPI, we don't really know. In libxdp and
xdp-tools we look at the return code to provide a nicer error message,
like:
https://github.com/xdp-project/xdp-tools/blob/master/lib/libxdp/libxdp.c#L615
and as a signal to fall back to loading the programme without a dispatcher:
https://github.com/xdp-project/xdp-tools/blob/master/lib/libxdp/libxdp.c#L1824
Both of these cases would be unaffected (or even improved) by this
patch, so in that sense I don't have a concrete objection, just a
general "userspace may react to this". In other words, my concern is
more of a general "we don't know, so this seems risky". If any of you
have more information about how bonding XDP is generally used, that may
help get a better idea of this?
-Toke
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 net-next 2/3] bonding: use correct return value
2024-10-18 11:29 ` Toke Høiland-Jørgensen
@ 2024-10-18 14:21 ` Simon Horman
2024-10-19 0:51 ` Hangbin Liu
0 siblings, 1 reply; 15+ messages in thread
From: Simon Horman @ 2024-10-18 14:21 UTC (permalink / raw)
To: Toke Høiland-Jørgensen
Cc: Hangbin Liu, netdev, David S. Miller, Eric Dumazet,
Jakub Kicinski, Paolo Abeni, Alexei Starovoitov, Daniel Borkmann,
Jesper Dangaard Brouer, John Fastabend, Jiri Pirko,
Sebastian Andrzej Siewior, Lorenzo Bianconi, Andrii Nakryiko,
Jussi Maki, Jay Vosburgh, Andy Gospodarek, Jonathan Corbet,
Andrew Lunn, linux-doc, linux-kernel, bpf, Nikolay Aleksandrov
On Fri, Oct 18, 2024 at 01:29:30PM +0200, Toke Høiland-Jørgensen wrote:
> Simon Horman <horms@kernel.org> writes:
>
> > On Fri, Oct 18, 2024 at 12:46:18AM +0000, Hangbin Liu wrote:
> >> On Thu, Oct 17, 2024 at 04:47:19PM +0200, Toke Høiland-Jørgensen wrote:
> >> > > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> >> > > index f0f76b6ac8be..6887a867fe8b 100644
> >> > > --- a/drivers/net/bonding/bond_main.c
> >> > > +++ b/drivers/net/bonding/bond_main.c
> >> > > @@ -5699,7 +5699,7 @@ static int bond_xdp_set(struct net_device *dev, struct bpf_prog *prog,
> >> > > if (dev_xdp_prog_count(slave_dev) > 0) {
> >> > > SLAVE_NL_ERR(dev, slave_dev, extack,
> >> > > "Slave has XDP program loaded, please unload before enslaving");
> >> > > - err = -EOPNOTSUPP;
> >> > > + err = -EEXIST;
> >> >
> >> > Hmm, this has been UAPI since kernel 5.15, so can we really change it
> >> > now? What's the purpose of changing it, anyway?
> >>
> >> I just think it should return EXIST when the error is "Slave has XDP program
> >> loaded". No special reason. If all others think we should not change it, I
> >> can drop this patch.
> >
> > Hi Toke,
> >
> > Could you add some colour to what extent user's might rely on this error code?
> >
> > Basically I think that if they do then we shouldn't change this.
>
> Well, that's the trouble with UAPI, we don't really know. In libxdp and
> xdp-tools we look at the return code to provide a nicer error message,
> like:
>
> https://github.com/xdp-project/xdp-tools/blob/master/lib/libxdp/libxdp.c#L615
>
> and as a signal to fall back to loading the programme without a dispatcher:
>
> https://github.com/xdp-project/xdp-tools/blob/master/lib/libxdp/libxdp.c#L1824
>
> Both of these cases would be unaffected (or even improved) by this
> patch, so in that sense I don't have a concrete objection, just a
> general "userspace may react to this". In other words, my concern is
> more of a general "we don't know, so this seems risky". If any of you
> have more information about how bonding XDP is generally used, that may
> help get a better idea of this?
Yes, that is the trouble with the UAPI. I was hoping you might be able to
provide the clarity you ask for above. But alas, things are as clear as
mud.
In lieu of more information I suggest caution and dropping this change for
now.
--
pw-bot: cr
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 net-next 2/3] bonding: use correct return value
2024-10-18 14:21 ` Simon Horman
@ 2024-10-19 0:51 ` Hangbin Liu
2024-10-19 9:19 ` Simon Horman
0 siblings, 1 reply; 15+ messages in thread
From: Hangbin Liu @ 2024-10-19 0:51 UTC (permalink / raw)
To: Simon Horman
Cc: Toke Høiland-Jørgensen, netdev, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Alexei Starovoitov,
Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
Jiri Pirko, Sebastian Andrzej Siewior, Lorenzo Bianconi,
Andrii Nakryiko, Jussi Maki, Jay Vosburgh, Andy Gospodarek,
Jonathan Corbet, Andrew Lunn, linux-doc, linux-kernel, bpf,
Nikolay Aleksandrov
On Fri, Oct 18, 2024 at 03:21:04PM +0100, Simon Horman wrote:
> On Fri, Oct 18, 2024 at 01:29:30PM +0200, Toke Høiland-Jørgensen wrote:
> > Simon Horman <horms@kernel.org> writes:
> >
> > > On Fri, Oct 18, 2024 at 12:46:18AM +0000, Hangbin Liu wrote:
> > >> On Thu, Oct 17, 2024 at 04:47:19PM +0200, Toke Høiland-Jørgensen wrote:
> > >> > > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> > >> > > index f0f76b6ac8be..6887a867fe8b 100644
> > >> > > --- a/drivers/net/bonding/bond_main.c
> > >> > > +++ b/drivers/net/bonding/bond_main.c
> > >> > > @@ -5699,7 +5699,7 @@ static int bond_xdp_set(struct net_device *dev, struct bpf_prog *prog,
> > >> > > if (dev_xdp_prog_count(slave_dev) > 0) {
> > >> > > SLAVE_NL_ERR(dev, slave_dev, extack,
> > >> > > "Slave has XDP program loaded, please unload before enslaving");
> > >> > > - err = -EOPNOTSUPP;
> > >> > > + err = -EEXIST;
> > >> >
> > >> > Hmm, this has been UAPI since kernel 5.15, so can we really change it
> > >> > now? What's the purpose of changing it, anyway?
> > >>
> > >> I just think it should return EXIST when the error is "Slave has XDP program
> > >> loaded". No special reason. If all others think we should not change it, I
> > >> can drop this patch.
> > >
> > > Hi Toke,
> > >
> > > Could you add some colour to what extent user's might rely on this error code?
> > >
> > > Basically I think that if they do then we shouldn't change this.
> >
> > Well, that's the trouble with UAPI, we don't really know. In libxdp and
> > xdp-tools we look at the return code to provide a nicer error message,
> > like:
> >
> > https://github.com/xdp-project/xdp-tools/blob/master/lib/libxdp/libxdp.c#L615
> >
> > and as a signal to fall back to loading the programme without a dispatcher:
> >
> > https://github.com/xdp-project/xdp-tools/blob/master/lib/libxdp/libxdp.c#L1824
> >
> > Both of these cases would be unaffected (or even improved) by this
> > patch, so in that sense I don't have a concrete objection, just a
> > general "userspace may react to this". In other words, my concern is
> > more of a general "we don't know, so this seems risky". If any of you
> > have more information about how bonding XDP is generally used, that may
> > help get a better idea of this?
>
> Yes, that is the trouble with the UAPI. I was hoping you might be able to
> provide the clarity you ask for above. But alas, things are as clear as
> mud.
>
> In lieu of more information I suggest caution and dropping this change for
> now.
OK, I will drop this one.
Thanks
Hangbin
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCHv2 net-next 2/3] bonding: use correct return value
2024-10-19 0:51 ` Hangbin Liu
@ 2024-10-19 9:19 ` Simon Horman
0 siblings, 0 replies; 15+ messages in thread
From: Simon Horman @ 2024-10-19 9:19 UTC (permalink / raw)
To: Hangbin Liu
Cc: Toke Høiland-Jørgensen, netdev, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Alexei Starovoitov,
Daniel Borkmann, Jesper Dangaard Brouer, John Fastabend,
Jiri Pirko, Sebastian Andrzej Siewior, Lorenzo Bianconi,
Andrii Nakryiko, Jussi Maki, Jay Vosburgh, Andy Gospodarek,
Jonathan Corbet, Andrew Lunn, linux-doc, linux-kernel, bpf,
Nikolay Aleksandrov
On Sat, Oct 19, 2024 at 12:51:00AM +0000, Hangbin Liu wrote:
> On Fri, Oct 18, 2024 at 03:21:04PM +0100, Simon Horman wrote:
> > On Fri, Oct 18, 2024 at 01:29:30PM +0200, Toke Høiland-Jørgensen wrote:
> > > Simon Horman <horms@kernel.org> writes:
> > >
> > > > On Fri, Oct 18, 2024 at 12:46:18AM +0000, Hangbin Liu wrote:
> > > >> On Thu, Oct 17, 2024 at 04:47:19PM +0200, Toke Høiland-Jørgensen wrote:
> > > >> > > diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
> > > >> > > index f0f76b6ac8be..6887a867fe8b 100644
> > > >> > > --- a/drivers/net/bonding/bond_main.c
> > > >> > > +++ b/drivers/net/bonding/bond_main.c
> > > >> > > @@ -5699,7 +5699,7 @@ static int bond_xdp_set(struct net_device *dev, struct bpf_prog *prog,
> > > >> > > if (dev_xdp_prog_count(slave_dev) > 0) {
> > > >> > > SLAVE_NL_ERR(dev, slave_dev, extack,
> > > >> > > "Slave has XDP program loaded, please unload before enslaving");
> > > >> > > - err = -EOPNOTSUPP;
> > > >> > > + err = -EEXIST;
> > > >> >
> > > >> > Hmm, this has been UAPI since kernel 5.15, so can we really change it
> > > >> > now? What's the purpose of changing it, anyway?
> > > >>
> > > >> I just think it should return EXIST when the error is "Slave has XDP program
> > > >> loaded". No special reason. If all others think we should not change it, I
> > > >> can drop this patch.
> > > >
> > > > Hi Toke,
> > > >
> > > > Could you add some colour to what extent user's might rely on this error code?
> > > >
> > > > Basically I think that if they do then we shouldn't change this.
> > >
> > > Well, that's the trouble with UAPI, we don't really know. In libxdp and
> > > xdp-tools we look at the return code to provide a nicer error message,
> > > like:
> > >
> > > https://github.com/xdp-project/xdp-tools/blob/master/lib/libxdp/libxdp.c#L615
> > >
> > > and as a signal to fall back to loading the programme without a dispatcher:
> > >
> > > https://github.com/xdp-project/xdp-tools/blob/master/lib/libxdp/libxdp.c#L1824
> > >
> > > Both of these cases would be unaffected (or even improved) by this
> > > patch, so in that sense I don't have a concrete objection, just a
> > > general "userspace may react to this". In other words, my concern is
> > > more of a general "we don't know, so this seems risky". If any of you
> > > have more information about how bonding XDP is generally used, that may
> > > help get a better idea of this?
> >
> > Yes, that is the trouble with the UAPI. I was hoping you might be able to
> > provide the clarity you ask for above. But alas, things are as clear as
> > mud.
> >
> > In lieu of more information I suggest caution and dropping this change for
> > now.
>
> OK, I will drop this one.
Thanks.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2024-10-19 9:19 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-17 2:06 [PATCHv2 net-next 0/3] Bonding: returns detailed error about XDP failures Hangbin Liu
2024-10-17 2:06 ` [PATCHv2 net-next 1/3] bonding: return detailed error when loading native XDP fails Hangbin Liu
2024-10-17 14:45 ` Toke Høiland-Jørgensen
2024-10-17 2:06 ` [PATCHv2 net-next 2/3] bonding: use correct return value Hangbin Liu
2024-10-17 14:47 ` Toke Høiland-Jørgensen
2024-10-18 0:46 ` Hangbin Liu
2024-10-18 9:41 ` Simon Horman
2024-10-18 11:29 ` Toke Høiland-Jørgensen
2024-10-18 14:21 ` Simon Horman
2024-10-19 0:51 ` Hangbin Liu
2024-10-19 9:19 ` Simon Horman
2024-10-17 2:06 ` [PATCHv2 net-next 3/3] Documentation: bonding: add XDP support explanation Hangbin Liu
2024-10-17 8:42 ` Nikolay Aleksandrov
2024-10-17 8:40 ` [PATCHv2 net-next 0/3] Bonding: returns detailed error about XDP failures Nikolay Aleksandrov
2024-10-17 9:26 ` Hangbin Liu
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).