1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 2 3 #ifndef _LINUX_DROPREASON_QDISC_H 4 #define _LINUX_DROPREASON_QDISC_H 5 #include <net/dropreason.h> 6 7 #define DEFINE_QDISC_DROP_REASON(FN, FNe) \ 8 FN(UNSPEC) \ 9 FN(GENERIC) \ 10 FN(OVERLIMIT) \ 11 FN(CONGESTED) \ 12 FN(MAXFLOWS) \ 13 FN(FLOOD_PROTECTION) \ 14 FN(BAND_LIMIT) \ 15 FN(HORIZON_LIMIT) \ 16 FN(FLOW_LIMIT) \ 17 FN(L4S_STEP_NON_ECN) \ 18 FNe(MAX) 19 20 #undef FN 21 #undef FNe 22 #define FN(reason) QDISC_DROP_##reason, 23 #define FNe(reason) QDISC_DROP_##reason 24 25 /** 26 * enum qdisc_drop_reason - reason why a qdisc dropped a packet 27 * 28 * Qdisc-specific drop reasons for packet drops that occur within the 29 * traffic control (TC) queueing discipline layer. These reasons provide 30 * detailed diagnostics about why packets were dropped by various qdisc 31 * algorithms, enabling fine-grained monitoring and troubleshooting of 32 * queue behavior. 33 */ 34 enum qdisc_drop_reason { 35 /** 36 * @QDISC_DROP_UNSPEC: unspecified/invalid qdisc drop reason. 37 * Value 0 serves as analogous to SKB_NOT_DROPPED_YET for enum skb_drop_reason. 38 * Used for catching zero-initialized drop_reason fields. 39 */ 40 QDISC_DROP_UNSPEC = 0, 41 /** 42 * @__QDISC_DROP_REASON: subsystem base value for qdisc drop reasons 43 */ 44 __QDISC_DROP_REASON = SKB_DROP_REASON_SUBSYS_QDISC << 45 SKB_DROP_REASON_SUBSYS_SHIFT, 46 /** 47 * @QDISC_DROP_GENERIC: generic/default qdisc drop, used when no 48 * more specific reason applies 49 */ 50 QDISC_DROP_GENERIC, 51 /** 52 * @QDISC_DROP_OVERLIMIT: packet dropped because the qdisc queue 53 * length exceeded its configured limit (sch->limit). This typically 54 * indicates the queue is full and cannot accept more packets. 55 */ 56 QDISC_DROP_OVERLIMIT, 57 /** 58 * @QDISC_DROP_CONGESTED: packet dropped due to active congestion 59 * control algorithms (e.g., CoDel, PIE, RED) detecting network 60 * congestion. The qdisc proactively dropped the packet to signal 61 * congestion to the sender and prevent bufferbloat. 62 */ 63 QDISC_DROP_CONGESTED, 64 /** 65 * @QDISC_DROP_MAXFLOWS: packet dropped because the qdisc's flow 66 * tracking table is full and no free slots are available to allocate 67 * for a new flow. This indicates flow table exhaustion in flow-based 68 * qdiscs that maintain per-flow state (e.g., SFQ). 69 */ 70 QDISC_DROP_MAXFLOWS, 71 /** 72 * @QDISC_DROP_FLOOD_PROTECTION: packet dropped by flood protection 73 * mechanism detecting unresponsive flows (potential DoS/flood). 74 * Used by qdiscs implementing probabilistic drop algorithms like 75 * BLUE (e.g., CAKE's Cobalt AQM). 76 */ 77 QDISC_DROP_FLOOD_PROTECTION, 78 /** 79 * @QDISC_DROP_BAND_LIMIT: packet dropped because the priority band's 80 * limit was reached. Used by qdiscs with priority bands that have 81 * per-band packet limits (e.g., FQ). 82 */ 83 QDISC_DROP_BAND_LIMIT, 84 /** 85 * @QDISC_DROP_HORIZON_LIMIT: packet dropped because its timestamp 86 * is too far in the future (beyond the configured horizon). 87 * Used by qdiscs with time-based scheduling (e.g., FQ). 88 */ 89 QDISC_DROP_HORIZON_LIMIT, 90 /** 91 * @QDISC_DROP_FLOW_LIMIT: packet dropped because an individual flow 92 * exceeded its per-flow packet/depth limit. Used by FQ and SFQ qdiscs 93 * to enforce per-flow fairness and prevent a single flow from 94 * monopolizing queue resources. 95 */ 96 QDISC_DROP_FLOW_LIMIT, 97 /** 98 * @QDISC_DROP_L4S_STEP_NON_ECN: DualPI2 qdisc dropped a non-ECN-capable 99 * packet because the L4S queue delay exceeded the step threshold. 100 * Since the packet cannot be ECN-marked, it must be dropped to signal 101 * congestion. See RFC 9332 for the DualQ Coupled AQM step mechanism. 102 */ 103 QDISC_DROP_L4S_STEP_NON_ECN, 104 /** 105 * @QDISC_DROP_MAX: the maximum of qdisc drop reasons, which 106 * shouldn't be used as a real 'reason' - only for tracing code gen 107 */ 108 QDISC_DROP_MAX, 109 }; 110 111 #undef FN 112 #undef FNe 113 114 #endif 115