struct dsa_db db)
{
struct net_device *bridge_dev = felix_classify_db(db);
+ struct dsa_port *dp = dsa_to_port(ds, port);
struct ocelot *ocelot = ds->priv;
if (IS_ERR(bridge_dev))
return PTR_ERR(bridge_dev);
- if (dsa_is_cpu_port(ds, port) && !bridge_dev &&
+ if (dsa_port_is_cpu(dp) && !bridge_dev &&
dsa_fdb_present_in_other_db(ds, port, addr, vid, db))
return 0;
+ if (dsa_port_is_cpu(dp))
+ port = PGID_CPU;
+
return ocelot_fdb_add(ocelot, port, addr, vid, bridge_dev);
}
struct dsa_db db)
{
struct net_device *bridge_dev = felix_classify_db(db);
+ struct dsa_port *dp = dsa_to_port(ds, port);
struct ocelot *ocelot = ds->priv;
if (IS_ERR(bridge_dev))
return PTR_ERR(bridge_dev);
- if (dsa_is_cpu_port(ds, port) && !bridge_dev &&
+ if (dsa_port_is_cpu(dp) && !bridge_dev &&
dsa_fdb_present_in_other_db(ds, port, addr, vid, db))
return 0;
+ if (dsa_port_is_cpu(dp))
+ port = PGID_CPU;
+
return ocelot_fdb_del(ocelot, port, addr, vid, bridge_dev);
}
int ocelot_fdb_add(struct ocelot *ocelot, int port, const unsigned char *addr,
u16 vid, const struct net_device *bridge)
{
- int pgid = port;
-
- if (port == ocelot->npi)
- pgid = PGID_CPU;
-
if (!vid)
vid = ocelot_vlan_unaware_pvid(ocelot, bridge);
- return ocelot_mact_learn(ocelot, pgid, addr, vid, ENTRYTYPE_LOCKED);
+ return ocelot_mact_learn(ocelot, port, addr, vid, ENTRYTYPE_LOCKED);
}
EXPORT_SYMBOL(ocelot_fdb_add);