netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: Use rx_nohandler for unhandled packets
@ 2019-12-11 16:21 Patrick Talbert
  2019-12-15  1:45 ` Jakub Kicinski
  2019-12-15 20:41 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Patrick Talbert @ 2019-12-11 16:21 UTC (permalink / raw)
  To: netdev; +Cc: ptalbert

Since caf586e5f23c ("net: add a core netdev->rx_dropped counter") incoming
packets which do not have a handler cause a counter named rx_dropped to be
incremented. This can lead to confusion as some see a non-zero "drop"
counter as cause for concern.

To avoid any confusion, instead use the existing rx_nohandler counter. Its
name more closely aligns with the activity being tracked here.

Signed-off-by: Patrick Talbert <ptalbert@redhat.com>
---
 include/linux/netdevice.h |  5 +++--
 net/core/dev.c            | 15 +++++++--------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9ef20389622d..3d194cea9859 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1618,8 +1618,9 @@ enum netdev_priv_flags {
  *			do not use this in drivers
  *	@tx_dropped:	Dropped packets by core network,
  *			do not use this in drivers
- *	@rx_nohandler:	nohandler dropped packets by core network on
- *			inactive devices, do not use this in drivers
+ *	@rx_nohandler:	Dropped packets by core network when they were not handled
+ *			by any protocol/socket or the device was inactive,
+ *			do not use this in drivers.
  *	@carrier_up_count:	Number of times the carrier has been up
  *	@carrier_down_count:	Number of times the carrier has been down
  *
diff --git a/net/core/dev.c b/net/core/dev.c
index 2c277b8aba38..11e500f8ffa3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5123,20 +5123,19 @@ static int __netif_receive_skb_core(struct sk_buff *skb, bool pfmemalloc,
 			goto drop;
 		*ppt_prev = pt_prev;
 	} else {
-drop:
-		if (!deliver_exact)
-			atomic_long_inc(&skb->dev->rx_dropped);
-		else
-			atomic_long_inc(&skb->dev->rx_nohandler);
+		/* We have not delivered the skb anywhere */
+		atomic_long_inc(&skb->dev->rx_nohandler);
 		kfree_skb(skb);
-		/* Jamal, now you will not able to escape explaining
-		 * me how you were going to use this. :-)
-		 */
 		ret = NET_RX_DROP;
 	}
 
 out:
 	return ret;
+drop:
+	atomic_long_inc(&skb->dev->rx_dropped);
+	kfree_skb(skb);
+	ret = NET_RX_DROP;
+	goto out;
 }
 
 static int __netif_receive_skb_one_core(struct sk_buff *skb, bool pfmemalloc)
-- 
2.18.1


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

end of thread, other threads:[~2019-12-16 20:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11 16:21 [PATCH net-next] net: Use rx_nohandler for unhandled packets Patrick Talbert
2019-12-15  1:45 ` Jakub Kicinski
2019-12-15 20:41 ` David Miller
2019-12-16 14:07   ` Patrick Talbert
2019-12-16 20:16     ` 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).