public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Liu Mingrui <liumingrui@huawei.com>
To: <willemdebruijn.kernel@gmail.com>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>
Cc: <netdev@vger.kernel.org>, <liumingrui@huawei.com>
Subject: [PATCH -next] af_packet: display drop field in packet_seq_show
Date: Mon, 26 Aug 2024 09:26:25 +0000	[thread overview]
Message-ID: <20240826092625.2637632-1-liumingrui@huawei.com> (raw)

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


             reply	other threads:[~2024-08-26  1:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-26  9:26 Liu Mingrui [this message]
2024-08-26  7:10 ` [PATCH -next] af_packet: display drop field in packet_seq_show Eric Dumazet
2024-08-27  0:19 ` 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=20240826092625.2637632-1-liumingrui@huawei.com \
    --to=liumingrui@huawei.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=willemdebruijn.kernel@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