Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: dsa: don't warn in dsa_port_set_state_now() when driver doesn't support it

ds->ops->port_stp_state_set() is, like most DSA methods, optional, and
if absent, the port is supposed to remain in the forwarding state (as
standalone). Such is the case with the mv88e6060 driver, which does not
offload the bridge layer. DSA warns that the STP state can't be changed
to FORWARDING as part of dsa_port_enable_rt(), when in fact it should not.

The error message is also not up to modern standards, so take the
opportunity to make it more descriptive.

Fixes: fd3645413197 ("net: dsa: change scope of STP state setter")
Reported-by: Sergei Antonov <saproj@gmail.com>
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Sergei Antonov <saproj@gmail.com>
Link: https://lore.kernel.org/r/20220816201445.1809483-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Vladimir Oltean and committed by
Jakub Kicinski
211987f3 fd8e899c

+5 -2
+5 -2
net/dsa/port.c
··· 145 145 static void dsa_port_set_state_now(struct dsa_port *dp, u8 state, 146 146 bool do_fast_age) 147 147 { 148 + struct dsa_switch *ds = dp->ds; 148 149 int err; 149 150 150 151 err = dsa_port_set_state(dp, state, do_fast_age); 151 - if (err) 152 - pr_err("DSA: failed to set STP state %u (%d)\n", state, err); 152 + if (err && err != -EOPNOTSUPP) { 153 + dev_err(ds->dev, "port %d failed to set STP state %u: %pe\n", 154 + dp->index, state, ERR_PTR(err)); 155 + } 153 156 } 154 157 155 158 int dsa_port_set_mst_state(struct dsa_port *dp,