netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net-packet: restore packet statistics tp_packets to include drops
@ 2013-08-18 19:58 Willem de Bruijn
  2013-08-19  6:53 ` Daniel Borkmann
  2013-08-19 18:22 ` Sergei Shtylyov
  0 siblings, 2 replies; 6+ messages in thread
From: Willem de Bruijn @ 2013-08-18 19:58 UTC (permalink / raw)
  To: davem, dborkman, netdev; +Cc: Willem de Bruijn

getsockopt PACKET_STATISTICS returns tp_packets + tp_drops.
Commit ee80fbf301 cleaned up the getsockopt PACKET_STATISTICS code.
This also changed semantics. Historically, tp_packets included
tp_drops on return. The commit removed the line that adds tp_drops
into tp_packets.

This patch reinstates the old semantics.

Signed-off-by: Willem de Bruijn <willemb@google.com>
---
 net/packet/af_packet.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index 4b66c75..75c8bbf 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -3259,9 +3259,11 @@ static int packet_getsockopt(struct socket *sock, int level, int optname,
 
 		if (po->tp_version == TPACKET_V3) {
 			lv = sizeof(struct tpacket_stats_v3);
+			st.stats3.tp_packets += st.stats3.tp_drops;
 			data = &st.stats3;
 		} else {
 			lv = sizeof(struct tpacket_stats);
+			st.stats1.tp_packets += st.stats1.tp_drops;
 			data = &st.stats1;
 		}
 
-- 
1.8.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-08-21  0:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-18 19:58 [PATCH net] net-packet: restore packet statistics tp_packets to include drops Willem de Bruijn
2013-08-19  6:53 ` Daniel Borkmann
2013-08-19 18:22 ` Sergei Shtylyov
2013-08-19 20:40   ` [PATCH net] packet: " Willem de Bruijn
2013-08-19 21:11     ` Daniel Borkmann
2013-08-21  0:24       ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).