Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1315232 > unrolled thread

[RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves

Started byJarod Wilson <jarod@redhat.com>
First post2016-01-22 20:20 +0100
Last post2016-01-28 17:30 +0100
Articles 20 on this page of 57 — 8 participants

Back to article view | Back to linux.kernel


Contents

  [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves Jarod Wilson <jarod@redhat.com> - 2016-01-22 20:20 +0100
    Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves Jay Vosburgh <jay.vosburgh@canonical.com> - 2016-01-22 22:00 +0100
      Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive  slaves Jiri Pirko <jiri@resnulli.us> - 2016-01-23 09:30 +0100
    Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive  slaves Jiri Pirko <jiri@resnulli.us> - 2016-01-23 09:10 +0100
    Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive  slaves Andy Gospodarek <gospo@cumulusnetworks.com> - 2016-01-23 15:30 +0100
    Re: [RFC PATCH net] net/core: don't increment rx_dropped on  inactive slaves Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-23 16:30 +0100
      Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive  slaves Jarod Wilson <jarod@redhat.com> - 2016-01-26 22:20 +0100
        Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves Eric Dumazet <edumazet@google.com> - 2016-01-26 22:30 +0100
          Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive  slaves Jarod Wilson <jarod@redhat.com> - 2016-01-26 22:40 +0100
        Re: [RFC PATCH net] net/core: don't increment rx_dropped on  inactive slaves David Miller <davem@davemloft.net> - 2016-01-26 22:30 +0100
          Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive  slaves Jarod Wilson <jarod@redhat.com> - 2016-01-26 22:40 +0100
    Re: [RFC PATCH net] net/core: don't increment rx_dropped on  inactive slaves David Miller <davem@davemloft.net> - 2016-01-25 07:50 +0100
      Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive  slaves Jarod Wilson <jarod@redhat.com> - 2016-01-25 15:30 +0100
        Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive  slaves Jarod Wilson <jarod@redhat.com> - 2016-01-26 05:50 +0100
    [PATCH net 0/4] net: add rx_unhandled stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-27 21:30 +0100
      [PATCH net 1/4] net: add rx_unhandled stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-27 21:30 +0100
      [PATCH net 2/4] net-procfs: show rx_unhandled counters Jarod Wilson <jarod@redhat.com> - 2016-01-27 21:30 +0100
      [PATCH net 4/4] bond: track sum of rx_unhandled for all slaves Jarod Wilson <jarod@redhat.com> - 2016-01-27 21:30 +0100
      [PATCH net 3/4] team: track sum of rx_unhandled for all slaves Jarod Wilson <jarod@redhat.com> - 2016-01-27 21:30 +0100
      Re: [PATCH net 0/4] net: add rx_unhandled stat counter Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-27 22:10 +0100
        Re: [PATCH net 0/4] net: add rx_unhandled stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-28 07:10 +0100
          Re: [PATCH net 0/4] net: add rx_unhandled stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-28 07:20 +0100
            Re: [PATCH net 0/4] net: add rx_unhandled stat counter Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-28 14:10 +0100
              Re: [PATCH net 0/4] net: add rx_unhandled stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-28 15:40 +0100
                Re: [PATCH net 0/4] net: add rx_unhandled stat counter Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-28 15:50 +0100
                  Re: [PATCH net 0/4] net: add rx_unhandled stat counter Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-28 15:50 +0100
                    Re: [PATCH net 0/4] net: add rx_unhandled stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-28 16:20 +0100
                  Re: [PATCH net 0/4] net: add rx_unhandled stat counter Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-28 15:50 +0100
          Re: [PATCH net 0/4] net: add rx_unhandled stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-28 07:20 +0100
          Re: [PATCH net 0/4] net: add rx_unhandled stat counter Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-28 14:10 +0100
    [PATCH net v2 2/4] net: add rx_nohandler stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-28 17:00 +0100
    [PATCH net v2 3/4] team: track sum of rx_nohandler for all slaves Jarod Wilson <jarod@redhat.com> - 2016-01-28 17:00 +0100
    [PATCH net v2 1/4] net/core: relax BUILD_BUG_ON in netdev_stats_to_stats64 Jarod Wilson <jarod@redhat.com> - 2016-01-28 17:00 +0100
    [PATCH net v2 4/4] bond: track sum of rx_nohandler for all slaves Jarod Wilson <jarod@redhat.com> - 2016-01-28 17:00 +0100
    [PATCH net v2 0/4] net: add and use rx_nohandler stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-28 17:00 +0100
      Re: [PATCH net v2 0/4] net: add and use rx_nohandler stat counter David Miller <davem@davemloft.net> - 2016-01-30 04:40 +0100
        Re: [PATCH net v2 0/4] net: add and use rx_nohandler stat counter Jarod Wilson <jarod@redhat.com> - 2016-01-30 19:20 +0100
      [PATCH net v2 1/4] net/core: relax BUILD_BUG_ON in netdev_stats_to_stats64 Jarod Wilson <jarod@redhat.com> - 2016-01-30 19:20 +0100
        Re: [PATCH net v2 1/4] net/core: relax BUILD_BUG_ON in  netdev_stats_to_stats64 Eric Dumazet <eric.dumazet@gmail.com> - 2016-01-30 19:40 +0100
          Re: [PATCH net v2 1/4] net/core: relax BUILD_BUG_ON in  netdev_stats_to_stats64 Jarod Wilson <jarod@redhat.com> - 2016-01-30 21:40 +0100
            Re: [PATCH net v2 1/4] net/core: relax BUILD_BUG_ON in  netdev_stats_to_stats64 Jarod Wilson <jarod@redhat.com> - 2016-01-30 22:00 +0100
              Re: [PATCH net v2 1/4] net/core: relax BUILD_BUG_ON in  netdev_stats_to_stats64 David Miller <davem@davemloft.net> - 2016-01-31 00:30 +0100
                Re: [PATCH net v2 1/4] net/core: relax BUILD_BUG_ON in  netdev_stats_to_stats64 Jarod Wilson <jarod@redhat.com> - 2016-01-31 19:10 +0100
      [PATCH net v3 4/4] bond: track sum of rx_nohandler for all slaves Jarod Wilson <jarod@redhat.com> - 2016-02-02 01:00 +0100
      [PATCH net v3 0/4] net: add and use rx_nohandler stat counter Jarod Wilson <jarod@redhat.com> - 2016-02-02 01:00 +0100
        [PATCH net v3 1/4] net/core: relax BUILD_BUG_ON in netdev_stats_to_stats64 Jarod Wilson <jarod@redhat.com> - 2016-02-02 01:00 +0100
        [PATCH net v3 2/4] net: add rx_nohandler stat counter Jarod Wilson <jarod@redhat.com> - 2016-02-02 01:00 +0100
          Re: [PATCH net v3 2/4] net: add rx_nohandler stat counter Stephen Hemminger <stephen@networkplumber.org> - 2016-02-07 20:40 +0100
            Re: [PATCH net v3 2/4] net: add rx_nohandler stat counter David Miller <davem@davemloft.net> - 2016-02-07 20:50 +0100
              Re: [PATCH net v3 2/4] net: add rx_nohandler stat counter Eric Dumazet <eric.dumazet@gmail.com> - 2016-02-07 21:20 +0100
                Re: [PATCH net v3 2/4] net: add rx_nohandler stat counter Jarod Wilson <jarod@redhat.com> - 2016-02-08 19:40 +0100
                  Re: [PATCH net v3 2/4] net: add rx_nohandler stat counter Stephen Hemminger <stephen@networkplumber.org> - 2016-02-08 20:40 +0100
                    Re: [PATCH net v3 2/4] net: add rx_nohandler stat counter Eric Dumazet <eric.dumazet@gmail.com> - 2016-02-09 00:00 +0100
                      Re: [PATCH net v3 2/4] net: add rx_nohandler stat counter David Miller <davem@davemloft.net> - 2016-02-09 09:50 +0100
        [PATCH net v3 3/4] team: track sum of rx_nohandler for all slaves Jarod Wilson <jarod@redhat.com> - 2016-02-02 01:00 +0100
        Re: [PATCH net v3 0/4] net: add and use rx_nohandler stat counter David Miller <davem@davemloft.net> - 2016-02-06 09:10 +0100
    [PATCH net v3 1/4] net/core: relax BUILD_BUG_ON in netdev_stats_to_stats64 Jarod Wilson <jarod@redhat.com> - 2016-01-28 17:30 +0100

Page 1 of 3  [1] 2 3  Next page →


#1315232 — [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves

FromJarod Wilson <jarod@redhat.com>
Date2016-01-22 20:20 +0100
Subject[RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves
Message-ID<qTPpw-8pj-13@gated-at.bofh.it>
The network core tries to keep track of dropped packets, but some packets
you wouldn't really call dropped, so much as intentionally ignored, under
certain circumstances. One such case is that of bonding and team device
slaves that are currently inactive. Their respective rx_handler functions
return RX_HANDLER_EXACT (the only places in the kernel that return that),
which ends up tracking into the network core's __netif_receive_skb_core()
function's drop path, with no pt_prev set. On a noisy network, this can
result in a very rapidly incrementing rx_dropped counter, not only on the
inactive slave(s), but also on the master device, such as the following:

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
  p7p1: 14783346  140430    0 140428    0     0          0      2040      680       8    0    0    0     0       0          0
  p7p2: 14805198  140648    0    0    0     0          0      2034        0       0    0    0    0     0       0          0
 bond0: 53365248  532798    0 421160    0     0          0    115151     2040      24    0    0    0     0       0          0
    lo:    5420      54    0    0    0     0          0         0     5420      54    0    0    0     0       0          0
  p5p1: 19292195  196197    0 140368    0     0          0     56564      680       8    0    0    0     0       0          0
  p5p2: 19289707  196171    0 140364    0     0          0     56547      680       8    0    0    0     0       0          0
   em3: 20996626  158214    0    0    0     0          0       383        0       0    0    0    0     0       0          0
   em2: 14065122  138462    0    0    0     0          0       310        0       0    0    0    0     0       0          0
   em1: 14063162  138440    0    0    0     0          0       308        0       0    0    0    0     0       0          0
   em4: 21050830  158729    0    0    0     0          0       385    71662     469    0    0    0     0       0          0
   ib0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0

In this scenario, p5p1, p5p2 and p7p1 are all inactive slaves in an
active-backup bond0, and you can see that all three have high drop counts,
with the master bond0 showing a tally of all three.

I know that this was previously discussed some here:

    http://www.spinics.net/lists/netdev/msg226341.html

It seems additional counters never came to fruition, but honestly, for
this particular case, I'm not even sure they're warranted, I'd be inclined
to say just silently drop these packets without incrementing a counter. At
least, that's probably what would make someone who has complained loudly
about this issue happy, as they have monitoring tools that are squaking
loudly at any increments to rx_dropped.

CC: "David S. Miller" <davem@davemloft.net>
CC: Eric Dumazet <edumazet@google.com>
CC: Jiri Pirko <jiri@mellanox.com>
CC: Daniel Borkmann <daniel@iogearbox.net>
CC: Tom Herbert <tom@herbertland.com>
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <gospo@cumulusnetworks.com>
CC: netdev@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
 net/core/dev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 8cba3d8..1354c7b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4153,8 +4153,11 @@ ncls:
 		else
 			ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
 	} else {
+		if (deliver_exact)
+			goto inactive; /* bond or team inactive slave */
 drop:
 		atomic_long_inc(&skb->dev->rx_dropped);
+inactive:
 		kfree_skb(skb);
 		/* Jamal, now you will not able to escape explaining
 		 * me how you were going to use this. :-)
-- 
1.8.3.1

[toc] | [next] | [standalone]


#1315273

FromJay Vosburgh <jay.vosburgh@canonical.com>
Date2016-01-22 22:00 +0100
Message-ID<qTQYi-PF-5@gated-at.bofh.it>
In reply to#1315232
Jarod Wilson <jarod@redhat.com> wrote:

>The network core tries to keep track of dropped packets, but some packets
>you wouldn't really call dropped, so much as intentionally ignored, under
>certain circumstances. One such case is that of bonding and team device
>slaves that are currently inactive. Their respective rx_handler functions
>return RX_HANDLER_EXACT (the only places in the kernel that return that),
>which ends up tracking into the network core's __netif_receive_skb_core()
>function's drop path, with no pt_prev set. On a noisy network, this can
>result in a very rapidly incrementing rx_dropped counter, not only on the
>inactive slave(s), but also on the master device, such as the following:
[...]
>In this scenario, p5p1, p5p2 and p7p1 are all inactive slaves in an
>active-backup bond0, and you can see that all three have high drop counts,
>with the master bond0 showing a tally of all three.
>
>I know that this was previously discussed some here:
>
>    http://www.spinics.net/lists/netdev/msg226341.html
>
>It seems additional counters never came to fruition, but honestly, for
>this particular case, I'm not even sure they're warranted, I'd be inclined
>to say just silently drop these packets without incrementing a counter. At
>least, that's probably what would make someone who has complained loudly
>about this issue happy, as they have monitoring tools that are squaking
>loudly at any increments to rx_dropped.

	I don't think the kernel should silently drop packets; there
should be a counter somewhere.  If a packet is being thrown away
deliberately, it should not just vanish into the screaming void of
space.  Someday someone will try and track down where that packet is
being dropped.

	I've had that same conversation with customers who insist on
accounting for every packet drop (from the "any drop is an error"
mindset), so I understand the issue.

	Thinking about the prior discussion, the rx_drop_inactive is
still a good idea, but I'd actually today get good use from a
"rx_drop_unforwardable" (or an equivalent but shorter name) counter that
counts every time a packet is dropped due to is_skb_forwardable()
returning false.  __dev_forward_skb does this (and hits rx_dropped), as
does the bridge (and does not count it).

	-J

>CC: "David S. Miller" <davem@davemloft.net>
>CC: Eric Dumazet <edumazet@google.com>
>CC: Jiri Pirko <jiri@mellanox.com>
>CC: Daniel Borkmann <daniel@iogearbox.net>
>CC: Tom Herbert <tom@herbertland.com>
>CC: Jay Vosburgh <j.vosburgh@gmail.com>
>CC: Veaceslav Falico <vfalico@gmail.com>
>CC: Andy Gospodarek <gospo@cumulusnetworks.com>
>CC: netdev@vger.kernel.org
>Signed-off-by: Jarod Wilson <jarod@redhat.com>
>---
> net/core/dev.c | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/net/core/dev.c b/net/core/dev.c
>index 8cba3d8..1354c7b 100644
>--- a/net/core/dev.c
>+++ b/net/core/dev.c
>@@ -4153,8 +4153,11 @@ ncls:
> 		else
> 			ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
> 	} else {
>+		if (deliver_exact)
>+			goto inactive; /* bond or team inactive slave */
> drop:
> 		atomic_long_inc(&skb->dev->rx_dropped);
>+inactive:
> 		kfree_skb(skb);
> 		/* Jamal, now you will not able to escape explaining
> 		 * me how you were going to use this. :-)
>-- 
>1.8.3.1
>

---
	-Jay Vosburgh, jay.vosburgh@canonical.com

[toc] | [prev] | [next] | [standalone]


#1315544 — Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves

FromJiri Pirko <jiri@resnulli.us>
Date2016-01-23 09:30 +0100
SubjectRe: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves
Message-ID<qU1K2-8qT-7@gated-at.bofh.it>
In reply to#1315273
Fri, Jan 22, 2016 at 09:59:12PM CET, jay.vosburgh@canonical.com wrote:
>Jarod Wilson <jarod@redhat.com> wrote:
>
>>The network core tries to keep track of dropped packets, but some packets
>>you wouldn't really call dropped, so much as intentionally ignored, under
>>certain circumstances. One such case is that of bonding and team device
>>slaves that are currently inactive. Their respective rx_handler functions
>>return RX_HANDLER_EXACT (the only places in the kernel that return that),
>>which ends up tracking into the network core's __netif_receive_skb_core()
>>function's drop path, with no pt_prev set. On a noisy network, this can
>>result in a very rapidly incrementing rx_dropped counter, not only on the
>>inactive slave(s), but also on the master device, such as the following:
>[...]
>>In this scenario, p5p1, p5p2 and p7p1 are all inactive slaves in an
>>active-backup bond0, and you can see that all three have high drop counts,
>>with the master bond0 showing a tally of all three.
>>
>>I know that this was previously discussed some here:
>>
>>    http://www.spinics.net/lists/netdev/msg226341.html
>>
>>It seems additional counters never came to fruition, but honestly, for
>>this particular case, I'm not even sure they're warranted, I'd be inclined
>>to say just silently drop these packets without incrementing a counter. At
>>least, that's probably what would make someone who has complained loudly
>>about this issue happy, as they have monitoring tools that are squaking
>>loudly at any increments to rx_dropped.

In this case, it is delivered with exact delivery according to per-dev
registered callback. We just have to avoid it gets to bond. So this case
is not "to drop", but rather "to block skb to don't get where it does
not belong".

>
>	I don't think the kernel should silently drop packets; there
>should be a counter somewhere.  If a packet is being thrown away
>deliberately, it should not just vanish into the screaming void of
>space.  Someday someone will try and track down where that packet is
>being dropped.
>
>	I've had that same conversation with customers who insist on
>accounting for every packet drop (from the "any drop is an error"
>mindset), so I understand the issue.
>
>	Thinking about the prior discussion, the rx_drop_inactive is
>still a good idea, but I'd actually today get good use from a
>"rx_drop_unforwardable" (or an equivalent but shorter name) counter that
>counts every time a packet is dropped due to is_skb_forwardable()
>returning false.  __dev_forward_skb does this (and hits rx_dropped), as
>does the bridge (and does not count it).
>
>	-J
>
>>CC: "David S. Miller" <davem@davemloft.net>
>>CC: Eric Dumazet <edumazet@google.com>
>>CC: Jiri Pirko <jiri@mellanox.com>
>>CC: Daniel Borkmann <daniel@iogearbox.net>
>>CC: Tom Herbert <tom@herbertland.com>
>>CC: Jay Vosburgh <j.vosburgh@gmail.com>
>>CC: Veaceslav Falico <vfalico@gmail.com>
>>CC: Andy Gospodarek <gospo@cumulusnetworks.com>
>>CC: netdev@vger.kernel.org
>>Signed-off-by: Jarod Wilson <jarod@redhat.com>
>>---
>> net/core/dev.c | 3 +++
>> 1 file changed, 3 insertions(+)
>>
>>diff --git a/net/core/dev.c b/net/core/dev.c
>>index 8cba3d8..1354c7b 100644
>>--- a/net/core/dev.c
>>+++ b/net/core/dev.c
>>@@ -4153,8 +4153,11 @@ ncls:
>> 		else
>> 			ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
>> 	} else {
>>+		if (deliver_exact)
>>+			goto inactive; /* bond or team inactive slave */
>> drop:
>> 		atomic_long_inc(&skb->dev->rx_dropped);
>>+inactive:
>> 		kfree_skb(skb);
>> 		/* Jamal, now you will not able to escape explaining
>> 		 * me how you were going to use this. :-)
>>-- 
>>1.8.3.1
>>
>
>---
>	-Jay Vosburgh, jay.vosburgh@canonical.com

[toc] | [prev] | [next] | [standalone]


#1315536 — Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves

FromJiri Pirko <jiri@resnulli.us>
Date2016-01-23 09:10 +0100
SubjectRe: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves
Message-ID<qU1qF-8jU-1@gated-at.bofh.it>
In reply to#1315232
Fri, Jan 22, 2016 at 08:11:22PM CET, jarod@redhat.com wrote:
>The network core tries to keep track of dropped packets, but some packets
>you wouldn't really call dropped, so much as intentionally ignored, under
>certain circumstances. One such case is that of bonding and team device
>slaves that are currently inactive. Their respective rx_handler functions
>return RX_HANDLER_EXACT (the only places in the kernel that return that),
>which ends up tracking into the network core's __netif_receive_skb_core()
>function's drop path, with no pt_prev set. On a noisy network, this can
>result in a very rapidly incrementing rx_dropped counter, not only on the
>inactive slave(s), but also on the master device, such as the following:
>
>Inter-|   Receive                                                |  Transmit
> face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
>  p7p1: 14783346  140430    0 140428    0     0          0      2040      680       8    0    0    0     0       0          0
>  p7p2: 14805198  140648    0    0    0     0          0      2034        0       0    0    0    0     0       0          0
> bond0: 53365248  532798    0 421160    0     0          0    115151     2040      24    0    0    0     0       0          0
>    lo:    5420      54    0    0    0     0          0         0     5420      54    0    0    0     0       0          0
>  p5p1: 19292195  196197    0 140368    0     0          0     56564      680       8    0    0    0     0       0          0
>  p5p2: 19289707  196171    0 140364    0     0          0     56547      680       8    0    0    0     0       0          0
>   em3: 20996626  158214    0    0    0     0          0       383        0       0    0    0    0     0       0          0
>   em2: 14065122  138462    0    0    0     0          0       310        0       0    0    0    0     0       0          0
>   em1: 14063162  138440    0    0    0     0          0       308        0       0    0    0    0     0       0          0
>   em4: 21050830  158729    0    0    0     0          0       385    71662     469    0    0    0     0       0          0
>   ib0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
>
>In this scenario, p5p1, p5p2 and p7p1 are all inactive slaves in an
>active-backup bond0, and you can see that all three have high drop counts,
>with the master bond0 showing a tally of all three.
>
>I know that this was previously discussed some here:
>
>    http://www.spinics.net/lists/netdev/msg226341.html
>
>It seems additional counters never came to fruition, but honestly, for
>this particular case, I'm not even sure they're warranted, I'd be inclined
>to say just silently drop these packets without incrementing a counter. At
>least, that's probably what would make someone who has complained loudly
>about this issue happy, as they have monitoring tools that are squaking
>loudly at any increments to rx_dropped.
>
>CC: "David S. Miller" <davem@davemloft.net>
>CC: Eric Dumazet <edumazet@google.com>
>CC: Jiri Pirko <jiri@mellanox.com>
>CC: Daniel Borkmann <daniel@iogearbox.net>
>CC: Tom Herbert <tom@herbertland.com>
>CC: Jay Vosburgh <j.vosburgh@gmail.com>
>CC: Veaceslav Falico <vfalico@gmail.com>
>CC: Andy Gospodarek <gospo@cumulusnetworks.com>
>CC: netdev@vger.kernel.org
>Signed-off-by: Jarod Wilson <jarod@redhat.com>

Acked-by: Jiri Pirko <jiri@mellanox.com>

I think this should be considered as a bug and go to -net.

[toc] | [prev] | [next] | [standalone]


#1315601 — Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves

FromAndy Gospodarek <gospo@cumulusnetworks.com>
Date2016-01-23 15:30 +0100
SubjectRe: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves
Message-ID<qU7mp-3Vc-3@gated-at.bofh.it>
In reply to#1315232
On Fri, Jan 22, 2016 at 02:11:22PM -0500, Jarod Wilson wrote:
> The network core tries to keep track of dropped packets, but some packets
> you wouldn't really call dropped, so much as intentionally ignored, under
> certain circumstances. One such case is that of bonding and team device
> slaves that are currently inactive. Their respective rx_handler functions
> return RX_HANDLER_EXACT (the only places in the kernel that return that),
> which ends up tracking into the network core's __netif_receive_skb_core()
> function's drop path, with no pt_prev set. On a noisy network, this can
> result in a very rapidly incrementing rx_dropped counter, not only on the
> inactive slave(s), but also on the master device, such as the following:
> 
> Inter-|   Receive                                                |  Transmit
>  face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
>   p7p1: 14783346  140430    0 140428    0     0          0      2040      680       8    0    0    0     0       0          0
>   p7p2: 14805198  140648    0    0    0     0          0      2034        0       0    0    0    0     0       0          0
>  bond0: 53365248  532798    0 421160    0     0          0    115151     2040      24    0    0    0     0       0          0
>     lo:    5420      54    0    0    0     0          0         0     5420      54    0    0    0     0       0          0
>   p5p1: 19292195  196197    0 140368    0     0          0     56564      680       8    0    0    0     0       0          0
>   p5p2: 19289707  196171    0 140364    0     0          0     56547      680       8    0    0    0     0       0          0
>    em3: 20996626  158214    0    0    0     0          0       383        0       0    0    0    0     0       0          0
>    em2: 14065122  138462    0    0    0     0          0       310        0       0    0    0    0     0       0          0
>    em1: 14063162  138440    0    0    0     0          0       308        0       0    0    0    0     0       0          0
>    em4: 21050830  158729    0    0    0     0          0       385    71662     469    0    0    0     0       0          0
>    ib0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
> 
> In this scenario, p5p1, p5p2 and p7p1 are all inactive slaves in an
> active-backup bond0, and you can see that all three have high drop counts,
> with the master bond0 showing a tally of all three.
> 
> I know that this was previously discussed some here:
> 
>     http://www.spinics.net/lists/netdev/msg226341.html
> 
> It seems additional counters never came to fruition, but honestly, for
> this particular case, I'm not even sure they're warranted, I'd be inclined
> to say just silently drop these packets without incrementing a counter. At
> least, that's probably what would make someone who has complained loudly
> about this issue happy, as they have monitoring tools that are squaking
> loudly at any increments to rx_dropped.

I completely agree.

> CC: "David S. Miller" <davem@davemloft.net>
> CC: Eric Dumazet <edumazet@google.com>
> CC: Jiri Pirko <jiri@mellanox.com>
> CC: Daniel Borkmann <daniel@iogearbox.net>
> CC: Tom Herbert <tom@herbertland.com>
> CC: Jay Vosburgh <j.vosburgh@gmail.com>
> CC: Veaceslav Falico <vfalico@gmail.com>
> CC: Andy Gospodarek <gospo@cumulusnetworks.com>
> CC: netdev@vger.kernel.org
> Signed-off-by: Jarod Wilson <jarod@redhat.com>

Acked-by: Andy Gospodarek <gospo@cumulusnetworks.com>

> ---
>  net/core/dev.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 8cba3d8..1354c7b 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4153,8 +4153,11 @@ ncls:
>  		else
>  			ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
>  	} else {
> +		if (deliver_exact)
> +			goto inactive; /* bond or team inactive slave */
>  drop:
>  		atomic_long_inc(&skb->dev->rx_dropped);
> +inactive:
>  		kfree_skb(skb);
>  		/* Jamal, now you will not able to escape explaining
>  		 * me how you were going to use this. :-)
> -- 
> 1.8.3.1
> 

[toc] | [prev] | [next] | [standalone]


#1315665 — Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves

FromEric Dumazet <eric.dumazet@gmail.com>
Date2016-01-23 16:30 +0100
SubjectRe: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves
Message-ID<qU8it-4Dc-9@gated-at.bofh.it>
In reply to#1315232
On Fri, 2016-01-22 at 14:11 -0500, Jarod Wilson wrote:

> ---
>  net/core/dev.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 8cba3d8..1354c7b 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4153,8 +4153,11 @@ ncls:
>  		else
>  			ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
>  	} else {
> +		if (deliver_exact)
> +			goto inactive; /* bond or team inactive slave */
>  drop:
>  		atomic_long_inc(&skb->dev->rx_dropped);
> +inactive:
>  		kfree_skb(skb);
>  		/* Jamal, now you will not able to escape explaining
>  		 * me how you were going to use this. :-)

Note that if you still have a kfree_skb() instead of consume_skb(),
some tools will still give you a wrong signal (packet dropped ...).

But then maybe the signal is telling some truth.

We receive a packet, and decide to drop it because no one was willing to
handle it.

Maybe someone wants to know a particular slave receives 10,000 such
frames per second and hurts performance with useless work.

We should at least increment some counter and maybe dump it with
"ethtool -S" or something.

[toc] | [prev] | [next] | [standalone]


#1318401 — Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves

FromJarod Wilson <jarod@redhat.com>
Date2016-01-26 22:20 +0100
SubjectRe: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves
Message-ID<qVjbR-1GJ-33@gated-at.bofh.it>
In reply to#1315665
On Sat, Jan 23, 2016 at 07:23:09AM -0800, Eric Dumazet wrote:
> On Fri, 2016-01-22 at 14:11 -0500, Jarod Wilson wrote:
> 
> > ---
> >  net/core/dev.c | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/net/core/dev.c b/net/core/dev.c
> > index 8cba3d8..1354c7b 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -4153,8 +4153,11 @@ ncls:
> >  		else
> >  			ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
> >  	} else {
> > +		if (deliver_exact)
> > +			goto inactive; /* bond or team inactive slave */
> >  drop:
> >  		atomic_long_inc(&skb->dev->rx_dropped);
> > +inactive:
> >  		kfree_skb(skb);
> >  		/* Jamal, now you will not able to escape explaining
> >  		 * me how you were going to use this. :-)
> 
> Note that if you still have a kfree_skb() instead of consume_skb(),
> some tools will still give you a wrong signal (packet dropped ...).
> 
> But then maybe the signal is telling some truth.
> 
> We receive a packet, and decide to drop it because no one was willing to
> handle it.
> 
> Maybe someone wants to know a particular slave receives 10,000 such
> frames per second and hurts performance with useless work.
> 
> We should at least increment some counter and maybe dump it with
> "ethtool -S" or something.

I've been digging into ethtool -S a little bit, and am somewhat at a loss
as to how I would wire into this. From what I've been able to figure out,
it's entirely device-specific-ish counters spit out. On my sfc cards, I
get rx_noskb_drops and rx_nodesc_drop_cnt output from ethtool -S, but for
the core network stack, these are actually added up and shoved into
rx_dropped, and no other network driver has those two individual counters.

By itself, rx_dropped isn't output directly anywhere from ethtool, 
so far as I can see. And ethtool -S bondX shows absolutely nothing.
*Should* ethtool -S be dumping all the network core stats? I have to say I
was more than a little surprised at this:

# ethtool -S bond0
no stats available

Particularly given that if I look in /proc/net/dev or
/sys/devices/virtual/net/bond0/statistics/*, there are quite a few stats
that are being tracked and make their way out to userspace...

-- 
Jarod Wilson
jarod@redhat.com

[toc] | [prev] | [next] | [standalone]


#1318404

FromEric Dumazet <edumazet@google.com>
Date2016-01-26 22:30 +0100
Message-ID<qVjlv-1L4-1@gated-at.bofh.it>
In reply to#1318401
On Tue, Jan 26, 2016 at 1:14 PM, Jarod Wilson <jarod@redhat.com> wrote:
> On Sat, Jan 23, 2016 at 07:23:09AM -0800, Eric Dumazet wrote:
>> On Fri, 2016-01-22 at 14:11 -0500, Jarod Wilson wrote:
>>
>> > ---
>> >  net/core/dev.c | 3 +++
>> >  1 file changed, 3 insertions(+)
>> >
>> > diff --git a/net/core/dev.c b/net/core/dev.c
>> > index 8cba3d8..1354c7b 100644
>> > --- a/net/core/dev.c
>> > +++ b/net/core/dev.c
>> > @@ -4153,8 +4153,11 @@ ncls:
>> >             else
>> >                     ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
>> >     } else {
>> > +           if (deliver_exact)
>> > +                   goto inactive; /* bond or team inactive slave */
>> >  drop:
>> >             atomic_long_inc(&skb->dev->rx_dropped);
>> > +inactive:
>> >             kfree_skb(skb);
>> >             /* Jamal, now you will not able to escape explaining
>> >              * me how you were going to use this. :-)
>>
>> Note that if you still have a kfree_skb() instead of consume_skb(),
>> some tools will still give you a wrong signal (packet dropped ...).
>>
>> But then maybe the signal is telling some truth.
>>
>> We receive a packet, and decide to drop it because no one was willing to
>> handle it.
>>
>> Maybe someone wants to know a particular slave receives 10,000 such
>> frames per second and hurts performance with useless work.
>>
>> We should at least increment some counter and maybe dump it with
>> "ethtool -S" or something.
>
> I've been digging into ethtool -S a little bit, and am somewhat at a loss
> as to how I would wire into this. From what I've been able to figure out,
> it's entirely device-specific-ish counters spit out. On my sfc cards, I
> get rx_noskb_drops and rx_nodesc_drop_cnt output from ethtool -S, but for
> the core network stack, these are actually added up and shoved into
> rx_dropped, and no other network driver has those two individual counters.
>
> By itself, rx_dropped isn't output directly anywhere from ethtool,
> so far as I can see. And ethtool -S bondX shows absolutely nothing.
> *Should* ethtool -S be dumping all the network core stats? I have to say I
> was more than a little surprised at this:

# ip -s -s link sh dev eth0
15: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc
pfifo_fast state DOWN mode DEFAULT group default qlen 1000
    link/ether 3c:97:0e:be:91:7b brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast
    0          0        0       0       0       0
    RX errors: length  crc     frame   fifo    missed
               0        0       0       0       0
    TX: bytes  packets  errors  dropped carrier collsns
    0          0        0       0       0       0
    TX errors: aborted fifo    window  heartbeat
               0        0       0       0

So start with the following patch :

diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index a30b78090594..7c762cf1e4d5 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -68,6 +68,8 @@ struct rtnl_link_stats64 {
        /* for cslip etc */
        __u64   rx_compressed;
        __u64   tx_compressed;
+
+       __u64   rx_nohandler;           /* packet was of no interest */
 };

 /* The struct should be in sync with struct ifmap */

[toc] | [prev] | [next] | [standalone]


#1318410 — Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves

FromJarod Wilson <jarod@redhat.com>
Date2016-01-26 22:40 +0100
SubjectRe: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves
Message-ID<qVjvc-1Q5-3@gated-at.bofh.it>
In reply to#1318404
On Tue, Jan 26, 2016 at 01:24:59PM -0800, Eric Dumazet wrote:
> On Tue, Jan 26, 2016 at 1:14 PM, Jarod Wilson <jarod@redhat.com> wrote:
> > On Sat, Jan 23, 2016 at 07:23:09AM -0800, Eric Dumazet wrote:
> >> On Fri, 2016-01-22 at 14:11 -0500, Jarod Wilson wrote:
> >>
> >> > ---
> >> >  net/core/dev.c | 3 +++
> >> >  1 file changed, 3 insertions(+)
> >> >
> >> > diff --git a/net/core/dev.c b/net/core/dev.c
> >> > index 8cba3d8..1354c7b 100644
> >> > --- a/net/core/dev.c
> >> > +++ b/net/core/dev.c
> >> > @@ -4153,8 +4153,11 @@ ncls:
> >> >             else
> >> >                     ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
> >> >     } else {
> >> > +           if (deliver_exact)
> >> > +                   goto inactive; /* bond or team inactive slave */
> >> >  drop:
> >> >             atomic_long_inc(&skb->dev->rx_dropped);
> >> > +inactive:
> >> >             kfree_skb(skb);
> >> >             /* Jamal, now you will not able to escape explaining
> >> >              * me how you were going to use this. :-)
> >>
> >> Note that if you still have a kfree_skb() instead of consume_skb(),
> >> some tools will still give you a wrong signal (packet dropped ...).
> >>
> >> But then maybe the signal is telling some truth.
> >>
> >> We receive a packet, and decide to drop it because no one was willing to
> >> handle it.
> >>
> >> Maybe someone wants to know a particular slave receives 10,000 such
> >> frames per second and hurts performance with useless work.
> >>
> >> We should at least increment some counter and maybe dump it with
> >> "ethtool -S" or something.
> >
> > I've been digging into ethtool -S a little bit, and am somewhat at a loss
> > as to how I would wire into this. From what I've been able to figure out,
> > it's entirely device-specific-ish counters spit out. On my sfc cards, I
> > get rx_noskb_drops and rx_nodesc_drop_cnt output from ethtool -S, but for
> > the core network stack, these are actually added up and shoved into
> > rx_dropped, and no other network driver has those two individual counters.
> >
> > By itself, rx_dropped isn't output directly anywhere from ethtool,
> > so far as I can see. And ethtool -S bondX shows absolutely nothing.
> > *Should* ethtool -S be dumping all the network core stats? I have to say I
> > was more than a little surprised at this:
> 
> # ip -s -s link sh dev eth0
> 15: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc
> pfifo_fast state DOWN mode DEFAULT group default qlen 1000
>     link/ether 3c:97:0e:be:91:7b brd ff:ff:ff:ff:ff:ff
>     RX: bytes  packets  errors  dropped overrun mcast
>     0          0        0       0       0       0
>     RX errors: length  crc     frame   fifo    missed
>                0        0       0       0       0
>     TX: bytes  packets  errors  dropped carrier collsns
>     0          0        0       0       0       0
>     TX errors: aborted fifo    window  heartbeat
>                0        0       0       0
> 
> So start with the following patch :
> 
> diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
> index a30b78090594..7c762cf1e4d5 100644
> --- a/include/uapi/linux/if_link.h
> +++ b/include/uapi/linux/if_link.h
> @@ -68,6 +68,8 @@ struct rtnl_link_stats64 {
>         /* for cslip etc */
>         __u64   rx_compressed;
>         __u64   tx_compressed;
> +
> +       __u64   rx_nohandler;           /* packet was of no interest */
>  };
> 
>  /* The struct should be in sync with struct ifmap */

I'm already well past that point, using rx_dropped_inactive as the stat
name though, based on the prior discussion. I can certainly convert that
over to rx_nohandler easily enough. It looks like adding a column to ip's
output there would be as simple as fetching the stat over netlink and
spitting it out.

-- 
Jarod Wilson
jarod@redhat.com

[toc] | [prev] | [next] | [standalone]


#1318406 — Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves

FromDavid Miller <davem@davemloft.net>
Date2016-01-26 22:30 +0100
SubjectRe: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves
Message-ID<qVjlw-1L4-9@gated-at.bofh.it>
In reply to#1318401
From: Jarod Wilson <jarod@redhat.com>
Date: Tue, 26 Jan 2016 16:14:53 -0500

> # ethtool -S bond0
> no stats available

ethtool -S is for device specific stats.

Some drivers use this facility to provide per-RX-queue and per-TX-queue
versions of the existing core netdev stats.

[toc] | [prev] | [next] | [standalone]


#1318409 — Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves

FromJarod Wilson <jarod@redhat.com>
Date2016-01-26 22:40 +0100
SubjectRe: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves
Message-ID<qVjvb-1Q5-1@gated-at.bofh.it>
In reply to#1318406
On Tue, Jan 26, 2016 at 01:21:00PM -0800, David Miller wrote:
> From: Jarod Wilson <jarod@redhat.com>
> Date: Tue, 26 Jan 2016 16:14:53 -0500
> 
> > # ethtool -S bond0
> > no stats available
> 
> ethtool -S is for device specific stats.

Okay, good, that was what it looked like to me. Glad I'm not completely
lost here. :)

