All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] net: remove unnecessary NULL checking in napi_consume_skb()
@ 2020-09-19  2:24 Yunsheng Lin
  2020-09-20 21:18 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Yunsheng Lin @ 2020-09-19  2:24 UTC (permalink / raw)
  To: davem, kuba, linmiaohe, martin.varghese, fw, edumazet, dcaratti,
	steffen.klassert, pabeni, kyk.segfault
  Cc: netdev, linux-kernel, linuxarm

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);
-- 
2.8.1


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

* Re: [PATCH net-next] net: remove unnecessary NULL checking in napi_consume_skb()
  2020-09-19  2:24 [PATCH net-next] net: remove unnecessary NULL checking in napi_consume_skb() Yunsheng Lin
@ 2020-09-20 21:18 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-09-20 21:18 UTC (permalink / raw)
  To: linyunsheng
  Cc: kuba, linmiaohe, martin.varghese, fw, edumazet, dcaratti,
	steffen.klassert, pabeni, kyk.segfault, netdev, linux-kernel,
	linuxarm

From: Yunsheng Lin <linyunsheng@huawei.com>
Date: Sat, 19 Sep 2020 10:24:47 +0800

> 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>

Applied.

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

end of thread, other threads:[~2020-09-20 21:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-19  2:24 [PATCH net-next] net: remove unnecessary NULL checking in napi_consume_skb() Yunsheng Lin
2020-09-20 21:18 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.