summaryrefslogtreecommitdiffstats
path: root/drivers/staging/fsl-dpaa2
diff options
context:
space:
mode:
authorIoana Ciornei <ioana.ciornei@nxp.com>2020-07-21 12:19:16 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-21 16:53:34 +0200
commit4acfc4393e90e4dfa6ebc6e43545296ca1d928fe (patch)
tree92e98af0fe65c675a4a13a9d01725947c7781ab2 /drivers/staging/fsl-dpaa2
parentaf85d0e06c6ab1a2d9432cf5923a1a5de816ac22 (diff)
staging: dpaa2-ethsw: setup the STP state for all installed VLANs
Setup the STP state for all VLANs installed on the port. This is also avoiding the error situation when the DEFAULT_VLAN_ID is not installed on the port (thus the firmware complains that it cannot setup the required STP state). Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com> Link: https://lore.kernel.org/r/20200721091919.20394-4-ioana.ciornei@nxp.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/fsl-dpaa2')
-rw-r--r--drivers/staging/fsl-dpaa2/ethsw/ethsw.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index f0d10afb1460..c620ee23227b 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -183,21 +183,26 @@ static int ethsw_port_set_flood(struct ethsw_port_priv *port_priv, bool enable)
static int ethsw_port_set_stp_state(struct ethsw_port_priv *port_priv, u8 state)
{
struct dpsw_stp_cfg stp_cfg = {
- .vlan_id = DEFAULT_VLAN_ID,
.state = state,
};
int err;
+ u16 vid;
if (!netif_running(port_priv->netdev) || state == port_priv->stp_state)
return 0; /* Nothing to do */
- err = dpsw_if_set_stp(port_priv->ethsw_data->mc_io, 0,
- port_priv->ethsw_data->dpsw_handle,
- port_priv->idx, &stp_cfg);
- if (err) {
- netdev_err(port_priv->netdev,
- "dpsw_if_set_stp err %d\n", err);
- return err;
+ for (vid = 0; vid <= VLAN_VID_MASK; vid++) {
+ if (port_priv->vlans[vid] & ETHSW_VLAN_MEMBER) {
+ stp_cfg.vlan_id = vid;
+ err = dpsw_if_set_stp(port_priv->ethsw_data->mc_io, 0,
+ port_priv->ethsw_data->dpsw_handle,
+ port_priv->idx, &stp_cfg);
+ if (err) {
+ netdev_err(port_priv->netdev,
+ "dpsw_if_set_stp err %d\n", err);
+ return err;
+ }
+ }
}
port_priv->stp_state = state;