Message ID | 20210421130540.12522-1-o.rempel@pengutronix.de (mailing list archive) |
---|---|
State | Accepted |
Commit | 70a7c484c7c3eaa17b679db2c74ec8ecbe8dc0e8 |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net-next,v1] net: dsa: fix bridge support for drivers without port_bridge_flags callback | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | success | CCed 7 of 7 maintainers |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 0 this patch: 0 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | success | total: 0 errors, 0 warnings, 0 checks, 8 lines checked |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 0 this patch: 0 |
netdev/header_inline | success | Link |
On 4/21/2021 6:05 AM, Oleksij Rempel wrote: > Starting with patch: > a8b659e7ff75 ("net: dsa: act as passthrough for bridge port flags") > > drivers without "port_bridge_flags" callback will fail to join the bridge. > Looking at the code, -EOPNOTSUPP seems to be the proper return value, > which makes at least microchip and atheros switches work again. > > Fixes: a8b659e7ff75 ("net: dsa: act as passthrough for bridge port flags") > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
On Wed, Apr 21, 2021 at 03:05:40PM +0200, Oleksij Rempel wrote: > Starting with patch: > a8b659e7ff75 ("net: dsa: act as passthrough for bridge port flags") > > drivers without "port_bridge_flags" callback will fail to join the bridge. > Looking at the code, -EOPNOTSUPP seems to be the proper return value, > which makes at least microchip and atheros switches work again. > > Fixes: a8b659e7ff75 ("net: dsa: act as passthrough for bridge port flags") > Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> > --- > net/dsa/port.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/dsa/port.c b/net/dsa/port.c > index 01e30264b25b..6379d66a6bb3 100644 > --- a/net/dsa/port.c > +++ b/net/dsa/port.c > @@ -550,7 +550,7 @@ int dsa_port_bridge_flags(const struct dsa_port *dp, > struct dsa_switch *ds = dp->ds; > > if (!ds->ops->port_bridge_flags) > - return -EINVAL; > + return -EOPNOTSUPP; > > return ds->ops->port_bridge_flags(ds, dp->index, flags, extack); > } > -- > 2.29.2 > The Fixes: tag should be: Fixes: 5961d6a12c13 ("net: dsa: inherit the actual bridge port flags at join time") What we return to the bridge is -EINVAL, via dsa_port_pre_bridge_flags() (it is a two-step calling convention thing). But dsa_port_bridge_flags() should never return that -EINVAL to the bridge, because the bridge should just stop if the "pre" call returned an error. So the -EINVAL return value from dsa_port_bridge_flags() is just for callers who don't bother to call "pre". To be honest I don't know why I wrote dsa_port_inherit_brport_flags this way. It might be better to just do: -----------------------------[cut here]----------------------------- diff --git a/net/dsa/port.c b/net/dsa/port.c index 01e30264b25b..d5e227a77fbc 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -138,8 +138,12 @@ static int dsa_port_inherit_brport_flags(struct dsa_port *dp, if (br_port_flag_is_set(brport_dev, BIT(flag))) flags.val = BIT(flag); + err = dsa_port_pre_bridge_flags(dp, flags, extack); + if (err == -EINVAL) + continue; + err = dsa_port_bridge_flags(dp, flags, extack); - if (err && err != -EOPNOTSUPP) + if (err) return err; } @@ -159,8 +163,12 @@ static void dsa_port_clear_brport_flags(struct dsa_port *dp) flags.mask = BIT(flag); flags.val = val & BIT(flag); + err = dsa_port_pre_bridge_flags(dp, flags, NULL); + if (err == -EINVAL) + continue; + err = dsa_port_bridge_flags(dp, flags, NULL); - if (err && err != -EOPNOTSUPP) + if (err) dev_err(dp->ds->dev, "failed to clear bridge port flag %lu: %pe\n", flags.val, ERR_PTR(err)); -----------------------------[cut here]-----------------------------
Hello: This patch was applied to netdev/net-next.git (refs/heads/master): On Wed, 21 Apr 2021 15:05:40 +0200 you wrote: > Starting with patch: > a8b659e7ff75 ("net: dsa: act as passthrough for bridge port flags") > > drivers without "port_bridge_flags" callback will fail to join the bridge. > Looking at the code, -EOPNOTSUPP seems to be the proper return value, > which makes at least microchip and atheros switches work again. > > [...] Here is the summary with links: - [net-next,v1] net: dsa: fix bridge support for drivers without port_bridge_flags callback https://git.kernel.org/netdev/net-next/c/70a7c484c7c3 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
diff --git a/net/dsa/port.c b/net/dsa/port.c index 01e30264b25b..6379d66a6bb3 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -550,7 +550,7 @@ int dsa_port_bridge_flags(const struct dsa_port *dp, struct dsa_switch *ds = dp->ds; if (!ds->ops->port_bridge_flags) - return -EINVAL; + return -EOPNOTSUPP; return ds->ops->port_bridge_flags(ds, dp->index, flags, extack); }
Starting with patch: a8b659e7ff75 ("net: dsa: act as passthrough for bridge port flags") drivers without "port_bridge_flags" callback will fail to join the bridge. Looking at the code, -EOPNOTSUPP seems to be the proper return value, which makes at least microchip and atheros switches work again. Fixes: a8b659e7ff75 ("net: dsa: act as passthrough for bridge port flags") Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de> --- net/dsa/port.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)