Skip to content

Commit e29bbd7

Browse files
vladimirolteankuba-moo
authored andcommitted
net: dsa: lantiq_gswip: support bridge FDB entries on the CPU port
Currently, the driver takes the bridge from dsa_port_bridge_dev_get(), which only works for user ports. This is why it has to ignore FDB entries installed on the CPU port. Commit c269336 ("net: dsa: request drivers to perform FDB isolation") introduced the possibility of getting the originating bridge from the passed dsa_db argument, so let's do that instead. This way, we can act on the local FDB entries coming from the bridge. Note that we do not expect FDB events for the DSA_DB_PORT database, because this driver doesn't fulfill the dsa_switch_supports_uc_filtering() requirements. So we can just return -EOPNOTSUPP and expect it will never be triggered. Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: Daniel Golle <[email protected]> Link: https://patch.msgid.link/ed9d847c0356f0fec81422bdad9ebdcc6a59da79.1760566491.git.daniel@makrotopia.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent e905768 commit e29bbd7

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

drivers/net/dsa/lantiq/lantiq_gswip.c

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1140,20 +1140,16 @@ static void gswip_port_stp_state_set(struct dsa_switch *ds, int port, u8 state)
11401140
}
11411141

11421142
static int gswip_port_fdb(struct dsa_switch *ds, int port,
1143-
const unsigned char *addr, u16 vid, bool add)
1143+
struct net_device *bridge, const unsigned char *addr,
1144+
u16 vid, bool add)
11441145
{
1145-
struct net_device *bridge = dsa_port_bridge_dev_get(dsa_to_port(ds, port));
11461146
struct gswip_priv *priv = ds->priv;
11471147
struct gswip_pce_table_entry mac_bridge = {0,};
11481148
unsigned int max_ports = priv->hw_info->max_ports;
11491149
int fid = -1;
11501150
int i;
11511151
int err;
11521152

1153-
/* Operation not supported on the CPU port, don't throw errors */
1154-
if (!bridge)
1155-
return 0;
1156-
11571153
for (i = max_ports; i < ARRAY_SIZE(priv->vlans); i++) {
11581154
if (priv->vlans[i].bridge == bridge) {
11591155
fid = priv->vlans[i].fid;
@@ -1188,14 +1184,20 @@ static int gswip_port_fdb_add(struct dsa_switch *ds, int port,
11881184
const unsigned char *addr, u16 vid,
11891185
struct dsa_db db)
11901186
{
1191-
return gswip_port_fdb(ds, port, addr, vid, true);
1187+
if (db.type != DSA_DB_BRIDGE)
1188+
return -EOPNOTSUPP;
1189+
1190+
return gswip_port_fdb(ds, port, db.bridge.dev, addr, vid, true);
11921191
}
11931192

11941193
static int gswip_port_fdb_del(struct dsa_switch *ds, int port,
11951194
const unsigned char *addr, u16 vid,
11961195
struct dsa_db db)
11971196
{
1198-
return gswip_port_fdb(ds, port, addr, vid, false);
1197+
if (db.type != DSA_DB_BRIDGE)
1198+
return -EOPNOTSUPP;
1199+
1200+
return gswip_port_fdb(ds, port, db.bridge.dev, addr, vid, false);
11991201
}
12001202

12011203
static int gswip_port_fdb_dump(struct dsa_switch *ds, int port,

0 commit comments

Comments
 (0)