From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 1F0FF2B94 for ; Thu, 13 Oct 2016 15:58:54 +0200 (CEST) Received: from [10.16.0.195] (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 9561F24729; Thu, 13 Oct 2016 15:58:51 +0200 (CEST) To: Yuanhan Liu References: <1475485223-30566-1-git-send-email-olivier.matz@6wind.com> <1475485223-30566-11-git-send-email-olivier.matz@6wind.com> <20161013083821.GU16751@yliu-dev.sh.intel.com> 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 From: Olivier MATZ Message-ID: <57FF9319.7070103@6wind.com> Date: Thu, 13 Oct 2016 15:58:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.6.0 MIME-Version: 1.0 In-Reply-To: <20161013083821.GU16751@yliu-dev.sh.intel.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit 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 13:58:54 -0000 On 10/13/2016 10:38 AM, Yuanhan Liu wrote: > 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. Will do, it's actually clearer. Olivier