net/sched: taprio: remove unnecessary taprio_list_lock
The 3 functions that want access to the taprio_list: taprio_dev_notifier(), taprio_destroy() and taprio_init() are all called with the rtnl_mutex held, therefore implicitly serialized with respect to each other. A spin lock serves no purpose. Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com> Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> Link: https://lore.kernel.org/r/20220921095632.1379251-1-vladimir.oltean@nxp.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
03d25cf7a0
commit
a2c2a4ddc2
@ -27,7 +27,6 @@
|
|||||||
#include <net/tcp.h>
|
#include <net/tcp.h>
|
||||||
|
|
||||||
static LIST_HEAD(taprio_list);
|
static LIST_HEAD(taprio_list);
|
||||||
static DEFINE_SPINLOCK(taprio_list_lock);
|
|
||||||
|
|
||||||
#define TAPRIO_ALL_GATES_OPEN -1
|
#define TAPRIO_ALL_GATES_OPEN -1
|
||||||
|
|
||||||
@ -1082,7 +1081,6 @@ static int taprio_dev_notifier(struct notifier_block *nb, unsigned long event,
|
|||||||
if (event != NETDEV_UP && event != NETDEV_CHANGE)
|
if (event != NETDEV_UP && event != NETDEV_CHANGE)
|
||||||
return NOTIFY_DONE;
|
return NOTIFY_DONE;
|
||||||
|
|
||||||
spin_lock(&taprio_list_lock);
|
|
||||||
list_for_each_entry(q, &taprio_list, taprio_list) {
|
list_for_each_entry(q, &taprio_list, taprio_list) {
|
||||||
qdev = qdisc_dev(q->root);
|
qdev = qdisc_dev(q->root);
|
||||||
if (qdev == dev) {
|
if (qdev == dev) {
|
||||||
@ -1090,7 +1088,6 @@ static int taprio_dev_notifier(struct notifier_block *nb, unsigned long event,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
spin_unlock(&taprio_list_lock);
|
|
||||||
|
|
||||||
if (found)
|
if (found)
|
||||||
taprio_set_picos_per_byte(dev, q);
|
taprio_set_picos_per_byte(dev, q);
|
||||||
@ -1602,9 +1599,7 @@ static void taprio_destroy(struct Qdisc *sch)
|
|||||||
struct sched_gate_list *oper, *admin;
|
struct sched_gate_list *oper, *admin;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
spin_lock(&taprio_list_lock);
|
|
||||||
list_del(&q->taprio_list);
|
list_del(&q->taprio_list);
|
||||||
spin_unlock(&taprio_list_lock);
|
|
||||||
|
|
||||||
/* Note that taprio_reset() might not be called if an error
|
/* Note that taprio_reset() might not be called if an error
|
||||||
* happens in qdisc_create(), after taprio_init() has been called.
|
* happens in qdisc_create(), after taprio_init() has been called.
|
||||||
@ -1653,9 +1648,7 @@ static int taprio_init(struct Qdisc *sch, struct nlattr *opt,
|
|||||||
q->clockid = -1;
|
q->clockid = -1;
|
||||||
q->flags = TAPRIO_FLAGS_INVALID;
|
q->flags = TAPRIO_FLAGS_INVALID;
|
||||||
|
|
||||||
spin_lock(&taprio_list_lock);
|
|
||||||
list_add(&q->taprio_list, &taprio_list);
|
list_add(&q->taprio_list, &taprio_list);
|
||||||
spin_unlock(&taprio_list_lock);
|
|
||||||
|
|
||||||
if (sch->parent != TC_H_ROOT) {
|
if (sch->parent != TC_H_ROOT) {
|
||||||
NL_SET_ERR_MSG_MOD(extack, "Can only be attached as root qdisc");
|
NL_SET_ERR_MSG_MOD(extack, "Can only be attached as root qdisc");
|
||||||
|
Loading…
Reference in New Issue
Block a user