iproute2: cake: add 'mpu' minimum packet length support
authorKevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
Sat, 31 Dec 2016 17:15:56 +0000 (17:15 +0000)
committerJo-Philipp Wich <jo@mein.io>
Wed, 1 Feb 2017 14:40:20 +0000 (15:40 +0100)
Add 'mpu' minimum length packet size parameter for scheduling/bandwidth
accounting.

Signed-off-by: Kevin Darbyshire-Bryant <kevin@darbyshire-bryant.me.uk>
package/network/utils/iproute2/Makefile
package/network/utils/iproute2/patches/950-add-cake-to-tc.patch

index 620cce22a05f66ae7f2d4c05cad5cbd541125ca0..196b8448925ea6bd76e00a0bc5a6d8f2ec0a96ac 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=iproute2
 PKG_VERSION:=4.4.0
-PKG_RELEASE:=6
+PKG_RELEASE:=7
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=@KERNEL/linux/utils/net/iproute2
index 6c73fbaf25cf9b0fda93e959b822917c268a66ba..9ebc4937d2fb5f8e5ec08e8c45eaa6b615205a8f 100644 (file)
@@ -1,6 +1,6 @@
 --- a/include/linux/pkt_sched.h
 +++ b/include/linux/pkt_sched.h
-@@ -850,4 +850,59 @@ struct tc_pie_xstats {
+@@ -850,4 +850,60 @@ struct tc_pie_xstats {
        __u32 maxq;             /* maximum queue size */
        __u32 ecn_mark;         /* packets marked with ecn*/
  };
@@ -13,6 +13,7 @@
 +      TCA_CAKE_ATM,
 +      TCA_CAKE_FLOW_MODE,
 +      TCA_CAKE_OVERHEAD,
++      TCA_CAKE_MPU,
 +      TCA_CAKE_RTT,
 +      TCA_CAKE_TARGET,
 +      TCA_CAKE_AUTORATE,
@@ -72,7 +73,7 @@
  
 --- /dev/null
 +++ b/tc/q_cake.c
-@@ -0,0 +1,663 @@
+@@ -0,0 +1,686 @@
 +/*
 + * Common Applications Kept Enhanced  --  CAKE
 + *
 +                      "                [ rtt TIME | datacentre | lan | metro | regional | internet* | oceanic | satellite | interplanetary ]\n"
 +                      "                [ besteffort | precedence | diffserv8 | diffserv4 | diffserv-llt | diffserv3* ]\n"
 +                      "                [ flowblind | srchost | dsthost | hosts | flows | dual-srchost | dual-dsthost | triple-isolate* ] [ nat | nonat* ]\n"
-+                      "                [ ptm | atm | noatm* ] [ overhead N | conservative | raw* ]\n"
++                      "                [ ptm | atm | noatm* ] [ overhead N | conservative | raw* ] [ mpu N ]\n"
 +                      "                [ wash | nowash* ]\n"
 +                      "                [ memlimit LIMIT ]\n"
 +                      "    (* marks defaults)\n");
 +      bool overhead_set = false;
 +      bool overhead_override = false;
 +      int wash = -1;
++      int mpu = 0;
 +      int flowmode = -1;
 +      int nat = -1;
 +      int atm = -1;
 +                       * you may need to add vlan tag */
 +                      overhead += 38;
 +                      overhead_set = true;
++                      mpu = 84;
 +
 +              /* Additional Ethernet-related overhead used by some ISPs */
 +              } else if (strcmp(*argv, "ether-vlan") == 0) {
 +                      atm = 0;
 +                      overhead += 18;
 +                      overhead_set = true;
++                      mpu = 64;
 +
 +              } else if (strcmp(*argv, "overhead") == 0) {
 +                      char* p = NULL;
 +                      }
 +                      overhead_set = true;
 +
++              } else if (strcmp(*argv, "mpu") == 0) {
++                      char* p = NULL;
++                      NEXT_ARG();
++                      mpu = strtol(*argv, &p, 10);
++                      if(!p || *p || !*argv || mpu < 0 || mpu > 256) {
++                              fprintf(stderr, "Illegal \"mpu\", valid range is 0 to 256\\n");
++                              return -1;
++                      }
++
 +              } else if (strcmp(*argv, "memlimit") == 0) {
 +                      NEXT_ARG();
 +                      if(get_size(&memlimit, *argv)) {
 +              unsigned zero = 0;
 +              addattr_l(n, 1024, TCA_CAKE_ETHERNET, &zero, sizeof(zero));
 +      }
++      if (mpu > 0)
++              addattr_l(n, 1024, TCA_CAKE_MPU, &mpu, sizeof(mpu));
 +      if (interval)
 +              addattr_l(n, 1024, TCA_CAKE_RTT, &interval, sizeof(interval));
 +      if (target)
 +      unsigned memlimit = 0;
 +      int overhead = 0;
 +      int ethernet = 0;
++      int mpu = 0;
 +      int atm = 0;
 +      int nat = 0;
 +      int autorate = 0;
 +          RTA_PAYLOAD(tb[TCA_CAKE_OVERHEAD]) >= sizeof(__u32)) {
 +              overhead = rta_getattr_u32(tb[TCA_CAKE_OVERHEAD]);
 +      }
++      if (tb[TCA_CAKE_MPU] &&
++          RTA_PAYLOAD(tb[TCA_CAKE_MPU]) >= sizeof(__u32)) {
++              mpu = rta_getattr_u32(tb[TCA_CAKE_MPU]);
++      }
 +      if (tb[TCA_CAKE_ETHERNET] &&
 +          RTA_PAYLOAD(tb[TCA_CAKE_ETHERNET]) >= sizeof(__u32)) {
 +              ethernet = rta_getattr_u32(tb[TCA_CAKE_ETHERNET]);
 +                      fprintf(f, "via-ethernet ");
 +      }
 +
++      if (mpu) {
++              fprintf(f, "mpu %d ", mpu);
++      }
++
 +      if (memlimit)
 +              fprintf(f, "memlimit %s", sprint_size(memlimit, b1));
 +