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