public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [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

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