Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1680504 > unrolled thread

Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer XDP

Started by"Michael S. Tsirkin" <mst@redhat.com>
First post2017-07-03 19:10 +0200
Last post2017-07-06 02:10 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer  XDP "Michael S. Tsirkin" <mst@redhat.com> - 2017-07-03 19:10 +0200
    Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer  XDP Jason Wang <jasowang@redhat.com> - 2017-07-04 14:30 +0200
      Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer  XDP "Michael S. Tsirkin" <mst@redhat.com> - 2017-07-06 02:10 +0200

#1680504 — Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer XDP

From"Michael S. Tsirkin" <mst@redhat.com>
Date2017-07-03 19:10 +0200
SubjectRe: [PATCH net] virtio-net: unbreak cusmed packet for small buffer XDP
Message-ID<tZd1f-4pZ-3@gated-at.bofh.it>
On Wed, Jun 28, 2017 at 08:05:06PM +0800, Jason Wang wrote:
> 
> 
> On 2017年06月28日 12:01, Michael S. Tsirkin wrote:
> > On Wed, Jun 28, 2017 at 11:40:30AM +0800, Jason Wang wrote:
> > > 
> > > On 2017年06月28日 11:31, Michael S. Tsirkin wrote:
> > > > On Wed, Jun 28, 2017 at 10:45:18AM +0800, Jason Wang wrote:
> > > > > On 2017年06月28日 10:17, Michael S. Tsirkin wrote:
> > > > > > On Wed, Jun 28, 2017 at 10:14:34AM +0800, Jason Wang wrote:
> > > > > > > On 2017年06月28日 10:02, Michael S. Tsirkin wrote:
> > > > > > > > On Wed, Jun 28, 2017 at 09:54:03AM +0800, Jason Wang wrote:
> > > > > > > > > We should allow csumed packet for small buffer, otherwise XDP_PASS
> > > > > > > > > won't work correctly.
> > > > > > > > > 
> > > > > > > > > Fixes commit bb91accf2733 ("virtio-net: XDP support for small buffers")
> > > > > > > > > Signed-off-by: Jason Wang<jasowang@redhat.com>
> > > > > > > > The issue would be VIRTIO_NET_HDR_F_DATA_VALID might be set.
> > > > > > > > What do you think?
> > > > > > > I think it's safe. For XDP_PASS, it work like in the past.
> > > > > > That's the part I don't get. With DATA_VALID csum in packet is wrong, XDP
> > > > > > tools assume it's value.
> > > > > DATA_VALID is CHECKSUM_UNCESSARY on the host, and according to the comment
> > > > > in skbuff.h
> > > > > 
> > > > > 
> > > > > "
> > > > >    *   The hardware you're dealing with doesn't calculate the full checksum
> > > > >    *   (as in CHECKSUM_COMPLETE), but it does parse headers and verify
> > > > > checksums
> > > > >    *   for specific protocols. For such packets it will set
> > > > > CHECKSUM_UNNECESSARY
> > > > >    *   if their checksums are okay. skb->csum is still undefined in this case
> > > > >    *   though. A driver or device must never modify the checksum field in the
> > > > >    *   packet even if checksum is verified.
> > > > > "
> > > > > 
> > > > > The csum is correct I believe?
> > > > > 
> > > > > Thanks
> > > > That's on input. But I think for tun it's output, where that is equivalent
> > > > to CHECKSUM_NONE
> > > > 
> > > > 
> > > Yes, but the comment said:
> > > 
> > > "
> > > CKSUM_NONE:
> > >   *
> > >   *   The skb was already checksummed by the protocol, or a checksum is not
> > >   *   required.
> > >   *
> > >   * CHECKSUM_UNNECESSARY:
> > >   *
> > >   *   This has the same meaning on as CHECKSUM_NONE for checksum offload on
> > >   *   output.
> > >   *
> > > "
> > > 
> > > So still correct I think?
> > > 
> > > Thanks
> > Hmm maybe I mean NEEDS_CHECKSUM actually.
> > 
> > I'll need to re-read the spec.
> > 
> 
> Not sure this is an issue. But if it is, we can probably checksum the packet
> before passing it to XDP. But it would be a little slow.
> 
> Thanks



Right. I confused DATA_VALID with NEEDS_CHECKSUM.

IIUC XDP generally refuses to attach if checksum offload
is enabled.

Could you pls explain how to reproduce the issue you are seeing?

-- 
MST

[toc] | [next] | [standalone]


#1680915

FromJason Wang <jasowang@redhat.com>
Date2017-07-04 14:30 +0200
Message-ID<tZv7Q-89B-13@gated-at.bofh.it>
In reply to#1680504

