Commit 68d6d71e authored by Vladimir Oltean's avatar Vladimir Oltean Committed by David S. Miller

net: dsa: rename the host FDB and MDB methods to contain the "bridge" namespace

We are preparing to add API in port.c that adds FDB and MDB entries that
correspond to the port's standalone database. Rename the existing
methods to make it clear that the FDB and MDB entries offloaded come
from the bridge database.

Since the function names lengthen in dsa_slave_switchdev_event_work(),
we place "addr" and "vid" in temporary variables, to shorten those.
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 35aae5ab
...@@ -223,9 +223,9 @@ int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr, ...@@ -223,9 +223,9 @@ int dsa_port_fdb_add(struct dsa_port *dp, const unsigned char *addr,
u16 vid); u16 vid);
int dsa_port_fdb_del(struct dsa_port *dp, const unsigned char *addr, int dsa_port_fdb_del(struct dsa_port *dp, const unsigned char *addr,
u16 vid); u16 vid);
int dsa_port_host_fdb_add(struct dsa_port *dp, const unsigned char *addr, int dsa_port_bridge_host_fdb_add(struct dsa_port *dp, const unsigned char *addr,
u16 vid); u16 vid);
int dsa_port_host_fdb_del(struct dsa_port *dp, const unsigned char *addr, int dsa_port_bridge_host_fdb_del(struct dsa_port *dp, const unsigned char *addr,
u16 vid); u16 vid);
int dsa_port_lag_fdb_add(struct dsa_port *dp, const unsigned char *addr, int dsa_port_lag_fdb_add(struct dsa_port *dp, const unsigned char *addr,
u16 vid); u16 vid);
...@@ -236,9 +236,9 @@ int dsa_port_mdb_add(const struct dsa_port *dp, ...@@ -236,9 +236,9 @@ int dsa_port_mdb_add(const struct dsa_port *dp,
const struct switchdev_obj_port_mdb *mdb); const struct switchdev_obj_port_mdb *mdb);
int dsa_port_mdb_del(const struct dsa_port *dp, int dsa_port_mdb_del(const struct dsa_port *dp,
const struct switchdev_obj_port_mdb *mdb); const struct switchdev_obj_port_mdb *mdb);
int dsa_port_host_mdb_add(const struct dsa_port *dp, int dsa_port_bridge_host_mdb_add(const struct dsa_port *dp,
const struct switchdev_obj_port_mdb *mdb); const struct switchdev_obj_port_mdb *mdb);
int dsa_port_host_mdb_del(const struct dsa_port *dp, int dsa_port_bridge_host_mdb_del(const struct dsa_port *dp,
const struct switchdev_obj_port_mdb *mdb); const struct switchdev_obj_port_mdb *mdb);
int dsa_port_pre_bridge_flags(const struct dsa_port *dp, int dsa_port_pre_bridge_flags(const struct dsa_port *dp,
struct switchdev_brport_flags flags, struct switchdev_brport_flags flags,
......
...@@ -835,7 +835,7 @@ int dsa_port_fdb_del(struct dsa_port *dp, const unsigned char *addr, ...@@ -835,7 +835,7 @@ int dsa_port_fdb_del(struct dsa_port *dp, const unsigned char *addr,
return dsa_port_notify(dp, DSA_NOTIFIER_FDB_DEL, &info); return dsa_port_notify(dp, DSA_NOTIFIER_FDB_DEL, &info);
} }
int dsa_port_host_fdb_add(struct dsa_port *dp, const unsigned char *addr, int dsa_port_bridge_host_fdb_add(struct dsa_port *dp, const unsigned char *addr,
u16 vid) u16 vid)
{ {
struct dsa_notifier_fdb_info info = { struct dsa_notifier_fdb_info info = {
...@@ -867,7 +867,7 @@ int dsa_port_host_fdb_add(struct dsa_port *dp, const unsigned char *addr, ...@@ -867,7 +867,7 @@ int dsa_port_host_fdb_add(struct dsa_port *dp, const unsigned char *addr,
return dsa_port_notify(dp, DSA_NOTIFIER_HOST_FDB_ADD, &info); return dsa_port_notify(dp, DSA_NOTIFIER_HOST_FDB_ADD, &info);
} }
int dsa_port_host_fdb_del(struct dsa_port *dp, const unsigned char *addr, int dsa_port_bridge_host_fdb_del(struct dsa_port *dp, const unsigned char *addr,
u16 vid) u16 vid)
{ {
struct dsa_notifier_fdb_info info = { struct dsa_notifier_fdb_info info = {
...@@ -982,7 +982,7 @@ int dsa_port_mdb_del(const struct dsa_port *dp, ...@@ -982,7 +982,7 @@ int dsa_port_mdb_del(const struct dsa_port *dp,
return dsa_port_notify(dp, DSA_NOTIFIER_MDB_DEL, &info); return dsa_port_notify(dp, DSA_NOTIFIER_MDB_DEL, &info);
} }
int dsa_port_host_mdb_add(const struct dsa_port *dp, int dsa_port_bridge_host_mdb_add(const struct dsa_port *dp,
const struct switchdev_obj_port_mdb *mdb) const struct switchdev_obj_port_mdb *mdb)
{ {
struct dsa_notifier_mdb_info info = { struct dsa_notifier_mdb_info info = {
...@@ -1007,7 +1007,7 @@ int dsa_port_host_mdb_add(const struct dsa_port *dp, ...@@ -1007,7 +1007,7 @@ int dsa_port_host_mdb_add(const struct dsa_port *dp,
return dsa_port_notify(dp, DSA_NOTIFIER_HOST_MDB_ADD, &info); return dsa_port_notify(dp, DSA_NOTIFIER_HOST_MDB_ADD, &info);
} }
int dsa_port_host_mdb_del(const struct dsa_port *dp, int dsa_port_bridge_host_mdb_del(const struct dsa_port *dp,
const struct switchdev_obj_port_mdb *mdb) const struct switchdev_obj_port_mdb *mdb)
{ {
struct dsa_notifier_mdb_info info = { struct dsa_notifier_mdb_info info = {
......
...@@ -397,7 +397,7 @@ static int dsa_slave_port_obj_add(struct net_device *dev, const void *ctx, ...@@ -397,7 +397,7 @@ static int dsa_slave_port_obj_add(struct net_device *dev, const void *ctx,
if (!dsa_port_offloads_bridge_dev(dp, obj->orig_dev)) if (!dsa_port_offloads_bridge_dev(dp, obj->orig_dev))
return -EOPNOTSUPP; return -EOPNOTSUPP;
err = dsa_port_host_mdb_add(dp, SWITCHDEV_OBJ_PORT_MDB(obj)); err = dsa_port_bridge_host_mdb_add(dp, SWITCHDEV_OBJ_PORT_MDB(obj));
break; break;
case SWITCHDEV_OBJ_ID_PORT_VLAN: case SWITCHDEV_OBJ_ID_PORT_VLAN:
if (dsa_port_offloads_bridge_port(dp, obj->orig_dev)) if (dsa_port_offloads_bridge_port(dp, obj->orig_dev))
...@@ -478,7 +478,7 @@ static int dsa_slave_port_obj_del(struct net_device *dev, const void *ctx, ...@@ -478,7 +478,7 @@ static int dsa_slave_port_obj_del(struct net_device *dev, const void *ctx,
if (!dsa_port_offloads_bridge_dev(dp, obj->orig_dev)) if (!dsa_port_offloads_bridge_dev(dp, obj->orig_dev))
return -EOPNOTSUPP; return -EOPNOTSUPP;
err = dsa_port_host_mdb_del(dp, SWITCHDEV_OBJ_PORT_MDB(obj)); err = dsa_port_bridge_host_mdb_del(dp, SWITCHDEV_OBJ_PORT_MDB(obj));
break; break;
case SWITCHDEV_OBJ_ID_PORT_VLAN: case SWITCHDEV_OBJ_ID_PORT_VLAN:
if (dsa_port_offloads_bridge_port(dp, obj->orig_dev)) if (dsa_port_offloads_bridge_port(dp, obj->orig_dev))
...@@ -2356,7 +2356,9 @@ static void dsa_slave_switchdev_event_work(struct work_struct *work) ...@@ -2356,7 +2356,9 @@ static void dsa_slave_switchdev_event_work(struct work_struct *work)
{ {
struct dsa_switchdev_event_work *switchdev_work = struct dsa_switchdev_event_work *switchdev_work =
container_of(work, struct dsa_switchdev_event_work, work); container_of(work, struct dsa_switchdev_event_work, work);
const unsigned char *addr = switchdev_work->addr;
struct net_device *dev = switchdev_work->dev; struct net_device *dev = switchdev_work->dev;
u16 vid = switchdev_work->vid;
struct dsa_switch *ds; struct dsa_switch *ds;
struct dsa_port *dp; struct dsa_port *dp;
int err; int err;
...@@ -2367,19 +2369,15 @@ static void dsa_slave_switchdev_event_work(struct work_struct *work) ...@@ -2367,19 +2369,15 @@ static void dsa_slave_switchdev_event_work(struct work_struct *work)
switch (switchdev_work->event) { switch (switchdev_work->event) {
case SWITCHDEV_FDB_ADD_TO_DEVICE: case SWITCHDEV_FDB_ADD_TO_DEVICE:
if (switchdev_work->host_addr) if (switchdev_work->host_addr)
err = dsa_port_host_fdb_add(dp, switchdev_work->addr, err = dsa_port_bridge_host_fdb_add(dp, addr, vid);
switchdev_work->vid);
else if (dp->lag) else if (dp->lag)
err = dsa_port_lag_fdb_add(dp, switchdev_work->addr, err = dsa_port_lag_fdb_add(dp, addr, vid);
switchdev_work->vid);
else else
err = dsa_port_fdb_add(dp, switchdev_work->addr, err = dsa_port_fdb_add(dp, addr, vid);
switchdev_work->vid);
if (err) { if (err) {
dev_err(ds->dev, dev_err(ds->dev,
"port %d failed to add %pM vid %d to fdb: %d\n", "port %d failed to add %pM vid %d to fdb: %d\n",
dp->index, switchdev_work->addr, dp->index, addr, vid, err);
switchdev_work->vid, err);
break; break;
} }
dsa_fdb_offload_notify(switchdev_work); dsa_fdb_offload_notify(switchdev_work);
...@@ -2387,19 +2385,15 @@ static void dsa_slave_switchdev_event_work(struct work_struct *work) ...@@ -2387,19 +2385,15 @@ static void dsa_slave_switchdev_event_work(struct work_struct *work)
case SWITCHDEV_FDB_DEL_TO_DEVICE: case SWITCHDEV_FDB_DEL_TO_DEVICE:
if (switchdev_work->host_addr) if (switchdev_work->host_addr)
err = dsa_port_host_fdb_del(dp, switchdev_work->addr, err = dsa_port_bridge_host_fdb_del(dp, addr, vid);
switchdev_work->vid);
else if (dp->lag) else if (dp->lag)
err = dsa_port_lag_fdb_del(dp, switchdev_work->addr, err = dsa_port_lag_fdb_del(dp, addr, vid);
switchdev_work->vid);
else else
err = dsa_port_fdb_del(dp, switchdev_work->addr, err = dsa_port_fdb_del(dp, addr, vid);
switchdev_work->vid);
if (err) { if (err) {
dev_err(ds->dev, dev_err(ds->dev,
"port %d failed to delete %pM vid %d from fdb: %d\n", "port %d failed to delete %pM vid %d from fdb: %d\n",
dp->index, switchdev_work->addr, dp->index, addr, vid, err);
switchdev_work->vid, err);
} }
break; break;
......
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