public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: John Fastabend <john.fastabend@gmail.com>
To: willemdebruijn.kernel@gmail.com, daniel@iogearbox.net,
	eric.dumazet@gmail.com, davem@davemloft.net
Cc: netdev@vger.kernel.org, jiri@resnulli.us, xiyou.wangcong@gmail.com
Subject: [net-next PATCH 01/14] net: sched: cleanup qdisc_run and __qdisc_run semantics
Date: Thu, 07 Dec 2017 09:54:06 -0800	[thread overview]
Message-ID: <20171207175406.5771.42070.stgit@john-Precision-Tower-5810> (raw)
In-Reply-To: <20171207173500.5771.41198.stgit@john-Precision-Tower-5810>

Currently __qdisc_run calls qdisc_run_end() but does not call
qdisc_run_begin(). This makes it hard to track pairs of
qdisc_run_{begin,end} across function calls.

To simplify reading these code paths this patch moves begin/end calls
into qdisc_run().

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
 include/net/pkt_sched.h |    4 +++-
 net/core/dev.c          |    5 +++--
 net/sched/sch_generic.c |    2 --
 3 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/include/net/pkt_sched.h b/include/net/pkt_sched.h
index d1f413f..4eea719 100644
--- a/include/net/pkt_sched.h
+++ b/include/net/pkt_sched.h
@@ -113,8 +113,10 @@ int sch_direct_xmit(struct sk_buff *skb, struct Qdisc *q,
 
 static inline void qdisc_run(struct Qdisc *q)
 {
-	if (qdisc_run_begin(q))
+	if (qdisc_run_begin(q)) {
 		__qdisc_run(q);
+		qdisc_run_end(q);
+	}
 }
 
 static inline __be16 tc_skb_protocol(const struct sk_buff *skb)
diff --git a/net/core/dev.c b/net/core/dev.c
index 6bea893..44c7de3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3192,9 +3192,9 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
 				contended = false;
 			}
 			__qdisc_run(q);
-		} else
-			qdisc_run_end(q);
+		}
 
+		qdisc_run_end(q);
 		rc = NET_XMIT_SUCCESS;
 	} else {
 		rc = q->enqueue(skb, q, &to_free) & NET_XMIT_MASK;
@@ -3204,6 +3204,7 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
 				contended = false;
 			}
 			__qdisc_run(q);
+			qdisc_run_end(q);
 		}
 	}
 	spin_unlock(root_lock);
diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
index 3839cbb..f6803e1 100644
--- a/net/sched/sch_generic.c
+++ b/net/sched/sch_generic.c
@@ -266,8 +266,6 @@ void __qdisc_run(struct Qdisc *q)
 			break;
 		}
 	}
-
-	qdisc_run_end(q);
 }
 
 unsigned long dev_trans_start(struct net_device *dev)

  reply	other threads:[~2017-12-07 17:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 17:53 [net-next PATCH 00/14] lockless qdisc series John Fastabend
2017-12-07 17:54 ` John Fastabend [this message]
2017-12-07 17:54 ` [net-next PATCH 02/14] net: sched: allow qdiscs to handle locking John Fastabend
2017-12-07 17:54 ` [net-next PATCH 03/14] net: sched: remove remaining uses for qdisc_qlen in xmit path John Fastabend
2017-12-07 17:55 ` [net-next PATCH 04/14] net: sched: provide per cpu qstat helpers John Fastabend
2017-12-07 17:55 ` [net-next PATCH 05/14] net: sched: a dflt qdisc may be used with per cpu stats John Fastabend
2017-12-07 17:55 ` [net-next PATCH 06/14] net: sched: explicit locking in gso_cpu fallback John Fastabend
2017-12-07 17:56 ` [net-next PATCH 07/14] net: sched: drop qdisc_reset from dev_graft_qdisc John Fastabend
2017-12-07 17:56 ` [net-next PATCH 08/14] net: sched: use skb list for skb_bad_tx John Fastabend
2017-12-07 17:56 ` [net-next PATCH 09/14] net: sched: check for frozen queue before skb_bad_txq check John Fastabend
2017-12-07 17:57 ` [net-next PATCH 10/14] net: sched: helpers to sum qlen and qlen for per cpu logic John Fastabend
2017-12-07 17:57 ` [net-next PATCH 11/14] net: sched: add support for TCQ_F_NOLOCK subqueues to sch_mq John Fastabend
2017-12-07 17:57 ` [net-next PATCH 12/14] net: sched: add support for TCQ_F_NOLOCK subqueues to sch_mqprio John Fastabend
2017-12-07 17:57 ` [net-next PATCH 13/14] net: skb_array: expose peek API John Fastabend
2017-12-07 17:58 ` [net-next PATCH 14/14] net: sched: pfifo_fast use skb_array John Fastabend
2017-12-12 22:06   ` Cong Wang
2017-12-07 18:09 ` [net-next PATCH 00/14] lockless qdisc series David Miller
2017-12-08 18:50 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171207175406.5771.42070.stgit@john-Precision-Tower-5810 \
    --to=john.fastabend@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=jiri@resnulli.us \
    --cc=netdev@vger.kernel.org \
    --cc=willemdebruijn.kernel@gmail.com \
    --cc=xiyou.wangcong@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox