public inbox for virtio-comment@lists.linux.dev
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: virtio-comment@lists.linux.dev, maxime.coquelin@redhat.com,
	Eelco Chaudron <echaudro@redhat.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	Willem de Bruijn <willemb@google.com>,
	kshankar@marvell.com
Subject: Re: [PATCH v9 1/2] virtio-net: define UDP tunnel segmentation offload feature
Date: Mon, 21 Oct 2024 18:27:18 +0200	[thread overview]
Message-ID: <7f40f3da-aa6e-437c-af73-97e44e1982d1@redhat.com> (raw)
In-Reply-To: <CACGkMEsiRJ2zAcys0iFQkiL0h9MY-LOE4=LP7s4ksN=T+HY_Xw@mail.gmail.com>

On 10/21/24 08:54, Jason Wang wrote:
> On Fri, Oct 18, 2024 at 6:10 PM Paolo Abeni <pabeni@redhat.com> wrote:
>> On 10/18/24 06:26, Jason Wang wrote:
>>> On Thu, Oct 17, 2024 at 11:34 PM Paolo Abeni <pabeni@redhat.com> wrote:
>>>> i.e. all the checks in
>>>>
>>>> https://elixir.bootlin.com/linux/v6.12-rc2/source/include/linux/virtio_net.h#L97
>>>> ..L112
>>>>
>>>> will be meaningless in such scenario and the GSO over UDP tunnel helper
>>>> code must replicate them with the correct offsets.
>>>
>>> I don't understand here. It works like a charm for non GSO UDP tunnel,
>>> anything that makes it can't work for GSO?
>>
>> I we chose to use csum_start for the outer header, for GSO over UDP
>> tunnel packets:
>>
>> 1) the 'all headers in linear part' check:
>>
>> https://elixir.bootlin.com/linux/v6.12-rc3/source/include/linux/virtio_net.h#L111
>>
>> and all the need preeceeding algebra will be useless,
> 
> This part I don't understand. We still need a validation for the outer
> header and we've already done this for non GSO tunnels already.

For GSO over UDP tunnel packet, what we need to ensure is that all the
headers, comprising the inner ones, are available.

Checking that the outer header are there does not avoid the need for
checking that the inner headers are present.

Checking the inners only is instead sufficient: if the inner headers are
available any preceeding data will also be available, including the
outer headers.

>> 3) the csum_start/csum_offset assignment performed by:
>>
>> https://elixir.bootlin.com/linux/v6.12-rc3/source/include/linux/virtio_net.h#L104
>>
>> will yeld the wrong values - as they should point to the inner header
>> for GSO over UDP tunnel packets.
> 
> See above, it just works as a non GSO UDP tunnel.

Note that all this topic is about GSO over UDP tunnel packets, and which
layout is more consistent for them.

For GSO over UDP tunnel packets, if we set virtio_net_header csum_start
to the outer, we can't reuse a single line of the existing code, as the
tests will be unnecessary or will give the wrong results.

i.e.

-
https://elixir.bootlin.com/linux/v6.12-rc3/source/include/linux/virtio_net.h#L171

would flag as invalid good  packets, as it would over-estimante the
packet payload size

-
https://elixir.bootlin.com/linux/v6.12-rc3/source/include/linux/virtio_net.h#L179

would drop every TCP over UDP tunnel packet, as csum_offset will be 6
even when the inner header is TCP.

Instead if for GSO over UDP tunnel we set csum_start to the inner
header, all the existing test will yield valid result - mostly because
the Linux kernel, for such packets, expect csum_start pointing the inner
header.

And that is IMHO a clear sign that for such packet csum_offset should
point to the inner header even for virtio_net_hdr.

Cheers,

Paolo


  reply	other threads:[~2024-10-21 16:27 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-04  8:13 [PATCH v9 0/2] virtio-net: define UDP tunnel offload Paolo Abeni
2024-10-04  8:13 ` [PATCH v9 1/2] virtio-net: define UDP tunnel segmentation offload feature Paolo Abeni
2024-10-09  7:18   ` Jason Wang
2024-10-09  8:37     ` Paolo Abeni
2024-10-10  3:17       ` Jason Wang
2024-10-10  7:40         ` Paolo Abeni
2024-10-11  2:08           ` Jason Wang
2024-10-11  7:50             ` Paolo Abeni
2024-10-14  7:20             ` Paolo Abeni
2024-10-17  6:47               ` Jason Wang
2024-10-17 15:34                 ` Paolo Abeni
2024-10-18  4:26                   ` Jason Wang
2024-10-18 10:10                     ` Paolo Abeni
2024-10-20 22:28                       ` Willem de Bruijn
2024-10-21 15:47                         ` Paolo Abeni
2024-10-22  7:54                           ` Jason Wang
2024-10-23 20:57                             ` Willem de Bruijn
2024-10-25  8:41                               ` Jason Wang
2024-10-21  6:54                       ` Jason Wang
2024-10-21 16:27                         ` Paolo Abeni [this message]
2024-10-22  7:42                           ` Jason Wang
2024-10-22 16:56                             ` Paolo Abeni
2024-10-25  8:28                               ` Jason Wang
2024-10-25 11:50                                 ` Paolo Abeni
2024-10-25 13:28                                   ` Willem de Bruijn
2024-10-25 14:35                                     ` Paolo Abeni
2024-10-25 15:47                                       ` Willem de Bruijn
2024-10-28  3:27                                   ` Jason Wang
2024-10-28 12:08                                     ` Paolo Abeni
2024-10-28 12:26                                       ` Willem de Bruijn
2024-10-28 14:23                                         ` Paolo Abeni
2024-10-29  7:32                                         ` Jason Wang
2024-10-04  8:13 ` [PATCH v9 2/2] virtio-net: define UDP tunnel checksum " Paolo Abeni
2024-10-09  7:18   ` Jason Wang
2024-10-09  9:39     ` Paolo Abeni
2024-10-10  4:22       ` Jason Wang
2024-10-04 16:53 ` [PATCH v9 0/2] virtio-net: define UDP tunnel offload Paolo Abeni
2024-10-09  7:24   ` Jason Wang
2024-10-09  8:08     ` Paolo Abeni
2024-10-10  2:29       ` Jason Wang

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=7f40f3da-aa6e-437c-af73-97e44e1982d1@redhat.com \
    --to=pabeni@redhat.com \
    --cc=echaudro@redhat.com \
    --cc=jasowang@redhat.com \
    --cc=kshankar@marvell.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=sgarzare@redhat.com \
    --cc=virtio-comment@lists.linux.dev \
    --cc=willemb@google.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox