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