Skip to contentSkip to conversation

net-packet: restore packet statistics tp_packets to include drops

PATCH In review Willem de Bruijn 4 participants 6 messages Aug 18, 2013 – Aug 21, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net-packet: restore packet statistics tp_packets to include drops

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.

---
 net/packet/af_packet.c | 2 ++
 1 file changed, 2 insertions(+)
net/packet/af_packet.c +2 -0
index 4b66c75..75c8bbf 100644
@@ -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;
 		}
 
Signature · 1 line
1.8.3
Acked-by on v1 1/1
#1 lore raw
Quoted 9 lines · 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.

#2 lore raw
In reply to Willem de Bruijn

Hello.

Quoted 2 lines · Willem de Bruijn

getsockopt PACKET_STATISTICS returns tp_packets + tp_drops. Commit ee80fbf301 cleaned up the getsockopt PACKET_STATISTICS code.

Please also specify that commit's summary in parens.

Quoted 7 lines

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.

WBR, Sergei

#3 lore raw

PATCH 1/1 packet: restore packet statistics tp_packets to include drops

getsockopt PACKET_STATISTICS returns tp_packets + tp_drops. Commit ee80fbf301 ("packet: account statistics only in tpacket_stats_u") 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.

---

v2: incorporated commit summary by request. no code changes

---
 net/packet/af_packet.c | 2 ++
 1 file changed, 2 insertions(+)
net/packet/af_packet.c +2 -0
index 6c53dd9..1fdf9ab 100644
@@ -3215,9 +3215,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;
 		}
 
Signature · 1 line
1.8.3
Acked-by on v1 1/1
#4 lore raw

Re: [PATCH net] packet: restore packet statistics tp_packets to include drops

Quoted 10 lines · Willem de Bruijn

getsockopt PACKET_STATISTICS returns tp_packets + tp_drops. Commit ee80fbf301 ("packet: account statistics only in tpacket_stats_u") 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.

maintainer Applied
#5 lore raw

Re: [PATCH net] packet: restore packet statistics tp_packets to include drops

From: Daniel Borkmann <[email protected]>
Date: Mon, 19 Aug 2013 23:11:08 +0200

Quoted 8 lines · Willem de Bruijn
Quoted 7 lines

getsockopt PACKET_STATISTICS returns tp_packets + tp_drops. Commit ee80fbf301 ("packet: account statistics only in tpacket_stats_u") 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.

Quoted 5 lines
Quoted 3 lines

This patch reinstates the old semantics.

Applied, thanks.