From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id C4963EE2B for ; Mon, 21 May 2018 14:27:24 +0200 (CEST) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2018 05:27:22 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,426,1520924400"; d="scan'208";a="225936359" Received: from bricha3-mobl.ger.corp.intel.com ([10.237.221.55]) by orsmga005.jf.intel.com with SMTP; 21 May 2018 05:27:20 -0700 Received: by (sSMTP sendmail emulation); Mon, 21 May 2018 13:27:20 +0100 Date: Mon, 21 May 2018 13:27:19 +0100 From: Bruce Richardson To: Andy Green Cc: dev@dpdk.org, thomas@monjalon.net Message-ID: <20180521122719.GE22944@bricha3-MOBL.ger.corp.intel.com> References: <152686781484.58694.14737673447518527445.stgit@localhost.localdomain> <152686807841.58694.11466927240402649305.stgit@localhost.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <152686807841.58694.11466927240402649305.stgit@localhost.localdomain> Organization: Intel Research and Development Ireland Ltd. User-Agent: Mutt/1.9.4 (2018-02-28) Subject: Re: [dpdk-dev] [PATCH v6 5/8] rte_mbuf.h: avoid implicit demotion in 64-bit arith X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2018 12:27:25 -0000 On Mon, May 21, 2018 at 10:01:18AM +0800, Andy Green wrote: > /projects/lagopus/src/dpdk/build/include/rte_mbuf.h: > In function 'rte_validate_tx_offload': > /projects/lagopus/src/dpdk/build/include/rte_mbuf.h: > 2112:19: warning: conversion to 'uint64_t' > {aka 'long unsigned int'} from 'int' may change the > sign of the result [-Wsign-conversion] > inner_l3_offset += m->outer_l2_len + m->outer_l3_len; > ^~ > > uint64_t inner_l3_offset... > > /* fields for TX offloading of tunnels */ > uint64_t outer_l3_len:9; /**< Outer L3 (IP) Hdr Length. */ > uint64_t outer_l2_len:7; /**< Outer L2 (MAC) Hdr Length. */ > > We want to do the arithmetic entirely in uint64_t > space, but there is an implicit demotion to int created by > the +=. Remove the +=. > > Fixes: 4fb7e803eb ("ethdev: add Tx preparation") > Signed-off-by: Andy Green > --- > lib/librte_mbuf/rte_mbuf.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > Fix looks ok, but given that it's non-obvious why += doesn't work, I think it would be good to put a comment in explaining it. Otherwise I could see someone changing this back in a later patch, because the problem doesn't arise with regular DPDK compiles Acked-by: Bruce Richardson