diff mbox series

[net] net/sched: taprio: drop packets when tc mapping to empty queue in taprio_enqueue

Message ID 20230612033115.3766791-1-shaozhengchao@huawei.com (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series [net] net/sched: taprio: drop packets when tc mapping to empty queue in taprio_enqueue | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers success CCed 10 of 10 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 17 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

shaozhengchao June 12, 2023, 3:31 a.m. UTC
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(-)

Comments

Vladimir Oltean June 12, 2023, 9:38 p.m. UTC | #1
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?
diff mbox series

Patch

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);