Netdev Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] net: Use __skb_pagelen() directly in skb_cow_data()
@ 2020-08-01  9:30 linmiaohe
  2020-08-03 22:38 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: linmiaohe @ 2020-08-01  9:30 UTC (permalink / raw)
  To: davem, kuba, fw, pshelar, martin.varghese, pabeni, edumazet,
	dcaratti, steffen.klassert, shmulik, kyk.segfault
  Cc: netdev, linux-kernel, linmiaohe

From: Miaohe Lin <linmiaohe@huawei.com>

In fact, skb_pagelen() - skb_headlen() is equal to __skb_pagelen(), use it
directly to avoid unnecessary skb_headlen() call.

Also fix the CHECK note of checkpatch.pl:
    Comparison to NULL could be written "!__pskb_pull_tail"

Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
---
 net/core/skbuff.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index b8afefe6f6b6..3219c26ddfae 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4413,7 +4413,7 @@ int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer)
 	 * at the moment even if they are anonymous).
 	 */
 	if ((skb_cloned(skb) || skb_shinfo(skb)->nr_frags) &&
-	    __pskb_pull_tail(skb, skb_pagelen(skb)-skb_headlen(skb)) == NULL)
+	    !__pskb_pull_tail(skb, __skb_pagelen(skb)))
 		return -ENOMEM;
 
 	/* Easy case. Most of packets will go this way. */
-- 
2.19.1


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

* Re: [PATCH] net: Use __skb_pagelen() directly in skb_cow_data()
  2020-08-01  9:30 [PATCH] net: Use __skb_pagelen() directly in skb_cow_data() linmiaohe
@ 2020-08-03 22:38 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-08-03 22:38 UTC (permalink / raw)
  To: linmiaohe
  Cc: kuba, fw, pshelar, martin.varghese, pabeni, edumazet, dcaratti,
	steffen.klassert, shmulik, kyk.segfault, netdev, linux-kernel

From: linmiaohe <linmiaohe@huawei.com>
Date: Sat, 1 Aug 2020 17:30:23 +0800

> From: Miaohe Lin <linmiaohe@huawei.com>
> 
> In fact, skb_pagelen() - skb_headlen() is equal to __skb_pagelen(), use it
> directly to avoid unnecessary skb_headlen() call.
> 
> Also fix the CHECK note of checkpatch.pl:
>     Comparison to NULL could be written "!__pskb_pull_tail"
> 
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>

Applied.

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-01  9:30 [PATCH] net: Use __skb_pagelen() directly in skb_cow_data() linmiaohe
2020-08-03 22:38 ` David Miller

Netdev Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/netdev/0 netdev/git/0.git
	git clone --mirror https://lore.kernel.org/netdev/1 netdev/git/1.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 netdev netdev/ https://lore.kernel.org/netdev \
		netdev@vger.kernel.org
	public-inbox-index netdev

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.netdev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git