diff options
author | Vivien Didelot <vivien.didelot@savoirfairelinux.com> | 2017-05-19 17:00:48 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-05-22 19:37:32 -0400 |
commit | d1cffff008dc2f238bfd0700c0f5027980089510 (patch) | |
tree | 6d2945f92d1cb70ed656a03e73556df8e5c55a5d /net/dsa/port.c | |
parent | d87bd94e1c2006c1bb1d717020116940f9d0735a (diff) | |
download | op-kernel-dev-d1cffff008dc2f238bfd0700c0f5027980089510.zip op-kernel-dev-d1cffff008dc2f238bfd0700c0f5027980089510.tar.gz |
net: dsa: move FDB handlers
Move the DSA port code which handles FDB objects in port.c, where it
belongs.
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.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/net/dsa/port.c b/net/dsa/port.c index 3382fdc..18ec6d4 100644 --- a/net/dsa/port.c +++ b/net/dsa/port.c @@ -167,3 +167,43 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock, return 0; } + +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); + + return 0; +} + +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; + + return ds->ops->port_fdb_del(ds, dp->index, fdb); +} + +int dsa_port_fdb_dump(struct dsa_port *dp, struct switchdev_obj_port_fdb *fdb, + switchdev_obj_dump_cb_t *cb) +{ + struct dsa_switch *ds = dp->ds; + + if (ds->ops->port_fdb_dump) + return ds->ops->port_fdb_dump(ds, dp->index, fdb, cb); + + return -EOPNOTSUPP; +} |