So this sort of output wouldn't belong there, it should show up in sysfs,
procfs, and be available to ip over netlink.

> Some drivers use this facility to provide per-RX-queue and per-TX-queue
> versions of the existing core netdev stats.

-- 
Jarod Wilson
jarod@redhat.com

[toc] | [prev] | [next] | [standalone]


#1316247 — Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves

FromDavid Miller <davem@davemloft.net>
Date2016-01-25 07:50 +0100
SubjectRe: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves
Message-ID<qUJ8l-8rY-3@gated-at.bofh.it>
In reply to#1315232
From: Jarod Wilson <jarod@redhat.com>
Date: Fri, 22 Jan 2016 14:11:22 -0500

> diff --git a/net/core/dev.c b/net/core/dev.c
> index 8cba3d8..1354c7b 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4153,8 +4153,11 @@ ncls:
>  		else
>  			ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
>  	} else {
> +		if (deliver_exact)
> +			goto inactive; /* bond or team inactive slave */
>  drop:
>  		atomic_long_inc(&skb->dev->rx_dropped);
> +inactive:
>  		kfree_skb(skb);
>  		/* Jamal, now you will not able to escape explaining
>  		 * me how you were going to use this. :-)
> -- 
> 1.8.3.1
> 

I agree that rx_dropped is not the correct stat to bump here, but
I'm totally against the event disappearing completely into thin
air.

You have to replace the rx_dropped bump with _something_.

The only reason this hasn't been "fixed" yet is that everyone is
too damn lazy to implement that "something".

[toc] | [prev] | [next] | [standalone]


#1316750 — Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves

FromJarod Wilson <jarod@redhat.com>
Date2016-01-25 15:30 +0100
SubjectRe: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves
Message-ID<qUQjw-5hx-9@gated-at.bofh.it>
In reply to#1316247
On Sun, Jan 24, 2016 at 10:42:22PM -0800, David Miller wrote:
> From: Jarod Wilson <jarod@redhat.com>
> Date: Fri, 22 Jan 2016 14:11:22 -0500
> 
> > diff --git a/net/core/dev.c b/net/core/dev.c
> > index 8cba3d8..1354c7b 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -4153,8 +4153,11 @@ ncls:
> >  		else
> >  			ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
> >  	} else {
> > +		if (deliver_exact)
> > +			goto inactive; /* bond or team inactive slave */
> >  drop:
> >  		atomic_long_inc(&skb->dev->rx_dropped);
> > +inactive:
> >  		kfree_skb(skb);
> >  		/* Jamal, now you will not able to escape explaining
> >  		 * me how you were going to use this. :-)
> > -- 
> > 1.8.3.1
> > 
> 
> I agree that rx_dropped is not the correct stat to bump here, but
> I'm totally against the event disappearing completely into thin
> air.
> 
> You have to replace the rx_dropped bump with _something_.
> 
> The only reason this hasn't been "fixed" yet is that everyone is
> too damn lazy to implement that "something".

Would you want to see all things that shouldn't increment rx_dropped come
in one shot, along with the four or so other counters, as discussed in the
prior thread, or can they be done piecemeal? To date, I'm really only
familiar with this particular case, and could probably get something
together this week. To address the rest, I'd have to poke around a bit
more and see what there is to see and do.

-- 
Jarod Wilson
jarod@redhat.com

[toc] | [prev] | [next] | [standalone]


#1317535 — Re: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves

FromJarod Wilson <jarod@redhat.com>
Date2016-01-26 05:50 +0100
SubjectRe: [RFC PATCH net] net/core: don't increment rx_dropped on inactive slaves
Message-ID<qV3JM-6mL-1@gated-at.bofh.it>
In reply to#1316750
On Mon, Jan 25, 2016 at 09:27:20AM -0500, Jarod Wilson wrote:
> On Sun, Jan 24, 2016 at 10:42:22PM -0800, David Miller wrote:
> > From: Jarod Wilson <jarod@redhat.com>
> > Date: Fri, 22 Jan 2016 14:11:22 -0500
> > 
> > > diff --git a/net/core/dev.c b/net/core/dev.c
> > > index 8cba3d8..1354c7b 100644
> > > --- a/net/core/dev.c
> > > +++ b/net/core/dev.c
> > > @@ -4153,8 +4153,11 @@ ncls:
> > >  		else
> > >  			ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
> > >  	} else {
> > > +		if (deliver_exact)
> > > +			goto inactive; /* bond or team inactive slave */
> > >  drop:
> > >  		atomic_long_inc(&skb->dev->rx_dropped);
> > > +inactive:
> > >  		kfree_skb(skb);
> > >  		/* Jamal, now you will not able to escape explaining
> > >  		 * me how you were going to use this. :-)
> > 
> > I agree that rx_dropped is not the correct stat to bump here, but
> > I'm totally against the event disappearing completely into thin
> > air.
> > 
> > You have to replace the rx_dropped bump with _something_.
> > 
> > The only reason this hasn't been "fixed" yet is that everyone is
> > too damn lazy to implement that "something".
> 
> Would you want to see all things that shouldn't increment rx_dropped come
> in one shot, along with the four or so other counters, as discussed in the
> prior thread, or can they be done piecemeal? To date, I'm really only
> familiar with this particular case, and could probably get something
> together this week. To address the rest, I'd have to poke around a bit
> more and see what there is to see and do.

Spent a while hacking around today, now have this, p7p1 and p5p2 are
the inactive slaves in the bond:

[root@dell-per720-06 ~]# cat /proc/net/dev
Inter-|   Receive                                                       |  Transmit
 face |bytes    packets errs drop drop_i fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
  p6p1:   16024     238    0    0      0    0     0          0       521        0       0    0    0    0     0       0          0
  p7p1: 1691386   16537    0    0  16568    0     0          0       488        0       0    0    0    0     0       0          0
  p7p2: 1709438   16718    0    0      0    0     0          0       561        0       0    0    0    0     0       0          0
 bond0: 6183056   63065    0    0  33151    0     0          0     13964    24747     193    0    0    0     0       0          0
  p4p1:       0       0    0    0      0    0     0          0         0        0       0    0    0    0     0       0          0
  p4p2:       0       0    0    0      0    0     0          0         0        0       0    0    0    0     0       0          0
    lo:    4928      50    0    0      0    0     0          0         0     4928      50    0    0    0     0       0          0
  p5p1: 2259498   23401    0    0      0    0     0          0      6740    24747     193    0    0    0     0       0          0
  p5p2: 2232172   23127    0    0  16583    0     0          0      6736        0       0    0    0    0     0       0          0
   em4: 2347251   18224    0    0      0    0     0          0        90     4541      47    0    0    0     0       0          0
   em2: 1590296   16061    0    0      0    0     0          0        81        0       0    0    0    0     0       0          0
   em1: 1590180   16060    0    0      0    0     0          0        79        0       0    0    0    0     0       0          0
   em3: 2343156   18209    0    0      0    0     0          0        94        0       0    0    0    0     0       0          0
[root@dell-per720-06 ~]# cat /sys/devices/virtual/net/bond0/statistics/rx_dropped_inactive
33181

Haven't yet thrown together anything for ethtool -S output as Eric had
suggested, but I'll dig into that tomorrow.

-- 
Jarod Wilson
jarod@redhat.com

[toc] | [prev] | [next] | [standalone]


#1319672 — [PATCH net 0/4] net: add rx_unhandled stat counter

FromJarod Wilson <jarod@redhat.com>
Date2016-01-27 21:30 +0100
Subject[PATCH net 0/4] net: add rx_unhandled stat counter
Message-ID<qVET0-FR-7@gated-at.bofh.it>
In reply to#1315232
The network core tries to keep track of dropped packets, but some packets
you wouldn't really call dropped, so much as intentionally ignored, under
certain circumstances. One such case is that of bonding and team device
slaves that are currently inactive. Their respective rx_handler functions
return RX_HANDLER_EXACT (the only places in the kernel that return that),
which ends up tracking into the network core's __netif_receive_skb_core()
function's drop path, with no pt_prev set. On a noisy network, this can
result in a very rapidly incrementing rx_dropped counter, not only on the
inactive slave(s), but also on the master device, such as the following:

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
  p7p1: 14783346  140430    0 140428    0     0          0      2040      680       8    0    0    0     0       0          0
  p7p2: 14805198  140648    0    0    0     0          0      2034        0       0    0    0    0     0       0          0
 bond0: 53365248  532798    0 421160    0     0          0    115151     2040      24    0    0    0     0       0          0
    lo:    5420      54    0    0    0     0          0         0     5420      54    0    0    0     0       0          0
  p5p1: 19292195  196197    0 140368    0     0          0     56564      680       8    0    0    0     0       0          0
  p5p2: 19289707  196171    0 140364    0     0          0     56547      680       8    0    0    0     0       0          0
   em3: 20996626  158214    0    0    0     0          0       383        0       0    0    0    0     0       0          0
   em2: 14065122  138462    0    0    0     0          0       310        0       0    0    0    0     0       0          0
   em1: 14063162  138440    0    0    0     0          0       308        0       0    0    0    0     0       0          0
   em4: 21050830  158729    0    0    0     0          0       385    71662     469    0    0    0     0       0          0
   ib0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0

In this scenario, p5p1, p5p2 and p7p1 are all inactive slaves in an
active-backup bond0, and you can see that all three have high drop counts,
with the master bond0 showing a tally of all three.

I know that this was previously discussed some here:

    http://www.spinics.net/lists/netdev/msg226341.html

It seems additional counters never came to fruition, so this is a first
attempt at creating one of them, so that we stop calling these drops,
which for users monitoring rx_dropped, causes great alarm, and renders the
counter much less useful for them.

This adds a sysfs statistics node and copies the counter out via netlink,
procfs additions will be handled separately, as I'm unsure if the current
output should be considered a stable interface...

Additionally, I'm not certain if this set qualifies for net, or if it
should be put aside and resubmitted for net-next after 4.5 is put to
bed, but I do have users who consider this an important bugfix.

CC: "David S. Miller" <davem@davemloft.net>
CC: Eric Dumazet <edumazet@google.com>
CC: Jiri Pirko <jiri@mellanox.com>
CC: Daniel Borkmann <daniel@iogearbox.net>
CC: Tom Herbert <tom@herbertland.com>
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <gospo@cumulusnetworks.com>
CC: netdev@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
 include/linux/netdevice.h    | 4 ++++
 include/uapi/linux/if_link.h | 4 ++++
 net/core/dev.c               | 6 +++++-
 net/core/net-sysfs.c         | 2 ++
 net/core/rtnetlink.c         | 2 ++
 5 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 289c231..7973ab5 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -180,6 +180,7 @@ struct net_device_stats {
 	unsigned long	tx_window_errors;
 	unsigned long	rx_compressed;
 	unsigned long	tx_compressed;
+	unsigned long	rx_unhandled;
 };
 
 
@@ -1397,6 +1398,8 @@ enum netdev_priv_flags {
  *			do not use this in drivers
  *	@tx_dropped:	Dropped packets by core network,
  *			do not use this in drivers
+ *	@rx_unhandled:	Unhandled dropped packets by core network on
+ *			inactive devices, do not use this in drivers
  *
  *	@wireless_handlers:	List of functions to handle Wireless Extensions,
  *				instead of ioctl,
@@ -1611,6 +1614,7 @@ struct net_device {
 
 	atomic_long_t		rx_dropped;
 	atomic_long_t		tx_dropped;
+	atomic_long_t		rx_unhandled;
 
 #ifdef CONFIG_WIRELESS_EXT
 	const struct iw_handler_def *	wireless_handlers;
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index a30b780..533639d 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -35,6 +35,8 @@ struct rtnl_link_stats {
 	/* for cslip etc */
 	__u32	rx_compressed;
 	__u32	tx_compressed;
+
+	__u32	rx_unhandled;		/* dropped, no handler found	*/
 };
 
 /* The main device statistics structure */
