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

net: dsa: move FDB handlers

Move the DSA port code which handles FDB objects in port.c, where it
belongs.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@savoirfairelinux.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d87bd94e
...@@ -70,6 +70,13 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering, ...@@ -70,6 +70,13 @@ int dsa_port_vlan_filtering(struct dsa_port *dp, bool vlan_filtering,
struct switchdev_trans *trans); struct switchdev_trans *trans);
int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock, int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock,
struct switchdev_trans *trans); struct switchdev_trans *trans);
int dsa_port_fdb_add(struct dsa_port *dp,
const struct switchdev_obj_port_fdb *fdb,
struct switchdev_trans *trans);
int dsa_port_fdb_del(struct dsa_port *dp,
const struct switchdev_obj_port_fdb *fdb);
int dsa_port_fdb_dump(struct dsa_port *dp, struct switchdev_obj_port_fdb *fdb,
switchdev_obj_dump_cb_t *cb);
/* slave.c */ /* slave.c */
extern const struct dsa_device_ops notag_netdev_ops; extern const struct dsa_device_ops notag_netdev_ops;
......
...@@ -167,3 +167,43 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock, ...@@ -167,3 +167,43 @@ int dsa_port_ageing_time(struct dsa_port *dp, clock_t ageing_clock,
return 0; 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;
}
...@@ -245,48 +245,6 @@ static int dsa_port_vlan_dump(struct dsa_port *dp, ...@@ -245,48 +245,6 @@ static int dsa_port_vlan_dump(struct dsa_port *dp,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
static 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;
}
static int dsa_port_fdb_del(struct dsa_port *dp,
const struct switchdev_obj_port_fdb *fdb)
{
struct dsa_switch *ds = dp->ds;
int ret = -EOPNOTSUPP;
if (ds->ops->port_fdb_del)
ret = ds->ops->port_fdb_del(ds, dp->index, fdb);
return ret;
}
static 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;
}
static int dsa_port_mdb_add(struct dsa_port *dp, static int dsa_port_mdb_add(struct dsa_port *dp,
const struct switchdev_obj_port_mdb *mdb, const struct switchdev_obj_port_mdb *mdb,
struct switchdev_trans *trans) struct switchdev_trans *trans)
......
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