diff mbox

[iproute2,PATH,2/2] tc action policer: enable timestamp display

Message ID 1464170749-7626-2-git-send-email-jhs@emojatatu.com
State Accepted, archived
Delegated to: stephen hemminger
Headers show

Commit Message

Jamal Hadi Salim May 25, 2016, 10:05 a.m. UTC
From: Jamal Hadi Salim <jhs@mojatatu.com>

Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
---
 tc/m_police.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Jamal Hadi Salim May 25, 2016, 10:09 a.m. UTC | #1
Stephen,
This requires you pull Dave's -net headers.

cheers,
jamal

On 16-05-25 06:05 AM, Jamal Hadi Salim wrote:
> From: Jamal Hadi Salim <jhs@mojatatu.com>
>
> Signed-off-by: Jamal Hadi Salim <jhs@mojatatu.com>
> ---
>   tc/m_police.c | 11 ++++++++++-
>   1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/tc/m_police.c b/tc/m_police.c
> index 8752d4f..cb17c9e 100644
> --- a/tc/m_police.c
> +++ b/tc/m_police.c
> @@ -379,7 +379,16 @@ int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
>   	linklayer = (p->rate.linklayer & TC_LINKLAYER_MASK);
>   	if (linklayer > TC_LINKLAYER_ETHERNET || show_details)
>   		fprintf(f, "linklayer %s ", sprint_linklayer(linklayer, b2));
> -	fprintf(f, "\n\tref %d bind %d\n", p->refcnt, p->bindcnt);
> +	fprintf(f, "\n\tref %d bind %d", p->refcnt, p->bindcnt);
> +	if (show_stats) {
> +		if (tb[TCA_POLICE_TM]) {
> +			struct tcf_t *tm = RTA_DATA(tb[TCA_POLICE_TM]);
> +
> +			print_tm(f, tm);
> +		}
> +	}
> +	fprintf(f, "\n");
> +
>
>   	return 0;
>   }
>
diff mbox

Patch

diff --git a/tc/m_police.c b/tc/m_police.c
index 8752d4f..cb17c9e 100644
--- a/tc/m_police.c
+++ b/tc/m_police.c
@@ -379,7 +379,16 @@  int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
 	linklayer = (p->rate.linklayer & TC_LINKLAYER_MASK);
 	if (linklayer > TC_LINKLAYER_ETHERNET || show_details)
 		fprintf(f, "linklayer %s ", sprint_linklayer(linklayer, b2));
-	fprintf(f, "\n\tref %d bind %d\n", p->refcnt, p->bindcnt);
+	fprintf(f, "\n\tref %d bind %d", p->refcnt, p->bindcnt);
+	if (show_stats) {
+		if (tb[TCA_POLICE_TM]) {
+			struct tcf_t *tm = RTA_DATA(tb[TCA_POLICE_TM]);
+
+			print_tm(f, tm);
+		}
+	}
+	fprintf(f, "\n");
+
 
 	return 0;
 }