[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230612033115.3766791-1-shaozhengchao@huawei.com>
Date: Mon, 12 Jun 2023 11:31:15 +0800
From: Zhengchao Shao <shaozhengchao@...wei.com>
To: <netdev@...r.kernel.org>, <vinicius.gomes@...el.com>, <jhs@...atatu.com>,
<xiyou.wangcong@...il.com>, <jiri@...nulli.us>, <davem@...emloft.net>,
<edumazet@...gle.com>, <kuba@...nel.org>, <pabeni@...hat.com>
CC: <vladimir.oltean@....com>, <weiyongjun1@...wei.com>,
<yuehaibing@...wei.com>, <shaozhengchao@...wei.com>
Subject: [PATCH net] net/sched: taprio: drop packets when tc mapping to empty queue in taprio_enqueue
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 <shaozhengchao@...wei.com>
---
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);
--
2.34.1
Powered by blists - more mailing lists