public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] net/sched: taprio: drop packets when tc mapping to empty queue in taprio_enqueue
@ 2023-06-12  3:31 Zhengchao Shao
  2023-06-12 21:38 ` Vladimir Oltean
  0 siblings, 1 reply; 2+ messages in thread
From: Zhengchao Shao @ 2023-06-12  3:31 UTC (permalink / raw)
  To: netdev, vinicius.gomes, jhs, xiyou.wangcong, jiri, davem,
	edumazet, kuba, pabeni
  Cc: vladimir.oltean, weiyongjun1, yuehaibing, shaozhengchao

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@huawei.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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net] net/sched: taprio: drop packets when tc mapping to empty queue in taprio_enqueue
  2023-06-12  3:31 [PATCH net] net/sched: taprio: drop packets when tc mapping to empty queue in taprio_enqueue Zhengchao Shao
@ 2023-06-12 21:38 ` Vladimir Oltean
  0 siblings, 0 replies; 2+ messages in thread
From: Vladimir Oltean @ 2023-06-12 21:38 UTC (permalink / raw)
  To: Zhengchao Shao
  Cc: netdev, vinicius.gomes, jhs, xiyou.wangcong, jiri, davem,
	edumazet, kuba, pabeni, weiyongjun1, yuehaibing

On Mon, Jun 12, 2023 at 11:31:15AM +0800, Zhengchao Shao wrote:
> 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@huawei.com>
> ---

Is there any reason at all why this patch is needed?

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-12 21:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-12  3:31 [PATCH net] net/sched: taprio: drop packets when tc mapping to empty queue in taprio_enqueue Zhengchao Shao
2023-06-12 21:38 ` Vladimir Oltean

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox