From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olivier Matz Subject: Re: [PATCH v2 12/12] virtio: add Tso support Date: Tue, 18 Oct 2016 16:07:03 +0200 Message-ID: <011ca25c-c198-02e1-2374-583068f14292@6wind.com> References: <1475485223-30566-1-git-send-email-olivier.matz@6wind.com> <1475485223-30566-13-git-send-email-olivier.matz@6wind.com> <20161013081839.GT16751@yliu-dev.sh.intel.com> <20161013163330.584b05db@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit 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, dprovan@bivio.net, xiao.w.wang@intel.com To: Stephen Hemminger , Yuanhan Liu Return-path: Received: from mail.droids-corp.org (zoll.droids-corp.org [94.23.50.67]) by dpdk.org (Postfix) with ESMTP id A4D112BEA for ; Tue, 18 Oct 2016 16:07:14 +0200 (CEST) In-Reply-To: <20161013163330.584b05db@xeon-e3> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Stephen, On 10/14/2016 01:33 AM, Stephen Hemminger wrote: > On Thu, 13 Oct 2016 16:18:39 +0800 > Yuanhan Liu wrote: > >> On Mon, Oct 03, 2016 at 11:00:23AM +0200, Olivier Matz wrote: >>> +/* When doing TSO, the IP length is not included in the pseudo header >>> + * checksum of the packet given to the PMD, but for virtio it is >>> + * expected. >>> + */ >>> +static void >>> +virtio_tso_fix_cksum(struct rte_mbuf *m) >>> +{ >>> + /* common case: header is not fragmented */ >>> + if (likely(rte_pktmbuf_data_len(m) >= m->l2_len + m->l3_len + >>> + m->l4_len)) { >> ... >>> + /* replace it in the packet */ >>> + th->cksum = new_cksum; >>> + } else { >> ... >>> + /* replace it in the packet */ >>> + *rte_pktmbuf_mtod_offset(m, uint8_t *, >>> + m->l2_len + m->l3_len + 16) = new_cksum.u8[0]; >>> + *rte_pktmbuf_mtod_offset(m, uint8_t *, >>> + m->l2_len + m->l3_len + 17) = new_cksum.u8[1]; >>> + } >> >> The tcp header will always be in the mbuf, right? Otherwise, you can't >> update the cksum field here. What's the point of introducing the "else >> clause" then? >> >> --yliu > > You need to check the reference count before updating any data in mbuf. > That's correct, I'll fix that. Thanks for the comment, Olivier