* [PATCH -next] af_packet: display drop field in packet_seq_show
@ 2024-08-26 9:26 Liu Mingrui
2024-08-26 7:10 ` Eric Dumazet
2024-08-27 0:19 ` Stephen Hemminger
0 siblings, 2 replies; 3+ messages in thread
From: Liu Mingrui @ 2024-08-26 9:26 UTC (permalink / raw)
To: willemdebruijn.kernel, davem, edumazet, kuba, pabeni; +Cc: netdev, liumingrui
Display the dropped count of the packet, which could provide more
information for debugging.
Signed-off-by: Liu Mingrui <liumingrui@huawei.com>
---
net/packet/af_packet.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 4a364cdd445e..22c59ee61888 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -4771,14 +4771,14 @@ static int packet_seq_show(struct seq_file *seq, void *v)
{
if (v == SEQ_START_TOKEN)
seq_printf(seq,
- "%*sRefCnt Type Proto Iface R Rmem User Inode\n",
+ "%*sRefCnt Type Proto Iface R Rmem User Inode Drops\n",
IS_ENABLED(CONFIG_64BIT) ? -17 : -9, "sk");
else {
struct sock *s = sk_entry(v);
const struct packet_sock *po = pkt_sk(s);
seq_printf(seq,
- "%pK %-6d %-4d %04x %-5d %1d %-6u %-6u %-6lu\n",
+ "%pK %-6d %-4d %04x %-5d %1d %-6u %-6u %-6lu %u\n",
s,
refcount_read(&s->sk_refcnt),
s->sk_type,
@@ -4787,7 +4787,8 @@ static int packet_seq_show(struct seq_file *seq, void *v)
packet_sock_flag(po, PACKET_SOCK_RUNNING),
atomic_read(&s->sk_rmem_alloc),
from_kuid_munged(seq_user_ns(seq), sock_i_uid(s)),
- sock_i_ino(s));
+ sock_i_ino(s),
+ atomic_read(&po->tp_drops));
}
return 0;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH -next] af_packet: display drop field in packet_seq_show
2024-08-26 9:26 [PATCH -next] af_packet: display drop field in packet_seq_show Liu Mingrui
@ 2024-08-26 7:10 ` Eric Dumazet
2024-08-27 0:19 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2024-08-26 7:10 UTC (permalink / raw)
To: Liu Mingrui; +Cc: willemdebruijn.kernel, davem, kuba, pabeni, netdev
On Mon, Aug 26, 2024 at 3:26 AM Liu Mingrui <liumingrui@huawei.com> wrote:
>
> Display the dropped count of the packet, which could provide more
> information for debugging.
>
> Signed-off-by: Liu Mingrui <liumingrui@huawei.com>
Old /proc interface is legacy, we do not accept changes in it.
Instead, change net/packet/diag.c , iproute2/ss and use "ss -0".
Also, your patch is not correct, because of getsockopt( ...
PACKET_STATISTICS ... )
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] af_packet: display drop field in packet_seq_show
2024-08-26 9:26 [PATCH -next] af_packet: display drop field in packet_seq_show Liu Mingrui
2024-08-26 7:10 ` Eric Dumazet
@ 2024-08-27 0:19 ` Stephen Hemminger
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2024-08-27 0:19 UTC (permalink / raw)
To: Liu Mingrui; +Cc: willemdebruijn.kernel, davem, edumazet, kuba, pabeni, netdev
On Mon, 26 Aug 2024 09:26:25 +0000
Liu Mingrui <liumingrui@huawei.com> wrote:
> Display the dropped count of the packet, which could provide more
> information for debugging.
>
> Signed-off-by: Liu Mingrui <liumingrui@huawei.com>
> ---
At this point /proc/net/packet is a poor choice for extension.
For example, ss command ignores it if PACKET_DIAG_MEMINFO is available.
Better to add new netlink field see net/packet/diag.c.
Maybe time for PACKET_DIAG_STATS with name/value like ethtool.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-08-27 0:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-26 9:26 [PATCH -next] af_packet: display drop field in packet_seq_show Liu Mingrui
2024-08-26 7:10 ` Eric Dumazet
2024-08-27 0:19 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox