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


Groups > linux.kernel > #1676330

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

From Jason Wang <jasowang@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer XDP
Date 2017-06-28 04:50 +0200
Message-ID <tXbdg-Yp-13@gated-at.bofh.it> (permalink)
References <tXaqR-ld-5@gated-at.bofh.it> <tXaAy-Ds-13@gated-at.bofh.it> <tXaKd-MM-1@gated-at.bofh.it> <tXaKd-MM-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



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

>
>> For XDP_TX, we
>> zero the vnet header.
> Again TX offload is disabled, so packets will go out with an invalid
> checksum.
>
>> For adjusting header, XDP prog should deal with csum.
>>
>> Thanks
> That part seems right.
>
>>>> ---
>>>> The patch is needed for -stable.
>>>> ---
>>>>    drivers/net/virtio_net.c | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>>>> index 143d8a9..499fcc9 100644
>>>> --- a/drivers/net/virtio_net.c
>>>> +++ b/drivers/net/virtio_net.c
>>>> @@ -413,7 +413,7 @@ static struct sk_buff *receive_small(struct net_device *dev,
>>>>    		void *orig_data;
>>>>    		u32 act;
>>>> -		if (unlikely(hdr->hdr.gso_type || hdr->hdr.flags))
>>>> +		if (unlikely(hdr->hdr.gso_type))
>>>>    			goto err_xdp;
>>>>    		xdp.data_hard_start = buf + VIRTNET_RX_PAD + vi->hdr_len;
>>>> -- 
>>>> 2.7.4

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH net] virtio-net: unbreak cusmed packet for small buffer XDP Jason Wang <jasowang@redhat.com> - 2017-06-28 04:00 +0200
  Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer  XDP "Michael S. Tsirkin" <mst@redhat.com> - 2017-06-28 04:10 +0200
    Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer  XDP Jason Wang <jasowang@redhat.com> - 2017-06-28 04:20 +0200
      Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer  XDP "Michael S. Tsirkin" <mst@redhat.com> - 2017-06-28 04:20 +0200
        Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer  XDP Jason Wang <jasowang@redhat.com> - 2017-06-28 04:50 +0200
          Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer  XDP "Michael S. Tsirkin" <mst@redhat.com> - 2017-06-28 05:40 +0200
            Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer  XDP Jason Wang <jasowang@redhat.com> - 2017-06-28 05:50 +0200
              Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer  XDP "Michael S. Tsirkin" <mst@redhat.com> - 2017-06-28 06:10 +0200
                Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer  XDP Jason Wang <jasowang@redhat.com> - 2017-06-28 14:10 +0200

csiph-web