@@ -68,6 +70,8 @@ struct rtnl_link_stats64 {
 	/* for cslip etc */
 	__u64	rx_compressed;
 	__u64	tx_compressed;
+
+	__u64	rx_unhandled;		/* dropped, no handler found	*/
 };
 
 /* The struct should be in sync with struct ifmap */
diff --git a/net/core/dev.c b/net/core/dev.c
index 8cba3d8..7700ca6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4154,7 +4154,10 @@ ncls:
 			ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
 	} else {
 drop:
-		atomic_long_inc(&skb->dev->rx_dropped);
+		if (!deliver_exact)
+			atomic_long_inc(&skb->dev->rx_dropped);
+		else
+			atomic_long_inc(&skb->dev->rx_unhandled);
 		kfree_skb(skb);
 		/* Jamal, now you will not able to escape explaining
 		 * me how you were going to use this. :-)
@@ -7300,6 +7303,7 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
 	}
 	storage->rx_dropped += atomic_long_read(&dev->rx_dropped);
 	storage->tx_dropped += atomic_long_read(&dev->tx_dropped);
+	storage->rx_unhandled += atomic_long_read(&dev->rx_unhandled);
 	return storage;
 }
 EXPORT_SYMBOL(dev_get_stats);
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index b6c8a66..fd22276 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -574,6 +574,7 @@ NETSTAT_ENTRY(tx_heartbeat_errors);
 NETSTAT_ENTRY(tx_window_errors);
 NETSTAT_ENTRY(rx_compressed);
 NETSTAT_ENTRY(tx_compressed);
+NETSTAT_ENTRY(rx_unhandled);
 
 static struct attribute *netstat_attrs[] = {
 	&dev_attr_rx_packets.attr,
@@ -599,6 +600,7 @@ static struct attribute *netstat_attrs[] = {
 	&dev_attr_tx_window_errors.attr,
 	&dev_attr_rx_compressed.attr,
 	&dev_attr_tx_compressed.attr,
+	&dev_attr_rx_unhandled.attr,
 	NULL
 };
 
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index d735e85..2e0f656 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -804,6 +804,8 @@ static void copy_rtnl_link_stats(struct rtnl_link_stats *a,
 
 	a->rx_compressed = b->rx_compressed;
 	a->tx_compressed = b->tx_compressed;
+
+	a->rx_unhandled = b->rx_unhandled;
 }
 
 static void copy_rtnl_link_stats64(void *v, const struct rtnl_link_stats64 *b)
-- 
1.8.3.1


Jarod Wilson (4):
  net: add rx_unhandled counter for tracking inactive slave drops
  net-procfs: show rx_unhandled counters
  team: track sum of rx_unhandled for all slaves
  bond: track sum of rx_unhandled for all slaves

 drivers/net/bonding/bond_main.c |  1 +
 drivers/net/team/team.c         | 10 +++++++---
 include/linux/if_team.h         |  1 +
 include/linux/netdevice.h       |  4 ++++
 include/uapi/linux/if_link.h    |  4 ++++
 net/core/dev.c                  |  6 +++++-
 net/core/net-procfs.c           | 11 ++++++-----
 net/core/net-sysfs.c            |  2 ++
 net/core/rtnetlink.c            |  2 ++
 9 files changed, 32 insertions(+), 9 deletions(-)

-- 
1.8.3.1

[toc] | [prev] | [next] | [standalone]


#1319674 — [PATCH net 1/4] net: add rx_unhandled stat counter

FromJarod Wilson <jarod@redhat.com>
Date2016-01-27 21:30 +0100
Subject[PATCH net 1/4] net: add rx_unhandled stat counter
Message-ID<qVET0-FR-15@gated-at.bofh.it>
In reply to#1319672
This adds an rx_unhandled stat counter, along with a sysfs statistics
node, and copies the counter out via netlink as well.

CC: "David S. Miller" <davem@davemloft.net>
CC: Eric Dumazet <edumazet@google.com>
CC: Jiri Pirko <jiri@mellanox.com>
CC: Daniel Borkmann <daniel@iogearbox.net>
CC: Tom Herbert <tom@herbertland.com>
CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <gospo@cumulusnetworks.com>
CC: netdev@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
 include/linux/netdevice.h    | 4 ++++
 include/uapi/linux/if_link.h | 4 ++++
 net/core/dev.c               | 6 +++++-
 net/core/net-sysfs.c         | 2 ++
 net/core/rtnetlink.c         | 2 ++
 5 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 289c231..7973ab5 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -180,6 +180,7 @@ struct net_device_stats {
 	unsigned long	tx_window_errors;
 	unsigned long	rx_compressed;
 	unsigned long	tx_compressed;
+	unsigned long	rx_unhandled;
 };
 
 
@@ -1397,6 +1398,8 @@ enum netdev_priv_flags {
  *			do not use this in drivers
  *	@tx_dropped:	Dropped packets by core network,
  *			do not use this in drivers
+ *	@rx_unhandled:	Unhandled dropped packets by core network on
+ *			inactive devices, do not use this in drivers
  *
  *	@wireless_handlers:	List of functions to handle Wireless Extensions,
  *				instead of ioctl,
@@ -1611,6 +1614,7 @@ struct net_device {
 
 	atomic_long_t		rx_dropped;
 	atomic_long_t		tx_dropped;
+	atomic_long_t		rx_unhandled;
 
 #ifdef CONFIG_WIRELESS_EXT
 	const struct iw_handler_def *	wireless_handlers;
diff --git a/include/uapi/linux/if_link.h b/include/uapi/linux/if_link.h
index a30b780..533639d 100644
--- a/include/uapi/linux/if_link.h
+++ b/include/uapi/linux/if_link.h
@@ -35,6 +35,8 @@ struct rtnl_link_stats {
 	/* for cslip etc */
 	__u32	rx_compressed;
 	__u32	tx_compressed;
+
+	__u32	rx_unhandled;		/* dropped, no handler found	*/
 };
 
 /* The main device statistics structure */
