Commit 326b212e authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Jakub Kicinski

net: bridge: switchdev: consistent function naming

Rename all recently imported functions in br_switchdev.c to start with a
br_switchdev_* prefix.

br_fdb_replay_one() -> br_switchdev_fdb_replay_one()
br_fdb_replay() -> br_switchdev_fdb_replay()
br_vlan_replay_one() -> br_switchdev_vlan_replay_one()
br_vlan_replay() -> br_switchdev_vlan_replay()
struct br_mdb_complete_info -> struct br_switchdev_mdb_complete_info
br_mdb_complete() -> br_switchdev_mdb_complete()
br_mdb_switchdev_host_port() -> br_switchdev_host_mdb_one()
br_mdb_switchdev_host() -> br_switchdev_host_mdb()
br_mdb_replay_one() -> br_switchdev_mdb_replay_one()
br_mdb_replay() -> br_switchdev_mdb_replay()
br_mdb_queue_one() -> br_switchdev_mdb_queue_one()
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: default avatarNikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 9776457c
...@@ -281,9 +281,10 @@ static void nbp_switchdev_del(struct net_bridge_port *p) ...@@ -281,9 +281,10 @@ static void nbp_switchdev_del(struct net_bridge_port *p)
} }
} }
static int br_fdb_replay_one(struct net_bridge *br, struct notifier_block *nb, static int
const struct net_bridge_fdb_entry *fdb, br_switchdev_fdb_replay_one(struct net_bridge *br, struct notifier_block *nb,
unsigned long action, const void *ctx) const struct net_bridge_fdb_entry *fdb,
unsigned long action, const void *ctx)
{ {
struct switchdev_notifier_fdb_info item; struct switchdev_notifier_fdb_info item;
int err; int err;
...@@ -294,8 +295,9 @@ static int br_fdb_replay_one(struct net_bridge *br, struct notifier_block *nb, ...@@ -294,8 +295,9 @@ static int br_fdb_replay_one(struct net_bridge *br, struct notifier_block *nb,
return notifier_to_errno(err); return notifier_to_errno(err);
} }
static int br_fdb_replay(const struct net_device *br_dev, const void *ctx, static int
bool adding, struct notifier_block *nb) br_switchdev_fdb_replay(const struct net_device *br_dev, const void *ctx,
bool adding, struct notifier_block *nb)
{ {
struct net_bridge_fdb_entry *fdb; struct net_bridge_fdb_entry *fdb;
struct net_bridge *br; struct net_bridge *br;
...@@ -318,7 +320,7 @@ static int br_fdb_replay(const struct net_device *br_dev, const void *ctx, ...@@ -318,7 +320,7 @@ static int br_fdb_replay(const struct net_device *br_dev, const void *ctx,
rcu_read_lock(); rcu_read_lock();
hlist_for_each_entry_rcu(fdb, &br->fdb_list, fdb_node) { hlist_for_each_entry_rcu(fdb, &br->fdb_list, fdb_node) {
err = br_fdb_replay_one(br, nb, fdb, action, ctx); err = br_switchdev_fdb_replay_one(br, nb, fdb, action, ctx);
if (err) if (err)
break; break;
} }
...@@ -328,11 +330,12 @@ static int br_fdb_replay(const struct net_device *br_dev, const void *ctx, ...@@ -328,11 +330,12 @@ static int br_fdb_replay(const struct net_device *br_dev, const void *ctx,
return err; return err;
} }
static int br_vlan_replay_one(struct notifier_block *nb, static int
struct net_device *dev, br_switchdev_vlan_replay_one(struct notifier_block *nb,
struct switchdev_obj_port_vlan *vlan, struct net_device *dev,
const void *ctx, unsigned long action, struct switchdev_obj_port_vlan *vlan,
struct netlink_ext_ack *extack) const void *ctx, unsigned long action,
struct netlink_ext_ack *extack)
{ {
struct switchdev_notifier_port_obj_info obj_info = { struct switchdev_notifier_port_obj_info obj_info = {
.info = { .info = {
...@@ -348,10 +351,11 @@ static int br_vlan_replay_one(struct notifier_block *nb, ...@@ -348,10 +351,11 @@ static int br_vlan_replay_one(struct notifier_block *nb,
return notifier_to_errno(err); return notifier_to_errno(err);
} }
static int br_vlan_replay(struct net_device *br_dev, struct net_device *dev, static int br_switchdev_vlan_replay(struct net_device *br_dev,
const void *ctx, bool adding, struct net_device *dev,
struct notifier_block *nb, const void *ctx, bool adding,
struct netlink_ext_ack *extack) struct notifier_block *nb,
struct netlink_ext_ack *extack)
{ {
struct net_bridge_vlan_group *vg; struct net_bridge_vlan_group *vg;
struct net_bridge_vlan *v; struct net_bridge_vlan *v;
...@@ -405,7 +409,8 @@ static int br_vlan_replay(struct net_device *br_dev, struct net_device *dev, ...@@ -405,7 +409,8 @@ static int br_vlan_replay(struct net_device *br_dev, struct net_device *dev,
if (!br_vlan_should_use(v)) if (!br_vlan_should_use(v))
continue; continue;
err = br_vlan_replay_one(nb, dev, &vlan, ctx, action, extack); err = br_switchdev_vlan_replay_one(nb, dev, &vlan, ctx,
action, extack);
if (err) if (err)
return err; return err;
} }
...@@ -414,14 +419,14 @@ static int br_vlan_replay(struct net_device *br_dev, struct net_device *dev, ...@@ -414,14 +419,14 @@ static int br_vlan_replay(struct net_device *br_dev, struct net_device *dev,
} }
#ifdef CONFIG_BRIDGE_IGMP_SNOOPING #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
struct br_mdb_complete_info { struct br_switchdev_mdb_complete_info {
struct net_bridge_port *port; struct net_bridge_port *port;
struct br_ip ip; struct br_ip ip;
}; };
static void br_mdb_complete(struct net_device *dev, int err, void *priv) static void br_switchdev_mdb_complete(struct net_device *dev, int err, void *priv)
{ {
struct br_mdb_complete_info *data = priv; struct br_switchdev_mdb_complete_info *data = priv;
struct net_bridge_port_group __rcu **pp; struct net_bridge_port_group __rcu **pp;
struct net_bridge_port_group *p; struct net_bridge_port_group *p;
struct net_bridge_mdb_entry *mp; struct net_bridge_mdb_entry *mp;
...@@ -462,10 +467,10 @@ static void br_switchdev_mdb_populate(struct switchdev_obj_port_mdb *mdb, ...@@ -462,10 +467,10 @@ static void br_switchdev_mdb_populate(struct switchdev_obj_port_mdb *mdb,
mdb->vid = mp->addr.vid; mdb->vid = mp->addr.vid;
} }
static void br_mdb_switchdev_host_port(struct net_device *dev, static void br_switchdev_host_mdb_one(struct net_device *dev,
struct net_device *lower_dev, struct net_device *lower_dev,
struct net_bridge_mdb_entry *mp, struct net_bridge_mdb_entry *mp,
int type) int type)
{ {
struct switchdev_obj_port_mdb mdb = { struct switchdev_obj_port_mdb mdb = {
.obj = { .obj = {
...@@ -487,20 +492,21 @@ static void br_mdb_switchdev_host_port(struct net_device *dev, ...@@ -487,20 +492,21 @@ static void br_mdb_switchdev_host_port(struct net_device *dev,
} }
} }
static void br_mdb_switchdev_host(struct net_device *dev, static void br_switchdev_host_mdb(struct net_device *dev,
struct net_bridge_mdb_entry *mp, int type) struct net_bridge_mdb_entry *mp, int type)
{ {
struct net_device *lower_dev; struct net_device *lower_dev;
struct list_head *iter; struct list_head *iter;
netdev_for_each_lower_dev(dev, lower_dev, iter) netdev_for_each_lower_dev(dev, lower_dev, iter)
br_mdb_switchdev_host_port(dev, lower_dev, mp, type); br_switchdev_host_mdb_one(dev, lower_dev, mp, type);
} }
static int br_mdb_replay_one(struct notifier_block *nb, struct net_device *dev, static int
const struct switchdev_obj_port_mdb *mdb, br_switchdev_mdb_replay_one(struct notifier_block *nb, struct net_device *dev,
unsigned long action, const void *ctx, const struct switchdev_obj_port_mdb *mdb,
struct netlink_ext_ack *extack) unsigned long action, const void *ctx,
struct netlink_ext_ack *extack)
{ {
struct switchdev_notifier_port_obj_info obj_info = { struct switchdev_notifier_port_obj_info obj_info = {
.info = { .info = {
...@@ -516,10 +522,10 @@ static int br_mdb_replay_one(struct notifier_block *nb, struct net_device *dev, ...@@ -516,10 +522,10 @@ static int br_mdb_replay_one(struct notifier_block *nb, struct net_device *dev,
return notifier_to_errno(err); return notifier_to_errno(err);
} }
static int br_mdb_queue_one(struct list_head *mdb_list, static int br_switchdev_mdb_queue_one(struct list_head *mdb_list,
enum switchdev_obj_id id, enum switchdev_obj_id id,
const struct net_bridge_mdb_entry *mp, const struct net_bridge_mdb_entry *mp,
struct net_device *orig_dev) struct net_device *orig_dev)
{ {
struct switchdev_obj_port_mdb *mdb; struct switchdev_obj_port_mdb *mdb;
...@@ -540,7 +546,7 @@ void br_switchdev_mdb_notify(struct net_device *dev, ...@@ -540,7 +546,7 @@ void br_switchdev_mdb_notify(struct net_device *dev,
struct net_bridge_port_group *pg, struct net_bridge_port_group *pg,
int type) int type)
{ {
struct br_mdb_complete_info *complete_info; struct br_switchdev_mdb_complete_info *complete_info;
struct switchdev_obj_port_mdb mdb = { struct switchdev_obj_port_mdb mdb = {
.obj = { .obj = {
.id = SWITCHDEV_OBJ_ID_PORT_MDB, .id = SWITCHDEV_OBJ_ID_PORT_MDB,
...@@ -549,7 +555,7 @@ void br_switchdev_mdb_notify(struct net_device *dev, ...@@ -549,7 +555,7 @@ void br_switchdev_mdb_notify(struct net_device *dev,
}; };
if (!pg) if (!pg)
return br_mdb_switchdev_host(dev, mp, type); return br_switchdev_host_mdb(dev, mp, type);
br_switchdev_mdb_populate(&mdb, mp); br_switchdev_mdb_populate(&mdb, mp);
...@@ -562,7 +568,7 @@ void br_switchdev_mdb_notify(struct net_device *dev, ...@@ -562,7 +568,7 @@ void br_switchdev_mdb_notify(struct net_device *dev,
complete_info->port = pg->key.port; complete_info->port = pg->key.port;
complete_info->ip = mp->addr; complete_info->ip = mp->addr;
mdb.obj.complete_priv = complete_info; mdb.obj.complete_priv = complete_info;
mdb.obj.complete = br_mdb_complete; mdb.obj.complete = br_switchdev_mdb_complete;
if (switchdev_port_obj_add(pg->key.port->dev, &mdb.obj, NULL)) if (switchdev_port_obj_add(pg->key.port->dev, &mdb.obj, NULL))
kfree(complete_info); kfree(complete_info);
break; break;
...@@ -573,10 +579,10 @@ void br_switchdev_mdb_notify(struct net_device *dev, ...@@ -573,10 +579,10 @@ void br_switchdev_mdb_notify(struct net_device *dev,
} }
#endif #endif
static int br_mdb_replay(struct net_device *br_dev, struct net_device *dev, static int
const void *ctx, bool adding, br_switchdev_mdb_replay(struct net_device *br_dev, struct net_device *dev,
struct notifier_block *nb, const void *ctx, bool adding, struct notifier_block *nb,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
#ifdef CONFIG_BRIDGE_IGMP_SNOOPING #ifdef CONFIG_BRIDGE_IGMP_SNOOPING
const struct net_bridge_mdb_entry *mp; const struct net_bridge_mdb_entry *mp;
...@@ -614,9 +620,9 @@ static int br_mdb_replay(struct net_device *br_dev, struct net_device *dev, ...@@ -614,9 +620,9 @@ static int br_mdb_replay(struct net_device *br_dev, struct net_device *dev,
const struct net_bridge_port_group *p; const struct net_bridge_port_group *p;
if (mp->host_joined) { if (mp->host_joined) {
err = br_mdb_queue_one(&mdb_list, err = br_switchdev_mdb_queue_one(&mdb_list,
SWITCHDEV_OBJ_ID_HOST_MDB, SWITCHDEV_OBJ_ID_HOST_MDB,
mp, br_dev); mp, br_dev);
if (err) { if (err) {
rcu_read_unlock(); rcu_read_unlock();
goto out_free_mdb; goto out_free_mdb;
...@@ -628,9 +634,9 @@ static int br_mdb_replay(struct net_device *br_dev, struct net_device *dev, ...@@ -628,9 +634,9 @@ static int br_mdb_replay(struct net_device *br_dev, struct net_device *dev,
if (p->key.port->dev != dev) if (p->key.port->dev != dev)
continue; continue;
err = br_mdb_queue_one(&mdb_list, err = br_switchdev_mdb_queue_one(&mdb_list,
SWITCHDEV_OBJ_ID_PORT_MDB, SWITCHDEV_OBJ_ID_PORT_MDB,
mp, dev); mp, dev);
if (err) { if (err) {
rcu_read_unlock(); rcu_read_unlock();
goto out_free_mdb; goto out_free_mdb;
...@@ -646,8 +652,9 @@ static int br_mdb_replay(struct net_device *br_dev, struct net_device *dev, ...@@ -646,8 +652,9 @@ static int br_mdb_replay(struct net_device *br_dev, struct net_device *dev,
action = SWITCHDEV_PORT_OBJ_DEL; action = SWITCHDEV_PORT_OBJ_DEL;
list_for_each_entry(obj, &mdb_list, list) { list_for_each_entry(obj, &mdb_list, list) {
err = br_mdb_replay_one(nb, dev, SWITCHDEV_OBJ_PORT_MDB(obj), err = br_switchdev_mdb_replay_one(nb, dev,
action, ctx, extack); SWITCHDEV_OBJ_PORT_MDB(obj),
action, ctx, extack);
if (err) if (err)
goto out_free_mdb; goto out_free_mdb;
} }
...@@ -674,15 +681,17 @@ static int nbp_switchdev_sync_objs(struct net_bridge_port *p, const void *ctx, ...@@ -674,15 +681,17 @@ static int nbp_switchdev_sync_objs(struct net_bridge_port *p, const void *ctx,
struct net_device *dev = p->dev; struct net_device *dev = p->dev;
int err; int err;
err = br_vlan_replay(br_dev, dev, ctx, true, blocking_nb, extack); err = br_switchdev_vlan_replay(br_dev, dev, ctx, true, blocking_nb,
extack);
if (err && err != -EOPNOTSUPP) if (err && err != -EOPNOTSUPP)
return err; return err;
err = br_mdb_replay(br_dev, dev, ctx, true, blocking_nb, extack); err = br_switchdev_mdb_replay(br_dev, dev, ctx, true, blocking_nb,
extack);
if (err && err != -EOPNOTSUPP) if (err && err != -EOPNOTSUPP)
return err; return err;
err = br_fdb_replay(br_dev, ctx, true, atomic_nb); err = br_switchdev_fdb_replay(br_dev, ctx, true, atomic_nb);
if (err && err != -EOPNOTSUPP) if (err && err != -EOPNOTSUPP)
return err; return err;
...@@ -697,11 +706,11 @@ static void nbp_switchdev_unsync_objs(struct net_bridge_port *p, ...@@ -697,11 +706,11 @@ static void nbp_switchdev_unsync_objs(struct net_bridge_port *p,
struct net_device *br_dev = p->br->dev; struct net_device *br_dev = p->br->dev;
struct net_device *dev = p->dev; struct net_device *dev = p->dev;
br_vlan_replay(br_dev, dev, ctx, false, blocking_nb, NULL); br_switchdev_vlan_replay(br_dev, dev, ctx, false, blocking_nb, NULL);
br_mdb_replay(br_dev, dev, ctx, false, blocking_nb, NULL); br_switchdev_mdb_replay(br_dev, dev, ctx, false, blocking_nb, NULL);
br_fdb_replay(br_dev, ctx, false, atomic_nb); br_switchdev_fdb_replay(br_dev, ctx, false, atomic_nb);
} }
/* Let the bridge know that this port is offloaded, so that it can assign a /* Let the bridge know that this port is offloaded, so that it can assign a
......
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