All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Eric Dumazet <edumazet@google.com>,
	Thomas Bogendoerfer <tbogendoerfer@suse.de>
Cc: "David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, <netdev@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net] gro_cells: Avoid packet re-ordering for cloned skbs
Date: Mon, 13 Jan 2025 14:33:24 +0100	[thread overview]
Message-ID: <f0e2665e-f6af-4c7b-aaf1-b9c8dc3cdd40@intel.com> (raw)
In-Reply-To: <CANn89iL-CcBxQUvJDn7o2ETSBnwf047hXJEf=q=O3m+qAenPFw@mail.gmail.com>

From: Eric Dumazet <edumazet@google.com>
Date: Mon, 13 Jan 2025 13:55:18 +0100

> On Mon, Jan 13, 2025 at 12:28 PM Thomas Bogendoerfer
> <tbogendoerfer@suse.de> wrote:
>>
>> On Thu, 9 Jan 2025 15:56:24 +0100
>> Eric Dumazet <edumazet@google.com> wrote:
>>
>>> On Thu, Jan 9, 2025 at 3:27 PM Thomas Bogendoerfer
>>> <tbogendoerfer@suse.de> wrote:
>>>>
>>>> gro_cells_receive() passes a cloned skb directly up the stack and
>>>> could cause re-ordering against segments still in GRO. To avoid
>>>> this copy the skb and let GRO do it's work.
>>>>
>>>> Fixes: c9e6bc644e55 ("net: add gro_cells infrastructure")
>>>> Signed-off-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
>>>> ---
>>>>  net/core/gro_cells.c | 11 ++++++++++-
>>>>  1 file changed, 10 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/net/core/gro_cells.c b/net/core/gro_cells.c
>>>> index ff8e5b64bf6b..2f8d688f9d82 100644
>>>> --- a/net/core/gro_cells.c
>>>> +++ b/net/core/gro_cells.c
>>>> @@ -20,11 +20,20 @@ int gro_cells_receive(struct gro_cells *gcells, struct sk_buff *skb)
>>>>         if (unlikely(!(dev->flags & IFF_UP)))
>>>>                 goto drop;
>>>>
>>>> -       if (!gcells->cells || skb_cloned(skb) || netif_elide_gro(dev)) {
>>>> +       if (!gcells->cells || netif_elide_gro(dev)) {
>>>> +netif_rx:
>>>>                 res = netif_rx(skb);
>>>>                 goto unlock;
>>>>         }
>>>> +       if (skb_cloned(skb)) {
>>>> +               struct sk_buff *n;
>>>>
>>>> +               n = skb_copy(skb, GFP_KERNEL);
>>>
>>> I do not think we want this skb_copy(). This is going to fail too often.
>>
>> ok
>>
>>> Can you remind us why we have this skb_cloned() check here ?
>>
>> some fields of the ip/tcp header are going to be changed in the first gro
>> segment
> 
> Presumably we should test skb_header_cloned()
> 
> This means something like skb_cow_head(skb, 0) could be much more
> reasonable than skb_copy().

Maybe skb_try_make_writable() would fit?

> 
> diff --git a/net/core/gro_cells.c b/net/core/gro_cells.c
> index ff8e5b64bf6b76451a69e3eae132b593c60ee204..bd8966484da3fe85d1d87bf847d3730d7ad094e5
> 100644
> --- a/net/core/gro_cells.c
> +++ b/net/core/gro_cells.c
> @@ -20,7 +20,7 @@ int gro_cells_receive(struct gro_cells *gcells,
> struct sk_buff *skb)
>         if (unlikely(!(dev->flags & IFF_UP)))
>                 goto drop;
> 
> -       if (!gcells->cells || skb_cloned(skb) || netif_elide_gro(dev)) {
> +       if (!gcells->cells || netif_elide_gro(dev) || skb_cow_head(skb, 0)) {
>                 res = netif_rx(skb);
>                 goto unlock;
>         }

Thanks,
Olek

  reply	other threads:[~2025-01-13 13:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-09 14:27 [PATCH net] gro_cells: Avoid packet re-ordering for cloned skbs Thomas Bogendoerfer
2025-01-09 14:56 ` Eric Dumazet
2025-01-13 11:28   ` Thomas Bogendoerfer
2025-01-13 12:55     ` Eric Dumazet
2025-01-13 13:33       ` Alexander Lobakin [this message]
2025-01-20 14:31       ` Thomas Bogendoerfer
2025-01-20 14:55         ` Eric Dumazet
2025-01-21 11:51           ` Thomas Bogendoerfer

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=f0e2665e-f6af-4c7b-aaf1-b9c8dc3cdd40@intel.com \
    --to=aleksander.lobakin@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=tbogendoerfer@suse.de \
    /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 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.