Advertisement
Guest User

Untitled

a guest
Nov 11th, 2017
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.10 KB | None | 0 0
  1. diff --git a/sch_cake.c b/sch_cake.c
  2. index 82f264f..a3a4a88 100644
  3. --- a/sch_cake.c
  4. +++ b/sch_cake.c
  5. @@ -769,6 +769,7 @@ static void cake_heapify_up(struct cake_sched_data *q, u16 i)
  6. }
  7.  
  8. static void cake_advance_shaper(struct cake_sched_data *q, struct cake_tin_data *b, u32 len, u64 now);
  9. +static void cake_advance_shaper2(struct cake_sched_data *q, struct cake_tin_data *b, u32 len, u64 now);
  10.  
  11. #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 8, 0)
  12. static unsigned int cake_drop(struct Qdisc *sch)
  13. @@ -1274,7 +1275,7 @@ retry:
  14. /* drop this packet, get another one */
  15. if(q->rate_flags & CAKE_FLAG_INGRESS) {
  16. len = cake_overhead(q, qdisc_pkt_len(skb));
  17. - cake_advance_shaper(q, b, len, now);
  18. + cake_advance_shaper2(q, b, len, now);
  19. flow->deficit -= len;
  20. b->tin_deficit -= len;
  21. }
  22. @@ -1286,8 +1287,6 @@ retry:
  23. qdisc_qstats_drop(sch);
  24. kfree_skb(skb);
  25. #endif
  26. - if(q->rate_flags & CAKE_FLAG_INGRESS)
  27. - goto retry;
  28. }
  29.  
  30. b->tin_ecn_mark += !!flow->cvars.ecn_marked;
  31. @@ -1351,6 +1350,24 @@ static void cake_advance_shaper(struct cake_sched_data *q, struct cake_tin_data
  32. }
  33. }
  34.  
  35. +static void cake_advance_shaper2(struct cake_sched_data *q, struct cake_tin_data *b, u32 len, u64 now)
  36. +{
  37. + /* charge packet bandwidth to this tin, lower tins,
  38. + * and to the global shaper.
  39. + */
  40. + if(q->rate_ns) {
  41. + s64 tdiff1 = b->tin_time_next_packet - now;
  42. + s64 tdiff2 = (len * (u64)b->tin_rate_ns) >> b->tin_rate_shft;
  43. + s64 tdiff3 = (len * (u64)q->rate_ns) >> q->rate_shft;
  44. +
  45. + if(tdiff1 < 0)
  46. + b->tin_time_next_packet += tdiff2;
  47. + else if(tdiff1 < tdiff2)
  48. + b->tin_time_next_packet = now + tdiff2;
  49. +
  50. + q->time_next_packet += (tdiff3*27)>>5;
  51. + }
  52. +}
  53. static void cake_reset(struct Qdisc *sch)
  54. {
  55. u32 c;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement