lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191126115807.27843-1-gautamramk@gmail.com>
Date:   Tue, 26 Nov 2019 17:28:07 +0530
From:   Gautam Ramakrishnan <gautamramk@...il.com>
To:     stephen@...workplumber.org
Cc:     netdev@...r.kernel.org, Gautam Ramakrishnan <gautamramk@...il.com>,
        Leslie Monis <lesliemonis@...il.com>,
        "Mohit P . Tahiliani" <tahiliani@...k.edu.in>
Subject: [PATCH iproute2] tc: pie: add dq_rate_estimator option

PIE now uses per packet timestamps to calculate queuing
delay. The average dequeue rate based queue delay
calculation is now made optional. This patch adds the option
to enable or disable the use of Little's law to calculate
queuing delay.

Signed-off-by: Gautam Ramakrishnan <gautamramk@...il.com>
Signed-off-by: Leslie Monis <lesliemonis@...il.com>
Signed-off-by: Mohit P. Tahiliani <tahiliani@...k.edu.in>
---
 bash-completion/tc |  1 +
 man/man8/tc-pie.8  | 31 ++++++++++++++++++++++++++-----
 tc/q_pie.c         | 35 +++++++++++++++++++++++++++++------
 3 files changed, 56 insertions(+), 11 deletions(-)

diff --git a/bash-completion/tc b/bash-completion/tc
index 007e1c2e..fe0d51ec 100644
--- a/bash-completion/tc
+++ b/bash-completion/tc
@@ -323,6 +323,7 @@ _tc_qdisc_options()
             _tc_once_attr 'limit target tupdate alpha beta'
             _tc_one_of_list 'bytemode nobytemode'
             _tc_one_of_list 'ecn noecn'
+            _tc_one_of_list 'dq_rate_estimator no_dq_rate_estimator'
             return 0
             ;;
         red)
diff --git a/man/man8/tc-pie.8 b/man/man8/tc-pie.8
index a302132f..bdcfba51 100644
--- a/man/man8/tc-pie.8
+++ b/man/man8/tc-pie.8
@@ -21,6 +21,10 @@ int ] [
 .B bytemode
 |
 .B nobytemode
+] [
+.B dq_rate_estimator
+|
+.B no_dq_rate_estimator
 ]
 
 .SH DESCRIPTION
@@ -71,7 +75,7 @@ alpha and beta are parameters chosen to control the drop probability. These
 should be in the range between 0 and 32.
 
 .SS ecn | noecn
-is used to mark packets instead of dropping
+is used to mark packets instead of dropping.
 .B ecn
 to turn on ecn mode,
 .B noecn
@@ -80,7 +84,7 @@ to turn off ecn mode. By default,
 is turned off.
 
 .SS bytemode | nobytemode
-is used to scale drop probability proportional to packet size
+is used to scale drop probability proportional to packet size.
 .B bytemode
 to turn on bytemode,
 .B nobytemode
@@ -88,21 +92,38 @@ to turn off bytemode. By default,
 .B bytemode
 is turned off.
 
+.SS dq_rate_estimator | no_dq_rate_estimator
+is used to calculate delay using Little's law.
+.B dq_rate_estimator
+to turn on dq_rate_estimator,
+.B no_dq_rate_estimator
+to turn off no_dq_rate_estimator. By default,
+.B dq_rate_estimator
+is turned off.
+
 .SH EXAMPLES
  # tc qdisc add dev eth0 root pie
  # tc -s qdisc show
    qdisc pie 8036: dev eth0 root refcnt 2 limit 1000p target 15.0ms tupdate 16.0ms alpha 2 beta 20
     Sent 31216108 bytes 20800 pkt (dropped 80, overlimits 0 requeues 0)
     backlog 16654b 11p requeues 0
-   prob 0.006161 delay 15666us avg_dq_rate 1159667
+   prob 0.006161 delay 15666us
    pkts_in 20811 overlimit 0 dropped 80 maxq 50 ecn_mark 0
 
+ # tc qdisc add dev eth0 root pie dq_rate_estimator
+ # tc -s qdisc show
+   qdisc pie 8036: dev eth0 root refcnt 2 limit 1000p target 15.0ms tupdate 16.0ms alpha 2 beta 20
+    Sent 63947420 bytes 42414 pkt (dropped 41, overlimits 0 requeues 0)
+    backlog 271006b 179p requeues 0
+   prob 0.000092 delay 22200us avg_dq_rate 12145996
+   pkts_in 41 overlimit 343 dropped 0 maxq 50 ecn_mark 0
+
  # tc qdisc add dev eth0 root pie limit 100 target 20ms tupdate 30ms ecn
  # tc -s qdisc show
    qdisc pie 8036: dev eth0 root refcnt 2 limit 100p target 20.0ms tupdate 32.0ms alpha 2 beta 20 ecn
     Sent 6591724 bytes 4442 pkt (dropped 27, overlimits 0 requeues 0)
     backlog 18168b 12p requeues 0
