virtio-dev.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cohuck@redhat.com>
To: Heng Qi <hengqi@linux.alibaba.com>,
	"Michael S. Tsirkin" <mst@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>,
	Yuri Benditovich <yuri.benditovich@daynix.com>,
	Xuan Zhuo <xuanzhuo@linux.alibaba.com>,
	"virtio-comment@lists.oasis-open.org"
	<virtio-comment@lists.oasis-open.org>,
	"virtio-dev@lists.oasis-open.org"
	<virtio-dev@lists.oasis-open.org>,
	"virtio@lists.oasis-open.org" <virtio@lists.oasis-open.org>
Subject: Re: [virtio-dev] [PATCH v8] virtio-net: correct conditions for devices to validate packet checksum
Date: Thu, 11 Jan 2024 17:27:24 +0100	[thread overview]
Message-ID: <87mstbomxf.fsf@redhat.com> (raw)
In-Reply-To: <79c04138-6e41-4b53-a830-33bfa36501bb@linux.alibaba.com>

On Thu, Jan 11 2024, Heng Qi <hengqi@linux.alibaba.com> wrote:

> 在 2024/1/4 下午12:47, Heng Qi 写道:
>>
>>
>> 在 2024/1/3 下午2:35, Heng Qi 写道:
>>> There is a historical error in virtio spec:
>>>    "If VIRTIO_NET_F_GUEST_CSUM is not negotiated, the device *MUST* 
>>> set flags
>>>     to zero and SHOULD supply a fully checksummed packet to the driver."
>>>
>>> Currently in Linux and virtio-related implementations, the device 
>>> validates
>>> the packet checksum and sets DATA_VALID regardless of whether
>>> VIRTIO_NET_F_GUEST_CSUM is negotiated.
>>>
>>> Please refer to the following summary and thread[1] for details and 
>>> reasons:
>>>
>>> Summary
>>> =============
>>> 1. GUEST_CSUM at virtio spec 0.95 is intended to be compatible with 
>>> partially
>>> checksummed packets (NEEDS_CSUM <-> CHECKSUM_PARTIAL). So GUEST_CSUM 
>>> is mapped
>>> to NETIF_F_RXCSUM.
>>> GUEST_CSUM only indicates whether the driver handles partially 
>>> checksummed packets.
>>> When XDP is loaded, the GUEST_CSUM's offload will be disabled, which 
>>> means that
>>> packets have NEEDS_CSUM set will be dropped, and packets have 
>>> DATA_VALID set will
>>> still be received.
>>>
>>> 2. When DATA_VALID was added to Linux in 2011[2] and virtio1.0, it 
>>> was actually
>>> expected that rx checksum offload (the driver can set 
>>> CHECKSUM_UNNECESSARY) had
>>> nothing to do with whether GUEST_CSUM was negotiated. But due to an 
>>> error, below
>>> desctiption was added incorrectly:
>>>    "If VIRTIO_NET_F_GUEST_CSUM is not negotiated, the device *MUST* 
>>> set flags
>>>     to zero and SHOULD supply a fully checksummed packet to the driver."
>>>
>>> 3. We now hope to correct this error. Let the setting of DATA_VALID 
>>> not be
>>> controlled by whether GUEST_CSUM is negotiated, but only controlled 
>>> by whether
>>> rx checksum offload is enabled on the OS side. The state of this rx 
>>> checksum
>>> offload is not aware of the device.
>>>
>>> 4. [Optional] NETIF_F_RXCSUM corresponding to rx checksum offload 
>>> should be
>>> added to dev->hw_features. When the user turns off rx checksum 
>>> offload through
>>> ethtool -K, neither NEEDS_CSUM nor DATA_VALID should be taken care 
>>> of, that is,
>>> all packets will be marked as CHECKSUM_NONE.
>>>
>>> Related Link
>>> =============
>>> [1] 
>>> https://lists.oasis-open.org/archives/virtio-comment/202312/msg00135.html
>>> [2] 10a8d94a9574 ("virtio_net: introduce VIRTIO_NET_HDR_F_DATA_VALID")
>>>
>>> Fixes: https://github.com/oasis-tcs/virtio-spec/issues/185
>>
>> Hi Michael, Cornelia.
>>
>> Could you please open a voting for this fix?
>
> Hi Michael and Cornelia.
>
> Sincerely asking if you missed this message?

I've been back from end-of-year PTO only this week...

I'm currently waiting for a confirmed updated schedule for the
infrastructure migration, as I don't want to risk having the platform
out of order in the middle of the voting period.

>
> In addition, Jason recently responded with his reviewed-by tag.
> Do I need to publish a new version carrying his tag (thanks Jason)?

No, we can add his R-b when pushing to git.


---------------------------------------------------------------------
To unsubscribe, e-mail: virtio-dev-unsubscribe@lists.oasis-open.org
For additional commands, e-mail: virtio-dev-help@lists.oasis-open.org


  reply	other threads:[~2024-01-11 16:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-03  6:35 [virtio-dev] [PATCH v8] virtio-net: correct conditions for devices to validate packet checksum Heng Qi
2024-01-04  4:47 ` Heng Qi
2024-01-08  3:48   ` [virtio-dev] Re: [virtio-comment] " Jason Wang
2024-01-11  3:27   ` Heng Qi
2024-01-11 16:27     ` Cornelia Huck [this message]
2024-01-12  3:09       ` [virtio-dev] Re: [virtio-comment] " Heng Qi
2024-01-16  5:52 ` [virtio-dev] " Xuan Zhuo
2024-02-20  2:38   ` Heng Qi

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=87mstbomxf.fsf@redhat.com \
    --to=cohuck@redhat.com \
    --cc=hengqi@linux.alibaba.com \
    --cc=jasowang@redhat.com \
    --cc=mst@redhat.com \
    --cc=virtio-comment@lists.oasis-open.org \
    --cc=virtio-dev@lists.oasis-open.org \
    --cc=virtio@lists.oasis-open.org \
    --cc=xuanzhuo@linux.alibaba.com \
    --cc=yuri.benditovich@daynix.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;
as well as URLs for NNTP newsgroup(s).