linux/drivers/net/ethernet/freescale/dpaa2
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
..
dpaa2-eth-dcb.c dpaa2-eth: add a dpaa2_eth_ prefix to all functions in dpaa2-eth-dcb.c 2020-09-01 13:23:47 -07:00
dpaa2-eth-debugfs.c dpaa2-eth: name the debugfs directory after the DPNI object 2021-05-21 14:05:04 -07:00
dpaa2-eth-debugfs.h
dpaa2-eth-devlink.c dpaa2-eth: add support for devlink parser error drop traps 2020-10-02 16:31:56 -07:00
dpaa2-eth-trace.h
dpaa2-eth.c freescale: Remove rcu_read_lock() around XDP program invocation 2021-06-24 19:44:17 +02:00
dpaa2-eth.h dpaa2-eth: export the rx copybreak value as an ethtool tunable 2021-04-02 14:25:47 -07:00
dpaa2-ethtool.c dpaa2-eth: export the rx copybreak value as an ethtool tunable 2021-04-02 14:25:47 -07:00
dpaa2-mac.c net: dpaa2-mac: Add ACPI support for DPAA2 MAC driver 2021-06-11 13:08:53 -07:00
dpaa2-mac.h net: dpaa2-mac: Add ACPI support for DPAA2 MAC driver 2021-06-11 13:08:53 -07:00
dpaa2-ptp.c dpaa2-eth: define a global ptp_qoriq structure pointer 2020-09-18 14:32:48 -07:00
dpaa2-ptp.h dpaa2-eth: define a global ptp_qoriq structure pointer 2020-09-18 14:32:48 -07:00
dpaa2-switch-ethtool.c staging: dpaa2-switch: move the driver out of staging 2021-03-10 13:30:36 -08:00
dpaa2-switch-flower.c dpaa2-switch: reuse dpaa2_switch_acl_entry_add() for STP frames trap 2021-04-13 15:12:18 -07:00
dpaa2-switch.c net: dpaa2-switch: disable the control interface on error path 2021-08-19 10:00:59 -07:00
dpaa2-switch.h dpaa2-switch: reuse dpaa2_switch_acl_entry_add() for STP frames trap 2021-04-13 15:12:18 -07:00
dpkg.h dpaa2-eth: fixup kdoc warnings 2021-03-16 15:29:49 -07:00
dpmac-cmd.h dpaa2-eth: fix a build warning in dpmac.c 2020-09-18 14:36:00 -07:00
dpmac.c
dpmac.h dpaa2-eth: fixup kdoc warnings 2021-03-16 15:29:49 -07:00
dpni-cmd.h dpaa2-eth: add support for Rx VLAN filtering 2021-01-13 19:20:55 -08:00
dpni.c dpaa2-eth: fixup kdoc warnings 2021-03-16 15:29:49 -07:00
dpni.h dpaa2-eth: fixup kdoc warnings 2021-03-16 15:29:49 -07:00
dprtc-cmd.h
dprtc.c
dprtc.h dpaa2-eth: fixup kdoc warnings 2021-03-16 15:29:49 -07:00
dpsw-cmd.h dpaa2-switch: add tc flower hardware offload on ingress traffic 2021-04-13 15:12:18 -07:00
dpsw.c dpaa2-switch: add tc flower hardware offload on ingress traffic 2021-04-13 15:12:18 -07:00
dpsw.h dpaa2-switch: add tc flower hardware offload on ingress traffic 2021-04-13 15:12:18 -07:00
Kconfig staging: dpaa2-switch: move the driver out of staging 2021-03-10 13:30:36 -08:00
Makefile dpaa2-switch: add tc flower hardware offload on ingress traffic 2021-04-13 15:12:18 -07:00