-   prob 0.008845 delay 11348us avg_dq_rate 1342773
+   prob 0.008845 delay 11348us
    pkts_in 4454 overlimit 0 dropped 27 maxq 65 ecn_mark 0
 
  # tc qdisc add dev eth0 root pie limit 100 target 50ms tupdate 30ms bytemode
@@ -110,7 +131,7 @@ is turned off.
    qdisc pie 8036: dev eth0 root refcnt 2 limit 100p target 50.0ms tupdate 32.0ms alpha 2 beta 20 bytemode
     Sent 1616274 bytes 1137 pkt (dropped 0, overlimits 0 requeues 0)
     backlog 13626b 9p requeues 0
-   prob 0.000000 delay 0us avg_dq_rate 0
+   prob 0.000000 delay 0us
    pkts_in 1146 overlimit 0 dropped 0 maxq 23 ecn_mark 0
 
 .SH SEE ALSO
diff --git a/tc/q_pie.c b/tc/q_pie.c
index 40982f96..935548a2 100644
--- a/tc/q_pie.c
+++ b/tc/q_pie.c
@@ -31,9 +31,10 @@
 static void explain(void)
 {
 	fprintf(stderr,
-		"Usage: ... pie	[ limit PACKETS ][ target TIME us]\n"
-		"		[ tupdate TIME us][ alpha ALPHA ]"
-		"[beta BETA ][bytemode | nobytemode][ecn | noecn ]\n");
+		"Usage: ... pie [ limit PACKETS ] [ target TIME ]\n"
+		"               [ tupdate TIME ] [ alpha ALPHA ] [ beta BETA ]\n"
+		"               [ bytemode | nobytemode ] [ ecn | noecn ]\n"
+		"               [ dq_rate_estimator | no_dq_rate_estimator ]\n");
 }
 
 #define ALPHA_MAX 32
@@ -49,6 +50,7 @@ static int pie_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 	unsigned int beta    = 0;
 	int ecn = -1;
 	int bytemode = -1;
+	int dq_rate_estimator = -1;
 	struct rtattr *tail;
 
 	while (argc > 0) {
@@ -92,6 +94,10 @@ static int pie_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 			bytemode = 1;
 		} else if (strcmp(*argv, "nobytemode") == 0) {
 			bytemode = 0;
+		} else if (strcmp(*argv, "dq_rate_estimator") == 0) {
+			dq_rate_estimator = 1;
+		} else if (strcmp(*argv, "no_dq_rate_estimator") == 0) {
+			dq_rate_estimator = 0;
 		} else if (strcmp(*argv, "help") == 0) {
 			explain();
 			return -1;
@@ -120,6 +126,9 @@ static int pie_parse_opt(struct qdisc_util *qu, int argc, char **argv,
 	if (bytemode != -1)
 		addattr_l(n, 1024, TCA_PIE_BYTEMODE, &bytemode,
 			  sizeof(bytemode));
+	if (dq_rate_estimator != -1)
+		addattr_l(n, 1024, TCA_PIE_DQ_RATE_ESTIMATOR,
+			  &dq_rate_estimator, sizeof(dq_rate_estimator));
 
 	addattr_nest_end(n, tail);
 	return 0;
@@ -135,6 +144,7 @@ static int pie_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 	unsigned int beta;
 	unsigned int ecn;
 	unsigned int bytemode;
+	unsigned int dq_rate_estimator;
 
 	SPRINT_BUF(b1);
 
@@ -182,6 +192,14 @@ static int pie_print_opt(struct qdisc_util *qu, FILE *f, struct rtattr *opt)
 			fprintf(f, "bytemode ");
 	}
 
+	if (tb[TCA_PIE_DQ_RATE_ESTIMATOR] &&
+	    RTA_PAYLOAD(tb[TCA_PIE_DQ_RATE_ESTIMATOR]) >= sizeof(__u32)) {
+		dq_rate_estimator =
+				rta_getattr_u32(tb[TCA_PIE_DQ_RATE_ESTIMATOR]);
+		if (dq_rate_estimator)
+			fprintf(f, "dq_rate_estimator ");
+	}
+
 	return 0;
 }
 
@@ -198,9 +216,14 @@ static int pie_print_xstats(struct qdisc_util *qu, FILE *f,
 
 	st = RTA_DATA(xstats);
 	/*prob is returned as a fracion of maximum integer value */
-	fprintf(f, "prob %f delay %uus avg_dq_rate %u\n",
-		(double)st->prob / UINT64_MAX, st->delay,
-		st->avg_dq_rate);
+	fprintf(f, "prob %f delay %uus",
+		(double)st->prob / UINT64_MAX, st->delay);
+
+	if (st->dq_rate_estimating)
+		fprintf(f, " avg_dq_rate %u\n", st->avg_dq_rate);
+	else
+		fprintf(f, "\n");
+
 	fprintf(f, "pkts_in %u overlimit %u dropped %u maxq %u ecn_mark %u\n",
 		st->packets_in, st->overlimit, st->dropped, st->maxq,
 		st->ecn_mark);
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