On 2017年07月04日 01:03, Michael S. Tsirkin wrote:
> On Wed, Jun 28, 2017 at 08:05:06PM +0800, Jason Wang wrote:
>>
>> On 2017年06月28日 12:01, Michael S. Tsirkin wrote:
>>> On Wed, Jun 28, 2017 at 11:40:30AM +0800, Jason Wang wrote:
>>>> On 2017年06月28日 11:31, Michael S. Tsirkin wrote:
>>>>> On Wed, Jun 28, 2017 at 10:45:18AM +0800, Jason Wang wrote:
>>>>>> On 2017年06月28日 10:17, Michael S. Tsirkin wrote:
>>>>>>> On Wed, Jun 28, 2017 at 10:14:34AM +0800, Jason Wang wrote:
>>>>>>>> On 2017年06月28日 10:02, Michael S. Tsirkin wrote:
>>>>>>>>> On Wed, Jun 28, 2017 at 09:54:03AM +0800, Jason Wang wrote:
>>>>>>>>>> We should allow csumed packet for small buffer, otherwise XDP_PASS
>>>>>>>>>> won't work correctly.
>>>>>>>>>>
>>>>>>>>>> Fixes commit bb91accf2733 ("virtio-net: XDP support for small buffers")
>>>>>>>>>> Signed-off-by: Jason Wang<jasowang@redhat.com>
>>>>>>>>> The issue would be VIRTIO_NET_HDR_F_DATA_VALID might be set.
>>>>>>>>> What do you think?
>>>>>>>> I think it's safe. For XDP_PASS, it work like in the past.
>>>>>>> That's the part I don't get. With DATA_VALID csum in packet is wrong, XDP
>>>>>>> tools assume it's value.
>>>>>> DATA_VALID is CHECKSUM_UNCESSARY on the host, and according to the comment
>>>>>> in skbuff.h
>>>>>>
>>>>>>
>>>>>> "
>>>>>>     *   The hardware you're dealing with doesn't calculate the full checksum
>>>>>>     *   (as in CHECKSUM_COMPLETE), but it does parse headers and verify
>>>>>> checksums
>>>>>>     *   for specific protocols. For such packets it will set
>>>>>> CHECKSUM_UNNECESSARY
>>>>>>     *   if their checksums are okay. skb->csum is still undefined in this case
>>>>>>     *   though. A driver or device must never modify the checksum field in the
>>>>>>     *   packet even if checksum is verified.
>>>>>> "
>>>>>>
>>>>>> The csum is correct I believe?
>>>>>>
>>>>>> Thanks
>>>>> That's on input. But I think for tun it's output, where that is equivalent
>>>>> to CHECKSUM_NONE
>>>>>
>>>>>
>>>> Yes, but the comment said:
>>>>
>>>> "
>>>> CKSUM_NONE:
>>>>    *
>>>>    *   The skb was already checksummed by the protocol, or a checksum is not
>>>>    *   required.
>>>>    *
>>>>    * CHECKSUM_UNNECESSARY:
>>>>    *
>>>>    *   This has the same meaning on as CHECKSUM_NONE for checksum offload on
>>>>    *   output.
>>>>    *
>>>> "
>>>>
>>>> So still correct I think?
>>>>
>>>> Thanks
>>> Hmm maybe I mean NEEDS_CHECKSUM actually.
>>>
>>> I'll need to re-read the spec.
>>>
>> Not sure this is an issue. But if it is, we can probably checksum the packet
>> before passing it to XDP. But it would be a little slow.
>>
>> Thanks
>
>
> Right. I confused DATA_VALID with NEEDS_CHECKSUM.
>
> IIUC XDP generally refuses to attach if checksum offload
> is enabled.

Any reason to do this? (Looks like I don't see any code for this)

>
> Could you pls explain how to reproduce the issue you are seeing?
>

Using small buffer, all csumed packets will be dropped.

Thanks

[toc] | [prev] | [next] | [standalone]


#1681961

From"Michael S. Tsirkin" <mst@redhat.com>
Date2017-07-06 02:10 +0200
Message-ID<u02wN-52u-11@gated-at.bofh.it>
In reply to#1680915
On Tue, Jul 04, 2017 at 08:20:00PM +0800, Jason Wang wrote:
> > IIUC XDP generally refuses to attach if checksum offload
> > is enabled.
> 
> Any reason to do this? (Looks like I don't see any code for this)

Some of it was covered here
https://www.mail-archive.com/netdev@vger.kernel.org/msg162577.html

-- 
MST

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web