From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f47.google.com (mail-pa0-f47.google.com [209.85.220.47]) by dpdk.org (Postfix) with ESMTP id D96CE2A1A for ; Fri, 14 Oct 2016 01:33:17 +0200 (CEST) Received: by mail-pa0-f47.google.com with SMTP id vu5so42240105pab.0 for ; Thu, 13 Oct 2016 16:33:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fWsAzuxdP1gYVVwhoZxdxlnSTpLu2Wom71B5vyKo7VM=; b=NUk2u6dWIPZ3yC9gTW3GlYTuXMBQetNtsfM2JWz1U2V06G++z3Fy/eNUL7I8qVFJzY WTEniFA5LCtqbFW4bYJKiNBvWYKMolWPsyW+DB7kxOclXQZIRJ22CMDSfVJN8vd4dXjH Zk8so1hRHO+Bv1tMSsxIuFML/uxeTHunAM/okbZjxNm/C5KLTmpMbcMOyqykVGt+S5+5 v/TJnkxLAdRKENsXncX4v4pvkq9WXGN0HPFmL2A750NfBA6j4OBmZ9QpgISZgCaUS1na XzMS3ek/9BF6UiXM8D1KoT1oMU8zJ8aK+R/wB80yycQugqfH9zroF2ZYI4dbDhTQO8Hb WKyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fWsAzuxdP1gYVVwhoZxdxlnSTpLu2Wom71B5vyKo7VM=; b=YN+8eDx6yKCNpCImWlhZL3bVEwb0BY3RGXACIp/pyEckKz4bAFRmfSJgn4XRV2W+Zn 7xITpzi2rCCz7+6lggaYzHvcciH0x+N6MzIpiOwFk/7cBzcFAfUoyHBWYQUk3rECsyrC hmiEqeItu53ehO5OQXUj/lXq9Gsd5Y7eD9Fo/qEdaKL3Y8OPOqRKJqGO4K9IxZ36fWH8 BIx7683m34HVbeVynXQwdWbGRPNu9PnGw3cjYKLPiklfS2LMWViqMGN4Go2nZw9dkV5H HkvgV34WKeNc6Qnq1giqccSCBRy4v0TPS7jbJ1UrKMn2V1PE0bMbSwCE72uhArW4RzKp HgPA== X-Gm-Message-State: AA6/9RlAIIextxlqyJg2FJ5n8H/UTsYMXW+BR3NPo3d3XdKs76CqYo1kHUQ+V8weXJ+62Q== X-Received: by 10.66.145.162 with SMTP id sv2mr11239806pab.207.1476401597209; Thu, 13 Oct 2016 16:33:17 -0700 (PDT) Received: from xeon-e3 (static-50-53-69-251.bvtn.or.frontiernet.net. [50.53.69.251]) by smtp.gmail.com with ESMTPSA id m62sm22117909pfi.10.2016.10.13.16.33.16 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 13 Oct 2016 16:33:17 -0700 (PDT) Date: Thu, 13 Oct 2016 16:33:30 -0700 From: Stephen Hemminger To: Yuanhan Liu Cc: Olivier Matz , 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 Message-ID: <20161013163330.584b05db@xeon-e3> In-Reply-To: <20161013081839.GT16751@yliu-dev.sh.intel.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> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v2 12/12] virtio: add Tso 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 23:33:18 -0000 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.