1 /*
2  * FQ_Codel - The FlowQueue-Codel scheduler/AQM
3  *
4  * $FreeBSD$
5  *
6  * Copyright (C) 2016 Centre for Advanced Internet Architectures,
7  *  Swinburne University of Technology, Melbourne, Australia.
8  * Portions of this code were made possible in part by a gift from
9  *  The Comcast Innovation Fund.
10  * Implemented by Rasool Al-Saadi <ralsaadi@swin.edu.au>
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31  * SUCH DAMAGE.
32  */
33 
34 #ifdef _KERNEL
35 #include <sys/malloc.h>
36 #include <sys/socket.h>
37 //#include <sys/socketvar.h>
38 #include <sys/kernel.h>
39 #include <sys/mbuf.h>
40 #include <sys/module.h>
41 #include <net/if.h>	/* IFNAMSIZ */
42 #include <netinet/in.h>
43 #include <netinet/ip_var.h>		/* ipfw_rule_ref */
44 #include <netinet/ip_fw.h>	/* flow_id */
45 #include <netinet/ip_dummynet.h>
46 
47 #include <sys/lock.h>
48 #include <sys/proc.h>
49 #include <sys/rwlock.h>
50 
51 #include <netpfil/ipfw/ip_fw_private.h>
52 #include <sys/sysctl.h>
53 #include <netinet/ip.h>
54 #include <netinet/ip6.h>
55 #include <netinet/ip_icmp.h>
56 #include <netinet/tcp.h>
57 #include <netinet/udp.h>
58 #include <sys/queue.h>
59 #include <sys/hash.h>
60 
61 #include <netpfil/ipfw/dn_heap.h>
62 #include <netpfil/ipfw/ip_dn_private.h>
63 
64 #include <netpfil/ipfw/dn_aqm.h>
65 #include <netpfil/ipfw/dn_aqm_codel.h>
66 #include <netpfil/ipfw/dn_sched.h>
67 #include <netpfil/ipfw/dn_sched_fq_codel.h>
68 #include <netpfil/ipfw/dn_sched_fq_codel_helper.h>
69 
70 #else
71 #include <dn_test.h>
72 #endif
73 
74 /* NOTE: In fq_codel module, we reimplements CoDel AQM functions
75  * because fq_codel use different flows (sub-queues) structure and
76  * dn_queue includes many variables not needed by a flow (sub-queue
77  * )i.e. avoid extra overhead (88 bytes vs 208 bytes).
78  * Also, CoDel functions manages stats of sub-queues as well as the main queue.
79  */
80 
81 #define DN_SCHED_FQ_CODEL 6
82 
83 static struct dn_alg fq_codel_desc;
84 
85 /* fq_codel default parameters including codel */
86 struct dn_sch_fq_codel_parms
87 fq_codel_sysctl = {{5000 * AQM_TIME_1US, 100000 * AQM_TIME_1US,
88 	CODEL_ECN_ENABLED}, 1024, 10240, 1514};
89 
90 static int
91 fqcodel_sysctl_interval_handler(SYSCTL_HANDLER_ARGS)
92 {
93 	int error;
94 	long  value;
95 
96 	value = fq_codel_sysctl.ccfg.interval;
97 	value /= AQM_TIME_1US;
98 	error = sysctl_handle_long(oidp, &value, 0, req);
99 	if (error != 0 || req->newptr == NULL)
100 		return (error);
101 	if (value < 1 || value > 100 * AQM_TIME_1S)
102 		return (EINVAL);
103 	fq_codel_sysctl.ccfg.interval = value * AQM_TIME_1US ;
104 
105 	return (0);
106 }
107 
108 static int
109 fqcodel_sysctl_target_handler(SYSCTL_HANDLER_ARGS)
110 {
111 	int error;
112 	long  value;
113 
114 	value = fq_codel_sysctl.ccfg.target;
115 	value /= AQM_TIME_1US;
116 	error = sysctl_handle_long(oidp, &value, 0, req);
117 	if (error != 0 || req->newptr == NULL)
118 		return (error);
119 	if (value < 1 || value > 5 * AQM_TIME_1S)
120 		return (EINVAL);
121 	fq_codel_sysctl.ccfg.target = value * AQM_TIME_1US ;
122 
123 	return (0);
124 }
125 
126 
127 SYSBEGIN(f4)
128 
129 SYSCTL_DECL(_net_inet);
130 SYSCTL_DECL(_net_inet_ip);
131 SYSCTL_DECL(_net_inet_ip_dummynet);
132 static SYSCTL_NODE(_net_inet_ip_dummynet, OID_AUTO, fqcodel,
133     CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
134     "FQ_CODEL");
135 
136 #ifdef SYSCTL_NODE
137 
138 SYSCTL_PROC(_net_inet_ip_dummynet_fqcodel, OID_AUTO, target,
139     CTLTYPE_LONG | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
140     NULL, 0, fqcodel_sysctl_target_handler, "L",
141     "FQ_CoDel target in microsecond");
142 SYSCTL_PROC(_net_inet_ip_dummynet_fqcodel, OID_AUTO, interval,
143     CTLTYPE_LONG | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
144     NULL, 0, fqcodel_sysctl_interval_handler, "L",
145     "FQ_CoDel interval in microsecond");
146 
147 SYSCTL_UINT(_net_inet_ip_dummynet_fqcodel, OID_AUTO, quantum,
148 	CTLFLAG_RW, &fq_codel_sysctl.quantum, 1514, "FQ_CoDel quantum");
149 SYSCTL_UINT(_net_inet_ip_dummynet_fqcodel, OID_AUTO, flows,
150 	CTLFLAG_RW, &fq_codel_sysctl.flows_cnt, 1024,
151 	"Number of queues for FQ_CoDel");
152 SYSCTL_UINT(_net_inet_ip_dummynet_fqcodel, OID_AUTO, limit,
153 	CTLFLAG_RW, &fq_codel_sysctl.limit, 10240, "FQ_CoDel queues size limit");
154 #endif
155 
156 /* Drop a packet form the head of codel queue */
157 static void
158 codel_drop_head(struct fq_codel_flow *q, struct fq_codel_si *si)
159 {
160 	struct mbuf *m = q->mq.head;
161 
162 	if (m == NULL)
163 		return;
164 	q->mq.head = m->m_nextpkt;
165 
166 	fq_update_stats(q, si, -m->m_pkthdr.len, 1);
167 
168 	if (si->main_q.ni.length == 0) /* queue is now idle */
169 			si->main_q.q_time = dn_cfg.curr_time;
170 
171 	FREE_PKT(m);
172 }
173 
174 /* Enqueue a packet 'm' to a queue 'q' and add timestamp to that packet.
175  * Return 1 when unable to add timestamp, otherwise return 0
176  */
177 static int
178 codel_enqueue(struct fq_codel_flow *q, struct mbuf *m, struct fq_codel_si *si)
179 {
180 	uint64_t len;
181 
182 	len = m->m_pkthdr.len;
183 	/* finding maximum packet size */
184 	if (len > q->cst.maxpkt_size)
185 		q->cst.maxpkt_size = len;
186 
187 	/* Add timestamp to mbuf as MTAG */
188 	struct m_tag *mtag;
189 	mtag = m_tag_locate(m, MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, NULL);
190 	if (mtag == NULL)
191 		mtag = m_tag_alloc(MTAG_ABI_COMPAT, DN_AQM_MTAG_TS, sizeof(aqm_time_t),
192 			M_NOWAIT);
193 	if (mtag == NULL) {
194 		m_freem(m);
195 		goto drop;
196 	}
197 	*(aqm_time_t *)(mtag + 1) = AQM_UNOW;
198 	m_tag_prepend(m, mtag);
199 
200 	mq_append(&q->mq, m);
201 	fq_update_stats(q, si, len, 0);
202 	return 0;
203 
204 drop:
205 	fq_update_stats(q, si, len, 1);
206 	m_freem(m);
207 	return 1;
208 }
209 
210 /*
211  * Classify a packet to queue number using Jenkins hash function.
212  * Return: queue number
213  * the input of the hash are protocol no, perturbation, src IP, dst IP,
214  * src port, dst port,
215  */
216 static inline int
217 fq_codel_classify_flow(struct mbuf *m, uint16_t fcount, struct fq_codel_si *si)
218 {
219 	struct ip *ip;
220 	struct tcphdr *th;
221 	struct udphdr *uh;
222 	uint8_t tuple[41];
223 	uint16_t hash=0;
224 
225 	ip = (struct ip *)mtodo(m, dn_tag_get(m)->iphdr_off);
226 //#ifdef INET6
227 	struct ip6_hdr *ip6;
228 	int isip6;
229 	isip6 = (ip->ip_v == 6);
230 
231 	if(isip6) {
232 		ip6 = (struct ip6_hdr *)ip;
233 		*((uint8_t *) &tuple[0]) = ip6->ip6_nxt;
234 		*((uint32_t *) &tuple[1]) = si->perturbation;
235 		memcpy(&tuple[5], ip6->ip6_src.s6_addr, 16);
236 		memcpy(&tuple[21], ip6->ip6_dst.s6_addr, 16);
237 
238 		switch (ip6->ip6_nxt) {
239 		case IPPROTO_TCP:
240 			th = (struct tcphdr *)(ip6 + 1);
241 			*((uint16_t *) &tuple[37]) = th->th_dport;
242 			*((uint16_t *) &tuple[39]) = th->th_sport;
243 			break;
244 
245 		case IPPROTO_UDP:
246 			uh = (struct udphdr *)(ip6 + 1);
247 			*((uint16_t *) &tuple[37]) = uh->uh_dport;
248 			*((uint16_t *) &tuple[39]) = uh->uh_sport;
249 			break;
250 		default:
251 			memset(&tuple[37], 0, 4);
252 
253 		}
254 
255 		hash = jenkins_hash(tuple, 41, HASHINIT) %  fcount;
256 		return hash;
257 	}
258 //#endif
259 
260 	/* IPv4 */
261 	*((uint8_t *) &tuple[0]) = ip->ip_p;
262 	*((uint32_t *) &tuple[1]) = si->perturbation;
263 	*((uint32_t *) &tuple[5]) = ip->ip_src.s_addr;
264 	*((uint32_t *) &tuple[9]) = ip->ip_dst.s_addr;
265 
266 	switch (ip->ip_p) {
267 		case IPPROTO_TCP:
268 			th = (struct tcphdr *)(ip + 1);
269 			*((uint16_t *) &tuple[13]) = th->th_dport;
270 			*((uint16_t *) &tuple[15]) = th->th_sport;
271 			break;
272 
273 		case IPPROTO_UDP:
274 			uh = (struct udphdr *)(ip + 1);
275 			*((uint16_t *) &tuple[13]) = uh->uh_dport;
276 			*((uint16_t *) &tuple[15]) = uh->uh_sport;
277 			break;
278 		default:
279 			memset(&tuple[13], 0, 4);
280 
281 	}
282 	hash = jenkins_hash(tuple, 17, HASHINIT) %  fcount;
283 
284 	return hash;
285 }
286 
287 /*
288  * Enqueue a packet into an appropriate queue according to
289  * FQ_CODEL algorithm.
290  */
291 static int
292 fq_codel_enqueue(struct dn_sch_inst *_si, struct dn_queue *_q,
293 	struct mbuf *m)
294 {
295 	struct fq_codel_si *si;
296 	struct fq_codel_schk *schk;
297 	struct dn_sch_fq_codel_parms *param;
298 	struct dn_queue *mainq;
299 	int idx, drop, i, maxidx;
300 
301 	mainq = (struct dn_queue *)(_si + 1);
302 	si = (struct fq_codel_si *)_si;
303 	schk = (struct fq_codel_schk *)(si->_si.sched+1);
304 	param = &schk->cfg;
305 
306 	 /* classify a packet to queue number*/
307 	idx = fq_codel_classify_flow(m, param->flows_cnt, si);
308 	/* enqueue packet into appropriate queue using CoDel AQM.
309 	 * Note: 'codel_enqueue' function returns 1 only when it unable to
310 	 * add timestamp to packet (no limit check)*/
311 	drop = codel_enqueue(&si->flows[idx], m, si);
312 
313 	/* codel unable to timestamp a packet */
314 	if (drop)
315 		return 1;
316 
317 	/* If the flow (sub-queue) is not active ,then add it to the tail of
318 	 * new flows list, initialize and activate it.
319 	 */
320 	if (!si->flows[idx].active ) {
321 		STAILQ_INSERT_TAIL(&si->newflows, &si->flows[idx], flowchain);
322 		si->flows[idx].deficit = param->quantum;
323 		si->flows[idx].cst.dropping = false;
324 		si->flows[idx].cst.first_above_time = 0;
325 		si->flows[idx].active = 1;
326 		//D("activate %d",idx);
327 	}
328 
329 	/* check the limit for all queues and remove a packet from the
330 	 * largest one
331 	 */
332 	if (mainq->ni.length > schk->cfg.limit) { D("over limit");
333 		/* find first active flow */
334 		for (maxidx = 0; maxidx < schk->cfg.flows_cnt; maxidx++)
335 			if (si->flows[maxidx].active)
336 				break;
337 		if (maxidx < schk->cfg.flows_cnt) {
338 			/* find the largest sub- queue */
339 			for (i = maxidx + 1; i < schk->cfg.flows_cnt; i++)
340 				if (si->flows[i].active && si->flows[i].stats.length >
341 					si->flows[maxidx].stats.length)
342 					maxidx = i;
343 			codel_drop_head(&si->flows[maxidx], si);
344 			D("maxidx = %d",maxidx);
345 			drop = 1;
346 		}
347 	}
348 
349 	return drop;
350 }
351 
352 /*
353  * Dequeue a packet from an appropriate queue according to
354  * FQ_CODEL algorithm.
355  */
356 static struct mbuf *
357 fq_codel_dequeue(struct dn_sch_inst *_si)
358 {
359 	struct fq_codel_si *si;
360 	struct fq_codel_schk *schk;
361 	struct dn_sch_fq_codel_parms *param;
362 	struct fq_codel_flow *f;
363 	struct mbuf *mbuf;
364 	struct fq_codel_list *fq_codel_flowlist;
365 
366 	si = (struct fq_codel_si *)_si;
367 	schk = (struct fq_codel_schk *)(si->_si.sched+1);
368 	param = &schk->cfg;
369 
370 	do {
371 		/* select a list to start with */
372 		if (STAILQ_EMPTY(&si->newflows))
373 			fq_codel_flowlist = &si->oldflows;
374 		else
375 			fq_codel_flowlist = &si->newflows;
376 
377 		/* Both new and old queue lists are empty, return NULL */
378 		if (STAILQ_EMPTY(fq_codel_flowlist))
379 			return NULL;
380 
381 		f = STAILQ_FIRST(fq_codel_flowlist);
382 		while (f != NULL)	{
383 			/* if there is no flow(sub-queue) deficit, increase deficit
384 			 * by quantum, move the flow to the tail of old flows list
385 			 * and try another flow.
386 			 * Otherwise, the flow will be used for dequeue.
387 			 */
388 			if (f->deficit < 0) {
389 				 f->deficit += param->quantum;
390 				 STAILQ_REMOVE_HEAD(fq_codel_flowlist, flowchain);
391 				 STAILQ_INSERT_TAIL(&si->oldflows, f, flowchain);
392 			 } else
393 				 break;
394 
395 			f = STAILQ_FIRST(fq_codel_flowlist);
396 		}
397 
398 		/* the new flows list is empty, try old flows list */
399 		if (STAILQ_EMPTY(fq_codel_flowlist))
400 			continue;
401 
402 		/* Dequeue a packet from the selected flow */
403 		mbuf = fqc_codel_dequeue(f, si);
404 
405 		/* Codel did not return a packet */
406 		if (!mbuf) {
407 			/* If the selected flow belongs to new flows list, then move
408 			 * it to the tail of old flows list. Otherwise, deactivate it and
409 			 * remove it from the old list and
410 			 */
411 			if (fq_codel_flowlist == &si->newflows) {
412 				STAILQ_REMOVE_HEAD(fq_codel_flowlist, flowchain);
413 				STAILQ_INSERT_TAIL(&si->oldflows, f, flowchain);
414 			}	else {
415 				f->active = 0;
416 				STAILQ_REMOVE_HEAD(fq_codel_flowlist, flowchain);
417 			}
418 			/* start again */
419 			continue;
420 		}
421 
422 		/* we have a packet to return,
423 		 * update flow deficit and return the packet*/
424 		f->deficit -= mbuf->m_pkthdr.len;
425 		return mbuf;
426 
427 	} while (1);
428 
429 	/* unreachable point */
430 	return NULL;
431 }
432 
433 /*
434  * Initialize fq_codel scheduler instance.
435  * also, allocate memory for flows array.
436  */
437 static int
438 fq_codel_new_sched(struct dn_sch_inst *_si)
439 {
440 	struct fq_codel_si *si;
441 	struct dn_queue *q;
442 	struct fq_codel_schk *schk;
443 	int i;
444 
445 	si = (struct fq_codel_si *)_si;
446 	schk = (struct fq_codel_schk *)(_si->sched+1);
447 
448 	if(si->flows) {
449 		D("si already configured!");
450 		return 0;
451 	}
452 
453 	/* init the main queue */
454 	q = &si->main_q;
455 	set_oid(&q->ni.oid, DN_QUEUE, sizeof(*q));
456 	q->_si = _si;
457 	q->fs = _si->sched->fs;
458 
459 	/* allocate memory for flows array */
460 	si->flows = mallocarray(schk->cfg.flows_cnt,
461 	    sizeof(struct fq_codel_flow), M_DUMMYNET, M_NOWAIT | M_ZERO);
462 	if (si->flows == NULL) {
463 		D("cannot allocate memory for fq_codel configuration parameters");
464 		return ENOMEM ;
465 	}
466 
467 	/* init perturbation for this si */
468 	si->perturbation = random();
469 
470 	/* init the old and new flows lists */
471 	STAILQ_INIT(&si->newflows);
472 	STAILQ_INIT(&si->oldflows);
473 
474 	/* init the flows (sub-queues) */
475 	for (i = 0; i < schk->cfg.flows_cnt; i++) {
476 		/* init codel */
477 		si->flows[i].cst.maxpkt_size = 500;
478 	}
479 
480 	fq_codel_desc.ref_count++;
481 	return 0;
482 }
483 
484 /*
485  * Free fq_codel scheduler instance.
486  */
487 static int
488 fq_codel_free_sched(struct dn_sch_inst *_si)
489 {
490 	struct fq_codel_si *si = (struct fq_codel_si *)_si ;
491 
492 	/* free the flows array */
493 	free(si->flows , M_DUMMYNET);
494 	si->flows = NULL;
495 	fq_codel_desc.ref_count--;
496 
497 	return 0;
498 }
499 
500 /*
501  * Configure fq_codel scheduler.
502  * the configurations for the scheduler is passed from userland.
503  */
504 static int
505 fq_codel_config(struct dn_schk *_schk)
506 {
507 	struct fq_codel_schk *schk;
508 	struct dn_extra_parms *ep;
509 	struct dn_sch_fq_codel_parms *fqc_cfg;
510 
511 	schk = (struct fq_codel_schk *)(_schk+1);
512 	ep = (struct dn_extra_parms *) _schk->cfg;
513 
514 	/* par array contains fq_codel configuration as follow
515 	 * Codel: 0- target,1- interval, 2- flags
516 	 * FQ_CODEL: 3- quantum, 4- limit, 5- flows
517 	 */
518 	if (ep && ep->oid.len ==sizeof(*ep) &&
519 		ep->oid.subtype == DN_SCH_PARAMS) {
520 
521 		fqc_cfg = &schk->cfg;
522 		if (ep->par[0] < 0)
523 			fqc_cfg->ccfg.target = fq_codel_sysctl.ccfg.target;
524 		else
525 			fqc_cfg->ccfg.target = ep->par[0] * AQM_TIME_1US;
526 
527 		if (ep->par[1] < 0)
528 			fqc_cfg->ccfg.interval = fq_codel_sysctl.ccfg.interval;
529 		else
530 			fqc_cfg->ccfg.interval = ep->par[1] * AQM_TIME_1US;
531 
532 		if (ep->par[2] < 0)
533 			fqc_cfg->ccfg.flags = 0;
534 		else
535 			fqc_cfg->ccfg.flags = ep->par[2];
536 
537 		/* FQ configurations */
538 		if (ep->par[3] < 0)
539 			fqc_cfg->quantum = fq_codel_sysctl.quantum;
540 		else
541 			fqc_cfg->quantum = ep->par[3];
542 
543 		if (ep->par[4] < 0)
544 			fqc_cfg->limit = fq_codel_sysctl.limit;
545 		else
546 			fqc_cfg->limit = ep->par[4];
547 
548 		if (ep->par[5] < 0)
549 			fqc_cfg->flows_cnt = fq_codel_sysctl.flows_cnt;
550 		else
551 			fqc_cfg->flows_cnt = ep->par[5];
552 
553 		/* Bound the configurations */
554 		fqc_cfg->ccfg.target = BOUND_VAR(fqc_cfg->ccfg.target, 1 ,
555 			5 * AQM_TIME_1S); ;
556 		fqc_cfg->ccfg.interval = BOUND_VAR(fqc_cfg->ccfg.interval, 1,
557 			100 * AQM_TIME_1S);
558 
559 		fqc_cfg->quantum = BOUND_VAR(fqc_cfg->quantum,1, 9000);
560 		fqc_cfg->limit= BOUND_VAR(fqc_cfg->limit,1,20480);
561 		fqc_cfg->flows_cnt= BOUND_VAR(fqc_cfg->flows_cnt,1,65536);
562 	}
563 	else
564 		return 1;
565 
566 	return 0;
567 }
568 
569 /*
570  * Return fq_codel scheduler configurations
571  * the configurations for the scheduler is passed to userland.
572  */
573 static int
574 fq_codel_getconfig (struct dn_schk *_schk, struct dn_extra_parms *ep) {
575 
576 	struct fq_codel_schk *schk = (struct fq_codel_schk *)(_schk+1);
577 	struct dn_sch_fq_codel_parms *fqc_cfg;
578 
579 	fqc_cfg = &schk->cfg;
580 
581 	strcpy(ep->name, fq_codel_desc.name);
582 	ep->par[0] = fqc_cfg->ccfg.target / AQM_TIME_1US;
583 	ep->par[1] = fqc_cfg->ccfg.interval / AQM_TIME_1US;
584 	ep->par[2] = fqc_cfg->ccfg.flags;
585 
586 	ep->par[3] = fqc_cfg->quantum;
587 	ep->par[4] = fqc_cfg->limit;
588 	ep->par[5] = fqc_cfg->flows_cnt;
589 
590 	return 0;
591 }
592 
593 /*
594  * fq_codel scheduler descriptor
595  * contains the type of the scheduler, the name, the size of extra
596  * data structures, and function pointers.
597  */
598 static struct dn_alg fq_codel_desc = {
599 	_SI( .type = )  DN_SCHED_FQ_CODEL,
600 	_SI( .name = ) "FQ_CODEL",
601 	_SI( .flags = ) 0,
602 
603 	_SI( .schk_datalen = ) sizeof(struct fq_codel_schk),
604 	_SI( .si_datalen = ) sizeof(struct fq_codel_si) - sizeof(struct dn_sch_inst),
605 	_SI( .q_datalen = ) 0,
606 
607 	_SI( .enqueue = ) fq_codel_enqueue,
608 	_SI( .dequeue = ) fq_codel_dequeue,
609 	_SI( .config = ) fq_codel_config, /* new sched i.e. sched X config ...*/
610 	_SI( .destroy = ) NULL,  /*sched x delete */
611 	_SI( .new_sched = ) fq_codel_new_sched, /* new schd instance */
612 	_SI( .free_sched = ) fq_codel_free_sched,	/* delete schd instance */
613 	_SI( .new_fsk = ) NULL,
614 	_SI( .free_fsk = ) NULL,
615 	_SI( .new_queue = ) NULL,
616 	_SI( .free_queue = ) NULL,
617 	_SI( .getconfig = )  fq_codel_getconfig,
618 	_SI( .ref_count = ) 0
619 };
620 
621 DECLARE_DNSCHED_MODULE(dn_fq_codel, &fq_codel_desc);
622