@@ -68,6 +70,8 @@ struct rtnl_link_stats64 {
 	/* for cslip etc */
 	__u64	rx_compressed;
 	__u64	tx_compressed;
+
+	__u64	rx_unhandled;		/* dropped, no handler found	*/
 };
 
 /* The struct should be in sync with struct ifmap */
diff --git a/net/core/dev.c b/net/core/dev.c
index 8cba3d8..7700ca6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4154,7 +4154,10 @@ ncls:
 			ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
 	} else {
 drop:
-		atomic_long_inc(&skb->dev->rx_dropped);
+		if (!deliver_exact)
+			atomic_long_inc(&skb->dev->rx_dropped);
+		else
+			atomic_long_inc(&skb->dev->rx_unhandled);
 		kfree_skb(skb);
 		/* Jamal, now you will not able to escape explaining
 		 * me how you were going to use this. :-)
@@ -7300,6 +7303,7 @@ struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
 	}
 	storage->rx_dropped += atomic_long_read(&dev->rx_dropped);
 	storage->tx_dropped += atomic_long_read(&dev->tx_dropped);
+	storage->rx_unhandled += atomic_long_read(&dev->rx_unhandled);
 	return storage;
 }
 EXPORT_SYMBOL(dev_get_stats);
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index b6c8a66..fd22276 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -574,6 +574,7 @@ NETSTAT_ENTRY(tx_heartbeat_errors);
 NETSTAT_ENTRY(tx_window_errors);
 NETSTAT_ENTRY(rx_compressed);
 NETSTAT_ENTRY(tx_compressed);
+NETSTAT_ENTRY(rx_unhandled);
 
 static struct attribute *netstat_attrs[] = {
 	&dev_attr_rx_packets.attr,
@@ -599,6 +600,7 @@ static struct attribute *netstat_attrs[] = {
 	&dev_attr_tx_window_errors.attr,
 	&dev_attr_rx_compressed.attr,
 	&dev_attr_tx_compressed.attr,
+	&dev_attr_rx_unhandled.attr,
 	NULL
 };
 
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index d735e85..2e0f656 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -804,6 +804,8 @@ static void copy_rtnl_link_stats(struct rtnl_link_stats *a,
 
 	a->rx_compressed = b->rx_compressed;
 	a->tx_compressed = b->tx_compressed;
+
+	a->rx_unhandled = b->rx_unhandled;
 }
 
 static void copy_rtnl_link_stats64(void *v, const struct rtnl_link_stats64 *b)
-- 
1.8.3.1

[toc] | [prev] | [next] | [standalone]


#1319681 — [PATCH net 2/4] net-procfs: show rx_unhandled counters

FromJarod Wilson <jarod@redhat.com>
Date2016-01-27 21:30 +0100
Subject[PATCH net 2/4] net-procfs: show rx_unhandled counters
Message-ID<qVET1-FR-41@gated-at.bofh.it>
In reply to#1319672
The rx_unhandled counters get output here in a column after drop with
a heading name of unh. I'm not sure if perhaps /proc/net/dev should be
considered a stable interface that shouldn't be mucked with. If so,
this can certainly be dropped, without impacting the core functionality.

CC: netdev@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
 net/core/net-procfs.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/core/net-procfs.c b/net/core/net-procfs.c
index 2bf8329..9f88f34 100644
--- a/net/core/net-procfs.c
+++ b/net/core/net-procfs.c
@@ -79,11 +79,12 @@ static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
 	struct rtnl_link_stats64 temp;
 	const struct rtnl_link_stats64 *stats = dev_get_stats(dev, &temp);
 
-	seq_printf(seq, "%6s: %7llu %7llu %4llu %4llu %4llu %5llu %10llu %9llu "
-		   "%8llu %7llu %4llu %4llu %4llu %5llu %7llu %10llu\n",
+	seq_printf(seq, "%6s: %7llu %7llu %4llu %4llu %4llu %4llu %5llu %10llu "
+		   "%9llu %8llu %7llu %4llu %4llu %4llu %5llu %7llu %10llu\n",
 		   dev->name, stats->rx_bytes, stats->rx_packets,
 		   stats->rx_errors,
 		   stats->rx_dropped + stats->rx_missed_errors,
+		   stats->rx_unhandled,
 		   stats->rx_fifo_errors,
 		   stats->rx_length_errors + stats->rx_over_errors +
 		    stats->rx_crc_errors + stats->rx_frame_errors,
@@ -107,9 +108,9 @@ static int dev_seq_show(struct seq_file *seq, void *v)
 	if (v == SEQ_START_TOKEN)
 		seq_puts(seq, "Inter-|   Receive                            "
 			      "                    |  Transmit\n"
-			      " face |bytes    packets errs drop fifo frame "
-			      "compressed multicast|bytes    packets errs "
-			      "drop fifo colls carrier compressed\n");
+			      " face |bytes    packets errs drop  unh fifo "
+			      "frame compressed multicast|bytes    packets "
+			      "errs drop fifo colls carrier compressed\n");
 	else
 		dev_seq_printf_stats(seq, v);
 	return 0;
-- 
1.8.3.1

[toc] | [prev] | [next] | [standalone]


#1319688 — [PATCH net 4/4] bond: track sum of rx_unhandled for all slaves

FromJarod Wilson <jarod@redhat.com>
Date2016-01-27 21:30 +0100
Subject[PATCH net 4/4] bond: track sum of rx_unhandled for all slaves
Message-ID<qVET2-FR-57@gated-at.bofh.it>
In reply to#1319672
Sample output with this set applied for an active-backup bond:

$ cat /proc/net/dev
Inter-|   Receive                                                       |  Transmit
 face |bytes    packets errs drop  unh fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
  p6p1:   16024     238    0    0    0    0     0          0       521        0       0    0    0    0     0       0          0
  p7p1: 1691386   16537    0    0 16568    0     0          0       488        0       0    0    0    0     0       0          0
  p7p2: 1709438   16718    0    0    0    0     0          0       561        0       0    0    0    0     0       0          0
 bond0: 6183056   63065    0    0 33151    0     0          0     13964    24747     193    0    0    0     0       0          0
  p4p1:       0       0    0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  p4p2:       0       0    0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
    lo:    4928      50    0    0    0    0     0          0         0     4928      50    0    0    0     0       0          0
  p5p1: 2259498   23401    0    0    0    0     0          0      6740    24747     193    0    0    0     0       0          0
  p5p2: 2232172   23127    0    0 16583    0     0          0      6736        0       0    0    0    0     0       0          0
   em4: 2347251   18224    0    0    0    0     0          0        90     4541      47    0    0    0     0       0          0
   em2: 1590296   16061    0    0    0    0     0          0        81        0       0    0    0    0     0       0          0
   em1: 1590180   16060    0    0    0    0     0          0        79        0       0    0    0    0     0       0          0
   em3: 2343156   18209    0    0    0    0     0          0        94        0       0    0    0    0     0       0          0
   ib0:       0       0    0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
$ cat /sys/devices/virtual/net/bond0/statistics/rx_unhandled
33181

CC: Jay Vosburgh <j.vosburgh@gmail.com>
CC: Veaceslav Falico <vfalico@gmail.com>
CC: Andy Gospodarek <gospo@cumulusnetworks.com>
CC: netdev@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
 drivers/net/bonding/bond_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 56b5605..72164dc 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -3309,6 +3309,7 @@ static struct rtnl_link_stats64 *bond_get_stats(struct net_device *bond_dev,
 		stats->rx_bytes += sstats->rx_bytes - pstats->rx_bytes;
 		stats->rx_errors += sstats->rx_errors - pstats->rx_errors;
 		stats->rx_dropped += sstats->rx_dropped - pstats->rx_dropped;
+		stats->rx_unhandled += sstats->rx_unhandled - pstats->rx_unhandled;
 
 		stats->tx_packets += sstats->tx_packets - pstats->tx_packets;;
 		stats->tx_bytes += sstats->tx_bytes - pstats->tx_bytes;
-- 
1.8.3.1

[toc] | [prev] | [next] | [standalone]


#1319698 — [PATCH net 3/4] team: track sum of rx_unhandled for all slaves

FromJarod Wilson <jarod@redhat.com>
Date2016-01-27 21:30 +0100
Subject[PATCH net 3/4] team: track sum of rx_unhandled for all slaves
Message-ID<qVET3-FR-77@gated-at.bofh.it>
In reply to#1319672
CC: Jiri Pirko <jiri@resnulli.us>
CC: netdev@vger.kernel.org
Signed-off-by: Jarod Wilson <jarod@redhat.com>
---
 drivers/net/team/team.c | 10 +++++++---
 include/linux/if_team.h |  1 +
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 718ceea..4460a8c 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -758,6 +758,8 @@ static rx_handler_result_t team_handle_frame(struct sk_buff **pskb)
 		u64_stats_update_end(&pcpu_stats->syncp);
 
 		skb->dev = team->dev;
+	} else if (res == RX_HANDLER_EXACT) {
+		this_cpu_inc(team->pcpu_stats->rx_unhandled);
 	} else {
 		this_cpu_inc(team->pcpu_stats->rx_dropped);
 	}
@@ -1807,7 +1809,7 @@ team_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
 	struct team *team = netdev_priv(dev);
 	struct team_pcpu_stats *p;
 	u64 rx_packets, rx_bytes, rx_multicast, tx_packets, tx_bytes;
-	u32 rx_dropped = 0, tx_dropped = 0;
+	u32 rx_dropped = 0, tx_dropped = 0, rx_unhandled = 0;
 	unsigned int start;
 	int i;
 
@@ -1828,14 +1830,16 @@ team_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats)
 		stats->tx_packets	+= tx_packets;
 		stats->tx_bytes		+= tx_bytes;
 		/*
-		 * rx_dropped & tx_dropped are u32, updated
-		 * without syncp protection.
+		 * rx_dropped, tx_dropped & rx_unhandled are u32,
+		 * updated without syncp protection.
 		 */
 		rx_dropped	+= p->rx_dropped;
 		tx_dropped	+= p->tx_dropped;
+		rx_unhandled	+= p->rx_unhandled;
 	}
 	stats->rx_dropped	= rx_dropped;
 	stats->tx_dropped	= tx_dropped;
