net: dsa: felix: bring the NPI port indirection for host MDBs to surface
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 11 May 2022 09:50:14 +0000 (12:50 +0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 12 May 2022 23:38:54 +0000 (16:38 -0700)
For symmetry with host FDBs where the indirection is now handled outside
the ocelot switch lib, do the same for host MDB entries. The only caller
of the ocelot switch lib which uses the NPI port is the Felix DSA driver.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/ocelot/felix.c
drivers/net/ethernet/mscc/ocelot.c

index 5af4f9b..f8a587a 100644 (file)
@@ -745,6 +745,9 @@ static int felix_mdb_add(struct dsa_switch *ds, int port,
            dsa_mdb_present_in_other_db(ds, port, mdb, db))
                return 0;
 
+       if (port == ocelot->npi)
+               port = ocelot->num_phys_ports;
+
        return ocelot_port_mdb_add(ocelot, port, mdb, bridge_dev);
 }
 
@@ -762,6 +765,9 @@ static int felix_mdb_del(struct dsa_switch *ds, int port,
            dsa_mdb_present_in_other_db(ds, port, mdb, db))
                return 0;
 
+       if (port == ocelot->npi)
+               port = ocelot->num_phys_ports;
+
        return ocelot_port_mdb_del(ocelot, port, mdb, bridge_dev);
 }
 
index 7a9ee91..29e8011 100644 (file)
@@ -2339,9 +2339,6 @@ int ocelot_port_mdb_add(struct ocelot *ocelot, int port,
        struct ocelot_pgid *pgid;
        u16 vid = mdb->vid;
 
-       if (port == ocelot->npi)
-               port = ocelot->num_phys_ports;
-
        if (!vid)
                vid = ocelot_vlan_unaware_pvid(ocelot, bridge);
 
@@ -2399,9 +2396,6 @@ int ocelot_port_mdb_del(struct ocelot *ocelot, int port,
        struct ocelot_pgid *pgid;
        u16 vid = mdb->vid;
 
-       if (port == ocelot->npi)
-               port = ocelot->num_phys_ports;
-
        if (!vid)
                vid = ocelot_vlan_unaware_pvid(ocelot, bridge);