]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: sched: sch_dualpi2: use qdisc_dequeue_drop() for dequeue drops
authorJesper Dangaard Brouer <hawk@kernel.org>
Thu, 26 Feb 2026 13:45:19 +0000 (14:45 +0100)
committerJakub Kicinski <kuba@kernel.org>
Sat, 28 Feb 2026 23:31:35 +0000 (15:31 -0800)
DualPI2 drops packets during dequeue but was using kfree_skb_reason()
directly, bypassing trace_qdisc_drop. Convert to qdisc_dequeue_drop()
and add QDISC_DROP_L4S_STEP_NON_ECN to the qdisc drop reason enum.

- Set TCQ_F_DEQUEUE_DROPS flag in dualpi2_init()
- Use enum qdisc_drop_reason in drop_and_retry()
- Replace kfree_skb_reason() with qdisc_dequeue_drop()

Signed-off-by: Jesper Dangaard Brouer <hawk@kernel.org>
Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com>
Link: https://patch.msgid.link/177211351978.3011628.11267023360997620069.stgit@firesoul
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/net/dropreason-core.h
include/net/dropreason-qdisc.h
net/sched/sch_dualpi2.c

index 3d8d284e05c846d290d824ad2163963969310cfb..5c8c2eb3d2c5b038683b78952106e374cf3b68d1 100644 (file)
        FN(CANFD_RX_INVALID_FRAME)      \
        FN(CANXL_RX_INVALID_FRAME)      \
        FN(PFMEMALLOC)  \
-       FN(DUALPI2_STEP_DROP)           \
        FN(PSP_INPUT)                   \
        FN(PSP_OUTPUT)                  \
        FNe(MAX)
@@ -579,11 +578,6 @@ enum skb_drop_reason {
         * reached a path or socket not eligible for use of memory reserves
         */
        SKB_DROP_REASON_PFMEMALLOC,
-       /**
-        * @SKB_DROP_REASON_DUALPI2_STEP_DROP: dropped by the step drop
-        * threshold of DualPI2 qdisc.
-        */
-       SKB_DROP_REASON_DUALPI2_STEP_DROP,
        /** @SKB_DROP_REASON_PSP_INPUT: PSP input checks failed */
        SKB_DROP_REASON_PSP_INPUT,
        /** @SKB_DROP_REASON_PSP_OUTPUT: PSP output checks failed */
index 84f19a51382c38fb8f97c508606e69fd5ac802ca..fb151cd31751bf2248debbf2f9a05d7ad650abba 100644 (file)
@@ -14,6 +14,7 @@
        FN(BAND_LIMIT)          \
        FN(HORIZON_LIMIT)               \
        FN(FLOW_LIMIT)                  \
+       FN(L4S_STEP_NON_ECN)            \
        FNe(MAX)
 
 #undef FN
@@ -93,6 +94,13 @@ enum qdisc_drop_reason {
         * monopolizing queue resources.
         */
        QDISC_DROP_FLOW_LIMIT,
+       /**
+        * @QDISC_DROP_L4S_STEP_NON_ECN: DualPI2 qdisc dropped a non-ECN-capable
+        * packet because the L4S queue delay exceeded the step threshold.
+        * Since the packet cannot be ECN-marked, it must be dropped to signal
+        * congestion. See RFC 9332 for the DualQ Coupled AQM step mechanism.
+        */
+       QDISC_DROP_L4S_STEP_NON_ECN,
        /**
         * @QDISC_DROP_MAX: the maximum of qdisc drop reasons, which
         * shouldn't be used as a real 'reason' - only for tracing code gen
index 020cc20c6b567240a9cd55d24cf2a686df3f02f7..fe6f5e8896257674b9f175e01428b89e299a7dda 100644 (file)
@@ -571,11 +571,11 @@ static int do_step_aqm(struct dualpi2_sched_data *q, struct sk_buff *skb,
 }
 
 static void drop_and_retry(struct dualpi2_sched_data *q, struct sk_buff *skb,
-                          struct Qdisc *sch, enum skb_drop_reason reason)
+                          struct Qdisc *sch, enum qdisc_drop_reason reason)
 {
        ++q->deferred_drops_cnt;
        q->deferred_drops_len += qdisc_pkt_len(skb);
-       kfree_skb_reason(skb, reason);
+       qdisc_dequeue_drop(sch, skb, reason);
        qdisc_qstats_drop(sch);
 }
 
@@ -590,15 +590,13 @@ static struct sk_buff *dualpi2_qdisc_dequeue(struct Qdisc *sch)
 
        while ((skb = dequeue_packet(sch, q, &credit_change, now))) {
                if (!q->drop_early && must_drop(sch, q, skb)) {
-                       drop_and_retry(q, skb, sch,
-                                      SKB_DROP_REASON_QDISC_DROP);
+                       drop_and_retry(q, skb, sch, QDISC_DROP_CONGESTED);
                        continue;
                }
 
                if (skb_in_l_queue(skb) && do_step_aqm(q, skb, now)) {
                        qdisc_qstats_drop(q->l_queue);
-                       drop_and_retry(q, skb, sch,
-                                      SKB_DROP_REASON_DUALPI2_STEP_DROP);
+                       drop_and_retry(q, skb, sch, QDISC_DROP_L4S_STEP_NON_ECN);
                        continue;
                }
 
@@ -915,6 +913,8 @@ static int dualpi2_init(struct Qdisc *sch, struct nlattr *opt,
        struct dualpi2_sched_data *q = qdisc_priv(sch);
        int err;
 
+       sch->flags |= TCQ_F_DEQUEUE_DROPS;
+
        q->l_queue = qdisc_create_dflt(sch->dev_queue, &pfifo_qdisc_ops,
                                       TC_H_MAKE(sch->handle, 1), extack);
        if (!q->l_queue)