From patchwork Mon Jun 12 03:31:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: shaozhengchao X-Patchwork-Id: 13275443 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8938717CE for ; Mon, 12 Jun 2023 03:24:08 +0000 (UTC) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57DA49E for ; Sun, 11 Jun 2023 20:24:06 -0700 (PDT) Received: from dggpeml500026.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4QfcRL61GCztQYt; Mon, 12 Jun 2023 11:21:34 +0800 (CST) Received: from huawei.com (10.175.101.6) by dggpeml500026.china.huawei.com (7.185.36.106) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.23; Mon, 12 Jun 2023 11:24:01 +0800 From: Zhengchao Shao To: , , , , , , , , CC: , , , Subject: [PATCH net] net/sched: taprio: drop packets when tc mapping to empty queue in taprio_enqueue Date: Mon, 12 Jun 2023 11:31:15 +0800 Message-ID: <20230612033115.3766791-1-shaozhengchao@huawei.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml500026.china.huawei.com (7.185.36.106) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net X-Patchwork-Delegate: kuba@kernel.org As discussed in link [1], queues setting (0@0) means TC mapped to the "empty set" queue. We should drop the packets from TCs mapped to the "empty set" queue (0@0) during enqueue(). [1] https://lore.kernel.org/all/20230608062756.3626573-1-shaozhengchao@huawei.com/ Fixes: 2f530df76c8c ("net/sched: taprio: give higher priority to higher TCs in software dequeue mode") Signed-off-by: Zhengchao Shao --- net/sched/sch_taprio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index 5076da103f63..79ba9cbd7b3d 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -632,11 +632,15 @@ static int taprio_enqueue(struct sk_buff *skb, struct Qdisc *sch, struct sk_buff **to_free) { struct taprio_sched *q = qdisc_priv(sch); + struct net_device *dev = qdisc_dev(sch); struct Qdisc *child; - int queue; + int tc, queue; - queue = skb_get_queue_mapping(skb); + tc = netdev_get_prio_tc_map(dev, skb->priority); + if (unlikely(!dev->tc_to_txq[tc].count)) + return qdisc_drop(skb, sch, to_free); + queue = skb_get_queue_mapping(skb); child = q->qdiscs[queue]; if (unlikely(!child)) return qdisc_drop(skb, sch, to_free);