summaryrefslogtreecommitdiff
path: root/net/dsa/port.c
diff options
context:
space:
mode:
authorVivien Didelot <vivien.didelot@savoirfairelinux.com>2017-05-19 17:00:53 -0400
committerDavid S. Miller <davem@davemloft.net>2017-05-22 19:37:32 -0400
commit685fb6a40ddace10a0bc8a680ab6ba65c6cdfdaf (patch)
tree258dc0f599d0e3ae686ce59ba7c5b84655328a7b /net/dsa/port.c
parent1faabf7440f17999f41973e91878c13ad9f080b2 (diff)
net: dsa: add FDB notifier
Add two new DSA_NOTIFIER_FDB_ADD and DSA_NOTIFIER_FDB_DEL events to notify not only a single switch, but all switches of a the fabric when an FDB entry is added or removed. For the moment, keep the current behavior and ignore other switches. Signed-off-by: Vivien Didelot <vivien.didelot@savoirfairelinux.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dsa/port.c')
-rw-r--r--net/dsa/port.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/net/dsa/port.c b/net/dsa/port.c
index 59328a35394d..ed88d8381642 100644
--- a/net/dsa/port.c
+++ b/net/dsa/port.c
@@ -151,29 +151,26 @@ int dsa_port_fdb_add(struct dsa_port *dp,
const struct switchdev_obj_port_fdb *fdb,
struct switchdev_trans *trans)
{
- struct dsa_switch *ds = dp->ds;
-
- if (switchdev_trans_ph_prepare(trans)) {
- if (!ds->ops->port_fdb_prepare || !ds->ops->port_fdb_add)
- return -EOPNOTSUPP;
-
- return ds->ops->port_fdb_prepare(ds, dp->index, fdb, trans);
- }
-
- ds->ops->port_fdb_add(ds, dp->index, fdb, trans);
+ struct dsa_notifier_fdb_info info = {
+ .sw_index = dp->ds->index,
+ .port = dp->index,
+ .trans = trans,
+ .fdb = fdb,
+ };
- return 0;
+ return dsa_port_notify(dp, DSA_NOTIFIER_FDB_ADD, &info);
}
int dsa_port_fdb_del(struct dsa_port *dp,
const struct switchdev_obj_port_fdb *fdb)
{
- struct dsa_switch *ds = dp->ds;
-
- if (ds->ops->port_fdb_del)
- return -EOPNOTSUPP;
+ struct dsa_notifier_fdb_info info = {
+ .sw_index = dp->ds->index,
+ .port = dp->index,
+ .fdb = fdb,
+ };
- return ds->ops->port_fdb_del(ds, dp->index, fdb);
+ return dsa_port_notify(dp, DSA_NOTIFIER_FDB_DEL, &info);
}
int dsa_port_fdb_dump(struct dsa_port *dp, struct switchdev_obj_port_fdb *fdb,