From: Stephen Hemminger <stephen@networkplumber.org>
To: Quentin Deslandes <qde@naccy.de>
Cc: <netdev@vger.kernel.org>, David Ahern <dsahern@gmail.com>,
Martin KaFai Lau <martin.lau@kernel.org>
Subject: Re: [PATCH 0/3] ss: pretty-printing BPF socket-local storage
Date: Tue, 28 Nov 2023 14:43:59 -0800 [thread overview]
Message-ID: <20231128144359.36108a3d@hermes.local> (raw)
In-Reply-To: <20231128023058.53546-1-qde@naccy.de>
On Mon, 27 Nov 2023 18:30:55 -0800
Quentin Deslandes <qde@naccy.de> wrote:
> BPF allows programs to store socket-specific data using
> BPF_MAP_TYPE_SK_STORAGE maps. The data is attached to the socket itself,
> and Martin added INET_DIAG_REQ_SK_BPF_STORAGES, so it can be fetched
> using the INET_DIAG mechanism.
>
> Currently, ss doesn't request the socket-local data, this patch aims to
> fix this.
>
> The first patch fixes a bug where the "Process" column would always be
> printed on ss' output, even if --processes/-p is not used.
>
> Patch #2 requests the socket-local data for the requested map ID
> (--bpf-map-id=) or all the maps (--bpf-maps). It then prints the map_id
> in a dedicated column.
>
> Patch #3 uses libbpf and BTF to pretty print the map's content, like
> `bpftool map dump` would do.
>
> While I think it makes sense for ss to provide the socket-local storage
> content for the sockets, it's difficult to conciliate the column-based
> output of ss and having readable socket-local data. Hence, the
> socket-local data is printed in a readable fashion over multiple lines
> under its socket statistics, independently of the column-based approach.
>
> Here is an example of ss' output with --bpf-maps:
> [...]
> ESTAB 2960280 0 [...]
> map_id: 259 [
> (struct my_sk_storage) {
> .field_hh = (char)127,
> .<anon> = (union <anon>) {
> .a = (int)0,
> .b = (int)0,
> },
> },
> ]
>
> Quentin Deslandes (3):
> ss: prevent "Process" column from being printed unless requested
> ss: add support for BPF socket-local storage
> ss: pretty-print BPF socket-local storage
>
> misc/ss.c | 822 +++++++++++++++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 818 insertions(+), 4 deletions(-)
Useful, but ss is growing into a huge monolithic program and may need some
refactoring. Also, this cries out for a json output format. Which ss doesn't
have yet.
next prev parent reply other threads:[~2023-11-28 22:44 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-28 2:30 [PATCH 0/3] ss: pretty-printing BPF socket-local storage Quentin Deslandes
2023-11-28 2:30 ` [PATCH 1/3] ss: prevent "Process" column from being printed unless requested Quentin Deslandes
2023-11-29 0:20 ` David Ahern
2023-11-28 2:30 ` [PATCH 2/3] ss: add support for BPF socket-local storage Quentin Deslandes
2023-11-28 23:35 ` Martin KaFai Lau
2023-11-28 2:30 ` [PATCH 3/3] ss: pretty-print " Quentin Deslandes
2023-11-28 23:42 ` Martin KaFai Lau
2023-11-28 22:43 ` Stephen Hemminger [this message]
2023-12-08 15:01 ` [PATCH 0/3] ss: pretty-printing " Quentin Deslandes
2023-12-08 17:27 ` Stephen Hemminger
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=20231128144359.36108a3d@hermes.local \
--to=stephen@networkplumber.org \
--cc=dsahern@gmail.com \
--cc=martin.lau@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=qde@naccy.de \
/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).