662-remove_pfifo_fast.patch 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. From b531d492d5ef1cf9dba0f4888eb5fd8624a6d762 Mon Sep 17 00:00:00 2001
  2. From: Felix Fietkau <[email protected]>
  3. Date: Fri, 7 Jul 2017 17:23:42 +0200
  4. Subject: net: sched: switch default qdisc from pfifo_fast to fq_codel and remove pfifo_fast
  5. Signed-off-by: Felix Fietkau <[email protected]>
  6. ---
  7. net/sched/sch_generic.c | 140 ------------------------------------------------
  8. 1 file changed, 140 deletions(-)
  9. diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
  10. index 97de97e3c5e2..a62de9e4e897 100644
  11. --- a/net/sched/sch_generic.c
  12. +++ b/net/sched/sch_generic.c
  13. @@ -449,146 +449,6 @@ struct Qdisc_ops noqueue_qdisc_ops __read_mostly = {
  14. .owner = THIS_MODULE,
  15. };
  16. -static const u8 prio2band[TC_PRIO_MAX + 1] = {
  17. - 1, 2, 2, 2, 1, 2, 0, 0 , 1, 1, 1, 1, 1, 1, 1, 1
  18. -};
  19. -
  20. -/* 3-band FIFO queue: old style, but should be a bit faster than
  21. - generic prio+fifo combination.
  22. - */
  23. -
  24. -#define PFIFO_FAST_BANDS 3
  25. -
  26. -/*
  27. - * Private data for a pfifo_fast scheduler containing:
  28. - * - queues for the three band
  29. - * - bitmap indicating which of the bands contain skbs
  30. - */
  31. -struct pfifo_fast_priv {
  32. - u32 bitmap;
  33. - struct qdisc_skb_head q[PFIFO_FAST_BANDS];
  34. -};
  35. -
  36. -/*
  37. - * Convert a bitmap to the first band number where an skb is queued, where:
  38. - * bitmap=0 means there are no skbs on any band.
  39. - * bitmap=1 means there is an skb on band 0.
  40. - * bitmap=7 means there are skbs on all 3 bands, etc.
  41. - */
  42. -static const int bitmap2band[] = {-1, 0, 1, 0, 2, 0, 1, 0};
  43. -
  44. -static inline struct qdisc_skb_head *band2list(struct pfifo_fast_priv *priv,
  45. - int band)
  46. -{
  47. - return priv->q + band;
  48. -}
  49. -
  50. -static int pfifo_fast_enqueue(struct sk_buff *skb, struct Qdisc *qdisc,
  51. - struct sk_buff **to_free)
  52. -{
  53. - if (qdisc->q.qlen < qdisc_dev(qdisc)->tx_queue_len) {
  54. - int band = prio2band[skb->priority & TC_PRIO_MAX];
  55. - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
  56. - struct qdisc_skb_head *list = band2list(priv, band);
  57. -
  58. - priv->bitmap |= (1 << band);
  59. - qdisc->q.qlen++;
  60. - return __qdisc_enqueue_tail(skb, qdisc, list);
  61. - }
  62. -
  63. - return qdisc_drop(skb, qdisc, to_free);
  64. -}
  65. -
  66. -static struct sk_buff *pfifo_fast_dequeue(struct Qdisc *qdisc)
  67. -{
  68. - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
  69. - int band = bitmap2band[priv->bitmap];
  70. -
  71. - if (likely(band >= 0)) {
  72. - struct qdisc_skb_head *qh = band2list(priv, band);
  73. - struct sk_buff *skb = __qdisc_dequeue_head(qh);
  74. -
  75. - if (likely(skb != NULL)) {
  76. - qdisc_qstats_backlog_dec(qdisc, skb);
  77. - qdisc_bstats_update(qdisc, skb);
  78. - }
  79. -
  80. - qdisc->q.qlen--;
  81. - if (qh->qlen == 0)
  82. - priv->bitmap &= ~(1 << band);
  83. -
  84. - return skb;
  85. - }
  86. -
  87. - return NULL;
  88. -}
  89. -
  90. -static struct sk_buff *pfifo_fast_peek(struct Qdisc *qdisc)
  91. -{
  92. - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
  93. - int band = bitmap2band[priv->bitmap];
  94. -
  95. - if (band >= 0) {
  96. - struct qdisc_skb_head *qh = band2list(priv, band);
  97. -
  98. - return qh->head;
  99. - }
  100. -
  101. - return NULL;
  102. -}
  103. -
  104. -static void pfifo_fast_reset(struct Qdisc *qdisc)
  105. -{
  106. - int prio;
  107. - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
  108. -
  109. - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++)
  110. - __qdisc_reset_queue(band2list(priv, prio));
  111. -
  112. - priv->bitmap = 0;
  113. - qdisc->qstats.backlog = 0;
  114. - qdisc->q.qlen = 0;
  115. -}
  116. -
  117. -static int pfifo_fast_dump(struct Qdisc *qdisc, struct sk_buff *skb)
  118. -{
  119. - struct tc_prio_qopt opt = { .bands = PFIFO_FAST_BANDS };
  120. -
  121. - memcpy(&opt.priomap, prio2band, TC_PRIO_MAX + 1);
  122. - if (nla_put(skb, TCA_OPTIONS, sizeof(opt), &opt))
  123. - goto nla_put_failure;
  124. - return skb->len;
  125. -
  126. -nla_put_failure:
  127. - return -1;
  128. -}
  129. -
  130. -static int pfifo_fast_init(struct Qdisc *qdisc, struct nlattr *opt)
  131. -{
  132. - int prio;
  133. - struct pfifo_fast_priv *priv = qdisc_priv(qdisc);
  134. -
  135. - for (prio = 0; prio < PFIFO_FAST_BANDS; prio++)
  136. - qdisc_skb_head_init(band2list(priv, prio));
  137. -
  138. - /* Can by-pass the queue discipline */
  139. - qdisc->flags |= TCQ_F_CAN_BYPASS;
  140. - return 0;
  141. -}
  142. -
  143. -struct Qdisc_ops pfifo_fast_ops __read_mostly = {
  144. - .id = "pfifo_fast",
  145. - .priv_size = sizeof(struct pfifo_fast_priv),
  146. - .enqueue = pfifo_fast_enqueue,
  147. - .dequeue = pfifo_fast_dequeue,
  148. - .peek = pfifo_fast_peek,
  149. - .init = pfifo_fast_init,
  150. - .reset = pfifo_fast_reset,
  151. - .dump = pfifo_fast_dump,
  152. - .owner = THIS_MODULE,
  153. -};
  154. -EXPORT_SYMBOL(pfifo_fast_ops);
  155. -
  156. static struct lock_class_key qdisc_tx_busylock;
  157. static struct lock_class_key qdisc_running_key;
  158. --
  159. 2.11.0