From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f48.google.com (mail-wm0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id 016D38DA6 for ; Wed, 11 Nov 2015 11:20:44 +0100 (CET) Received: by wmww144 with SMTP id w144so38023705wmw.0 for ; Wed, 11 Nov 2015 02:20:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind_com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :in-reply-to:references:mime-version:content-transfer-encoding :content-type; bh=GsBegVqEmE96BSUq21J7q3M6H6eZODfDZKcJz6mwXWg=; b=u5gmR502lJUyvLaQRA5+i5E9umqg+mYPv6ohC73FNSyIiL3jPz63H2En9IV2gCjByU +dnnsIAulMryz/C8B/5grhwCJZ3kGxbM1xzpv07nKKjl7TP5MNbgtTxRxPuYNP8x64BU 7HFrA8EM6HBdOYs9fFx15mru+ip+f00uJ1OMCBp7D0BA9TAGDhMFiRxpbGIGmMvcLL7r /JC71i22H8Rro4M0kVcevpF4Jbds74Jk84fOgvuAAA+msBY4awhBIS83B33YvhDrCeka eYbvEsP5es9D1BsRbuDwA4FfB2d5Pe0krd1+mZrrSVMoZ2zKmfsvX4K7pFw0XAqPrSls Tx9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:in-reply-to:references:mime-version :content-transfer-encoding:content-type; bh=GsBegVqEmE96BSUq21J7q3M6H6eZODfDZKcJz6mwXWg=; b=QSG945Q/trrK2DYdCpiQqWXc6Qx/Wg14lvUA8+6C/+2JSI9378zeuhdG+V28l6cylz 5dQnEkcXG6DKI7j/k5vLTvZLhgrk0nnktmzHDaR19oBt/dTwJEyzqZWkEgHCz1bCUEPi Qn6BxBMo4eEbL3SbbvTLVHpuSYNmbx5zfbW6eM3fa6JQTWBlVO/vgZ6UJ26atJfP5Zjb PZEUbLGPZzLOhqndtTT/G/qxHvoYArqWTZttyakRMtoP3zyf8ogFDuYOs5zlDFlK8B61 OVTUtl97uS3RooGoGzO+LNtUq0rgwBRTV2qX0iOvgHMm3s5ZMblDEwIcXVu7TSTx4okD JEWw== X-Gm-Message-State: ALoCoQl3NvKwnVx0NAuyWZUYLxRVhZuJWfXMmt3fQ5e20umItcZ4SkGPNYWAuZFOsg18TPMoNWY5 X-Received: by 10.194.235.170 with SMTP id un10mr4163949wjc.57.1447237243874; Wed, 11 Nov 2015 02:20:43 -0800 (PST) Received: from xps13.localnet (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by smtp.gmail.com with ESMTPSA id 77sm8799068wml.20.2015.11.11.02.20.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Nov 2015 02:20:43 -0800 (PST) From: Thomas Monjalon To: Yuanhan Liu Date: Wed, 11 Nov 2015 11:19:32 +0100 Message-ID: <3146122.45QdW36GMG@xps13> Organization: 6WIND User-Agent: KMail/4.14.10 (Linux/4.1.6-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: <20151111082318.GY2326@yliu-dev.sh.intel.com> References: <1447224046-1169-1-git-send-email-jijiang.liu@intel.com> <1447224046-1169-9-git-send-email-jijiang.liu@intel.com> <20151111082318.GY2326@yliu-dev.sh.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Cc: dev@dpdk.org Subject: Re: [dpdk-dev] [PATCH v4 8/8] virtio/lib:add guest offload handle X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Nov 2015 10:20:44 -0000 Yuanhan, You deserve a "review award"! Thanks a lot 2015-11-11 16:23, Yuanhan Liu: > Regarding to your patch title, there are two minor pits: > > - the prefix should be "vhost" but not "virtio/lib". > > - you should add an extra space after ":" > > On Wed, Nov 11, 2015 at 02:40:46PM +0800, Jijiang Liu wrote: > > Enqueue guest offload(CSUM and TSO) handle. > > (ALL) Your patch lacks some explanation. And I don't think it's about > guest offload handling, it's about setting the right offload fields for > RX side, such as VIRTIO_NET_HDR_F_NEEDS_CSUM. > > And you need spend few words to state why that is required. Something > like following might help others to review: > > For packet going through from one VM to another VM without passing > the NIC, and the VM claiming that it supports checksum offload, > no one will actually calculate the checksum, hence, the packet > will be dropped at TCP layer, due to checksum validation is failed. > > However, for VM2VM case, there is no need to do checksum, for we > think the data should be reliable enough, and setting VIRTIO_NET_HDR_F_NEEDS_CSUM > at RX side will let the TCP layer to bypass the checksum validation, > so that the RX side could receive the packet in the end. > > At RX side, the offload information is inherited from mbuf, which is > in turn inherited from TX side. If we can still get those info at RX > side, it means the packet is from another VM at same host. So, it's > safe to set the VIRTIO_NET_HDR_F_NEEDS_CSUM, to skip checksum validation. > > > > Signed-off-by: Jijiang Liu > > --- > > lib/librte_vhost/vhost_rxtx.c | 45 +++++++++++++++++++++++++++++++++++++++- > > 1 files changed, 43 insertions(+), 2 deletions(-) > > > > diff --git a/lib/librte_vhost/vhost_rxtx.c b/lib/librte_vhost/vhost_rxtx.c > > index 9e70990..468fed8 100644 > > --- a/lib/librte_vhost/vhost_rxtx.c > > +++ b/lib/librte_vhost/vhost_rxtx.c > > @@ -54,6 +54,42 @@ is_valid_virt_queue_idx(uint32_t idx, int is_tx, uint32_t qp_nb) > > return (is_tx ^ (idx & 1)) == 0 && idx < qp_nb * VIRTIO_QNUM; > > } > > > > +static void > > +virtio_enqueue_offload(struct rte_mbuf *m_buf, struct virtio_net_hdr *net_hdr) > > +{ > > As virtio_hdr is set per mbuf, you'd better reset net_hdr first before > setting it. Otherwise, if this mbuf has no offload related stuff, you > may still get a net_hdr with offload related fields set, due to last > mbuf has that. > > I know the chance is rare, but it's for code logic. > > > --yliu