linux/drivers/net/ethernet/freescale
Vladimir Oltean cd0a719fbd net: dpaa2-switch: disable the control interface on error path
Currently dpaa2_switch_takedown has a funny name and does not do the
opposite of dpaa2_switch_init, which makes probing fail when we need to
handle an -EPROBE_DEFER.

A sketch of what dpaa2_switch_init does:

	dpsw_open

	dpaa2_switch_detect_features

	dpsw_reset

	for (i = 0; i < ethsw->sw_attr.num_ifs; i++) {
		dpsw_if_disable

		dpsw_if_set_stp

		dpsw_vlan_remove_if_untagged

		dpsw_if_set_tci

		dpsw_vlan_remove_if
	}

	dpsw_vlan_remove

	alloc_ordered_workqueue

	dpsw_fdb_remove

	dpaa2_switch_ctrl_if_setup

When dpaa2_switch_takedown is called from the error path of
dpaa2_switch_probe(), the control interface, enabled by
dpaa2_switch_ctrl_if_setup from dpaa2_switch_init, remains enabled,
because dpaa2_switch_takedown does not call
dpaa2_switch_ctrl_if_teardown.

Since dpaa2_switch_probe might fail due to EPROBE_DEFER of a PHY, this
means that a second probe of the driver will happen with the control
interface directly enabled.

This will trigger a second error:

[   93.273528] fsl_dpaa2_switch dpsw.0: dpsw_ctrl_if_set_pools() failed
[   93.281966] fsl_dpaa2_switch dpsw.0: fsl_mc_driver_probe failed: -13
[   93.288323] fsl_dpaa2_switch: probe of dpsw.0 failed with error -13

Which if we investigate the /dev/dpaa2_mc_console log, we find out is
caused by:

[E, ctrl_if_set_pools:2211, DPMNG]  ctrl_if must be disabled

So make dpaa2_switch_takedown do the opposite of dpaa2_switch_init (in
reasonable limits, no reason to change STP state, re-add VLANs etc), and
rename it to something more conventional, like dpaa2_switch_teardown.

Fixes: 613c0a5810 ("staging: dpaa2-switch: enable the control interface")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20210819141755.1931423-1-vladimir.oltean@nxp.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-08-19 10:00:59 -07:00
..
dpaa freescale: Remove rcu_read_lock() around XDP program invocation 2021-06-24 19:44:17 +02:00
dpaa2 net: dpaa2-switch: disable the control interface on error path 2021-08-19 10:00:59 -07:00
enetc net: enetc: Use devm_platform_get_and_ioremap_resource() 2021-06-07 14:07:22 -07:00
fman fsl/fman: Add fibre support 2021-07-20 07:16:45 -07:00
fs_enet of: net: pass the dst buffer to of_get_mac_address() 2021-04-13 14:35:02 -07:00
fec_main.c net: fec: fix use-after-free in fec_drv_remove 2021-08-05 07:29:49 -07:00
fec_mpc52xx_phy.c
fec_mpc52xx.c of: net: pass the dst buffer to of_get_mac_address() 2021-04-13 14:35:02 -07:00
fec_mpc52xx.h
fec_ptp.c net: fec_ptp: fix issue caused by refactor the fec_devtype 2021-06-16 12:39:03 -07:00
fec.h net: fec: add FEC_QUIRK_HAS_MULTI_QUEUES represents i.MX6SX ENET IP 2021-06-21 14:24:20 -07:00
fsl_pq_mdio.c net: freescale: convert comma to semicolon 2020-12-09 16:23:08 -08:00
gianfar_ethtool.c net: gianfar: reject unsupported coalescing params 2020-03-12 11:32:35 -07:00
gianfar.c net: gianfar: Implement rx_missed_errors counter 2021-06-17 11:39:48 -07:00
gianfar.h net: gianfar: Implement rx_missed_errors counter 2021-06-17 11:39:48 -07:00
Kconfig net: mdiobus: withdraw fwnode_mdbiobus_register 2021-06-25 11:46:29 -07:00
Makefile net: enetc: fix link error again 2021-04-22 13:23:07 -07:00
ucc_geth_ethtool.c net/freescale: Don't set zero if FW not-available in ucc_geth 2020-03-03 17:54:55 -08:00
ucc_geth.c ethernet: ucc_geth: Use kmemdup() rather than kmalloc+memcpy 2021-05-23 18:51:42 -07:00
ucc_geth.h ethernet: ucc_geth: simplify rx/tx allocations 2021-01-21 12:19:56 -08:00
xgmac_mdio.c net: mdiobus: withdraw fwnode_mdbiobus_register 2021-06-25 11:46:29 -07:00