summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2017-11-30 12:56:43 -0500
committerDavid S. Miller <davem@davemloft.net>2017-12-02 21:21:17 -0500
commit3169241f55e194278294c7a4c43ef558c75cb0b7 (patch)
tree6865c94b27eaef509b93bbcd81fce2c87baa9c67
parent3b8fac5d905ee15346ba2de1e2427ef43fbbd880 (diff)
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: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/dsa/switch.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/net/dsa/switch.c b/net/dsa/switch.c
index 9a01514ea9f3..b93511726069 100644
--- a/net/dsa/switch.c
+++ b/net/dsa/switch.c
@@ -83,29 +83,23 @@ static int dsa_switch_bridge_leave(struct dsa_switch *ds,
83static int dsa_switch_fdb_add(struct dsa_switch *ds, 83static int dsa_switch_fdb_add(struct dsa_switch *ds,
84 struct dsa_notifier_fdb_info *info) 84 struct dsa_notifier_fdb_info *info)
85{ 85{
86 /* Do not care yet about other switch chips of the fabric */ 86 int port = dsa_towards_port(ds, info->sw_index, info->port);
87 if (ds->index != info->sw_index)
88 return 0;
89 87
90 if (!ds->ops->port_fdb_add) 88 if (!ds->ops->port_fdb_add)
91 return -EOPNOTSUPP; 89 return -EOPNOTSUPP;
92 90
93 return ds->ops->port_fdb_add(ds, info->port, info->addr, 91 return ds->ops->port_fdb_add(ds, port, info->addr, info->vid);
94 info->vid);
95} 92}
96 93
97static int dsa_switch_fdb_del(struct dsa_switch *ds, 94static int dsa_switch_fdb_del(struct dsa_switch *ds,
98 struct dsa_notifier_fdb_info *info) 95 struct dsa_notifier_fdb_info *info)
99{ 96{
100 /* Do not care yet about other switch chips of the fabric */ 97 int port = dsa_towards_port(ds, info->sw_index, info->port);
101 if (ds->index != info->sw_index)
102 return 0;
103 98
104 if (!ds->ops->port_fdb_del) 99 if (!ds->ops->port_fdb_del)
105 return -EOPNOTSUPP; 100 return -EOPNOTSUPP;
106 101
107 return ds->ops->port_fdb_del(ds, info->port, info->addr, 102 return ds->ops->port_fdb_del(ds, port, info->addr, info->vid);
108 info->vid);
109} 103}
110 104
111static int 105static int