[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    net: update netdev_rx_csum_fault() print dump only once
From:       Linux Kernel Mailing List <linux-kernel () vger ! kernel ! org>
Date:       2021-06-30 23:50:17
Message-ID: git-mailbomb-linux-master-127d7355abb355b05ff4b42d6e18cc97aa9d1d11 () kernel ! org
[Download RAW message or body]

Commit:     127d7355abb355b05ff4b42d6e18cc97aa9d1d11
Parent:     a358f40600b3b39ae3906b6118625b99c0aa7a34
Refname:    refs/heads/master
Web:        https://git.kernel.org/torvalds/c/127d7355abb355b05ff4b42d6e18cc97aa9d1d11
Author:     Tanner Love <tannerlove@google.com>
AuthorDate: Mon Jun 28 09:50:07 2021 -0400
Committer:  David S. Miller <davem@davemloft.net>
CommitDate: Mon Jun 28 15:54:57 2021 -0700

    net: update netdev_rx_csum_fault() print dump only once
    
    Printing this stack dump multiple times does not provide additional
    useful information, and consumes time in the data path. Printing once
    is sufficient.
    
    Changes
      v2: Format indentation properly
    
    Signed-off-by: Tanner Love <tannerlove@google.com>
    Acked-by: Eric Dumazet <edumazet@google.com>
    Acked-by: Mahesh Bandewar <maheshb@google.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/core/dev.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/net/core/dev.c b/net/core/dev.c
index 991d09b67bd90..d609366da95c7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -148,6 +148,7 @@
 #include <net/devlink.h>
 #include <linux/pm_runtime.h>
 #include <linux/prandom.h>
+#include <linux/once_lite.h>
 
 #include "net-sysfs.h"
 
@@ -3487,13 +3488,16 @@ EXPORT_SYMBOL(__skb_gso_segment);
 
 /* Take action when hardware reception checksum errors are detected. */
 #ifdef CONFIG_BUG
+static void do_netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb)
+{
+	pr_err("%s: hw csum failure\n", dev ? dev->name : "<unknown>");
+	skb_dump(KERN_ERR, skb, true);
+	dump_stack();
+}
+
 void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb)
 {
-	if (net_ratelimit()) {
-		pr_err("%s: hw csum failure\n", dev ? dev->name : "<unknown>");
-		skb_dump(KERN_ERR, skb, true);
-		dump_stack();
-	}
+	DO_ONCE_LITE(do_netdev_rx_csum_fault, dev, skb);
 }
 EXPORT_SYMBOL(netdev_rx_csum_fault);
 #endif
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic