public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Cc: netdev@vger.kernel.org, roopa@cumulusnetworks.com
Subject: Re: [PATCH iproute2 net-next v4] bridge: mdb: add support for extended router port information
Date: Sun, 13 Mar 2016 23:37:08 -0700	[thread overview]
Message-ID: <20160313233708.57005031@xeon-e3> (raw)
In-Reply-To: <1457345432-19360-1-git-send-email-nikolay@cumulusnetworks.com>

On Mon,  7 Mar 2016 11:10:32 +0100
Nikolay Aleksandrov <nikolay@cumulusnetworks.com> wrote:

>  	rem = RTA_PAYLOAD(attr);
>  	for (i = RTA_DATA(attr); RTA_OK(i, rem); i = RTA_NEXT(i, rem)) {
>  		port_ifindex = RTA_DATA(i);
> -		fprintf(f, "%s ", ll_index_to_name(*port_ifindex));
> +		if (show_stats) {
> +			struct rtattr *tb[MDBA_ROUTER_PATTR_MAX + 1];
> +
> +			parse_rtattr(tb, MDBA_ROUTER_PATTR_MAX,
> +				     MDB_RTR_RTA(RTA_DATA(i)),
> +				     RTA_PAYLOAD(i) -
> +				     RTA_ALIGN(sizeof(*port_ifindex)));
> +
> +			fprintf(f, "router ports on %s: %s",
> +				ll_index_to_name(brifidx),
> +				ll_index_to_name(*port_ifindex));
> +			if (tb[MDBA_ROUTER_PATTR_TIMER]) {
> +				struct timeval tv;
> +				__u32 tval;
> +
> +				tval = rta_getattr_u32(
> +						tb[MDBA_ROUTER_PATTR_TIMER]);
> +				__jiffies_to_tv(&tv, tval);
> +				fprintf(f, " %4i.%.2i",
> +					(int)tv.tv_sec, (int)tv.tv_usec/10000);
> +			}

You are having to cut lines short here to fit 80 characters, maybe
good time to make statistics a helper function.

  reply	other threads:[~2016-03-14  6:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-03 15:19 [PATCH iproute2 net-next] bridge: mdb: add support for extended router port information Nikolay Aleksandrov
2016-03-03 16:20 ` [PATCH iproute2 net-next v2] " Nikolay Aleksandrov
2016-03-07  9:32   ` [PATCH iproute2 net-next v3] " Nikolay Aleksandrov
2016-03-07 10:10     ` [PATCH iproute2 net-next v4] " Nikolay Aleksandrov
2016-03-14  6:37       ` Stephen Hemminger [this message]
2016-03-14 10:04         ` [PATCH iproute2 net-next v5] " Nikolay Aleksandrov
2016-03-06 20:56 ` [PATCH iproute2 net-next] " Stephen Hemminger
2016-03-06 21:12   ` Nikolay Aleksandrov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160313233708.57005031@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=netdev@vger.kernel.org \
    --cc=nikolay@cumulusnetworks.com \
    --cc=roopa@cumulusnetworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox