1*f7c14bbaSAndroid Build Coastguard WorkerFrom f267f262815033452195f46c43b572159262f533 Mon Sep 17 00:00:00 2001
2*f7c14bbaSAndroid Build Coastguard WorkerFrom: Daniel Borkmann <[email protected]>
3*f7c14bbaSAndroid Build Coastguard WorkerDate: Tue, 5 Mar 2024 10:08:28 +0100
4*f7c14bbaSAndroid Build Coastguard WorkerSubject: [PATCH 2/2] xdp, bonding: Fix feature flags when there are no slave
5*f7c14bbaSAndroid Build Coastguard Worker devs anymore
6*f7c14bbaSAndroid Build Coastguard WorkerMIME-Version: 1.0
7*f7c14bbaSAndroid Build Coastguard WorkerContent-Type: text/plain; charset=UTF-8
8*f7c14bbaSAndroid Build Coastguard WorkerContent-Transfer-Encoding: 8bit
9*f7c14bbaSAndroid Build Coastguard Worker
10*f7c14bbaSAndroid Build Coastguard WorkerCommit 9b0ed890ac2a ("bonding: do not report NETDEV_XDP_ACT_XSK_ZEROCOPY")
11*f7c14bbaSAndroid Build Coastguard Workerchanged the driver from reporting everything as supported before a device
12*f7c14bbaSAndroid Build Coastguard Workerwas bonded into having the driver report that no XDP feature is supported
13*f7c14bbaSAndroid Build Coastguard Workeruntil a real device is bonded as it seems to be more truthful given
14*f7c14bbaSAndroid Build Coastguard Workereventually real underlying devices decide what XDP features are supported.
15*f7c14bbaSAndroid Build Coastguard Worker
16*f7c14bbaSAndroid Build Coastguard WorkerThe change however did not take into account when all slave devices get
17*f7c14bbaSAndroid Build Coastguard Workerremoved from the bond device. In this case after 9b0ed890ac2a, the driver
18*f7c14bbaSAndroid Build Coastguard Workerkeeps reporting a feature mask of 0x77, that is, NETDEV_XDP_ACT_MASK &
19*f7c14bbaSAndroid Build Coastguard Worker~NETDEV_XDP_ACT_XSK_ZEROCOPY whereas it should have reported a feature
20*f7c14bbaSAndroid Build Coastguard Workermask of 0.
21*f7c14bbaSAndroid Build Coastguard Worker
22*f7c14bbaSAndroid Build Coastguard WorkerFix it by resetting XDP feature flags in the same way as if no XDP program
23*f7c14bbaSAndroid Build Coastguard Workeris attached to the bond device. This was uncovered by the XDP bond selftest
24*f7c14bbaSAndroid Build Coastguard Workerwhich let BPF CI fail. After adjusting the starting masks on the latter
25*f7c14bbaSAndroid Build Coastguard Workerto 0 instead of NETDEV_XDP_ACT_MASK the test passes again together with
26*f7c14bbaSAndroid Build Coastguard Workerthis fix.
27*f7c14bbaSAndroid Build Coastguard Worker
28*f7c14bbaSAndroid Build Coastguard WorkerFixes: 9b0ed890ac2a ("bonding: do not report NETDEV_XDP_ACT_XSK_ZEROCOPY")
29*f7c14bbaSAndroid Build Coastguard WorkerSigned-off-by: Daniel Borkmann <[email protected]>
30*f7c14bbaSAndroid Build Coastguard WorkerCc: Magnus Karlsson <[email protected]>
31*f7c14bbaSAndroid Build Coastguard WorkerCc: Prashant Batra <[email protected]>
32*f7c14bbaSAndroid Build Coastguard WorkerCc: Toke Høiland-Jørgensen <[email protected]>
33*f7c14bbaSAndroid Build Coastguard WorkerCc: Jakub Kicinski <[email protected]>
34*f7c14bbaSAndroid Build Coastguard WorkerReviewed-by: Toke Høiland-Jørgensen <[email protected]>
35*f7c14bbaSAndroid Build Coastguard WorkerMessage-ID: <[email protected]>
36*f7c14bbaSAndroid Build Coastguard WorkerSigned-off-by: Alexei Starovoitov <[email protected]>
37*f7c14bbaSAndroid Build Coastguard Worker---
38*f7c14bbaSAndroid Build Coastguard Worker drivers/net/bonding/bond_main.c | 2 +-
39*f7c14bbaSAndroid Build Coastguard Worker 1 file changed, 1 insertion(+), 1 deletion(-)
40*f7c14bbaSAndroid Build Coastguard Worker
41*f7c14bbaSAndroid Build Coastguard Workerdiff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
42*f7c14bbaSAndroid Build Coastguard Workerindex a11748b8d69b..cd0683bcca03 100644
43*f7c14bbaSAndroid Build Coastguard Worker--- a/drivers/net/bonding/bond_main.c
44*f7c14bbaSAndroid Build Coastguard Worker+++ b/drivers/net/bonding/bond_main.c
45*f7c14bbaSAndroid Build Coastguard Worker@@ -1811,7 +1811,7 @@ void bond_xdp_set_features(struct net_device *bond_dev)
46*f7c14bbaSAndroid Build Coastguard Worker
47*f7c14bbaSAndroid Build Coastguard Worker 	ASSERT_RTNL();
48*f7c14bbaSAndroid Build Coastguard Worker
49*f7c14bbaSAndroid Build Coastguard Worker-	if (!bond_xdp_check(bond)) {
50*f7c14bbaSAndroid Build Coastguard Worker+	if (!bond_xdp_check(bond) || !bond_has_slaves(bond)) {
51*f7c14bbaSAndroid Build Coastguard Worker 		xdp_clear_features_flag(bond_dev);
52*f7c14bbaSAndroid Build Coastguard Worker 		return;
53*f7c14bbaSAndroid Build Coastguard Worker 	}
54*f7c14bbaSAndroid Build Coastguard Worker--
55*f7c14bbaSAndroid Build Coastguard Worker2.43.0
56*f7c14bbaSAndroid Build Coastguard Worker
57