From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 790B1C433ED for ; Fri, 23 Apr 2021 00:42:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2AAAF613D1 for ; Fri, 23 Apr 2021 00:42:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236666AbhDWAnZ (ORCPT ); Thu, 22 Apr 2021 20:43:25 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:3952 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229888AbhDWAnY (ORCPT ); Thu, 22 Apr 2021 20:43:24 -0400 Received: from dggeml406-hub.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4FRFnL0nyVz5swD; Fri, 23 Apr 2021 08:40:22 +0800 (CST) Received: from dggpemm500005.china.huawei.com (7.185.36.74) by dggeml406-hub.china.huawei.com (10.3.17.50) with Microsoft SMTP Server (TLS) id 14.3.498.0; Fri, 23 Apr 2021 08:42:45 +0800 Received: from [127.0.0.1] (10.69.30.204) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2176.2; Fri, 23 Apr 2021 08:42:45 +0800 Subject: Re: [PATCH net-next 3/3] net: update netdev_rx_csum_fault() print dump only once To: Tanner Love , CC: , Tanner Love , Eric Dumazet , Mahesh Bandewar References: <20210422194738.2175542-1-tannerlove.kernel@gmail.com> <20210422194738.2175542-4-tannerlove.kernel@gmail.com> From: Yunsheng Lin Message-ID: Date: Fri, 23 Apr 2021 08:42:45 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <20210422194738.2175542-4-tannerlove.kernel@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggeme716-chm.china.huawei.com (10.1.199.112) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On 2021/4/23 3:47, Tanner Love wrote: > From: Tanner Love > > Printing this stack dump multiple times does not provide additional > useful information, and consumes time in the data path. Printing once > is sufficient. > > Signed-off-by: Tanner Love > Acked-by: Eric Dumazet > Acked-by: Mahesh Bandewar > --- > net/core/dev.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/net/core/dev.c b/net/core/dev.c > index d9bf63dbe4fd..26b82b5d8563 100644 > --- a/net/core/dev.c > +++ b/net/core/dev.c > @@ -148,6 +148,7 @@ > #include > #include > #include > +#include > > #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 > -void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb) > +static void do_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 : ""); > skb_dump(KERN_ERR, skb, true); > dump_stack(); Once the "if ()" is removed, one level of indent seems enough? > - } > +} > + > +void netdev_rx_csum_fault(struct net_device *dev, struct sk_buff *skb) > +{ > + DO_ONCE_LITE(do_netdev_rx_csum_fault, dev, skb); > } > EXPORT_SYMBOL(netdev_rx_csum_fault); > #endif >