From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.warmcat.com (mail.warmcat.com [163.172.24.82]) by dpdk.org (Postfix) with ESMTP id 4F3DED090 for ; Mon, 21 May 2018 04:01:22 +0200 (CEST) From: Andy Green To: dev@dpdk.org Cc: thomas@monjalon.net Date: Mon, 21 May 2018 10:01:18 +0800 Message-ID: <152686807841.58694.11466927240402649305.stgit@localhost.localdomain> In-Reply-To: <152686781484.58694.14737673447518527445.stgit@localhost.localdomain> References: <152686781484.58694.14737673447518527445.stgit@localhost.localdomain> User-Agent: StGit/unknown-version Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Subject: [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 02:01:22 -0000 /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(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 76e37a2f8..55fba3b14 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -2112,7 +2112,8 @@ rte_validate_tx_offload(const struct rte_mbuf *m) return 0; if (ol_flags & PKT_TX_OUTER_IP_CKSUM) - inner_l3_offset += m->outer_l2_len + m->outer_l3_len; + inner_l3_offset = inner_l3_offset + m->outer_l2_len + + m->outer_l3_len; /* Headers are fragmented */ if (rte_pktmbuf_data_len(m) < inner_l3_offset + m->l3_len + m->l4_len)