Commit c487b653 authored by David S. Miller's avatar David S. Miller

Merge branch 'dsa-notifier-cleanup'

Vladimir Oltean says:

====================
DSA cross-chip notifier cleanup

This series deletes the no-op cross-chip notifier support for MRP and
HSR, features which were introduced relatively recently and did not get
full review at the time. The new code is functionally equivalent, but
simpler.

Cc: Horatiu Vultur <horatiu.vultur@microchip.com>
Cc: George McCollister <george.mccollister@gmail.com>
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d43e4271 a68dc7b9
...@@ -25,8 +25,6 @@ enum { ...@@ -25,8 +25,6 @@ enum {
DSA_NOTIFIER_FDB_DEL, DSA_NOTIFIER_FDB_DEL,
DSA_NOTIFIER_HOST_FDB_ADD, DSA_NOTIFIER_HOST_FDB_ADD,
DSA_NOTIFIER_HOST_FDB_DEL, DSA_NOTIFIER_HOST_FDB_DEL,
DSA_NOTIFIER_HSR_JOIN,
DSA_NOTIFIER_HSR_LEAVE,
DSA_NOTIFIER_LAG_CHANGE, DSA_NOTIFIER_LAG_CHANGE,
DSA_NOTIFIER_LAG_JOIN, DSA_NOTIFIER_LAG_JOIN,
DSA_NOTIFIER_LAG_LEAVE, DSA_NOTIFIER_LAG_LEAVE,
...@@ -40,10 +38,6 @@ enum { ...@@ -40,10 +38,6 @@ enum {
DSA_NOTIFIER_TAG_PROTO, DSA_NOTIFIER_TAG_PROTO,
DSA_NOTIFIER_TAG_PROTO_CONNECT, DSA_NOTIFIER_TAG_PROTO_CONNECT,
DSA_NOTIFIER_TAG_PROTO_DISCONNECT, DSA_NOTIFIER_TAG_PROTO_DISCONNECT,
DSA_NOTIFIER_MRP_ADD,
DSA_NOTIFIER_MRP_DEL,
DSA_NOTIFIER_MRP_ADD_RING_ROLE,
DSA_NOTIFIER_MRP_DEL_RING_ROLE,
DSA_NOTIFIER_TAG_8021Q_VLAN_ADD, DSA_NOTIFIER_TAG_8021Q_VLAN_ADD,
DSA_NOTIFIER_TAG_8021Q_VLAN_DEL, DSA_NOTIFIER_TAG_8021Q_VLAN_DEL,
}; };
...@@ -107,20 +101,6 @@ struct dsa_notifier_tag_proto_info { ...@@ -107,20 +101,6 @@ struct dsa_notifier_tag_proto_info {
const struct dsa_device_ops *tag_ops; const struct dsa_device_ops *tag_ops;
}; };
/* DSA_NOTIFIER_MRP_* */
struct dsa_notifier_mrp_info {
const struct switchdev_obj_mrp *mrp;
int sw_index;
int port;
};
/* DSA_NOTIFIER_MRP_* */
struct dsa_notifier_mrp_ring_role_info {
const struct switchdev_obj_ring_role_mrp *mrp;
int sw_index;
int port;
};
/* DSA_NOTIFIER_TAG_8021Q_VLAN_* */ /* DSA_NOTIFIER_TAG_8021Q_VLAN_* */
struct dsa_notifier_tag_8021q_vlan_info { struct dsa_notifier_tag_8021q_vlan_info {
int tree_index; int tree_index;
...@@ -143,13 +123,6 @@ struct dsa_switchdev_event_work { ...@@ -143,13 +123,6 @@ struct dsa_switchdev_event_work {
bool host_addr; bool host_addr;
}; };
/* DSA_NOTIFIER_HSR_* */
struct dsa_notifier_hsr_info {
struct net_device *hsr;
int sw_index;
int port;
};
struct dsa_slave_priv { struct dsa_slave_priv {
/* Copy of CPU port xmit for faster access in slave transmit hot path */ /* Copy of CPU port xmit for faster access in slave transmit hot path */
struct sk_buff * (*xmit)(struct sk_buff *skb, struct sk_buff * (*xmit)(struct sk_buff *skb,
......
...@@ -907,49 +907,45 @@ int dsa_port_vlan_del(struct dsa_port *dp, ...@@ -907,49 +907,45 @@ int dsa_port_vlan_del(struct dsa_port *dp,
int dsa_port_mrp_add(const struct dsa_port *dp, int dsa_port_mrp_add(const struct dsa_port *dp,
const struct switchdev_obj_mrp *mrp) const struct switchdev_obj_mrp *mrp)
{ {
struct dsa_notifier_mrp_info info = { struct dsa_switch *ds = dp->ds;
.sw_index = dp->ds->index,
.port = dp->index, if (!ds->ops->port_mrp_add)
.mrp = mrp, return -EOPNOTSUPP;
};
return dsa_port_notify(dp, DSA_NOTIFIER_MRP_ADD, &info); return ds->ops->port_mrp_add(ds, dp->index, mrp);
} }
int dsa_port_mrp_del(const struct dsa_port *dp, int dsa_port_mrp_del(const struct dsa_port *dp,
const struct switchdev_obj_mrp *mrp) const struct switchdev_obj_mrp *mrp)
{ {
struct dsa_notifier_mrp_info info = { struct dsa_switch *ds = dp->ds;
.sw_index = dp->ds->index,
.port = dp->index,
.mrp = mrp,
};
return dsa_port_notify(dp, DSA_NOTIFIER_MRP_DEL, &info); if (!ds->ops->port_mrp_del)
return -EOPNOTSUPP;
return ds->ops->port_mrp_del(ds, dp->index, mrp);
} }
int dsa_port_mrp_add_ring_role(const struct dsa_port *dp, int dsa_port_mrp_add_ring_role(const struct dsa_port *dp,
const struct switchdev_obj_ring_role_mrp *mrp) const struct switchdev_obj_ring_role_mrp *mrp)
{ {
struct dsa_notifier_mrp_ring_role_info info = { struct dsa_switch *ds = dp->ds;
.sw_index = dp->ds->index,
.port = dp->index, if (!ds->ops->port_mrp_add_ring_role)
.mrp = mrp, return -EOPNOTSUPP;
};
return dsa_port_notify(dp, DSA_NOTIFIER_MRP_ADD_RING_ROLE, &info); return ds->ops->port_mrp_add_ring_role(ds, dp->index, mrp);
} }
int dsa_port_mrp_del_ring_role(const struct dsa_port *dp, int dsa_port_mrp_del_ring_role(const struct dsa_port *dp,
const struct switchdev_obj_ring_role_mrp *mrp) const struct switchdev_obj_ring_role_mrp *mrp)
{ {
struct dsa_notifier_mrp_ring_role_info info = { struct dsa_switch *ds = dp->ds;
.sw_index = dp->ds->index,
.port = dp->index,
.mrp = mrp,
};
return dsa_port_notify(dp, DSA_NOTIFIER_MRP_DEL_RING_ROLE, &info); if (!ds->ops->port_mrp_del_ring_role)
return -EOPNOTSUPP;
return ds->ops->port_mrp_del_ring_role(ds, dp->index, mrp);
} }
void dsa_port_set_tag_protocol(struct dsa_port *cpu_dp, void dsa_port_set_tag_protocol(struct dsa_port *cpu_dp,
...@@ -1321,16 +1317,15 @@ EXPORT_SYMBOL_GPL(dsa_port_get_phy_sset_count); ...@@ -1321,16 +1317,15 @@ EXPORT_SYMBOL_GPL(dsa_port_get_phy_sset_count);
int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr) int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr)
{ {
struct dsa_notifier_hsr_info info = { struct dsa_switch *ds = dp->ds;
.sw_index = dp->ds->index,
.port = dp->index,
.hsr = hsr,
};
int err; int err;
if (!ds->ops->port_hsr_join)
return -EOPNOTSUPP;
dp->hsr_dev = hsr; dp->hsr_dev = hsr;
err = dsa_port_notify(dp, DSA_NOTIFIER_HSR_JOIN, &info); err = ds->ops->port_hsr_join(ds, dp->index, hsr);
if (err) if (err)
dp->hsr_dev = NULL; dp->hsr_dev = NULL;
...@@ -1339,20 +1334,18 @@ int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr) ...@@ -1339,20 +1334,18 @@ int dsa_port_hsr_join(struct dsa_port *dp, struct net_device *hsr)
void dsa_port_hsr_leave(struct dsa_port *dp, struct net_device *hsr) void dsa_port_hsr_leave(struct dsa_port *dp, struct net_device *hsr)
{ {
struct dsa_notifier_hsr_info info = { struct dsa_switch *ds = dp->ds;
.sw_index = dp->ds->index,
.port = dp->index,
.hsr = hsr,
};
int err; int err;
dp->hsr_dev = NULL; dp->hsr_dev = NULL;
err = dsa_port_notify(dp, DSA_NOTIFIER_HSR_LEAVE, &info); if (ds->ops->port_hsr_leave) {
if (err) err = ds->ops->port_hsr_leave(ds, dp->index, hsr);
dev_err(dp->ds->dev, if (err)
"port %d failed to notify DSA_NOTIFIER_HSR_LEAVE: %pe\n", dev_err(dp->ds->dev,
dp->index, ERR_PTR(err)); "port %d failed to leave HSR %s: %pe\n",
dp->index, hsr->name, ERR_PTR(err));
}
} }
int dsa_port_tag_8021q_vlan_add(struct dsa_port *dp, u16 vid, bool broadcast) int dsa_port_tag_8021q_vlan_add(struct dsa_port *dp, u16 vid, bool broadcast)
......
...@@ -437,24 +437,6 @@ static int dsa_switch_fdb_del(struct dsa_switch *ds, ...@@ -437,24 +437,6 @@ static int dsa_switch_fdb_del(struct dsa_switch *ds,
return dsa_port_do_fdb_del(dp, info->addr, info->vid); return dsa_port_do_fdb_del(dp, info->addr, info->vid);
} }
static int dsa_switch_hsr_join(struct dsa_switch *ds,
struct dsa_notifier_hsr_info *info)
{
if (ds->index == info->sw_index && ds->ops->port_hsr_join)
return ds->ops->port_hsr_join(ds, info->port, info->hsr);
return -EOPNOTSUPP;
}
static int dsa_switch_hsr_leave(struct dsa_switch *ds,
struct dsa_notifier_hsr_info *info)
{
if (ds->index == info->sw_index && ds->ops->port_hsr_leave)
return ds->ops->port_hsr_leave(ds, info->port, info->hsr);
return -EOPNOTSUPP;
}
static int dsa_switch_lag_change(struct dsa_switch *ds, static int dsa_switch_lag_change(struct dsa_switch *ds,
struct dsa_notifier_lag_info *info) struct dsa_notifier_lag_info *info)
{ {
...@@ -701,58 +683,6 @@ dsa_switch_disconnect_tag_proto(struct dsa_switch *ds, ...@@ -701,58 +683,6 @@ dsa_switch_disconnect_tag_proto(struct dsa_switch *ds,
return 0; return 0;
} }
static int dsa_switch_mrp_add(struct dsa_switch *ds,
struct dsa_notifier_mrp_info *info)
{
if (!ds->ops->port_mrp_add)
return -EOPNOTSUPP;
if (ds->index == info->sw_index)
return ds->ops->port_mrp_add(ds, info->port, info->mrp);
return 0;
}
static int dsa_switch_mrp_del(struct dsa_switch *ds,
struct dsa_notifier_mrp_info *info)
{
if (!ds->ops->port_mrp_del)
return -EOPNOTSUPP;
if (ds->index == info->sw_index)
return ds->ops->port_mrp_del(ds, info->port, info->mrp);
return 0;
}
static int
dsa_switch_mrp_add_ring_role(struct dsa_switch *ds,
struct dsa_notifier_mrp_ring_role_info *info)
{
if (!ds->ops->port_mrp_add)
return -EOPNOTSUPP;
if (ds->index == info->sw_index)
return ds->ops->port_mrp_add_ring_role(ds, info->port,
info->mrp);
return 0;
}
static int
dsa_switch_mrp_del_ring_role(struct dsa_switch *ds,
struct dsa_notifier_mrp_ring_role_info *info)
{
if (!ds->ops->port_mrp_del)
return -EOPNOTSUPP;
if (ds->index == info->sw_index)
return ds->ops->port_mrp_del_ring_role(ds, info->port,
info->mrp);
return 0;
}
static int dsa_switch_event(struct notifier_block *nb, static int dsa_switch_event(struct notifier_block *nb,
unsigned long event, void *info) unsigned long event, void *info)
{ {
...@@ -781,12 +711,6 @@ static int dsa_switch_event(struct notifier_block *nb, ...@@ -781,12 +711,6 @@ static int dsa_switch_event(struct notifier_block *nb,
case DSA_NOTIFIER_HOST_FDB_DEL: case DSA_NOTIFIER_HOST_FDB_DEL:
err = dsa_switch_host_fdb_del(ds, info); err = dsa_switch_host_fdb_del(ds, info);
break; break;
case DSA_NOTIFIER_HSR_JOIN:
err = dsa_switch_hsr_join(ds, info);
break;
case DSA_NOTIFIER_HSR_LEAVE:
err = dsa_switch_hsr_leave(ds, info);
break;
case DSA_NOTIFIER_LAG_CHANGE: case DSA_NOTIFIER_LAG_CHANGE:
err = dsa_switch_lag_change(ds, info); err = dsa_switch_lag_change(ds, info);
break; break;
...@@ -826,18 +750,6 @@ static int dsa_switch_event(struct notifier_block *nb, ...@@ -826,18 +750,6 @@ static int dsa_switch_event(struct notifier_block *nb,
case DSA_NOTIFIER_TAG_PROTO_DISCONNECT: case DSA_NOTIFIER_TAG_PROTO_DISCONNECT:
err = dsa_switch_disconnect_tag_proto(ds, info); err = dsa_switch_disconnect_tag_proto(ds, info);
break; break;
case DSA_NOTIFIER_MRP_ADD:
err = dsa_switch_mrp_add(ds, info);
break;
case DSA_NOTIFIER_MRP_DEL:
err = dsa_switch_mrp_del(ds, info);
break;
case DSA_NOTIFIER_MRP_ADD_RING_ROLE:
err = dsa_switch_mrp_add_ring_role(ds, info);
break;
case DSA_NOTIFIER_MRP_DEL_RING_ROLE:
err = dsa_switch_mrp_del_ring_role(ds, info);
break;
case DSA_NOTIFIER_TAG_8021Q_VLAN_ADD: case DSA_NOTIFIER_TAG_8021Q_VLAN_ADD:
err = dsa_switch_tag_8021q_vlan_add(ds, info); err = dsa_switch_tag_8021q_vlan_add(ds, info);
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