Skip to content

Commit f267f26

Browse files
borkmannAlexei Starovoitov
authored andcommitted
xdp, bonding: Fix feature flags when there are no slave devs anymore
Commit 9b0ed89 ("bonding: do not report NETDEV_XDP_ACT_XSK_ZEROCOPY") changed the driver from reporting everything as supported before a device was bonded into having the driver report that no XDP feature is supported until a real device is bonded as it seems to be more truthful given eventually real underlying devices decide what XDP features are supported. The change however did not take into account when all slave devices get removed from the bond device. In this case after 9b0ed89, the driver keeps reporting a feature mask of 0x77, that is, NETDEV_XDP_ACT_MASK & ~NETDEV_XDP_ACT_XSK_ZEROCOPY whereas it should have reported a feature mask of 0. Fix it by resetting XDP feature flags in the same way as if no XDP program is attached to the bond device. This was uncovered by the XDP bond selftest which let BPF CI fail. After adjusting the starting masks on the latter to 0 instead of NETDEV_XDP_ACT_MASK the test passes again together with this fix. Fixes: 9b0ed89 ("bonding: do not report NETDEV_XDP_ACT_XSK_ZEROCOPY") Signed-off-by: Daniel Borkmann <[email protected]> Cc: Magnus Karlsson <[email protected]> Cc: Prashant Batra <[email protected]> Cc: Toke Høiland-Jørgensen <[email protected]> Cc: Jakub Kicinski <[email protected]> Reviewed-by: Toke Høiland-Jørgensen <[email protected]> Message-ID: <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 399eca1 commit f267f26

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1811,7 +1811,7 @@ void bond_xdp_set_features(struct net_device *bond_dev)
18111811

18121812
ASSERT_RTNL();
18131813

1814-
if (!bond_xdp_check(bond)) {
1814+
if (!bond_xdp_check(bond) || !bond_has_slaves(bond)) {
18151815
xdp_clear_features_flag(bond_dev);
18161816
return;
18171817
}

0 commit comments

Comments
 (0)