From: Yunsheng Lin <linyunsheng@huawei.com>
To: Saeed Mahameed <saeedm@nvidia.com>,
"tanhuazhong@huawei.com" <tanhuazhong@huawei.com>,
"davem@davemloft.net" <davem@davemloft.net>
Cc: "yisen.zhuang@huawei.com" <yisen.zhuang@huawei.com>,
"salil.mehta@huawei.com" <salil.mehta@huawei.com>,
"linuxarm@huawei.com" <linuxarm@huawei.com>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kuba@kernel.org" <kuba@kernel.org>
Subject: Re: [PATCH net-next 6/6] net: hns3: use napi_consume_skb() when cleaning tx desc
Date: Tue, 15 Sep 2020 15:04:13 +0800 [thread overview]
Message-ID: <2b1219b6-a7dd-38a3-bfb7-1cb49330df90@huawei.com> (raw)
In-Reply-To: <e615366cb2b260bf1b77fdaa0692957ab750a9a4.camel@nvidia.com>
On 2020/9/15 13:09, Saeed Mahameed wrote:
> On Mon, 2020-09-14 at 20:06 +0800, Huazhong Tan wrote:
>> From: Yunsheng Lin <linyunsheng@huawei.com>
>>
>> Use napi_consume_skb() to batch consuming skb when cleaning
>> tx desc in NAPI polling.
>>
>> Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
>> Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
>> ---
>> drivers/net/ethernet/hisilicon/hns3/hns3_enet.c | 27 +++++++++++-
>> ----------
>> drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 2 +-
>> drivers/net/ethernet/hisilicon/hns3/hns3_ethtool.c | 4 ++--
>> 3 files changed, 17 insertions(+), 16 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
>> b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
>> index 4a49a76..feeaf75 100644
>> --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
>> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
>> @@ -2333,10 +2333,10 @@ static int hns3_alloc_buffer(struct
>> hns3_enet_ring *ring,
>> }
>>
>> static void hns3_free_buffer(struct hns3_enet_ring *ring,
>> - struct hns3_desc_cb *cb)
>> + struct hns3_desc_cb *cb, int budget)
>> {
>> if (cb->type == DESC_TYPE_SKB)
>> - dev_kfree_skb_any((struct sk_buff *)cb->priv);
>> + napi_consume_skb(cb->priv, budget);
>
> This code can be reached from hns3_lb_clear_tx_ring() below which is
> your loopback test and called with non-zero budget, I am not sure you
> are allowed to call napi_consume_skb() with non-zero budget outside
> napi context, perhaps the cb->type for loopback test is different in lb
> test case ? Idk.. , please double check other code paths.
Yes, loopback test may call napi_consume_skb() with non-zero budget outside
napi context. Thanks for pointing out this case.
How about add the below WARN_ONCE() in napi_consume_skb() to catch this
kind of error?
WARN_ONCE(!in_serving_softirq(), "napi_consume_skb() is called with non-zero budget outside napi context");
>
> [...]
>
>> static void hns3_lb_clear_tx_ring(struct hns3_nic_priv *priv, u32
>> start_ringid,
>> - u32 end_ringid, u32 budget)
>> + u32 end_ringid, int budget)
>> {
>> u32 i;
>>
>> for (i = start_ringid; i <= end_ringid; i++) {
>> struct hns3_enet_ring *ring = &priv->ring[i];
>>
>> - hns3_clean_tx_ring(ring);
>> + hns3_clean_tx_ring(ring, budget);
>> }
>> }
>>
next prev parent reply other threads:[~2020-09-15 7:06 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-14 12:06 [PATCH net-next 0/6] net: hns3: updates for -next Huazhong Tan
2020-09-14 12:06 ` [PATCH net-next 1/6] net: hns3: batch the page reference count updates Huazhong Tan
2020-09-14 12:06 ` [PATCH net-next 2/6] net: hns3: batch tx doorbell operation Huazhong Tan
2020-09-14 12:06 ` [PATCH net-next 3/6] net: hns3: optimize the tx clean process Huazhong Tan
2020-09-14 12:06 ` [PATCH net-next 4/6] net: hns3: optimize the rx " Huazhong Tan
2020-09-14 12:06 ` [PATCH net-next 5/6] net: hns3: use writel() to optimize the barrier operation Huazhong Tan
2020-09-14 21:45 ` Jakub Kicinski
2020-09-15 1:41 ` Yunsheng Lin
2020-09-14 12:06 ` [PATCH net-next 6/6] net: hns3: use napi_consume_skb() when cleaning tx desc Huazhong Tan
2020-09-15 5:09 ` Saeed Mahameed
2020-09-15 7:04 ` Yunsheng Lin [this message]
2020-09-16 8:33 ` Saeed Mahameed
2020-09-16 8:38 ` Eric Dumazet
2020-09-17 6:52 ` Yunsheng Lin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2b1219b6-a7dd-38a3-bfb7-1cb49330df90@huawei.com \
--to=linyunsheng@huawei.com \
--cc=davem@davemloft.net \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@nvidia.com \
--cc=salil.mehta@huawei.com \
--cc=tanhuazhong@huawei.com \
--cc=yisen.zhuang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®