Commit 3169241f authored by Vivien Didelot's avatar Vivien Didelot Committed by David S. Miller

net: dsa: support cross-chip FDB operations

When a MAC address is added to or removed from a switch port in the
fabric, the target switch must program its port and adjacent switches
must program their local DSA port used to reach the target switch.

For this purpose, use the dsa_towards_port() helper to identify the
local switch port which must be programmed.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3b8fac5d
...@@ -83,29 +83,23 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds, ...@@ -83,29 +83,23 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds,
static int dsa_switch_fdb_add(struct dsa_switch *ds, static int dsa_switch_fdb_add(struct dsa_switch *ds,
struct dsa_notifier_fdb_info *info) struct dsa_notifier_fdb_info *info)
{ {
/* Do not care yet about other switch chips of the fabric */ int port = dsa_towards_port(ds, info->sw_index, info->port);
if (ds->index != info->sw_index)
return 0;
if (!ds->ops->port_fdb_add) if (!ds->ops->port_fdb_add)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return ds->ops->port_fdb_add(ds, info->port, info->addr, return ds->ops->port_fdb_add(ds, port, info->addr, info->vid);
info->vid);
} }
static int dsa_switch_fdb_del(struct dsa_switch *ds, static int dsa_switch_fdb_del(struct dsa_switch *ds,
struct dsa_notifier_fdb_info *info) struct dsa_notifier_fdb_info *info)
{ {
/* Do not care yet about other switch chips of the fabric */ int port = dsa_towards_port(ds, info->sw_index, info->port);
if (ds->index != info->sw_index)
return 0;
if (!ds->ops->port_fdb_del) if (!ds->ops->port_fdb_del)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return ds->ops->port_fdb_del(ds, info->port, info->addr, return ds->ops->port_fdb_del(ds, port, info->addr, info->vid);
info->vid);
} }
static int static int
......
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