Commit df2a81a3 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by David S. Miller

net: dsa: sja1105: don't assign the host port using dsa_upstream_port()

If @port is unused, then dsa_upstream_port(ds, port) returns @port,
which means we cannot assume the CPU port can be retrieved this way.

The sja1105 switches support a single CPU port, so just iterate over the
switch ports and stop at the first CPU port we see.
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 82760d7f
...@@ -556,7 +556,7 @@ static int sja1105_init_general_params(struct sja1105_private *priv) ...@@ -556,7 +556,7 @@ static int sja1105_init_general_params(struct sja1105_private *priv)
* receieved on host_port itself would be dropped, except * receieved on host_port itself would be dropped, except
* by installing a temporary 'management route' * by installing a temporary 'management route'
*/ */
.host_port = dsa_upstream_port(priv->ds, 0), .host_port = priv->ds->num_ports,
/* Default to an invalid value */ /* Default to an invalid value */
.mirr_port = priv->ds->num_ports, .mirr_port = priv->ds->num_ports,
/* Link-local traffic received on casc_port will be forwarded /* Link-local traffic received on casc_port will be forwarded
...@@ -579,7 +579,16 @@ static int sja1105_init_general_params(struct sja1105_private *priv) ...@@ -579,7 +579,16 @@ static int sja1105_init_general_params(struct sja1105_private *priv)
.tpid = ETH_P_SJA1105, .tpid = ETH_P_SJA1105,
.tpid2 = ETH_P_SJA1105, .tpid2 = ETH_P_SJA1105,
}; };
struct dsa_switch *ds = priv->ds;
struct sja1105_table *table; struct sja1105_table *table;
int port;
for (port = 0; port < ds->num_ports; port++) {
if (dsa_is_cpu_port(ds, port)) {
default_general_params.host_port = port;
break;
}
}
table = &priv->static_config.tables[BLK_IDX_GENERAL_PARAMS]; table = &priv->static_config.tables[BLK_IDX_GENERAL_PARAMS];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment