netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: netdev@vger.kernel.org, roopa@cumulusnetworks.com
Subject: Re: [PATCH iproute2 net-next] bridge: vlan: add support to display per-vlan statistics
Date: Tue, 21 Jun 2016 18:10:49 +0200	[thread overview]
Message-ID: <57696709.7010506@cumulusnetworks.com> (raw)
In-Reply-To: <20160621090141.0c13d12d@xeon-e3>

On 21/06/16 18:01, Stephen Hemminger wrote:
> On Mon, 20 Jun 2016 12:13:19 +0200
> Nikolay Aleksandrov <nikolay@cumulusnetworks.com> wrote:
> 
>> This patch adds support for the -statistics (-s) argument to the bridge
>> vlan show command which will display the per-vlan statistics and the bridge
>> device each vlan belongs to. The show command filtering options are both
>> supported, also the man page is updated to explain the new option.
>> This patch uses the new RTM_GETSTATS interface with a filter_mask to dump
>> only the bridge vlans. Later we can add support for using the per-device
>> dump and filter it in the kernel instead.
>>
>> Example:
>> $ bridge -s vlan
>> port	vlan id	stats
>> br0	 1	 RX: 33724730 bytes 492075 packets TX: 67409922 bytes 984029 packets
>> 	 100	 RX: 0 bytes 0 packets TX: 0 bytes 0 packets
>> 	 200	 RX: 0 bytes 0 packets TX: 0 bytes 0 packets
>> 	 300	 RX: 0 bytes 0 packets TX: 0 bytes 0 packets
>> 	 301	 RX: 169562135 bytes 790877 packets TX: 169550926 bytes 790824 packets
>> br1	 1	 RX: 0 bytes 0 packets TX: 0 bytes 0 packets
>>
>> Note that it will print the per-vlan statistics for all vlans in a bridge
>> even if the vlan is only added to ports. Later when we add per-port
>> per-vlan statistics support, we'll be able to print the exact ports each
>> vlan belongs to, not only the bridge.
>>
>> Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
> 
> Thanks, this is a useful tool, but I think the formatting of output may need to be
> reworked.  The bridge tool works similar to ip command. And in the ip command the
> -s flag causes additional lines, but does not change the output format.

Indeed, I agree that it needs refinement.

> 
> There is also double line spacing in current output, which scrolls off when
> managing in little VM windows. Plush the port name is too narrow a field width

The port name width is the same as vlan show - 1 tab and a space.

> 
> Why not something like:
> 
> $ bridge vlan
> port	   vlan ids
> virbr1	   1 PVID Egress Untagged
> virbr4	   1 PVID Egress Untagged
> virbr0	   1 PVID Egress Untagged
> 
> $ bridge -s vlan
> virbr1	   1 PVID Egress Untagged
>              RX: 33724730 bytes 492075 packets
>              TX: 67409922 bytes 984029 packets
> virbr0	   1 PVID Egress Untagged
>              RX: 169562135 bytes 790877 packets 
>              TX: 169550926 bytes 790824 packets
> 
> The -d detail flag would also be useful to implement
> 

Yep, this was one of the formats I tested. The only thing that we currently
cannot implement is the flags printing as they're not exported via the stats
utility and really can't be because some of these entries may not exist on
the bridge device itself and it will get too confusing.
I left a few padding fields and I can export the flags if the entry exists
on the bridge device, then some will have the flags while others
will not, but it still sounds confusing to me. I'd prefer to just leave the
flags to the normal vlan show. What do you think ?

With your example:
 $ bridge -s vlan
 virbr1	   	1 
              RX: 33724730 bytes 492075 packets
              TX: 67409922 bytes 984029 packets

This way we can later add more fields like broadcast packets or multicast if
we ever start counting them.

I'll later add the "-brief" flag and print them on one line since with
thousands of vlans it comes in handy.

Cheers,
 Nik

  reply	other threads:[~2016-06-21 16:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-20 10:13 [PATCH iproute2 net-next] bridge: vlan: add support to display per-vlan statistics Nikolay Aleksandrov
2016-06-21 16:01 ` Stephen Hemminger
2016-06-21 16:10   ` Nikolay Aleksandrov [this message]
2016-06-21 16:11     ` Nikolay Aleksandrov
2016-07-01  0:06       ` Stephen Hemminger
2016-07-01  9:24         ` Nikolay Aleksandrov
2016-06-21 18:07 ` [PATCH iproute2 net-next v2] " Nikolay Aleksandrov
2016-06-21 18:08   ` 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=57696709.7010506@cumulusnetworks.com \
    --to=nikolay@cumulusnetworks.com \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@cumulusnetworks.com \
    --cc=stephen@networkplumber.org \
    /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;
as well as URLs for NNTP newsgroup(s).