Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-arrange output columns #376

Merged
merged 15 commits into from
May 28, 2024
Merged

Re-arrange output columns #376

merged 15 commits into from
May 28, 2024

Conversation

jschwinger233
Copy link
Member

@jschwinger233 jschwinger233 commented May 17, 2024

The output of pwru --output-meta --output-tuple now is like:

SKB                CPU PROCESS          NETNS      MARK          IFACE       PROTO  MTU   LEN   TUPLE FUNC
0xffff9fc1014a8700 0   ~/ampdaemon:4417          0 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        netlink_broadcast
0xffff9fc1014a8700 0   ~/ampdaemon:4417          0 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        netlink_trim
0xffff9fc1014a8700 0   ~/ampdaemon:4417          0 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        sk_filter_trim_cap
0xffff9fc1014a8700 0   ~/ampdaemon:4417          0 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        security_sock_rcv_skb
0xffff9fc1014a8700 0   ~/ampdaemon:4417          0 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        apparmor_socket_sock_rcv_skb
0xffff9fc1014a8700 0   ~/ampdaemon:4417          0 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        netlink_skb_set_owner_r
0xffff9fc1014a8700 0   ~/ampdaemon:4417 4026531840 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        __netlink_sendskb
0xffff9fc1014a8700 0   ~/ampdaemon:4417 4026531840 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        skb_queue_tail
0xffff9fc1014a8700 0   ~/ampdaemon:4417 4026531840 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        consume_skb
0xffff9fc1014a8700 11  ~code42-aat:1053 4026531840 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        skb_free_datagram
0xffff9fc1014a8700 11  ~code42-aat:1053 4026531840 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        consume_skb
0xffff9fc1014a8700 11  ~code42-aat:1053 4026531840 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        skb_release_head_state
0xffff9fc1014a8700 11  ~code42-aat:1053 4026531840 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        netlink_skb_destructor
0xffff9fc1014a8700 11  ~code42-aat:1053 4026531840 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        sock_rfree
0xffff9fc1014a8700 11  ~code42-aat:1053 4026531840 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        skb_release_data
0xffff9fc1014a8700 11  ~code42-aat:1053 4026531840 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        skb_free_head
0xffff9fc1014a8700 11  ~code42-aat:1053 4026531840 00000000        0         0x0000 0     76    0.0.0.0:0->1.0.0.0:0()                        kfree_skbmem
0xffff9fc1ad4c84e8 2   ~-apiserver:5328 4026533261 00000000        0         0x0000 0     150   172.19.0.6:6443->172.19.0.4:55646(tcp)        ip_local_out
0xffff9fc1ad4c84e8 2   ~-apiserver:5328 4026533261 00000000        0         0x0000 0     150   172.19.0.6:6443->172.19.0.4:55646(tcp)        __ip_local_out
0xffff9fc1ad4c84e8 2   ~-apiserver:5328 4026533261 00000000        0         0x0800 0     150   172.19.0.6:6443->172.19.0.4:55646(tcp)        nf_hook_slow
0xffff9fc1ad4c84e8 2   ~-apiserver:5328 4026533261 00000000        0         0x0800 0     150   172.19.0.6:6443->172.19.0.4:55646(tcp)        ip_output
0xffff9fc1ad4c84e8 2   ~-apiserver:5328 4026533261 00000000     eth0:22      0x0800 1500  150   172.19.0.6:6443->172.19.0.4:55646(tcp)        nf_hook_slow
0xffff9fc1ad4c84e8 2   ~-apiserver:5328 4026533261 00000000     eth0:22      0x0800 1500  150   172.19.0.6:6443->172.19.0.4:55646(tcp)        apparmor_ip_postroute
0xffff9fc1ad4c84e8 2   ~-apiserver:5328 4026533261 00000000     eth0:22      0x0800 1500  150   172.19.0.6:6443->172.19.0.4:55646(tcp)        ip_finish_output
0xffff9fc1ad4c84e8 2   ~-apiserver:5328 4026533261 00000000     eth0:22      0x0800 1500  150   172.19.0.6:6443->172.19.0.4:55646(tcp)        __ip_finish_output
0xffff9fc1ad4c84e8 2   ~-apiserver:5328 4026533261 00000000     eth0:22      0x0800 1500  150   172.19.0.6:6443->172.19.0.4:55646(tcp)        ip_finish_output2
0xffff9fc1ad4c84e8 2   ~-apiserver:5328 4026533261 00000000     eth0:22      0x0800 1500  164   172.19.0.6:6443->172.19.0.4:55646(tcp)        __dev_queue_xmit

Comparing to original output, now it shows all data with less width in a clearer way:

Original:

               SKB    CPU          PROCESS                     FUNC
