mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: exit immediately when off = 0 in skb_headers_offset_update()
@ 2020-08-27 11:23 Miaohe Lin
  2020-08-27 11:37 ` Eric Dumazet
  0 siblings, 1 reply; 2+ messages in thread
From: Miaohe Lin @ 2020-08-27 11:23 UTC (permalink / raw)
  To: davem, kuba, pshelar, fw, martin.varghese, edumazet, dcaratti,
	steffen.klassert, pabeni, shmulik, kyk.segfault
  Cc: netdev, linux-kernel, linmiaohe

In the case of off = 0, skb_headers_offset_update() do nothing indeed.

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

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 18ed56316e56..f67f0da20a5b 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1459,6 +1459,8 @@ EXPORT_SYMBOL(skb_clone);
 
 void skb_headers_offset_update(struct sk_buff *skb, int off)
 {
+	if (unlikely(off == 0))
+		return;
 	/* Only adjust this if it actually is csum_start rather than csum */
 	if (skb->ip_summed == CHECKSUM_PARTIAL)
 		skb->csum_start += off;
-- 
2.19.1


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

* Re: [PATCH] net: exit immediately when off = 0 in skb_headers_offset_update()
  2020-08-27 11:23 [PATCH] net: exit immediately when off = 0 in skb_headers_offset_update() Miaohe Lin
@ 2020-08-27 11:37 ` Eric Dumazet
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Dumazet @ 2020-08-27 11:37 UTC (permalink / raw)
  To: Miaohe Lin
  Cc: David Miller, Jakub Kicinski, Pravin B Shelar, Florian Westphal,
	martin.varghese, Davide Caratti, Steffen Klassert, Paolo Abeni,
	shmulik, kyk.segfault, netdev, LKML

On Thu, Aug 27, 2020 at 4:25 AM Miaohe Lin <linmiaohe@huawei.com> wrote:
>
> In the case of off = 0, skb_headers_offset_update() do nothing indeed.
>
> Signed-off-by: Miaohe Lin <linmiaohe@huawei.com>
> ---
>  net/core/skbuff.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 18ed56316e56..f67f0da20a5b 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -1459,6 +1459,8 @@ EXPORT_SYMBOL(skb_clone);
>
>  void skb_headers_offset_update(struct sk_buff *skb, int off)
>  {
> +       if (unlikely(off == 0))
> +               return;

If this is unlikely, I doubt adding a test is going to save anything.

This will instead add a conditional test for the 'likely' cases.

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

end of thread, other threads:[~2020-08-27 15:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 11:23 [PATCH] net: exit immediately when off = 0 in skb_headers_offset_update() Miaohe Lin
2020-08-27 11:37 ` Eric Dumazet

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®