sch_fq_pie.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /* Flow Queue PIE discipline
  3. *
  4. * Copyright (C) 2019 Mohit P. Tahiliani <tahiliani@nitk.edu.in>
  5. * Copyright (C) 2019 Sachin D. Patil <sdp.sachin@gmail.com>
  6. * Copyright (C) 2019 V. Saicharan <vsaicharan1998@gmail.com>
  7. * Copyright (C) 2019 Mohit Bhasi <mohitbhasi1998@gmail.com>
  8. * Copyright (C) 2019 Leslie Monis <lesliemonis@gmail.com>
  9. * Copyright (C) 2019 Gautam Ramakrishnan <gautamramk@gmail.com>
  10. */
  11. #include <linux/jhash.h>
  12. #include <linux/module.h>
  13. #include <linux/sizes.h>
  14. #include <linux/vmalloc.h>
  15. #include <net/pkt_cls.h>
  16. #include <net/pie.h>
  17. /* Flow Queue PIE
  18. *
  19. * Principles:
  20. * - Packets are classified on flows.
  21. * - This is a Stochastic model (as we use a hash, several flows might
  22. * be hashed to the same slot)
  23. * - Each flow has a PIE managed queue.
  24. * - Flows are linked onto two (Round Robin) lists,
  25. * so that new flows have priority on old ones.
  26. * - For a given flow, packets are not reordered.
  27. * - Drops during enqueue only.
  28. * - ECN capability is off by default.
  29. * - ECN threshold (if ECN is enabled) is at 10% by default.
  30. * - Uses timestamps to calculate queue delay by default.
  31. */
  32. /**
  33. * struct fq_pie_flow - contains data for each flow
  34. * @vars: pie vars associated with the flow
  35. * @deficit: number of remaining byte credits
  36. * @backlog: size of data in the flow
  37. * @qlen: number of packets in the flow
  38. * @flowchain: flowchain for the flow
  39. * @head: first packet in the flow
  40. * @tail: last packet in the flow
  41. */
  42. struct fq_pie_flow {
  43. struct pie_vars vars;
  44. s32 deficit;
  45. u32 backlog;
  46. u32 qlen;
  47. struct list_head flowchain;
  48. struct sk_buff *head;
  49. struct sk_buff *tail;
  50. };
  51. struct fq_pie_sched_data {
  52. struct tcf_proto __rcu *filter_list; /* optional external classifier */
  53. struct tcf_block *block;
  54. struct fq_pie_flow *flows;
  55. struct Qdisc *sch;
  56. struct list_head old_flows;
  57. struct list_head new_flows;
  58. struct pie_params p_params;
  59. u32 ecn_prob;
  60. u32 flows_cnt;
  61. u32 flows_cursor;
  62. u32 quantum;
  63. u32 memory_limit;
  64. u32 new_flow_count;
  65. u32 memory_usage;
  66. u32 overmemory;
  67. struct pie_stats stats;
  68. struct timer_list adapt_timer;
  69. };
  70. static unsigned int fq_pie_hash(const struct fq_pie_sched_data *q,
  71. struct sk_buff *skb)
  72. {
  73. return reciprocal_scale(skb_get_hash(skb), q->flows_cnt);
  74. }
  75. static unsigned int fq_pie_classify(struct sk_buff *skb, struct Qdisc *sch,
  76. int *qerr)
  77. {
  78. struct fq_pie_sched_data *q = qdisc_priv(sch);
  79. struct tcf_proto *filter;
  80. struct tcf_result res;
  81. int result;
  82. if (TC_H_MAJ(skb->priority) == sch->handle &&
  83. TC_H_MIN(skb->priority) > 0 &&
  84. TC_H_MIN(skb->priority) <= q->flows_cnt)
  85. return TC_H_MIN(skb->priority);
  86. filter = rcu_dereference_bh(q->filter_list);
  87. if (!filter)
  88. return fq_pie_hash(q, skb) + 1;
  89. *qerr = NET_XMIT_SUCCESS | __NET_XMIT_BYPASS;
  90. result = tcf_classify(skb, NULL, filter, &res, false);
  91. if (result >= 0) {
  92. #ifdef CONFIG_NET_CLS_ACT
  93. switch (result) {
  94. case TC_ACT_STOLEN:
  95. case TC_ACT_QUEUED:
  96. case TC_ACT_TRAP:
  97. *qerr = NET_XMIT_SUCCESS | __NET_XMIT_STOLEN;
  98. fallthrough;
  99. case TC_ACT_SHOT:
  100. return 0;
  101. }
  102. #endif
  103. if (TC_H_MIN(res.classid) <= q->flows_cnt)
  104. return TC_H_MIN(res.classid);
  105. }
  106. return 0;
  107. }
  108. /* add skb to flow queue (tail add) */
  109. static inline void flow_queue_add(struct fq_pie_flow *flow,
  110. struct sk_buff *skb)
  111. {
  112. if (!flow->head)
  113. flow->head = skb;
  114. else
  115. flow->tail->next = skb;
  116. flow->tail = skb;
  117. skb->next = NULL;
  118. }
  119. static int fq_pie_qdisc_enqueue(struct sk_buff *skb, struct Qdisc *sch,
  120. struct sk_buff **to_free)
  121. {
  122. enum skb_drop_reason reason = SKB_DROP_REASON_QDISC_OVERLIMIT;
  123. struct fq_pie_sched_data *q = qdisc_priv(sch);
  124. struct fq_pie_flow *sel_flow;
  125. int ret;
  126. u8 memory_limited = false;
  127. u8 enqueue = false;
  128. u32 pkt_len;
  129. u32 idx;
  130. /* Classifies packet into corresponding flow */
  131. idx = fq_pie_classify(skb, sch, &ret);
  132. if (idx == 0) {
  133. if (ret & __NET_XMIT_BYPASS)
  134. qdisc_qstats_drop(sch);
  135. __qdisc_drop(skb, to_free);
  136. return ret;
  137. }
  138. idx--;
  139. sel_flow = &q->flows[idx];
  140. /* Checks whether adding a new packet would exceed memory limit */
  141. get_pie_cb(skb)->mem_usage = skb->truesize;
  142. memory_limited = q->memory_usage > q->memory_limit + skb->truesize;
  143. /* Checks if the qdisc is full */
  144. if (unlikely(qdisc_qlen(sch) >= sch->limit)) {
  145. q->stats.overlimit++;
  146. goto out;
  147. } else if (unlikely(memory_limited)) {
  148. q->overmemory++;
  149. }
  150. reason = SKB_DROP_REASON_QDISC_CONGESTED;
  151. if (!pie_drop_early(sch, &q->p_params, &sel_flow->vars,
  152. sel_flow->backlog, skb->len)) {
  153. enqueue = true;
  154. } else if (q->p_params.ecn &&
  155. sel_flow->vars.prob <= (MAX_PROB / 100) * q->ecn_prob &&
  156. INET_ECN_set_ce(skb)) {
  157. /* If packet is ecn capable, mark it if drop probability
  158. * is lower than the parameter ecn_prob, else drop it.
  159. */
  160. q->stats.ecn_mark++;
  161. enqueue = true;
  162. }
  163. if (enqueue) {
  164. /* Set enqueue time only when dq_rate_estimator is disabled. */
  165. if (!q->p_params.dq_rate_estimator)
  166. pie_set_enqueue_time(skb);
  167. pkt_len = qdisc_pkt_len(skb);
  168. q->stats.packets_in++;
  169. q->memory_usage += skb->truesize;
  170. sch->qstats.backlog += pkt_len;
  171. sch->q.qlen++;
  172. flow_queue_add(sel_flow, skb);
  173. if (list_empty(&sel_flow->flowchain)) {
  174. list_add_tail(&sel_flow->flowchain, &q->new_flows);
  175. q->new_flow_count++;
  176. sel_flow->deficit = q->quantum;
  177. sel_flow->qlen = 0;
  178. sel_flow->backlog = 0;
  179. }
  180. sel_flow->qlen++;
  181. sel_flow->backlog += pkt_len;
  182. return NET_XMIT_SUCCESS;
  183. }
  184. out:
  185. q->stats.dropped++;
  186. sel_flow->vars.accu_prob = 0;
  187. qdisc_drop_reason(skb, sch, to_free, reason);
  188. return NET_XMIT_CN;
  189. }
  190. static const struct netlink_range_validation fq_pie_q_range = {
  191. .min = 1,
  192. .max = 1 << 20,
  193. };
  194. static const struct nla_policy fq_pie_policy[TCA_FQ_PIE_MAX + 1] = {
  195. [TCA_FQ_PIE_LIMIT] = {.type = NLA_U32},
  196. [TCA_FQ_PIE_FLOWS] = {.type = NLA_U32},
  197. [TCA_FQ_PIE_TARGET] = {.type = NLA_U32},
  198. [TCA_FQ_PIE_TUPDATE] = {.type = NLA_U32},
  199. [TCA_FQ_PIE_ALPHA] = {.type = NLA_U32},
  200. [TCA_FQ_PIE_BETA] = {.type = NLA_U32},
  201. [TCA_FQ_PIE_QUANTUM] =
  202. NLA_POLICY_FULL_RANGE(NLA_U32, &fq_pie_q_range),
  203. [TCA_FQ_PIE_MEMORY_LIMIT] = {.type = NLA_U32},
  204. [TCA_FQ_PIE_ECN_PROB] = {.type = NLA_U32},
  205. [TCA_FQ_PIE_ECN] = {.type = NLA_U32},
  206. [TCA_FQ_PIE_BYTEMODE] = {.type = NLA_U32},
  207. [TCA_FQ_PIE_DQ_RATE_ESTIMATOR] = {.type = NLA_U32},
  208. };
  209. static inline struct sk_buff *dequeue_head(struct fq_pie_flow *flow)
  210. {
  211. struct sk_buff *skb = flow->head;
  212. flow->head = skb->next;
  213. skb->next = NULL;
  214. return skb;
  215. }
  216. static struct sk_buff *fq_pie_qdisc_dequeue(struct Qdisc *sch)
  217. {
  218. struct fq_pie_sched_data *q = qdisc_priv(sch);
  219. struct sk_buff *skb = NULL;
  220. struct fq_pie_flow *flow;
  221. struct list_head *head;
  222. u32 pkt_len;
  223. begin:
  224. head = &q->new_flows;
  225. if (list_empty(head)) {
  226. head = &q->old_flows;
  227. if (list_empty(head))
  228. return NULL;
  229. }
  230. flow = list_first_entry(head, struct fq_pie_flow, flowchain);
  231. /* Flow has exhausted all its credits */
  232. if (flow->deficit <= 0) {
  233. flow->deficit += q->quantum;
  234. list_move_tail(&flow->flowchain, &q->old_flows);
  235. goto begin;
  236. }
  237. if (flow->head) {
  238. skb = dequeue_head(flow);
  239. pkt_len = qdisc_pkt_len(skb);
  240. sch->qstats.backlog -= pkt_len;
  241. sch->q.qlen--;
  242. qdisc_bstats_update(sch, skb);
  243. }
  244. if (!skb) {
  245. /* force a pass through old_flows to prevent starvation */
  246. if (head == &q->new_flows && !list_empty(&q->old_flows))
  247. list_move_tail(&flow->flowchain, &q->old_flows);
  248. else
  249. list_del_init(&flow->flowchain);
  250. goto begin;
  251. }
  252. flow->qlen--;
  253. flow->deficit -= pkt_len;
  254. flow->backlog -= pkt_len;
  255. q->memory_usage -= get_pie_cb(skb)->mem_usage;
  256. pie_process_dequeue(skb, &q->p_params, &flow->vars, flow->backlog);
  257. return skb;
  258. }
  259. static int fq_pie_change(struct Qdisc *sch, struct nlattr *opt,
  260. struct netlink_ext_ack *extack)
  261. {
  262. unsigned int dropped_pkts = 0, dropped_bytes = 0;
  263. struct fq_pie_sched_data *q = qdisc_priv(sch);
  264. struct nlattr *tb[TCA_FQ_PIE_MAX + 1];
  265. int err;
  266. err = nla_parse_nested(tb, TCA_FQ_PIE_MAX, opt, fq_pie_policy, extack);
  267. if (err < 0)
  268. return err;
  269. sch_tree_lock(sch);
  270. if (tb[TCA_FQ_PIE_LIMIT]) {
  271. u32 limit = nla_get_u32(tb[TCA_FQ_PIE_LIMIT]);
  272. WRITE_ONCE(q->p_params.limit, limit);
  273. WRITE_ONCE(sch->limit, limit);
  274. }
  275. if (tb[TCA_FQ_PIE_FLOWS]) {
  276. if (q->flows) {
  277. NL_SET_ERR_MSG_MOD(extack,
  278. "Number of flows cannot be changed");
  279. goto flow_error;
  280. }
  281. q->flows_cnt = nla_get_u32(tb[TCA_FQ_PIE_FLOWS]);
  282. if (!q->flows_cnt || q->flows_cnt > 65536) {
  283. NL_SET_ERR_MSG_MOD(extack,
  284. "Number of flows must range in [1..65536]");
  285. goto flow_error;
  286. }
  287. }
  288. /* convert from microseconds to pschedtime */
  289. if (tb[TCA_FQ_PIE_TARGET]) {
  290. /* target is in us */
  291. u32 target = nla_get_u32(tb[TCA_FQ_PIE_TARGET]);
  292. /* convert to pschedtime */
  293. WRITE_ONCE(q->p_params.target,
  294. PSCHED_NS2TICKS((u64)target * NSEC_PER_USEC));
  295. }
  296. /* tupdate is in jiffies */
  297. if (tb[TCA_FQ_PIE_TUPDATE])
  298. WRITE_ONCE(q->p_params.tupdate,
  299. usecs_to_jiffies(nla_get_u32(tb[TCA_FQ_PIE_TUPDATE])));
  300. if (tb[TCA_FQ_PIE_ALPHA])
  301. WRITE_ONCE(q->p_params.alpha,
  302. nla_get_u32(tb[TCA_FQ_PIE_ALPHA]));
  303. if (tb[TCA_FQ_PIE_BETA])
  304. WRITE_ONCE(q->p_params.beta,
  305. nla_get_u32(tb[TCA_FQ_PIE_BETA]));
  306. if (tb[TCA_FQ_PIE_QUANTUM])
  307. WRITE_ONCE(q->quantum, nla_get_u32(tb[TCA_FQ_PIE_QUANTUM]));
  308. if (tb[TCA_FQ_PIE_MEMORY_LIMIT])
  309. WRITE_ONCE(q->memory_limit,
  310. nla_get_u32(tb[TCA_FQ_PIE_MEMORY_LIMIT]));
  311. if (tb[TCA_FQ_PIE_ECN_PROB])
  312. WRITE_ONCE(q->ecn_prob,
  313. nla_get_u32(tb[TCA_FQ_PIE_ECN_PROB]));
  314. if (tb[TCA_FQ_PIE_ECN])
  315. WRITE_ONCE(q->p_params.ecn,
  316. nla_get_u32(tb[TCA_FQ_PIE_ECN]));
  317. if (tb[TCA_FQ_PIE_BYTEMODE])
  318. WRITE_ONCE(q->p_params.bytemode,
  319. nla_get_u32(tb[TCA_FQ_PIE_BYTEMODE]));
  320. if (tb[TCA_FQ_PIE_DQ_RATE_ESTIMATOR])
  321. WRITE_ONCE(q->p_params.dq_rate_estimator,
  322. nla_get_u32(tb[TCA_FQ_PIE_DQ_RATE_ESTIMATOR]));
  323. /* Drop excess packets if new limit is lower */
  324. while (sch->q.qlen > sch->limit) {
  325. struct sk_buff *skb = qdisc_dequeue_internal(sch, false);
  326. if (!skb)
  327. break;
  328. dropped_pkts++;
  329. dropped_bytes += qdisc_pkt_len(skb);
  330. rtnl_kfree_skbs(skb, skb);
  331. }
  332. qdisc_tree_reduce_backlog(sch, dropped_pkts, dropped_bytes);
  333. sch_tree_unlock(sch);
  334. return 0;
  335. flow_error:
  336. sch_tree_unlock(sch);
  337. return -EINVAL;
  338. }
  339. static void fq_pie_timer(struct timer_list *t)
  340. {
  341. struct fq_pie_sched_data *q = timer_container_of(q, t, adapt_timer);
  342. unsigned long next, tupdate;
  343. struct Qdisc *sch = q->sch;
  344. spinlock_t *root_lock; /* to lock qdisc for probability calculations */
  345. int max_cnt, i;
  346. rcu_read_lock();
  347. root_lock = qdisc_lock(qdisc_root_sleeping(sch));
  348. spin_lock(root_lock);
  349. /* Limit this expensive loop to 2048 flows per round. */
  350. max_cnt = min_t(int, q->flows_cnt - q->flows_cursor, 2048);
  351. for (i = 0; i < max_cnt; i++) {
  352. pie_calculate_probability(&q->p_params,
  353. &q->flows[q->flows_cursor].vars,
  354. q->flows[q->flows_cursor].backlog);
  355. q->flows_cursor++;
  356. }
  357. tupdate = q->p_params.tupdate;
  358. next = 0;
  359. if (q->flows_cursor >= q->flows_cnt) {
  360. q->flows_cursor = 0;
  361. next = tupdate;
  362. }
  363. if (tupdate)
  364. mod_timer(&q->adapt_timer, jiffies + next);
  365. spin_unlock(root_lock);
  366. rcu_read_unlock();
  367. }
  368. static int fq_pie_init(struct Qdisc *sch, struct nlattr *opt,
  369. struct netlink_ext_ack *extack)
  370. {
  371. struct fq_pie_sched_data *q = qdisc_priv(sch);
  372. int err;
  373. u32 idx;
  374. pie_params_init(&q->p_params);
  375. sch->limit = 10 * 1024;
  376. q->p_params.limit = sch->limit;
  377. q->quantum = psched_mtu(qdisc_dev(sch));
  378. q->sch = sch;
  379. q->ecn_prob = 10;
  380. q->flows_cnt = 1024;
  381. q->memory_limit = SZ_32M;
  382. INIT_LIST_HEAD(&q->new_flows);
  383. INIT_LIST_HEAD(&q->old_flows);
  384. timer_setup(&q->adapt_timer, fq_pie_timer, 0);
  385. if (opt) {
  386. err = fq_pie_change(sch, opt, extack);
  387. if (err)
  388. return err;
  389. }
  390. err = tcf_block_get(&q->block, &q->filter_list, sch, extack);
  391. if (err)
  392. goto init_failure;
  393. q->flows = kvzalloc_objs(struct fq_pie_flow, q->flows_cnt);
  394. if (!q->flows) {
  395. err = -ENOMEM;
  396. goto init_failure;
  397. }
  398. for (idx = 0; idx < q->flows_cnt; idx++) {
  399. struct fq_pie_flow *flow = q->flows + idx;
  400. INIT_LIST_HEAD(&flow->flowchain);
  401. pie_vars_init(&flow->vars);
  402. }
  403. mod_timer(&q->adapt_timer, jiffies + HZ / 2);
  404. return 0;
  405. init_failure:
  406. q->flows_cnt = 0;
  407. return err;
  408. }
  409. static int fq_pie_dump(struct Qdisc *sch, struct sk_buff *skb)
  410. {
  411. struct fq_pie_sched_data *q = qdisc_priv(sch);
  412. struct nlattr *opts;
  413. opts = nla_nest_start(skb, TCA_OPTIONS);
  414. if (!opts)
  415. return -EMSGSIZE;
  416. /* convert target from pschedtime to us */
  417. if (nla_put_u32(skb, TCA_FQ_PIE_LIMIT, READ_ONCE(sch->limit)) ||
  418. nla_put_u32(skb, TCA_FQ_PIE_FLOWS, READ_ONCE(q->flows_cnt)) ||
  419. nla_put_u32(skb, TCA_FQ_PIE_TARGET,
  420. ((u32)PSCHED_TICKS2NS(READ_ONCE(q->p_params.target))) /
  421. NSEC_PER_USEC) ||
  422. nla_put_u32(skb, TCA_FQ_PIE_TUPDATE,
  423. jiffies_to_usecs(READ_ONCE(q->p_params.tupdate))) ||
  424. nla_put_u32(skb, TCA_FQ_PIE_ALPHA, READ_ONCE(q->p_params.alpha)) ||
  425. nla_put_u32(skb, TCA_FQ_PIE_BETA, READ_ONCE(q->p_params.beta)) ||
  426. nla_put_u32(skb, TCA_FQ_PIE_QUANTUM, READ_ONCE(q->quantum)) ||
  427. nla_put_u32(skb, TCA_FQ_PIE_MEMORY_LIMIT,
  428. READ_ONCE(q->memory_limit)) ||
  429. nla_put_u32(skb, TCA_FQ_PIE_ECN_PROB, READ_ONCE(q->ecn_prob)) ||
  430. nla_put_u32(skb, TCA_FQ_PIE_ECN, READ_ONCE(q->p_params.ecn)) ||
  431. nla_put_u32(skb, TCA_FQ_PIE_BYTEMODE, READ_ONCE(q->p_params.bytemode)) ||
  432. nla_put_u32(skb, TCA_FQ_PIE_DQ_RATE_ESTIMATOR,
  433. READ_ONCE(q->p_params.dq_rate_estimator)))
  434. goto nla_put_failure;
  435. return nla_nest_end(skb, opts);
  436. nla_put_failure:
  437. nla_nest_cancel(skb, opts);
  438. return -EMSGSIZE;
  439. }
  440. static int fq_pie_dump_stats(struct Qdisc *sch, struct gnet_dump *d)
  441. {
  442. struct fq_pie_sched_data *q = qdisc_priv(sch);
  443. struct tc_fq_pie_xstats st = {
  444. .packets_in = q->stats.packets_in,
  445. .overlimit = q->stats.overlimit,
  446. .overmemory = q->overmemory,
  447. .dropped = q->stats.dropped,
  448. .ecn_mark = q->stats.ecn_mark,
  449. .new_flow_count = q->new_flow_count,
  450. .memory_usage = q->memory_usage,
  451. };
  452. struct list_head *pos;
  453. sch_tree_lock(sch);
  454. list_for_each(pos, &q->new_flows)
  455. st.new_flows_len++;
  456. list_for_each(pos, &q->old_flows)
  457. st.old_flows_len++;
  458. sch_tree_unlock(sch);
  459. return gnet_stats_copy_app(d, &st, sizeof(st));
  460. }
  461. static void fq_pie_reset(struct Qdisc *sch)
  462. {
  463. struct fq_pie_sched_data *q = qdisc_priv(sch);
  464. u32 idx;
  465. INIT_LIST_HEAD(&q->new_flows);
  466. INIT_LIST_HEAD(&q->old_flows);
  467. for (idx = 0; idx < q->flows_cnt; idx++) {
  468. struct fq_pie_flow *flow = q->flows + idx;
  469. /* Removes all packets from flow */
  470. rtnl_kfree_skbs(flow->head, flow->tail);
  471. flow->head = NULL;
  472. INIT_LIST_HEAD(&flow->flowchain);
  473. pie_vars_init(&flow->vars);
  474. }
  475. }
  476. static void fq_pie_destroy(struct Qdisc *sch)
  477. {
  478. struct fq_pie_sched_data *q = qdisc_priv(sch);
  479. tcf_block_put(q->block);
  480. q->p_params.tupdate = 0;
  481. timer_delete_sync(&q->adapt_timer);
  482. kvfree(q->flows);
  483. }
  484. static struct Qdisc_ops fq_pie_qdisc_ops __read_mostly = {
  485. .id = "fq_pie",
  486. .priv_size = sizeof(struct fq_pie_sched_data),
  487. .enqueue = fq_pie_qdisc_enqueue,
  488. .dequeue = fq_pie_qdisc_dequeue,
  489. .peek = qdisc_peek_dequeued,
  490. .init = fq_pie_init,
  491. .destroy = fq_pie_destroy,
  492. .reset = fq_pie_reset,
  493. .change = fq_pie_change,
  494. .dump = fq_pie_dump,
  495. .dump_stats = fq_pie_dump_stats,
  496. .owner = THIS_MODULE,
  497. };
  498. MODULE_ALIAS_NET_SCH("fq_pie");
  499. static int __init fq_pie_module_init(void)
  500. {
  501. return register_qdisc(&fq_pie_qdisc_ops);
  502. }
  503. static void __exit fq_pie_module_exit(void)
  504. {
  505. unregister_qdisc(&fq_pie_qdisc_ops);
  506. }
  507. module_init(fq_pie_module_init);
  508. module_exit(fq_pie_module_exit);
  509. MODULE_DESCRIPTION("Flow Queue Proportional Integral controller Enhanced (FQ-PIE)");
  510. MODULE_AUTHOR("Mohit P. Tahiliani");
  511. MODULE_LICENSE("GPL");