From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id EDA3D2A07 for ; Thu, 13 Oct 2016 10:37:30 +0200 (CEST) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga102.fm.intel.com with ESMTP; 13 Oct 2016 01:37:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.31,339,1473145200"; d="scan'208";a="889560989" Received: from yliu-dev.sh.intel.com (HELO yliu-dev) ([10.239.67.162]) by orsmga003.jf.intel.com with ESMTP; 13 Oct 2016 01:37:27 -0700 Date: Thu, 13 Oct 2016 16:38:21 +0800 From: Yuanhan Liu To: Olivier Matz Cc: dev@dpdk.org, konstantin.ananyev@intel.com, sugesh.chandran@intel.com, bruce.richardson@intel.com, jianfeng.tan@intel.com, helin.zhang@intel.com, adrien.mazarguil@6wind.com, stephen@networkplumber.org, dprovan@bivio.net, xiao.w.wang@intel.com Message-ID: <20161013083821.GU16751@yliu-dev.sh.intel.com> References: <1475485223-30566-1-git-send-email-olivier.matz@6wind.com> <1475485223-30566-11-git-send-email-olivier.matz@6wind.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1475485223-30566-11-git-send-email-olivier.matz@6wind.com> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH v2 10/12] virtio: add Tx checksum offload support 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: Thu, 13 Oct 2016 08:37:31 -0000 On Mon, Oct 03, 2016 at 11:00:21AM +0200, Olivier Matz wrote: > + /* Checksum Offload */ > + switch (cookie->ol_flags & PKT_TX_L4_MASK) { > + case PKT_TX_UDP_CKSUM: > + hdr->csum_start = cookie->l2_len + cookie->l3_len; > + hdr->csum_offset = 6; > + hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; > + break; > + > + case PKT_TX_TCP_CKSUM: > + hdr->csum_start = cookie->l2_len + cookie->l3_len; > + hdr->csum_offset = 16; I would suggest to use "offsetof(...)" here, instead of some magic number like 16. --yliu