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

net: mscc: ocelot: make the NPI port a proper target for FDB and MDB

When used in DSA mode (as seen in Felix), the DEST_IDX in the MAC table
should point to the PGID for the CPU port (PGID_CPU) and not for the
Ethernet port where the CPU queues are redirected to (also known as Node
Processor Interface - NPI).

Because for Felix this distinction shouldn't really matter (from DSA
perspective, the NPI port _is_ the CPU port), make the ocelot library
act upon the CPU port when NPI mode is enabled. This has no effect for
the mscc_ocelot driver for VSC7514, because that does not use NPI (and
ocelot->npi is -1).
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0897ecf7
...@@ -535,6 +535,10 @@ int ocelot_fdb_add(struct ocelot *ocelot, int port, ...@@ -535,6 +535,10 @@ int ocelot_fdb_add(struct ocelot *ocelot, int port,
const unsigned char *addr, u16 vid) const unsigned char *addr, u16 vid)
{ {
struct ocelot_port *ocelot_port = ocelot->ports[port]; struct ocelot_port *ocelot_port = ocelot->ports[port];
int pgid = port;
if (port == ocelot->npi)
pgid = PGID_CPU;
if (!vid) { if (!vid) {
if (!ocelot_port->vlan_aware) if (!ocelot_port->vlan_aware)
...@@ -550,7 +554,7 @@ int ocelot_fdb_add(struct ocelot *ocelot, int port, ...@@ -550,7 +554,7 @@ int ocelot_fdb_add(struct ocelot *ocelot, int port,
return -EINVAL; return -EINVAL;
} }
return ocelot_mact_learn(ocelot, port, addr, vid, ENTRYTYPE_LOCKED); return ocelot_mact_learn(ocelot, pgid, addr, vid, ENTRYTYPE_LOCKED);
} }
EXPORT_SYMBOL(ocelot_fdb_add); EXPORT_SYMBOL(ocelot_fdb_add);
...@@ -953,6 +957,9 @@ int ocelot_port_obj_add_mdb(struct net_device *dev, ...@@ -953,6 +957,9 @@ int ocelot_port_obj_add_mdb(struct net_device *dev,
u16 vid = mdb->vid; u16 vid = mdb->vid;
bool new = false; bool new = false;
if (port == ocelot->npi)
port = ocelot->num_phys_ports;
if (!vid) if (!vid)
vid = ocelot_port->pvid; vid = ocelot_port->pvid;
...@@ -997,6 +1004,9 @@ int ocelot_port_obj_del_mdb(struct net_device *dev, ...@@ -997,6 +1004,9 @@ int ocelot_port_obj_del_mdb(struct net_device *dev,
int port = priv->chip_port; int port = priv->chip_port;
u16 vid = mdb->vid; u16 vid = mdb->vid;
if (port == ocelot->npi)
port = ocelot->num_phys_ports;
if (!vid) if (!vid)
vid = ocelot_port->pvid; vid = ocelot_port->pvid;
......
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