Commit 46a76724 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by Jakub Kicinski

net: dsa: rename references to "lag" as "lag_dev"

In preparation of converting struct net_device *dp->lag_dev into a
struct dsa_lag *dp->lag, we need to rename, for consistency purposes,
all occurrences of the "lag" variable in the DSA core to "lag_dev".
Signed-off-by: default avatarVladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 89183b6e
...@@ -182,12 +182,12 @@ static inline struct net_device *dsa_lag_dev(struct dsa_switch_tree *dst, ...@@ -182,12 +182,12 @@ static inline struct net_device *dsa_lag_dev(struct dsa_switch_tree *dst,
} }
static inline int dsa_lag_id(struct dsa_switch_tree *dst, static inline int dsa_lag_id(struct dsa_switch_tree *dst,
struct net_device *lag) struct net_device *lag_dev)
{ {
unsigned int id; unsigned int id;
dsa_lags_foreach_id(id, dst) { dsa_lags_foreach_id(id, dst) {
if (dsa_lag_dev(dst, id) == lag) if (dsa_lag_dev(dst, id) == lag_dev)
return id; return id;
} }
...@@ -966,10 +966,10 @@ struct dsa_switch_ops { ...@@ -966,10 +966,10 @@ struct dsa_switch_ops {
int (*crosschip_lag_change)(struct dsa_switch *ds, int sw_index, int (*crosschip_lag_change)(struct dsa_switch *ds, int sw_index,
int port); int port);
int (*crosschip_lag_join)(struct dsa_switch *ds, int sw_index, int (*crosschip_lag_join)(struct dsa_switch *ds, int sw_index,
int port, struct net_device *lag, int port, struct net_device *lag_dev,
struct netdev_lag_upper_info *info); struct netdev_lag_upper_info *info);
int (*crosschip_lag_leave)(struct dsa_switch *ds, int sw_index, int (*crosschip_lag_leave)(struct dsa_switch *ds, int sw_index,
int port, struct net_device *lag); int port, struct net_device *lag_dev);
/* /*
* PTP functionality * PTP functionality
...@@ -1041,10 +1041,10 @@ struct dsa_switch_ops { ...@@ -1041,10 +1041,10 @@ struct dsa_switch_ops {
*/ */
int (*port_lag_change)(struct dsa_switch *ds, int port); int (*port_lag_change)(struct dsa_switch *ds, int port);
int (*port_lag_join)(struct dsa_switch *ds, int port, int (*port_lag_join)(struct dsa_switch *ds, int port,
struct net_device *lag, struct net_device *lag_dev,
struct netdev_lag_upper_info *info); struct netdev_lag_upper_info *info);
int (*port_lag_leave)(struct dsa_switch *ds, int port, int (*port_lag_leave)(struct dsa_switch *ds, int port,
struct net_device *lag); struct net_device *lag_dev);
/* /*
* HSR integration * HSR integration
......
...@@ -74,7 +74,7 @@ int dsa_broadcast(unsigned long e, void *v) ...@@ -74,7 +74,7 @@ int dsa_broadcast(unsigned long e, void *v)
/** /**
* dsa_lag_map() - Map LAG netdev to a linear LAG ID * dsa_lag_map() - Map LAG netdev to a linear LAG ID
* @dst: Tree in which to record the mapping. * @dst: Tree in which to record the mapping.
* @lag: Netdev that is to be mapped to an ID. * @lag_dev: Netdev that is to be mapped to an ID.
* *
* dsa_lag_id/dsa_lag_dev can then be used to translate between the * dsa_lag_id/dsa_lag_dev can then be used to translate between the
* two spaces. The size of the mapping space is determined by the * two spaces. The size of the mapping space is determined by the
...@@ -82,17 +82,17 @@ int dsa_broadcast(unsigned long e, void *v) ...@@ -82,17 +82,17 @@ int dsa_broadcast(unsigned long e, void *v)
* it unset if it is not needed, in which case these functions become * it unset if it is not needed, in which case these functions become
* no-ops. * no-ops.
*/ */
void dsa_lag_map(struct dsa_switch_tree *dst, struct net_device *lag) void dsa_lag_map(struct dsa_switch_tree *dst, struct net_device *lag_dev)
{ {
unsigned int id; unsigned int id;
if (dsa_lag_id(dst, lag) >= 0) if (dsa_lag_id(dst, lag_dev) >= 0)
/* Already mapped */ /* Already mapped */
return; return;
for (id = 0; id < dst->lags_len; id++) { for (id = 0; id < dst->lags_len; id++) {
if (!dsa_lag_dev(dst, id)) { if (!dsa_lag_dev(dst, id)) {
dst->lags[id] = lag; dst->lags[id] = lag_dev;
return; return;
} }
} }
...@@ -108,22 +108,22 @@ void dsa_lag_map(struct dsa_switch_tree *dst, struct net_device *lag) ...@@ -108,22 +108,22 @@ void dsa_lag_map(struct dsa_switch_tree *dst, struct net_device *lag)
/** /**
* dsa_lag_unmap() - Remove a LAG ID mapping * dsa_lag_unmap() - Remove a LAG ID mapping
* @dst: Tree in which the mapping is recorded. * @dst: Tree in which the mapping is recorded.
* @lag: Netdev that was mapped. * @lag_dev: Netdev that was mapped.
* *
* As there may be multiple users of the mapping, it is only removed * As there may be multiple users of the mapping, it is only removed
* if there are no other references to it. * if there are no other references to it.
*/ */
void dsa_lag_unmap(struct dsa_switch_tree *dst, struct net_device *lag) void dsa_lag_unmap(struct dsa_switch_tree *dst, struct net_device *lag_dev)
{ {
struct dsa_port *dp; struct dsa_port *dp;
unsigned int id; unsigned int id;
dsa_lag_foreach_port(dp, dst, lag) dsa_lag_foreach_port(dp, dst, lag_dev)
/* There are remaining users of this mapping */ /* There are remaining users of this mapping */
return; return;
dsa_lags_foreach_id(id, dst) { dsa_lags_foreach_id(id, dst) {
if (dsa_lag_dev(dst, id) == lag) { if (dsa_lag_dev(dst, id) == lag_dev) {
dst->lags[id] = NULL; dst->lags[id] = NULL;
break; break;
} }
......
...@@ -76,7 +76,7 @@ struct dsa_notifier_mdb_info { ...@@ -76,7 +76,7 @@ struct dsa_notifier_mdb_info {
/* DSA_NOTIFIER_LAG_* */ /* DSA_NOTIFIER_LAG_* */
struct dsa_notifier_lag_info { struct dsa_notifier_lag_info {
struct net_device *lag; struct net_device *lag_dev;
int sw_index; int sw_index;
int port; int port;
...@@ -487,8 +487,8 @@ int dsa_switch_register_notifier(struct dsa_switch *ds); ...@@ -487,8 +487,8 @@ int dsa_switch_register_notifier(struct dsa_switch *ds);
void dsa_switch_unregister_notifier(struct dsa_switch *ds); void dsa_switch_unregister_notifier(struct dsa_switch *ds);
/* dsa2.c */ /* dsa2.c */
void dsa_lag_map(struct dsa_switch_tree *dst, struct net_device *lag); void dsa_lag_map(struct dsa_switch_tree *dst, struct net_device *lag_dev);
void dsa_lag_unmap(struct dsa_switch_tree *dst, struct net_device *lag); void dsa_lag_unmap(struct dsa_switch_tree *dst, struct net_device *lag_dev);
int dsa_tree_notify(struct dsa_switch_tree *dst, unsigned long e, void *v); int dsa_tree_notify(struct dsa_switch_tree *dst, unsigned long e, void *v);
int dsa_broadcast(unsigned long e, void *v); int dsa_broadcast(unsigned long e, void *v);
int dsa_tree_change_tag_proto(struct dsa_switch_tree *dst, int dsa_tree_change_tag_proto(struct dsa_switch_tree *dst,
......
...@@ -447,27 +447,27 @@ int dsa_port_lag_change(struct dsa_port *dp, ...@@ -447,27 +447,27 @@ int dsa_port_lag_change(struct dsa_port *dp,
return dsa_port_notify(dp, DSA_NOTIFIER_LAG_CHANGE, &info); return dsa_port_notify(dp, DSA_NOTIFIER_LAG_CHANGE, &info);
} }
int dsa_port_lag_join(struct dsa_port *dp, struct net_device *lag, int dsa_port_lag_join(struct dsa_port *dp, struct net_device *lag_dev,
struct netdev_lag_upper_info *uinfo, struct netdev_lag_upper_info *uinfo,
struct netlink_ext_ack *extack) struct netlink_ext_ack *extack)
{ {
struct dsa_notifier_lag_info info = { struct dsa_notifier_lag_info info = {
.sw_index = dp->ds->index, .sw_index = dp->ds->index,
.port = dp->index, .port = dp->index,
.lag = lag, .lag_dev = lag_dev,
.info = uinfo, .info = uinfo,
}; };
struct net_device *bridge_dev; struct net_device *bridge_dev;
int err; int err;
dsa_lag_map(dp->ds->dst, lag); dsa_lag_map(dp->ds->dst, lag_dev);
dp->lag_dev = lag; dp->lag_dev = lag_dev;
err = dsa_port_notify(dp, DSA_NOTIFIER_LAG_JOIN, &info); err = dsa_port_notify(dp, DSA_NOTIFIER_LAG_JOIN, &info);
if (err) if (err)
goto err_lag_join; goto err_lag_join;
bridge_dev = netdev_master_upper_dev_get(lag); bridge_dev = netdev_master_upper_dev_get(lag_dev);
if (!bridge_dev || !netif_is_bridge_master(bridge_dev)) if (!bridge_dev || !netif_is_bridge_master(bridge_dev))
return 0; return 0;
...@@ -481,11 +481,11 @@ int dsa_port_lag_join(struct dsa_port *dp, struct net_device *lag, ...@@ -481,11 +481,11 @@ int dsa_port_lag_join(struct dsa_port *dp, struct net_device *lag,
dsa_port_notify(dp, DSA_NOTIFIER_LAG_LEAVE, &info); dsa_port_notify(dp, DSA_NOTIFIER_LAG_LEAVE, &info);
err_lag_join: err_lag_join:
dp->lag_dev = NULL; dp->lag_dev = NULL;
dsa_lag_unmap(dp->ds->dst, lag); dsa_lag_unmap(dp->ds->dst, lag_dev);
return err; return err;
} }
void dsa_port_pre_lag_leave(struct dsa_port *dp, struct net_device *lag) void dsa_port_pre_lag_leave(struct dsa_port *dp, struct net_device *lag_dev)
{ {
struct net_device *br = dsa_port_bridge_dev_get(dp); struct net_device *br = dsa_port_bridge_dev_get(dp);
...@@ -493,13 +493,13 @@ void dsa_port_pre_lag_leave(struct dsa_port *dp, struct net_device *lag) ...@@ -493,13 +493,13 @@ void dsa_port_pre_lag_leave(struct dsa_port *dp, struct net_device *lag)
dsa_port_pre_bridge_leave(dp, br); dsa_port_pre_bridge_leave(dp, br);
} }
void dsa_port_lag_leave(struct dsa_port *dp, struct net_device *lag) void dsa_port_lag_leave(struct dsa_port *dp, struct net_device *lag_dev)
{ {
struct net_device *br = dsa_port_bridge_dev_get(dp); struct net_device *br = dsa_port_bridge_dev_get(dp);
struct dsa_notifier_lag_info info = { struct dsa_notifier_lag_info info = {
.sw_index = dp->ds->index, .sw_index = dp->ds->index,
.port = dp->index, .port = dp->index,
.lag = lag, .lag_dev = lag_dev,
}; };
int err; int err;
...@@ -521,7 +521,7 @@ void dsa_port_lag_leave(struct dsa_port *dp, struct net_device *lag) ...@@ -521,7 +521,7 @@ void dsa_port_lag_leave(struct dsa_port *dp, struct net_device *lag)
"port %d failed to notify DSA_NOTIFIER_LAG_LEAVE: %pe\n", "port %d failed to notify DSA_NOTIFIER_LAG_LEAVE: %pe\n",
dp->index, ERR_PTR(err)); dp->index, ERR_PTR(err));
dsa_lag_unmap(dp->ds->dst, lag); dsa_lag_unmap(dp->ds->dst, lag_dev);
} }
/* Must be called under rcu_read_lock() */ /* Must be called under rcu_read_lock() */
......
...@@ -468,12 +468,12 @@ static int dsa_switch_lag_join(struct dsa_switch *ds, ...@@ -468,12 +468,12 @@ static int dsa_switch_lag_join(struct dsa_switch *ds,
struct dsa_notifier_lag_info *info) struct dsa_notifier_lag_info *info)
{ {
if (ds->index == info->sw_index && ds->ops->port_lag_join) if (ds->index == info->sw_index && ds->ops->port_lag_join)
return ds->ops->port_lag_join(ds, info->port, info->lag, return ds->ops->port_lag_join(ds, info->port, info->lag_dev,
info->info); info->info);
if (ds->index != info->sw_index && ds->ops->crosschip_lag_join) if (ds->index != info->sw_index && ds->ops->crosschip_lag_join)
return ds->ops->crosschip_lag_join(ds, info->sw_index, return ds->ops->crosschip_lag_join(ds, info->sw_index,
info->port, info->lag, info->port, info->lag_dev,
info->info); info->info);
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -483,11 +483,11 @@ static int dsa_switch_lag_leave(struct dsa_switch *ds, ...@@ -483,11 +483,11 @@ static int dsa_switch_lag_leave(struct dsa_switch *ds,
struct dsa_notifier_lag_info *info) struct dsa_notifier_lag_info *info)
{ {
if (ds->index == info->sw_index && ds->ops->port_lag_leave) if (ds->index == info->sw_index && ds->ops->port_lag_leave)
return ds->ops->port_lag_leave(ds, info->port, info->lag); return ds->ops->port_lag_leave(ds, info->port, info->lag_dev);
if (ds->index != info->sw_index && ds->ops->crosschip_lag_leave) if (ds->index != info->sw_index && ds->ops->crosschip_lag_leave)
return ds->ops->crosschip_lag_leave(ds, info->sw_index, return ds->ops->crosschip_lag_leave(ds, info->sw_index,
info->port, info->lag); info->port, info->lag_dev);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
......
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