From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 9341A8DA8 for ; Wed, 4 Nov 2015 14:07:00 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP; 04 Nov 2015 05:06:07 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.20,243,1444719600"; d="scan'208";a="678150870" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga003.jf.intel.com with ESMTP; 04 Nov 2015 05:06:07 -0800 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 4 Nov 2015 05:06:07 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.248.2; Wed, 4 Nov 2015 05:06:06 -0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.57]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.160]) with mapi id 14.03.0248.002; Wed, 4 Nov 2015 21:06:04 +0800 From: "Liu, Jijiang" To: Thomas Monjalon Thread-Topic: [dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost TX offload Thread-Index: AQHRFu89DSl6C3bBZkC4lqvvuDZDwp6LMNoAgACgsKA= Date: Wed, 4 Nov 2015 13:06:04 +0000 Message-ID: <1ED644BD7E0A5F4091CF203DAFB8E4CC22BCFE5B@SHSMSX101.ccr.corp.intel.com> References: <1446634456-413-1-git-send-email-jijiang.liu@intel.com> <1446634456-413-7-git-send-email-jijiang.liu@intel.com> <2611781.I9AKvK5K3K@xps13> In-Reply-To: <2611781.I9AKvK5K3K@xps13> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" , "Michael S. Tsirkin" Subject: Re: [dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost TX offload 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, 04 Nov 2015 13:07:01 -0000 Hi Thomas, > -----Original Message----- > From: Thomas Monjalon [mailto:thomas.monjalon@6wind.com] > Sent: Wednesday, November 4, 2015 7:18 PM > To: Liu, Jijiang > Cc: dev@dpdk.org; Michael S. Tsirkin > Subject: Re: [dpdk-dev] [PATCH v3 6/8] driver/virtio:enqueue vhost TX > offload >=20 > 2015-11-04 18:54, Jijiang Liu: > > + /* if vhost TX checksum offload is required */ > > + if (m->ol_flags & PKT_TX_IP_CKSUM) { > > + hdr->csum_start =3D m->l2_len; > > + hdr->csum_offset =3D offsetof(struct ipv4_hdr, hdr_chec= ksum); > > + } else if (m->ol_flags & PKT_TX_L4_MASK) { > > + hdr->csum_start =3D m->l2_len + m->l3_len; > > + switch (m->ol_flags & PKT_TX_L4_MASK) { > > + case PKT_TX_TCP_CKSUM: > > + hdr->csum_offset =3D offsetof(struct tcp_hdr, c= ksum); > > + break; > > + case PKT_TX_UDP_CKSUM: > > + hdr->csum_offset =3D offsetof(struct udp_hdr, > > + dgram_cksum); > > + break; > > + case PKT_TX_SCTP_CKSUM: > > + hdr->csum_offset =3D offsetof(struct sctp_hdr, = cksum); > > + break; > > + default: > > + break; > > + } >=20 > The header checksum to offload is deduced from csum_offset. > Your vhost implementation do some parsing to deduce it: >=20 The ol_flag is set in application, we have to fill 'csum_start' and 'csum= _offset' based on these offload flags.=20 As long as the 'csum_start' and 'csum_offset' fileds are set correctly, a= nd it can work well with a vanilla linux with vhost. But in DPDK vhost lib, we need to parse the 'csum_start' and 'csum_offset'= filed to get the which offload flags should be set, and the l2_len, l3_len= and l3_len also should be filled. So I think it is necessary to do this in both side. We can continue discuss this if you have further comments. Thanks --Jijiang Liu=20