From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Fastabend Subject: [RFC PATCH 09/17] net: sched: check for frozen queue before skb_bad_txq check Date: Mon, 13 Nov 2017 12:10:35 -0800 Message-ID: <20171113201035.6245.29801.stgit@john-Precision-Tower-5810> References: <20171113195256.6245.64676.stgit@john-Precision-Tower-5810> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Cc: make0818@gmail.com, netdev@vger.kernel.org, jiri@resnulli.us, xiyou.wangcong@gmail.com To: willemdebruijn.kernel@gmail.com, daniel@iogearbox.net, eric.dumazet@gmail.com Return-path: Received: from mail-pf0-f194.google.com ([209.85.192.194]:54544 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755253AbdKMUKt (ORCPT ); Mon, 13 Nov 2017 15:10:49 -0500 Received: by mail-pf0-f194.google.com with SMTP id n89so12613971pfk.11 for ; Mon, 13 Nov 2017 12:10:49 -0800 (PST) In-Reply-To: <20171113195256.6245.64676.stgit@john-Precision-Tower-5810> Sender: netdev-owner@vger.kernel.org List-ID: I can not think of any reason to pull the bad txq skb off the qdisc if the txq we plan to send this on is still frozen. So check for frozen queue first and abort before dequeuing either skb_bad_txq skb or normal qdisc dequeue() skb. Signed-off-by: John Fastabend --- 0 files changed diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c index 92570d4..84c4ea1 100644 --- a/net/sched/sch_generic.c +++ b/net/sched/sch_generic.c @@ -204,7 +204,7 @@ static struct sk_buff *dequeue_skb(struct Qdisc *q, bool *validate, int *packets) { const struct netdev_queue *txq = q->dev_queue; - struct sk_buff *skb; + struct sk_buff *skb = NULL; *packets = 1; if (unlikely(!skb_queue_empty(&q->gso_skb))) { @@ -248,12 +248,15 @@ static struct sk_buff *dequeue_skb(struct Qdisc *q, bool *validate, } validate: *validate = true; + + if ((q->flags & TCQ_F_ONETXQUEUE) && + netif_xmit_frozen_or_stopped(txq)) + return skb; + skb = qdisc_dequeue_skb_bad_txq(q); if (unlikely(skb)) goto bulk; - if (!(q->flags & TCQ_F_ONETXQUEUE) || - !netif_xmit_frozen_or_stopped(txq)) - skb = q->dequeue(q); + skb = q->dequeue(q); if (skb) { bulk: if (qdisc_may_bulk(q))