Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47a1a1d4 authored by Patrick McHardy's avatar Patrick McHardy Committed by David S. Miller
Browse files

pkt_sched: remove unnecessary xchg() in packet classifiers



The use of xchg() hasn't been necessary since 2.2.something when proper
locking was added to packet schedulers. In the case of classifiers they
mostly weren't even necessary before that since they're mainly used
to assign a NULL pointer to the filter root in the ->destroy path;
the root is destroyed immediately after that.

Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b94c8afc
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -531,7 +531,8 @@ void tcf_exts_change(struct tcf_proto *tp, struct tcf_exts *dst,
	if (src->action) {
		struct tc_action *act;
		tcf_tree_lock(tp);
		act = xchg(&dst->action, src->action);
		act = dst->action;
		dst->action = src->action;
		tcf_tree_unlock(tp);
		if (act)
			tcf_action_destroy(act, TCA_ACT_UNBIND);
+1 −1
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ static inline void basic_delete_filter(struct tcf_proto *tp,

static void basic_destroy(struct tcf_proto *tp)
{
	struct basic_head *head = (struct basic_head *) xchg(&tp->root, NULL);
	struct basic_head *head = tp->root;
	struct basic_filter *f, *n;

	list_for_each_entry_safe(f, n, &head->flist, link) {
+1 −3
Original line number Diff line number Diff line
@@ -201,9 +201,7 @@ static int cls_cgroup_change(struct tcf_proto *tp, unsigned long base,

static void cls_cgroup_destroy(struct tcf_proto *tp)
{
	struct cls_cgroup_head *head;

	head = (struct cls_cgroup_head *)xchg(&tp->root, NULL);
	struct cls_cgroup_head *head = tp->root;

	if (head) {
		tcf_exts_destroy(tp, &head->exts);
+1 −1
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ fw_delete_filter(struct tcf_proto *tp, struct fw_filter *f)

static void fw_destroy(struct tcf_proto *tp)
{
	struct fw_head *head = (struct fw_head*)xchg(&tp->root, NULL);
	struct fw_head *head = tp->root;
	struct fw_filter *f;
	int h;

+1 −1
Original line number Diff line number Diff line
@@ -260,7 +260,7 @@ route4_delete_filter(struct tcf_proto *tp, struct route4_filter *f)

static void route4_destroy(struct tcf_proto *tp)
{
	struct route4_head *head = xchg(&tp->root, NULL);
	struct route4_head *head = tp->root;
	int h1, h2;

	if (head == NULL)
Loading