xref: /xnu-11417.121.6/bsd/net/classq/classq_fq_codel.h (revision a1e26a70f38d1d7daa7b49b258e2f8538ad81650)
1*a1e26a70SApple OSS Distributions /*
2*a1e26a70SApple OSS Distributions  * Copyright (c) 2016-2021 Apple Inc. All rights reserved.
3*a1e26a70SApple OSS Distributions  *
4*a1e26a70SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
5*a1e26a70SApple OSS Distributions  *
6*a1e26a70SApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*a1e26a70SApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*a1e26a70SApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*a1e26a70SApple OSS Distributions  * compliance with the License. The rights granted to you under the License
10*a1e26a70SApple OSS Distributions  * may not be used to create, or enable the creation or redistribution of,
11*a1e26a70SApple OSS Distributions  * unlawful or unlicensed copies of an Apple operating system, or to
12*a1e26a70SApple OSS Distributions  * circumvent, violate, or enable the circumvention or violation of, any
13*a1e26a70SApple OSS Distributions  * terms of an Apple operating system software license agreement.
14*a1e26a70SApple OSS Distributions  *
15*a1e26a70SApple OSS Distributions  * Please obtain a copy of the License at
16*a1e26a70SApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this file.
17*a1e26a70SApple OSS Distributions  *
18*a1e26a70SApple OSS Distributions  * The Original Code and all software distributed under the License are
19*a1e26a70SApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20*a1e26a70SApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21*a1e26a70SApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22*a1e26a70SApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23*a1e26a70SApple OSS Distributions  * Please see the License for the specific language governing rights and
24*a1e26a70SApple OSS Distributions  * limitations under the License.
25*a1e26a70SApple OSS Distributions  *
26*a1e26a70SApple OSS Distributions  * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27*a1e26a70SApple OSS Distributions  */
28*a1e26a70SApple OSS Distributions 
29*a1e26a70SApple OSS Distributions #ifndef _NET_CLASSQ_CLASSQ_FQ_CODEL_H
30*a1e26a70SApple OSS Distributions #define _NET_CLASSQ_CLASSQ_FQ_CODEL_H
31*a1e26a70SApple OSS Distributions #ifdef PRIVATE
32*a1e26a70SApple OSS Distributions #ifdef BSD_KERNEL_PRIVATE
33*a1e26a70SApple OSS Distributions #include <stdbool.h>
34*a1e26a70SApple OSS Distributions #include <sys/time.h>
35*a1e26a70SApple OSS Distributions #include <net/flowadv.h>
36*a1e26a70SApple OSS Distributions #include <net/classq/if_classq.h>
37*a1e26a70SApple OSS Distributions #if SKYWALK
38*a1e26a70SApple OSS Distributions #include <skywalk/os_skywalk_private.h>
39*a1e26a70SApple OSS Distributions #endif /* SKYWALK */
40*a1e26a70SApple OSS Distributions 
41*a1e26a70SApple OSS Distributions #ifdef __cplusplus
42*a1e26a70SApple OSS Distributions extern "C" {
43*a1e26a70SApple OSS Distributions #endif
44*a1e26a70SApple OSS Distributions 
45*a1e26a70SApple OSS Distributions #define AQM_KTRACE_AON_FLOW_HIGH_DELAY    AQMDBG_CODE(DBG_AQM_ALWAYSON, 0x001)
46*a1e26a70SApple OSS Distributions #define AQM_KTRACE_AON_THROTTLE           AQMDBG_CODE(DBG_AQM_ALWAYSON, 0x002)
47*a1e26a70SApple OSS Distributions #define AQM_KTRACE_AON_FLOW_OVERWHELMING  AQMDBG_CODE(DBG_AQM_ALWAYSON, 0x003)
48*a1e26a70SApple OSS Distributions #define AQM_KTRACE_AON_FLOW_DQ_STALL      AQMDBG_CODE(DBG_AQM_ALWAYSON, 0x004)
49*a1e26a70SApple OSS Distributions 
50*a1e26a70SApple OSS Distributions #define AQM_KTRACE_STATS_FLOW_ENQUEUE   AQMDBG_CODE(DBG_AQM_STATS, 0x001)
51*a1e26a70SApple OSS Distributions #define AQM_KTRACE_STATS_FLOW_DEQUEUE   AQMDBG_CODE(DBG_AQM_STATS, 0x002)
52*a1e26a70SApple OSS Distributions #define AQM_KTRACE_STATS_FLOW_CTL       AQMDBG_CODE(DBG_AQM_STATS, 0x003)
53*a1e26a70SApple OSS Distributions #define AQM_KTRACE_STATS_FLOW_ALLOC     AQMDBG_CODE(DBG_AQM_STATS, 0x004)
54*a1e26a70SApple OSS Distributions #define AQM_KTRACE_STATS_FLOW_DESTROY   AQMDBG_CODE(DBG_AQM_STATS, 0x005)
55*a1e26a70SApple OSS Distributions #define AQM_KTRACE_STATS_FLOW_REPORT_CE AQMDBG_CODE(DBG_AQM_STATS, 0x006)
56*a1e26a70SApple OSS Distributions #define AQM_KTRACE_STATS_GET_QLEN       AQMDBG_CODE(DBG_AQM_STATS, 0x007)
57*a1e26a70SApple OSS Distributions #define AQM_KTRACE_TX_NOT_READY         AQMDBG_CODE(DBG_AQM_STATS, 0x008)
58*a1e26a70SApple OSS Distributions #define AQM_KTRACE_TX_PACEMAKER         AQMDBG_CODE(DBG_AQM_STATS, 0x009)
59*a1e26a70SApple OSS Distributions 
60*a1e26a70SApple OSS Distributions #define AQM_KTRACE_FQ_GRP_SC_IDX(_fq_) \
61*a1e26a70SApple OSS Distributions 	((_fq_)->fq_group->fqg_index << 4 | (_fq_)->fq_sc_index)
62*a1e26a70SApple OSS Distributions 
63*a1e26a70SApple OSS Distributions #define FQ_MIN_FC_THRESHOLD_BYTES       7500
64*a1e26a70SApple OSS Distributions #define FQ_IS_DELAY_HIGH(_fq_)   ((_fq_)->fq_flags & FQF_DELAY_HIGH)
65*a1e26a70SApple OSS Distributions #define FQ_SET_DELAY_HIGH(_fq_) do {                          \
66*a1e26a70SApple OSS Distributions     if (!FQ_IS_DELAY_HIGH(_fq_)) {                              \
67*a1e26a70SApple OSS Distributions 	KDBG(AQM_KTRACE_AON_FLOW_HIGH_DELAY | DBG_FUNC_START, \
68*a1e26a70SApple OSS Distributions 	    (_fq_)->fq_flowhash, AQM_KTRACE_FQ_GRP_SC_IDX((_fq_)),    \
69*a1e26a70SApple OSS Distributions 	    (_fq_)->fq_bytes, (_fq_)->fq_min_qdelay);                 \
70*a1e26a70SApple OSS Distributions     }                                                                 \
71*a1e26a70SApple OSS Distributions     (_fq_)->fq_flags |= FQF_DELAY_HIGH; \
72*a1e26a70SApple OSS Distributions     } while (0)
73*a1e26a70SApple OSS Distributions #define FQ_CLEAR_DELAY_HIGH(_fq_) do { \
74*a1e26a70SApple OSS Distributions     if (FQ_IS_DELAY_HIGH(_fq_)) {        \
75*a1e26a70SApple OSS Distributions 	    KDBG(AQM_KTRACE_AON_FLOW_HIGH_DELAY | DBG_FUNC_END, \
76*a1e26a70SApple OSS Distributions 	            (_fq_)->fq_flowhash, AQM_KTRACE_FQ_GRP_SC_IDX((_fq_)),  \
77*a1e26a70SApple OSS Distributions 	            (_fq_)->fq_bytes, (_fq_)->fq_min_qdelay);               \
78*a1e26a70SApple OSS Distributions     }                                                       \
79*a1e26a70SApple OSS Distributions     (_fq_)->fq_flags &= ~FQF_DELAY_HIGH;                    \
80*a1e26a70SApple OSS Distributions } while (0)
81*a1e26a70SApple OSS Distributions 
82*a1e26a70SApple OSS Distributions #define FQ_IS_OVERWHELMING(_fq_)   ((_fq_)->fq_flags & FQF_OVERWHELMING)
83*a1e26a70SApple OSS Distributions #define FQ_SET_OVERWHELMING(_fq_) do { \
84*a1e26a70SApple OSS Distributions 	if (!FQ_IS_OVERWHELMING(_fq_)) {                              \
85*a1e26a70SApple OSS Distributions 	        KDBG(AQM_KTRACE_AON_FLOW_OVERWHELMING | DBG_FUNC_START, \
86*a1e26a70SApple OSS Distributions 	                        (_fq_)->fq_flowhash, AQM_KTRACE_FQ_GRP_SC_IDX((_fq_)),    \
87*a1e26a70SApple OSS Distributions 	                        (_fq_)->fq_bytes, (_fq_)->fq_min_qdelay);                 \
88*a1e26a70SApple OSS Distributions 	}                                                                                                                                         \
89*a1e26a70SApple OSS Distributions 	(_fq_)->fq_flags |= FQF_OVERWHELMING; \
90*a1e26a70SApple OSS Distributions } while (0)
91*a1e26a70SApple OSS Distributions #define FQ_CLEAR_OVERWHELMING(_fq_) do { \
92*a1e26a70SApple OSS Distributions 	if (FQ_IS_OVERWHELMING(_fq_)) {                              \
93*a1e26a70SApple OSS Distributions 	        KDBG(AQM_KTRACE_AON_FLOW_OVERWHELMING | DBG_FUNC_END,  \
94*a1e26a70SApple OSS Distributions 	                        (_fq_)->fq_flowhash, AQM_KTRACE_FQ_GRP_SC_IDX((_fq_)),    \
95*a1e26a70SApple OSS Distributions 	                        (_fq_)->fq_bytes, (_fq_)->fq_min_qdelay);                 \
96*a1e26a70SApple OSS Distributions 	}                                                                                     \
97*a1e26a70SApple OSS Distributions 	(_fq_)->fq_flags &= ~FQF_OVERWHELMING; \
98*a1e26a70SApple OSS Distributions } while (0)
99*a1e26a70SApple OSS Distributions 
100*a1e26a70SApple OSS Distributions /*
101*a1e26a70SApple OSS Distributions  * time (in ns) the flow queue can stay in empty state.
102*a1e26a70SApple OSS Distributions  */
103*a1e26a70SApple OSS Distributions #define FQ_EMPTY_PURGE_DELAY    (3ULL * 1000 * 1000 * 1000)
104*a1e26a70SApple OSS Distributions 
105*a1e26a70SApple OSS Distributions /*
106*a1e26a70SApple OSS Distributions  * maximum number of flow queues which can be purged during a dequeue.
107*a1e26a70SApple OSS Distributions  */
108*a1e26a70SApple OSS Distributions #define FQ_EMPTY_PURGE_MAX      4
109*a1e26a70SApple OSS Distributions 
110*a1e26a70SApple OSS Distributions #define FQ_INVALID_TX_TS        UINT64_MAX
111*a1e26a70SApple OSS Distributions 
112*a1e26a70SApple OSS Distributions struct flowq {
113*a1e26a70SApple OSS Distributions #pragma pack(push,1)
114*a1e26a70SApple OSS Distributions 	union {
115*a1e26a70SApple OSS Distributions 		MBUFQ_HEAD(mbufq_head) __mbufq; /* mbuf packet queue */
116*a1e26a70SApple OSS Distributions #if SKYWALK
117*a1e26a70SApple OSS Distributions 		KPKTQ_HEAD(kpktq_head) __kpktq; /* skywalk packet queue */
118*a1e26a70SApple OSS Distributions #endif /* SKYWALK */
119*a1e26a70SApple OSS Distributions 	} __fq_pktq_u;
120*a1e26a70SApple OSS Distributions #pragma pack(pop)
121*a1e26a70SApple OSS Distributions 	uint32_t       fq_flowhash;    /* Flow hash */
122*a1e26a70SApple OSS Distributions 	uint32_t       fq_bytes;       /* Number of bytes in the queue */
123*a1e26a70SApple OSS Distributions 	int32_t        fq_deficit;     /* Deficit for scheduling */
124*a1e26a70SApple OSS Distributions 	fq_if_group_t  *fq_group;          /* Back pointer to the group */
125*a1e26a70SApple OSS Distributions #define FQF_FLOWCTL_CAPABLE 0x01 /* Use flow control instead of drop */
126*a1e26a70SApple OSS Distributions #define FQF_DELAY_HIGH  0x02    /* Min delay is greater than target */
127*a1e26a70SApple OSS Distributions #define FQF_NEW_FLOW    0x04    /* Currently on new flows queue */
128*a1e26a70SApple OSS Distributions #define FQF_OLD_FLOW    0x08    /* Currently on old flows queue */
129*a1e26a70SApple OSS Distributions #define FQF_FLOWCTL_ON  0x10    /* Currently flow controlled */
130*a1e26a70SApple OSS Distributions #define FQF_EMPTY_FLOW  0x20    /* Currently on empty flows queue */
131*a1e26a70SApple OSS Distributions #define FQF_OVERWHELMING  0x40  /* The largest flow when AQM hits queue limit */
132*a1e26a70SApple OSS Distributions #define FQF_FRESH_FLOW  0x80  /* The flow queue has just been allocated */
133*a1e26a70SApple OSS Distributions 	uint8_t        fq_flags;       /* flags */
134*a1e26a70SApple OSS Distributions 	uint8_t        fq_sc_index; /* service_class index */
135*a1e26a70SApple OSS Distributions 	bool           fq_in_dqlist;
136*a1e26a70SApple OSS Distributions 	fq_tfc_type_t  fq_tfc_type;
137*a1e26a70SApple OSS Distributions 	uint8_t        __fq_pad_uint8[4];
138*a1e26a70SApple OSS Distributions 	uint64_t       fq_min_qdelay; /* min queue delay for Codel */
139*a1e26a70SApple OSS Distributions 	uint64_t       fq_getqtime;    /* last dequeue time */
140*a1e26a70SApple OSS Distributions 	/* total pkt count since last congestion event report */
141*a1e26a70SApple OSS Distributions 	uint32_t       fq_pkts_since_last_report;
142*a1e26a70SApple OSS Distributions 	/* the next time that a paced packet is ready to go*/
143*a1e26a70SApple OSS Distributions 	uint64_t       fq_next_tx_time;
144*a1e26a70SApple OSS Distributions 	union {
145*a1e26a70SApple OSS Distributions 		uint64_t   fq_updatetime; /* next update interval */
146*a1e26a70SApple OSS Distributions 		/* empty list purge time (in nanoseconds) */
147*a1e26a70SApple OSS Distributions 		uint64_t   fq_empty_purge_time;
148*a1e26a70SApple OSS Distributions 	};
149*a1e26a70SApple OSS Distributions 	LIST_ENTRY(flowq) fq_hashlink; /* for flow queue hash table */
150*a1e26a70SApple OSS Distributions 	/*
151*a1e26a70SApple OSS Distributions 	 * flow queue will only be on either one of the lists.
152*a1e26a70SApple OSS Distributions 	 */
153*a1e26a70SApple OSS Distributions 	union {
154*a1e26a70SApple OSS Distributions 		STAILQ_ENTRY(flowq) fq_actlink; /* for new/old flow queues */
155*a1e26a70SApple OSS Distributions 		/* entry on empty flow queue list */
156*a1e26a70SApple OSS Distributions 		TAILQ_ENTRY(flowq) fq_empty_link;
157*a1e26a70SApple OSS Distributions 	};
158*a1e26a70SApple OSS Distributions 	/* entry on dequeue flow list */
159*a1e26a70SApple OSS Distributions 	STAILQ_ENTRY(flowq) fq_dqlink;
160*a1e26a70SApple OSS Distributions 	/* temporary packet queue for dequeued packets */
161*a1e26a70SApple OSS Distributions 	classq_pkt_t   fq_dq_head;
162*a1e26a70SApple OSS Distributions 	classq_pkt_t   fq_dq_tail;
163*a1e26a70SApple OSS Distributions };
164*a1e26a70SApple OSS Distributions 
165*a1e26a70SApple OSS Distributions typedef struct flowq fq_t;
166*a1e26a70SApple OSS Distributions 
167*a1e26a70SApple OSS Distributions #define FQF_FLOW_STATE_MASK    (FQF_DELAY_HIGH | FQF_NEW_FLOW | \
168*a1e26a70SApple OSS Distributions     FQF_OLD_FLOW | FQF_FLOWCTL_ON | FQF_EMPTY_FLOW)
169*a1e26a70SApple OSS Distributions 
170*a1e26a70SApple OSS Distributions #define fq_mbufq        __fq_pktq_u.__mbufq
171*a1e26a70SApple OSS Distributions #if SKYWALK
172*a1e26a70SApple OSS Distributions #define fq_kpktq        __fq_pktq_u.__kpktq
173*a1e26a70SApple OSS Distributions #endif /* SKYWALK */
174*a1e26a70SApple OSS Distributions 
175*a1e26a70SApple OSS Distributions #if SKYWALK
176*a1e26a70SApple OSS Distributions #define fq_empty(_q, _ptype)    (((_ptype) == QP_MBUF) ?  \
177*a1e26a70SApple OSS Distributions     MBUFQ_EMPTY(&(_q)->fq_mbufq) : KPKTQ_EMPTY(&(_q)->fq_kpktq))
178*a1e26a70SApple OSS Distributions #else /* !SKYWALK */
179*a1e26a70SApple OSS Distributions #define fq_empty(_q, _ptype)    MBUFQ_EMPTY(&(_q)->fq_mbufq)
180*a1e26a70SApple OSS Distributions #endif /* !SKYWALK */
181*a1e26a70SApple OSS Distributions 
182*a1e26a70SApple OSS Distributions #if SKYWALK
183*a1e26a70SApple OSS Distributions #define fq_enqueue(_q, _h, _t, _c, _ptype) do {                         \
184*a1e26a70SApple OSS Distributions 	switch (_ptype) {                                               \
185*a1e26a70SApple OSS Distributions 	case QP_MBUF:                                                   \
186*a1e26a70SApple OSS Distributions 	        ASSERT((_h).cp_ptype == QP_MBUF);                       \
187*a1e26a70SApple OSS Distributions 	        ASSERT((_t).cp_ptype == QP_MBUF);                       \
188*a1e26a70SApple OSS Distributions 	        MBUFQ_ENQUEUE_MULTI(&(_q)->fq_mbufq, (_h).cp_mbuf,      \
189*a1e26a70SApple OSS Distributions 	            (_t).cp_mbuf);                                      \
190*a1e26a70SApple OSS Distributions 	        MBUFQ_ADD_CRUMB_MULTI(&(_q)->fq_mbufq, (_h).cp_mbuf,    \
191*a1e26a70SApple OSS Distributions 	            (_t).cp_mbuf, PKT_CRUMB_FQ_ENQUEUE);                \
192*a1e26a70SApple OSS Distributions 	        break;                                                  \
193*a1e26a70SApple OSS Distributions 	case QP_PACKET:                                                 \
194*a1e26a70SApple OSS Distributions 	        ASSERT((_h).cp_ptype == QP_PACKET);                     \
195*a1e26a70SApple OSS Distributions 	        ASSERT((_t).cp_ptype == QP_PACKET);                     \
196*a1e26a70SApple OSS Distributions 	        KPKTQ_ENQUEUE_MULTI(&(_q)->fq_kpktq, (_h).cp_kpkt,      \
197*a1e26a70SApple OSS Distributions 	            (_t).cp_kpkt, (_c));                                \
198*a1e26a70SApple OSS Distributions 	        break;                                                  \
199*a1e26a70SApple OSS Distributions 	default:                                                        \
200*a1e26a70SApple OSS Distributions 	        VERIFY(0);                                              \
201*a1e26a70SApple OSS Distributions 	        __builtin_unreachable();                                \
202*a1e26a70SApple OSS Distributions 	        break;                                                  \
203*a1e26a70SApple OSS Distributions 	}                                                               \
204*a1e26a70SApple OSS Distributions } while (0)
205*a1e26a70SApple OSS Distributions #else /* !SKYWALK */
206*a1e26a70SApple OSS Distributions #define fq_enqueue(_q, _h, _t, _c, _ptype) {                            \
207*a1e26a70SApple OSS Distributions     MBUFQ_ENQUEUE_MULTI(&(_q)->fq_mbufq, (_h).cp_mbuf, (_t).cp_mbuf);   \
208*a1e26a70SApple OSS Distributions     MBUFQ_ADD_CRUMB_MULTI(&(_q)->fq_mbufq, (_h).cp_mbuf,                \
209*a1e26a70SApple OSS Distributions 	    (_t).cp_mbuf, PKT_CRUMB_FQ_ENQUEUE);                        \
210*a1e26a70SApple OSS Distributions } while (0)
211*a1e26a70SApple OSS Distributions #endif /* !SKYWALK */
212*a1e26a70SApple OSS Distributions 
213*a1e26a70SApple OSS Distributions #if SKYWALK
214*a1e26a70SApple OSS Distributions #define fq_dequeue(_q, _p, _ptype) do {                                 \
215*a1e26a70SApple OSS Distributions 	switch (_ptype) {                                               \
216*a1e26a70SApple OSS Distributions 	case QP_MBUF: {                                                 \
217*a1e26a70SApple OSS Distributions 	        MBUFQ_DEQUEUE(&(_q)->fq_mbufq, (_p)->cp_mbuf);          \
218*a1e26a70SApple OSS Distributions 	        if (__probable((_p)->cp_mbuf != NULL)) {                \
219*a1e26a70SApple OSS Distributions 	                CLASSQ_PKT_INIT_MBUF((_p), (_p)->cp_mbuf);      \
220*a1e26a70SApple OSS Distributions 	                m_add_crumb((_p)->cp_mbuf,                      \
221*a1e26a70SApple OSS Distributions 	                    PKT_CRUMB_FQ_DEQUEUE);                      \
222*a1e26a70SApple OSS Distributions 	        }                                                       \
223*a1e26a70SApple OSS Distributions 	        break;                                                  \
224*a1e26a70SApple OSS Distributions 	}                                                               \
225*a1e26a70SApple OSS Distributions 	case QP_PACKET: {                                               \
226*a1e26a70SApple OSS Distributions 	        KPKTQ_DEQUEUE(&(_q)->fq_kpktq, (_p)->cp_kpkt);          \
227*a1e26a70SApple OSS Distributions 	        if (__probable((_p)->cp_kpkt != NULL)) {                \
228*a1e26a70SApple OSS Distributions 	                CLASSQ_PKT_INIT_PACKET((_p), (_p)->cp_kpkt);    \
229*a1e26a70SApple OSS Distributions 	        }                                                       \
230*a1e26a70SApple OSS Distributions 	        break;                                                  \
231*a1e26a70SApple OSS Distributions 	}                                                               \
232*a1e26a70SApple OSS Distributions 	default:                                                        \
233*a1e26a70SApple OSS Distributions 	        VERIFY(0);                                              \
234*a1e26a70SApple OSS Distributions 	        __builtin_unreachable();                                \
235*a1e26a70SApple OSS Distributions 	        break;                                                  \
236*a1e26a70SApple OSS Distributions 	}                                                               \
237*a1e26a70SApple OSS Distributions } while (0)
238*a1e26a70SApple OSS Distributions #else /* !SKYWALK */
239*a1e26a70SApple OSS Distributions #define fq_dequeue(_q, _p, _ptype) do {                                 \
240*a1e26a70SApple OSS Distributions 	MBUFQ_DEQUEUE(&(_q)->fq_mbufq, (_p)->cp_mbuf);                  \
241*a1e26a70SApple OSS Distributions 	if (__probable((_p)->cp_mbuf != NULL)) {                        \
242*a1e26a70SApple OSS Distributions 	        CLASSQ_PKT_INIT_MBUF((_p), (_p)->cp_mbuf);              \
243*a1e26a70SApple OSS Distributions 	        m_add_crumb((_p)->cp_mbuf, PKT_CRUMB_FQ_DEQUEUE);       \
244*a1e26a70SApple OSS Distributions 	}                                                               \
245*a1e26a70SApple OSS Distributions } while (0)
246*a1e26a70SApple OSS Distributions #endif /* !SKYWALK */
247*a1e26a70SApple OSS Distributions 
248*a1e26a70SApple OSS Distributions struct fq_codel_sched_data;
249*a1e26a70SApple OSS Distributions struct fq_if_classq;
250*a1e26a70SApple OSS Distributions 
251*a1e26a70SApple OSS Distributions /* Function definitions */
252*a1e26a70SApple OSS Distributions extern void fq_codel_init(void);
253*a1e26a70SApple OSS Distributions extern fq_t *fq_alloc(classq_pkt_type_t);
254*a1e26a70SApple OSS Distributions extern void fq_destroy(fq_t *, classq_pkt_type_t);
255*a1e26a70SApple OSS Distributions extern int fq_addq(struct fq_codel_sched_data *, fq_if_group_t *,
256*a1e26a70SApple OSS Distributions     pktsched_pkt_t *, struct fq_if_classq *);
257*a1e26a70SApple OSS Distributions extern void fq_getq_flow(struct fq_codel_sched_data *, fq_t *,
258*a1e26a70SApple OSS Distributions     pktsched_pkt_t *, uint64_t now);
259*a1e26a70SApple OSS Distributions extern void fq_codel_dequeue(fq_if_t *fqs, fq_t *fq,
260*a1e26a70SApple OSS Distributions     pktsched_pkt_t *pkt, uint64_t now);
261*a1e26a70SApple OSS Distributions extern void fq_getq_flow_internal(struct fq_codel_sched_data *,
262*a1e26a70SApple OSS Distributions     fq_t *, pktsched_pkt_t *);
263*a1e26a70SApple OSS Distributions extern void fq_head_drop(struct fq_codel_sched_data *, fq_t *);
264*a1e26a70SApple OSS Distributions extern boolean_t fq_tx_time_ready(fq_if_t *fqs, fq_t *fq, uint64_t now,
265*a1e26a70SApple OSS Distributions     uint64_t *ready_time);
266*a1e26a70SApple OSS Distributions 
267*a1e26a70SApple OSS Distributions #ifdef __cplusplus
268*a1e26a70SApple OSS Distributions }
269*a1e26a70SApple OSS Distributions #endif
270*a1e26a70SApple OSS Distributions #endif /* BSD_KERNEL_PRIVATE */
271*a1e26a70SApple OSS Distributions #endif /* PRIVATE */
272*a1e26a70SApple OSS Distributions #endif /* _NET_CLASSQ_CLASSQ_FQ_CODEL_H */
273