Skip to content

Commit

Permalink
net: dsa: remove the DSA specific notifiers
Browse files Browse the repository at this point in the history
This effectively reverts commit 60724d4 ("net: dsa: Add support for
DSA specific notifiers"). The reason is that since commit 2f1e8ea
("net: dsa: link interfaces with the DSA master to get rid of lockdep
warnings"), it appears that there is a generic way to achieve the same
purpose. The only user thus far, the Broadcom SYSTEMPORT driver, was
converted to use the generic notifiers.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
  • Loading branch information
Vladimir Oltean authored and Jakub Kicinski committed Jan 7, 2021
1 parent 1593cd4 commit 1dbb130
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 81 deletions.
42 changes: 0 additions & 42 deletions include/net/dsa.h
Original file line number Diff line number Diff line change
Expand Up @@ -833,51 +833,9 @@ static inline int dsa_switch_resume(struct dsa_switch *ds)
}
#endif /* CONFIG_PM_SLEEP */

enum dsa_notifier_type {
DSA_PORT_REGISTER,
DSA_PORT_UNREGISTER,
};

struct dsa_notifier_info {
struct net_device *dev;
};

struct dsa_notifier_register_info {
struct dsa_notifier_info info; /* must be first */
struct net_device *master;
unsigned int port_number;
unsigned int switch_number;
};

static inline struct net_device *
dsa_notifier_info_to_dev(const struct dsa_notifier_info *info)
{
return info->dev;
}

#if IS_ENABLED(CONFIG_NET_DSA)
int register_dsa_notifier(struct notifier_block *nb);
int unregister_dsa_notifier(struct notifier_block *nb);
int call_dsa_notifiers(unsigned long val, struct net_device *dev,
struct dsa_notifier_info *info);
bool dsa_slave_dev_check(const struct net_device *dev);
#else
static inline int register_dsa_notifier(struct notifier_block *nb)
{
return 0;
}

static inline int unregister_dsa_notifier(struct notifier_block *nb)
{
return 0;
}

static inline int call_dsa_notifiers(unsigned long val, struct net_device *dev,
struct dsa_notifier_info *info)
{
return NOTIFY_DONE;
}

static inline bool dsa_slave_dev_check(const struct net_device *dev)
{
return false;
Expand Down
22 changes: 0 additions & 22 deletions net/dsa/dsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -309,28 +309,6 @@ bool dsa_schedule_work(struct work_struct *work)
return queue_work(dsa_owq, work);
}

static ATOMIC_NOTIFIER_HEAD(dsa_notif_chain);

int register_dsa_notifier(struct notifier_block *nb)
{
return atomic_notifier_chain_register(&dsa_notif_chain, nb);
}
EXPORT_SYMBOL_GPL(register_dsa_notifier);

int unregister_dsa_notifier(struct notifier_block *nb)
{
return atomic_notifier_chain_unregister(&dsa_notif_chain, nb);
}
EXPORT_SYMBOL_GPL(unregister_dsa_notifier);

int call_dsa_notifiers(unsigned long val, struct net_device *dev,
struct dsa_notifier_info *info)
{
info->dev = dev;
return atomic_notifier_call_chain(&dsa_notif_chain, val, info);
}
EXPORT_SYMBOL_GPL(call_dsa_notifiers);

int dsa_devlink_param_get(struct devlink *dl, u32 id,
struct devlink_param_gset_ctx *ctx)
{
Expand Down
17 changes: 0 additions & 17 deletions net/dsa/slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -1764,20 +1764,6 @@ int dsa_slave_resume(struct net_device *slave_dev)
return 0;
}

static void dsa_slave_notify(struct net_device *dev, unsigned long val)
{
struct net_device *master = dsa_slave_to_master(dev);
struct dsa_port *dp = dsa_slave_to_port(dev);
struct dsa_notifier_register_info rinfo = {
.switch_number = dp->ds->index,
.port_number = dp->index,
.master = master,
.info.dev = dev,
};

call_dsa_notifiers(val, dev, &rinfo.info);
}

int dsa_slave_create(struct dsa_port *port)
{
const struct dsa_port *cpu_dp = port->cpu_dp;
Expand Down Expand Up @@ -1863,8 +1849,6 @@ int dsa_slave_create(struct dsa_port *port)
goto out_gcells;
}

dsa_slave_notify(slave_dev, DSA_PORT_REGISTER);

rtnl_lock();

ret = register_netdevice(slave_dev);
Expand Down Expand Up @@ -1913,7 +1897,6 @@ void dsa_slave_destroy(struct net_device *slave_dev)
phylink_disconnect_phy(dp->pl);
rtnl_unlock();

dsa_slave_notify(slave_dev, DSA_PORT_UNREGISTER);
phylink_destroy(dp->pl);
gro_cells_destroy(&p->gcells);
free_percpu(slave_dev->tstats);
Expand Down

0 comments on commit 1dbb130

Please sign in to comment.