From: Kevin Darbyshire-Bryant Date: Sat, 31 Dec 2016 17:15:56 +0000 (+0000) Subject: iproute2: cake: add 'mpu' minimum packet length support X-Git-Tag: v18.06.0-rc1~3947 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a40f3f90d61146d369dc13083e06fef69c08cdb3;p=oweals%2Fopenwrt.git iproute2: cake: add 'mpu' minimum packet length support Add 'mpu' minimum length packet size parameter for scheduling/bandwidth accounting. Signed-off-by: Kevin Darbyshire-Bryant --- diff --git a/package/network/utils/iproute2/Makefile b/package/network/utils/iproute2/Makefile index 620cce22a0..196b844892 100644 --- a/package/network/utils/iproute2/Makefile +++ b/package/network/utils/iproute2/Makefile @@ -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 diff --git a/package/network/utils/iproute2/patches/950-add-cake-to-tc.patch b/package/network/utils/iproute2/patches/950-add-cake-to-tc.patch index 6c73fbaf25..9ebc4937d2 100644 --- a/package/network/utils/iproute2/patches/950-add-cake-to-tc.patch +++ b/package/network/utils/iproute2/patches/950-add-cake-to-tc.patch @@ -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 + * @@ -130,7 +131,7 @@ + " [ 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"); @@ -149,6 +150,7 @@ + bool overhead_set = false; + bool overhead_override = false; + int wash = -1; ++ int mpu = 0; + int flowmode = -1; + int nat = -1; + int atm = -1; @@ -332,6 +334,7 @@ + * 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) { @@ -347,6 +350,7 @@ + atm = 0; + overhead += 18; + overhead_set = true; ++ mpu = 64; + + } else if (strcmp(*argv, "overhead") == 0) { + char* p = NULL; @@ -358,6 +362,15 @@ + } + 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)) { @@ -392,6 +405,8 @@ + 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) @@ -420,6 +435,7 @@ + unsigned memlimit = 0; + int overhead = 0; + int ethernet = 0; ++ int mpu = 0; + int atm = 0; + int nat = 0; + int autorate = 0; @@ -525,6 +541,10 @@ + 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]); @@ -558,6 +578,10 @@ + fprintf(f, "via-ethernet "); + } + ++ if (mpu) { ++ fprintf(f, "mpu %d ", mpu); ++ } ++ + if (memlimit) + fprintf(f, "memlimit %s", sprint_size(memlimit, b1)); +