+	stats->rx_unhandled	= rx_unhandled;
 	return stats;
 }
 
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index b84e49c..787dbd2 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -24,6 +24,7 @@ struct team_pcpu_stats {
 	struct u64_stats_sync	syncp;
 	u32			rx_dropped;
 	u32			tx_dropped;
+	u32			rx_unhandled;
 };
 
 struct team;
-- 
1.8.3.1

[toc] | [prev] | [next] | [standalone]


#1319825 — Re: [PATCH net 0/4] net: add rx_unhandled stat counter

FromEric Dumazet <eric.dumazet@gmail.com>
Date2016-01-27 22:10 +0100
SubjectRe: [PATCH net 0/4] net: add rx_unhandled stat counter
Message-ID<qVFvI-1dk-27@gated-at.bofh.it>
In reply to#1319672
On Wed, 2016-01-27 at 15:21 -0500, Jarod Wilson wrote:

> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 289c231..7973ab5 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -180,6 +180,7 @@ struct net_device_stats {
>  	unsigned long	tx_window_errors;
>  	unsigned long	rx_compressed;
>  	unsigned long	tx_compressed;
> +	unsigned long	rx_unhandled;
>  };
>  

This structure is deprecated, please do not add new fields in it,
as it will increase netlink answers for no good reason.

rtnl_link_stats64 is what really matters these days.

[toc] | [prev] | [next] | [standalone]


Page 1 of 3  [1] 2 3  Next page →

Back to top | Article view | linux.kernel


csiph-web