Skip to contentSkip to conversation

tc/m_estimator: Print proper value for estimator interval in raw.

PATCH In review Jamie Gloudon 2 participants 2 messages Jul 17, 2020 – Jul 19, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tc/m_estimator: Print proper value for estimator interval in raw.

While looking at the estimator code, I noticed an incorrect interval number printed in raw for the handles. This patch fixes the formatting.

Before patch:

[email protected]:~# tc -r filter add dev eth0 ingress estimator
250ms 999ms matchall action police avrate 12mbit conform-exceed drop
[estimator i=4294967294 e=2]

After patch:

[email protected]:~# tc -r filter add dev eth0 ingress estimator
250ms 999ms matchall action police avrate 12mbit conform-exceed drop
[estimator i=-2 e=2]
---
 tc/m_estimator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tc/m_estimator.c +1 -1
index ef62e1bb..b5f4c860 100644
@@ -57,7 +57,7 @@ int parse_estimator(int *p_argc, char ***p_argv, struct tc_estimator *est)
 		return -1;
 	}
 	if (show_raw)
-		fprintf(stderr, "[estimator i=%u e=%u]\n", est->interval, est->ewma_log);
+		fprintf(stderr, "[estimator i=%hhd e=%u]\n", est->interval, est->ewma_log);
 	*p_argc = argc;
 	*p_argv = argv;
 	return 0;

--
2.17.5

#1 lore raw
Quoted 34 lines · On Fri, 17 Jul 2020 11:05:30 -0400 Jamie Gloudon <[email protected]> wrote:

While looking at the estimator code, I noticed an incorrect interval number printed in raw for the handles. This patch fixes the formatting.

Before patch:

[email protected]:~# tc -r filter add dev eth0 ingress estimator
250ms 999ms matchall action police avrate 12mbit conform-exceed drop
[estimator i=4294967294 e=2]

After patch:

[email protected]:~# tc -r filter add dev eth0 ingress estimator
250ms 999ms matchall action police avrate 12mbit conform-exceed drop
[estimator i=-2 e=2]
---
 tc/m_estimator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tc/m_estimator.c +1 -2
index ef62e1bb..b5f4c860 100644
@@ -57,7 +57,7 @@ int parse_estimator(int *p_argc, char ***p_argv, struct tc_estimator *est)
 		return -1;
 	}
 	if (show_raw)
-		fprintf(stderr, "[estimator i=%u e=%u]\n", est->interval, est->ewma_log);
+		fprintf(stderr, "[estimator i=%hhd e=%u]\n", est->interval, est->ewma_log);
 	*p_argc = argc;
 	*p_argv = argv;
 	return 0;
--
Quoted 2 lines

2.17.5

Looks ok to me. Could you update estimator to print JSON as well?