From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yuanhan Liu Subject: Re: [PATCH v2 12/12] virtio: add Tso support Date: Thu, 13 Oct 2016 23:04:04 +0800 Message-ID: <20161013150404.GY16751@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> <57FF9409.2090205@6wind.com> <20161013141654.GW16751@yliu-dev.sh.intel.com> <57FF9FA9.8020403@6wind.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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 To: Olivier MATZ Return-path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 21010FE5 for ; Thu, 13 Oct 2016 17:03:10 +0200 (CEST) Content-Disposition: inline In-Reply-To: <57FF9FA9.8020403@6wind.com> 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" On Thu, Oct 13, 2016 at 04:52:25PM +0200, Olivier MATZ wrote: > >In the "else" clause, the ip header is still in the mbuf, right? > >Why do you have to access it the way like: > > > > ip_version = *rte_pktmbuf_mtod_offset(m, uint8_t *, > > m->l2_len) >> 4; > > > >Why can't you just use > > > > iph = rte_pktmbuf_mtod_offset(m, struct ipv4_hdr *, m->l2_len); > > iph->version_ihl ....; > > AFAIK, there is no requirement that each network header has to be contiguous > in a mbuf segment. > > Of course, a split in the middle of a network header probably never > happens... but we never knows, as it is not forbidden. I think the code > should be robust enough to avoid accesses to wrong addresses. One more question is do you have any case to trigger the "else" clause? --yliu