From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752224AbdGDMUM (ORCPT ); Tue, 4 Jul 2017 08:20:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36442 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752067AbdGDMUL (ORCPT ); Tue, 4 Jul 2017 08:20:11 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com E7F258553F Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jasowang@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com E7F258553F Subject: Re: [PATCH net] virtio-net: unbreak cusmed packet for small buffer XDP To: "Michael S. Tsirkin" Cc: virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <1498614843-8163-1-git-send-email-jasowang@redhat.com> <20170628050057-mutt-send-email-mst@kernel.org> <7068053c-50da-6779-5ff2-6588e01e616d@redhat.com> <20170628051555-mutt-send-email-mst@kernel.org> <69907228-fc1b-175f-f6cd-7ac332e318be@redhat.com> <20170628063033-mutt-send-email-mst@kernel.org> <51f4c402-6a02-9bad-6dab-563ca72f431a@redhat.com> <20170628065126-mutt-send-email-mst@kernel.org> <20170703195752-mutt-send-email-mst@kernel.org> From: Jason Wang Message-ID: <4de0c8e7-a9b6-7477-691a-a2ed0f317106@redhat.com> Date: Tue, 4 Jul 2017 20:20:00 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170703195752-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 04 Jul 2017 12:20:11 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 >>>>>>>>> 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