diff mbox series

[net-next] net: hns3: remove unnecessary NULL checking in napi_consume_skb()

Message ID 1600481766-46158-1-git-send-email-linyunsheng@huawei.com
State Changes Requested
Delegated to: David Miller
Headers show
Series [net-next] net: hns3: remove unnecessary NULL checking in napi_consume_skb() | expand

Commit Message

Yunsheng Lin Sept. 19, 2020, 2:16 a.m. UTC
When budget is non-zero, skb_unref() has already handled the
NULL checking.

When budget is zero, the dev_consume_skb_any() has handled NULL
checking in __dev_kfree_skb_irq(), or dev_kfree_skb() which also
ultimately call skb_unref().

So remove the unnecessary checking in napi_consume_skb().

Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
---
 net/core/skbuff.c | 3 ---
 1 file changed, 3 deletions(-)

Comments

Yunsheng Lin Sept. 19, 2020, 2:23 a.m. UTC | #1
Please ignore this patch, the title is not right, sorry for the noise.

On 2020/9/19 10:16, Yunsheng Lin wrote:
> When budget is non-zero, skb_unref() has already handled the
> NULL checking.
> 
> When budget is zero, the dev_consume_skb_any() has handled NULL
> checking in __dev_kfree_skb_irq(), or dev_kfree_skb() which also
> ultimately call skb_unref().
> 
> So remove the unnecessary checking in napi_consume_skb().
> 
> Signed-off-by: Yunsheng Lin <linyunsheng@huawei.com>
> ---
>  net/core/skbuff.c | 3 ---
>  1 file changed, 3 deletions(-)
> 
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index bfd7483..e077447 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -895,9 +895,6 @@ void __kfree_skb_defer(struct sk_buff *skb)
>  
>  void napi_consume_skb(struct sk_buff *skb, int budget)
>  {
> -	if (unlikely(!skb))
> -		return;
> -
>  	/* Zero budget indicate non-NAPI context called us, like netpoll */
>  	if (unlikely(!budget)) {
>  		dev_consume_skb_any(skb);
>
diff mbox series

Patch

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index bfd7483..e077447 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -895,9 +895,6 @@  void __kfree_skb_defer(struct sk_buff *skb)
 
 void napi_consume_skb(struct sk_buff *skb, int budget)
 {
-	if (unlikely(!skb))
-		return;
-
 	/* Zero budget indicate non-NAPI context called us, like netpoll */
 	if (unlikely(!budget)) {
 		dev_consume_skb_any(skb);