0xffff9fc1ad53c800      4 [irq/177-iwlwifi:queue_2:904] kfree_skb_reason(SKB_DROP_REASON_NOT_SPECIFIED) netns=4026531840 mark=0x0 iface=0 proto=0x0800 mtu=0 len=0 1.1.1.1:80->10.103.80.118:59176(tcp)
0xffff9fc1ad53c800      4 [irq/177-iwlwifi:queue_2:904]   skb_release_head_state netns=4026531840 mark=0x0 iface=0 proto=0x0800 mtu=0 len=0 1.1.1.1:80->10.103.80.118:59176(tcp)
0xffff9fc1ad53c800      4 [irq/177-iwlwifi:queue_2:904]               sock_rfree netns=4026531840 mark=0x0 iface=0 proto=0x0800 mtu=0 len=0 1.1.1.1:80->10.103.80.118:59176(tcp)
0xffff9fc1ad53c800      4 [irq/177-iwlwifi:queue_2:904]         skb_release_data netns=4026531840 mark=0x0 iface=0 proto=0x0800 mtu=0 len=0 1.1.1.1:80->10.103.80.118:59176(tcp)
0xffff9fc1ad53c800      4 [irq/177-iwlwifi:queue_2:904]            skb_free_head netns=4026531840 mark=0x0 iface=0 proto=0x0800 mtu=0 len=0 1.1.1.1:80->10.103.80.118:59176(tcp)
0xffff9fc1ad53c800      4 [irq/177-iwlwifi:queue_2:904]             kfree_skbmem netns=4026531840 mark=0x0 iface=0 proto=0x0800 mtu=0 len=0 1.1.1.1:80->10.103.80.118:59176(tcp)

Now:

SKB                CPU PROCESS          NETNS      MARK          IFACE       PROTO  MTU   LEN   TUPLE FUNC
0xffff9fc1ad53ca00 4   ~ifi:queue_2:904 4026531840 00000000        0         0x0800 0     0     1.1.1.1:80->10.103.80.118:49544(tcp) kfree_skb_reason(SKB_DROP_REASON_NOT_SPECIFIED)
0xffff9fc1ad53ca00 4   ~ifi:queue_2:904 4026531840 00000000        0         0x0800 0     0     1.1.1.1:80->10.103.80.118:49544(tcp) skb_release_head_state
0xffff9fc1ad53ca00 4   ~ifi:queue_2:904 4026531840 00000000        0         0x0800 0     0     1.1.1.1:80->10.103.80.118:49544(tcp) sock_rfree
0xffff9fc1ad53ca00 4   ~ifi:queue_2:904 4026531840 00000000        0         0x0800 0     0     1.1.1.1:80->10.103.80.118:49544(tcp) skb_release_data
0xffff9fc1ad53ca00 4   ~ifi:queue_2:904 4026531840 00000000        0         0x0800 0     0     1.1.1.1:80->10.103.80.118:49544(tcp) skb_free_head
0xffff9fc1ad53ca00 4   ~ifi:queue_2:904 4026531840 00000000        0         0x0800 0     0     1.1.1.1:80->10.103.80.118:49544(tcp) kfree_skbmem

Signed-off-by: gray <gray.liang@isovalent.com>
Because it has variant length.

Signed-off-by: gray <gray.liang@isovalent.com>
Signed-off-by: gray <gray.liang@isovalent.com>
Signed-off-by: gray <gray.liang@isovalent.com>
Signed-off-by: gray <gray.liang@isovalent.com>
Signed-off-by: gray <gray.liang@isovalent.com>
Also strip 0x prefix.

Signed-off-by: gray <gray.liang@isovalent.com>
ifname can be as long as 16 bytes, plust len of ifindex
len(str(1<<32))=10, it should be at least 26.

However, 16 is enough for most of situations, so let's make it 16.

Also center align this column out of aesthetics.

Signed-off-by: gray <gray.liang@isovalent.com>
Signed-off-by: gray <gray.liang@isovalent.com>
Actually it's a uint32, but let's make it 5 that fits most scenarios.

Signed-off-by: gray <gray.liang@isovalent.com>
Still, it's a u32, but let's treat it as u16 for most cases.

Signed-off-by: gray <gray.liang@isovalent.com>
So that the following FUNC can be aligned

Signed-off-by: gray <gray.liang@isovalent.com>
Signed-off-by: gray <gray.liang@isovalent.com>
@jschwinger233 jschwinger233 changed the title Pr/gray/output columns Re-arrange output columns May 17, 2024
@jschwinger233 jschwinger233 marked this pull request as ready for review May 17, 2024 06:57
@jschwinger233 jschwinger233 requested a review from a team as a code owner May 17, 2024 06:57
@jschwinger233 jschwinger233 requested review from tklauser and removed request for a team May 17, 2024 06:57
@jschwinger233 jschwinger233 requested a review from brb May 17, 2024 06:59
Signed-off-by: gray <gray.liang@isovalent.com>
Otherwise it's hard to distinguish 00000000 from 08000000.

Signed-off-by: gray <gray.liang@isovalent.com>
Copy link
Member

@brb brb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@brb brb merged commit 05fe67e into main May 28, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants