mirror of
https://github.com/torvalds/linux.git
synced 2024-11-17 09:31:50 +00:00
net: dsa: felix: break at first CPU port during init and teardown
The NXP LS1028A switch has two Ethernet ports towards the CPU, but only
one of them is capable of acting as an NPI port at a time (inject and
extract packets using DSA tags).
However, using the alternative ocelot-8021q tagging protocol, it should
be possible to use both CPU ports symmetrically, but for that we need to
mark both ports in the device tree as DSA masters.
In the process of doing that, it can be seen that traffic to/from the
network stack gets broken, and this is because the Felix driver iterates
through all DSA CPU ports and configures them as NPI ports. But since
there can only be a single NPI port, we effectively end up in a
situation where DSA thinks the default CPU port is the first one, but
the hardware port configured to be an NPI is the last one.
I would like to treat this as a bug, because if the updated device trees
are going to start circulating, it would be really good for existing
kernels to support them, too.
Fixes: adb3dccf09
("net: dsa: felix: convert to the new .change_tag_protocol DSA API")
Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
43ba33b4f1
commit
8d5f7954b7
@ -266,12 +266,12 @@ static void felix_8021q_cpu_port_deinit(struct ocelot *ocelot, int port)
|
||||
*/
|
||||
static int felix_setup_mmio_filtering(struct felix *felix)
|
||||
{
|
||||
unsigned long user_ports = 0, cpu_ports = 0;
|
||||
unsigned long user_ports = dsa_user_ports(felix->ds);
|
||||
struct ocelot_vcap_filter *redirect_rule;
|
||||
struct ocelot_vcap_filter *tagging_rule;
|
||||
struct ocelot *ocelot = &felix->ocelot;
|
||||
struct dsa_switch *ds = felix->ds;
|
||||
int port, ret;
|
||||
int cpu = -1, port, ret;
|
||||
|
||||
tagging_rule = kzalloc(sizeof(struct ocelot_vcap_filter), GFP_KERNEL);
|
||||
if (!tagging_rule)
|
||||
@ -284,12 +284,15 @@ static int felix_setup_mmio_filtering(struct felix *felix)
|
||||
}
|
||||
|
||||
for (port = 0; port < ocelot->num_phys_ports; port++) {
|
||||
if (dsa_is_user_port(ds, port))
|
||||
user_ports |= BIT(port);
|
||||
if (dsa_is_cpu_port(ds, port))
|
||||
cpu_ports |= BIT(port);
|
||||
if (dsa_is_cpu_port(ds, port)) {
|
||||
cpu = port;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (cpu < 0)
|
||||
return -EINVAL;
|
||||
|
||||
tagging_rule->key_type = OCELOT_VCAP_KEY_ETYPE;
|
||||
*(__be16 *)tagging_rule->key.etype.etype.value = htons(ETH_P_1588);
|
||||
*(__be16 *)tagging_rule->key.etype.etype.mask = htons(0xffff);
|
||||
@ -325,7 +328,7 @@ static int felix_setup_mmio_filtering(struct felix *felix)
|
||||
* the CPU port module
|
||||
*/
|
||||
redirect_rule->action.mask_mode = OCELOT_MASK_MODE_REDIRECT;
|
||||
redirect_rule->action.port_mask = cpu_ports;
|
||||
redirect_rule->action.port_mask = BIT(cpu);
|
||||
} else {
|
||||
/* Trap PTP packets only to the CPU port module (which is
|
||||
* redirected to the NPI port)
|
||||
@ -1235,6 +1238,7 @@ static int felix_setup(struct dsa_switch *ds)
|
||||
* there's no real point in checking for errors.
|
||||
*/
|
||||
felix_set_tag_protocol(ds, port, felix->tag_proto);
|
||||
break;
|
||||
}
|
||||
|
||||
ds->mtu_enforcement_ingress = true;
|
||||
@ -1275,6 +1279,7 @@ static void felix_teardown(struct dsa_switch *ds)
|
||||
continue;
|
||||
|
||||
felix_del_tag_protocol(ds, port, felix->tag_proto);
|
||||
break;
|
||||
}
|
||||
|
||||
for (port = 0; port < ocelot->num_phys_ports; port++) {
|
||||
|
Loading…
Reference in New Issue
Block a user