From patchwork Mon Aug 26 09:26:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Mingrui X-Patchwork-Id: 13776945 X-Patchwork-Delegate: kuba@kernel.org Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E832210E3 for ; Mon, 26 Aug 2024 01:26:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.176.79.56 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724635576; cv=none; b=LbmHRJRBxI5H1jMYFjv/yMr4q4TtzZu07XGucuJ1TLPjY9XxtdWDd2nNNisfy3eZnsdno21MBnKqqQOCSnR4Z9LQ4TYlCaAmhGzVqEa6gwdkUVNmduZKQoWQ3zaR4A0wOoac8CFwcdXx40uuc1gcp+lPanqR+qjKEmZBlr8TMMs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724635576; c=relaxed/simple; bh=0ZiGBOJHOPnpRujsxIgwmWiaCQ1iYfL9aDIqptPPPF4=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=maWXHUsq3BXqLP6Di7XzkktNU6Xg+T0Wdk4SCbKBIPA5jS4LOAwRrT1lMPpivoTuQLj6eBjvEGxeP3f5cn9Qr94OaugLzgvwRcemhU6jqhg5zcz3LmMnhs9qOsC6IS2JkR/lsysOSd1x8w+w35fGzB8YuVUgIlw3Ok0TBoge+kA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=185.176.79.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.18.186.216]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4WsXws1gp7z6LCdq; Mon, 26 Aug 2024 09:22:53 +0800 (CST) Received: from lhrpeml500002.china.huawei.com (unknown [7.191.160.78]) by mail.maildlp.com (Postfix) with ESMTPS id CE870140CF4; Mon, 26 Aug 2024 09:26:05 +0800 (CST) Received: from huawei.com (10.67.174.89) by lhrpeml500002.china.huawei.com (7.191.160.78) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.39; Mon, 26 Aug 2024 02:26:03 +0100 From: Liu Mingrui To: , , , , CC: , Subject: [PATCH -next] af_packet: display drop field in packet_seq_show Date: Mon, 26 Aug 2024 09:26:25 +0000 Message-ID: <20240826092625.2637632-1-liumingrui@huawei.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To lhrpeml500002.china.huawei.com (7.191.160.78) X-Patchwork-Delegate: kuba@kernel.org Display the dropped count of the packet, which could provide more information for debugging. Signed-off-by: Liu Mingrui --- 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;