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

* Re: [PATCH net] net-packet: restore packet statistics tp_packets to include drops
  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
  1 sibling, 0 replies; 6+ messages in thread
From: Daniel Borkmann @ 2013-08-19  6:53 UTC (permalink / raw)
  To: Willem de Bruijn; +Cc: davem, netdev

On 08/18/2013 09:58 PM, Willem de Bruijn wrote:
> 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>

Acked-by: Daniel Borkmann <dborkman@redhat.com>

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

* Re: [PATCH net] net-packet: restore packet statistics tp_packets to include drops
  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
  1 sibling, 1 reply; 6+ messages in thread
From: Sergei Shtylyov @ 2013-08-19 18:22 UTC (permalink / raw)
  To: Willem de Bruijn; +Cc: davem, dborkman, netdev

Hello.

On 08/18/2013 11:58 PM, Willem de Bruijn wrote:

> 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.

> 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>

WBR, Sergei

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

* [PATCH net] packet: restore packet statistics tp_packets to include drops
  2013-08-19 18:22 ` Sergei Shtylyov
@ 2013-08-19 20:40   ` Willem de Bruijn
  2013-08-19 21:11     ` Daniel Borkmann
  0 siblings, 1 reply; 6+ messages in thread
From: Willem de Bruijn @ 2013-08-19 20:40 UTC (permalink / raw)
  To: davem, dborkman, netdev, sergei.shtylyov; +Cc: 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.

Signed-off-by: Willem de Bruijn <willemb@google.com>

---

v2: incorporated commit summary by request. no code changes
---
 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 6c53dd9..1fdf9ab 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -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;
 		}
 
-- 
1.8.3

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

* Re: [PATCH net] packet: restore packet statistics tp_packets to include drops
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Daniel Borkmann @ 2013-08-19 21:11 UTC (permalink / raw)
  To: Willem de Bruijn; +Cc: davem, netdev, sergei.shtylyov

On 08/19/2013 10:40 PM, Willem de Bruijn wrote:
> 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.
>
> Signed-off-by: Willem de Bruijn <willemb@google.com>

Acked-by: Daniel Borkmann <dborkman@redhat.com>

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

* Re: [PATCH net] packet: restore packet statistics tp_packets to include drops
  2013-08-19 21:11     ` Daniel Borkmann
@ 2013-08-21  0:24       ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2013-08-21  0:24 UTC (permalink / raw)
  To: dborkman; +Cc: willemb, netdev, sergei.shtylyov

From: Daniel Borkmann <dborkman@redhat.com>
Date: Mon, 19 Aug 2013 23:11:08 +0200

> On 08/19/2013 10:40 PM, Willem de Bruijn wrote:
>> 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.
>>
>> Signed-off-by: Willem de Bruijn <willemb@google.com>
> 
> Acked-by: Daniel Borkmann <dborkman@redhat.com>

Applied, thanks.

^ permalink raw reply	[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).