LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: yajun.deng@linux.dev
To: "Vladimir Oltean" <olteanv@gmail.com>
Cc: davem@davemloft.net, kuba@kernel.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next] net: procfs: add seq_puts() statement for dev_mcast
Date: Mon, 11 Oct 2021 02:44:04 +0000 [thread overview]
Message-ID: <83d864e81ea774b8124948a65c069e82@linux.dev> (raw)
In-Reply-To: <20211009164249.euf7dfpccr6kz7a3@skbuf>
There is PCIe NIC with long name, this is the reason why put the 'Interface' a whole.
before:
Inter-| Receive | Transmit
face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed
lo: 251136 2956 0 0 0 0 0 0 251136 2956 0 0 0 0 0 0
enp27s0f0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
enp27s0f1: 95099489 627116 0 328486 0 0 0 187285 18680642 67213 0 0 0 0 0 0
docker0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
after:
Interface| Receive | Transmit
| bytes packets errs drop fifo frame compressed multicast| bytes packets errs drop fifo colls carrier compressed
lo: 251136 2956 0 0 0 0 0 0 251136 2956 0 0 0 0 0 0
enp27s0f0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
enp27s0f1: 95099489 627116 0 328486 0 0 0 187285 18680642 67213 0 0 0 0 0 0
docker0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
October 10, 2021 12:42 AM, "Vladimir Oltean" <olteanv@gmail.com> 写到:
> On Sat, Oct 09, 2021 at 07:35:11PM +0300, Vladimir Oltean wrote:
>
>> On Mon, Aug 16, 2021 at 04:57:57PM +0800, Yajun Deng wrote:
>> Add seq_puts() statement for dev_mcast, make it more readable.
>> As also, keep vertical alignment for {dev, ptype, dev_mcast} that
>> under /proc/net.
>>
>> Signed-off-by: Yajun Deng <yajun.deng@linux.dev>
>> ---
>>
>> FYI, this program got broken by this commit (reverting it restores
>> functionality):
>>
>> root@debian:~# ifstat
>> ifstat: /proc/net/dev: unsupported format.
>>
>> Confusingly enough, the "ifstat" provided by Debian is not from iproute2:
>> https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/tree/misc/ifstat.c
>> but rather a similarly named program:
>> https://packages.debian.org/source/bullseye/ifstat
>> https://github.com/matttbe/ifstat
>>
>> I haven't studied how this program parses /proc/net/dev, but here's how
>> the kernel's output changed:
>
> Ah, it scrapes the text for "Inter-|":
> https://github.com/matttbe/ifstat/blob/main/drivers.c#L825
>
>> Doesn't work:
>>
>> root@debian:~# cat /proc/net/dev
>> Interface| Receive | Transmit
>> | bytes packets errs drop fifo frame compressed multicast| bytes packets errs drop fifo colls
>> carrier compressed
>> lo: 97400 1204 0 0 0 0 0 0 97400 1204 0 0 0 0 0 0
>> bond0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> sit0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> eno2: 5002206 6651 0 0 0 0 0 0 105518642 1465023 0 0 0 0 0 0
>> swp0: 134531 2448 0 0 0 0 0 0 99599598 1464381 0 0 0 0 0 0
>> swp1: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> swp2: 4867675 4203 0 0 0 0 0 0 58134 631 0 0 0 0 0 0
>> sw0p0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> sw0p1: 124739 2448 0 1422 0 0 0 0 93741184 1464369 0 0 0 0 0 0
>> sw0p2: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> sw2p0: 4850863 4203 0 0 0 0 0 0 54722 619 0 0 0 0 0 0
>> sw2p1: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> sw2p2: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> sw2p3: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> br0: 10508 212 0 212 0 0 0 212 61369558 958857 0 0 0 0 0 0
>>
>> Works:
>>
>> root@debian:~# cat /proc/net/dev
>> Inter-| Receive | Transmit
>> face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls
>> carrier compressed
>> lo: 13160 164 0 0 0 0 0 0 13160 164 0 0 0 0 0 0
>> bond0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> sit0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> eno2: 30824 268 0 0 0 0 0 0 3332 37 0 0 0 0 0 0
>> swp0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> swp1: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> swp2: 30824 268 0 0 0 0 0 0 2428 27 0 0 0 0 0 0
>> sw0p0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> sw0p1: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> sw0p2: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> sw2p0: 29752 268 0 0 0 0 0 0 1564 17 0 0 0 0 0 0
>> sw2p1: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> sw2p2: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
>> sw2p3: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
prev parent reply other threads:[~2021-10-11 2:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-16 8:57 [PATCH net-next] net: procfs: add seq_puts() statement for dev_mcast Yajun Deng
2021-08-18 9:20 ` patchwork-bot+netdevbpf
2021-10-09 16:35 ` Vladimir Oltean
2021-10-09 16:42 ` Vladimir Oltean
2021-10-11 2:44 ` yajun.deng [this message]
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=83d864e81ea774b8124948a65c069e82@linux.dev \
--to=yajun.deng@linux.dev \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.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;
as well as URLs for NNTP newsgroup(s).