Skip to contentSkip to conversation

be2net: propagate bridge config query errors

PATCH In review Avi Weiss 2 participants 2 messages Aug 9 – Aug 11

Subsystems (3)
lore
Share & tools
lore

Avi Weiss

author
#0 lore raw

PATCH 1/1 be2net: propagate bridge config query errors

be_ndo_bridge_getlink() returns success when be_cmd_get_hsw_config() fails, hiding the error from rtnetlink users.

Return the normalized command status instead.

Fixes a77dcb8c8ff0 ("be2net: set and query VEB/VEPA mode of the PF interface")
---
 drivers/net/ethernet/emulex/benet/be_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/emulex/benet/be_main.c +1 -1
index ed302f5ec476..49646e4eeaa9 100644
@@ -5028,7 +5028,7 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 					       adapter->if_handle, &hsw_mode,
 					       NULL);
 		if (status)
-			return 0;
+			return be_cmd_status(status);
 
 		if (hsw_mode == PORT_FWD_TYPE_PASSTHRU)
 			return 0;

base-commit: dd057113ac7ba5bdd2aed3d9405305911152f911

Signature · 1 line
2.43.0
reviewer
#1 lore raw

This is an AI-generated review of your patch. The human sending this
email has considered the AI review valid, or at least plausible.
Full review at: https://sashiko.dev/#/patchset/[email protected]?part=1
---
--- Patch [1]: [PATCH net] be2net: propagate bridge config query errors ---
commit 7ca874943675f3c258ffbdac77a92f7564cc5f1a
Author: Avi Weiss <[email protected]>

be2net: propagate bridge config query errors

This patch modifies be_ndo_bridge_getlink to return a normalized error code when be_cmd_get_hsw_config fails. The goal is to propagate the hardware or firmware error to rtnetlink users instead of silently masking it with a success return code.

drivers/net/ethernet/emulex/benet/be_main.c static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, · line 5031

Quoted 9 lines
drivers/net/ethernet/emulex/benet/be_main.c +1 -1
@@ -5028,7 +5028,7 @@ static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
 					       adapter->if_handle, &hsw_mode,
 					       NULL);
 		if (status)
-			return 0;
+			return be_cmd_status(status);

[Severity: High]
Will returning a hard error here abort the system-wide rtnetlink bridge dump?

Looking at how the netlink core handles the return value from ndo_bridge_getlink:

net/core/rtnetlink.c:rtnl_bridge_getlink() {
...

                err = ops->ndo_bridge_getlink(skb, portid,
                                              seq, dev,
                                              filter_mask,
                                              NLM_F_MULTI);
                if (err < 0 && err != -EOPNOTSUPP) {
                        if (likely(skb->len))
                                break;
                        goto out_err;
                }

...
}

If a localized firmware failure causes the be2net driver to return an error like -EIO, it appears this will terminate the global netlink dump. Could this cause system management tools like 'bridge link' to fail to list all the other unrelated network interfaces on the system?

Quoted 3 lines
drivers/net/ethernet/emulex/benet/be_main.c +0 -0
 		if (hsw_mode == PORT_FWD_TYPE_PASSTHRU)
 			return 0;