bonding: return detailed error when loading native XDP fails
authorHangbin Liu <liuhangbin@gmail.com>
Mon, 21 Oct 2024 03:12:10 +0000 (03:12 +0000)
committerJakub Kicinski <kuba@kernel.org>
Mon, 28 Oct 2024 23:09:42 +0000 (16:09 -0700)
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>
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://patch.msgid.link/20241021031211.814-2-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/bonding/bond_main.c

index 3928287..5812e8e 100644 (file)
@@ -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;