From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id E95CF2BF4 for ; Thu, 3 Jan 2019 09:15:26 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from yskoh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 3 Jan 2019 10:15:25 +0200 Received: from scfae-sc-2.mti.labs.mlnx (scfae-sc-2.mti.labs.mlnx [10.101.0.96]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x038EJg4008603; Thu, 3 Jan 2019 10:15:24 +0200 From: Yongseok Koh To: Andy Green Cc: Bruce Richardson , dpdk stable Date: Thu, 3 Jan 2019 00:13:58 -0800 Message-Id: <20190103081400.14191-35-yskoh@mellanox.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190103081400.14191-1-yskoh@mellanox.com> References: <20190103081400.14191-1-yskoh@mellanox.com> Subject: [dpdk-stable] patch 'mbuf: avoid implicit demotion in 64-bit arithmetic' has been queued to LTS release 17.11.5 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Jan 2019 08:15:27 -0000 Hi, FYI, your patch has been queued to LTS release 17.11.5 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 01/04/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. If the code is different (ie: not only metadata diffs), due for example to a change in context or macro names, please double check it. Thanks. Yongseok --- >>From cf80647272d6586f2032059361162f0ad2f9f14f Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 22 May 2018 09:24:32 +0800 Subject: [PATCH] mbuf: avoid implicit demotion in 64-bit arithmetic [ upstream commit ef5092e16b137fd5e23d19b4b17b32f330d4a4ad ] GCC 8.1 warned: In function 'rte_validate_tx_offload': 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 with the +=, the rhs type becomes int since the bitfields will fit in int. Elaborate the artithmetic to be u64 = u64 + int + int, so the type of the result is correct to be stored in the u64. Fixes: 4fb7e803eb ("ethdev: add Tx preparation") Signed-off-by: Andy Green Acked-by: Bruce Richardson --- lib/librte_mbuf/rte_mbuf.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index ee94ec6b2..8c63a9fdb 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -1870,7 +1870,11 @@ 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; + /* NB: elaborating the addition like this instead of using + * += gives the result uint64_t type instead of int, + * avoiding compiler warnings on gcc 8.1 at least */ + 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) -- 2.11.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-01-02 23:59:13.923877201 -0800 +++ 0035-mbuf-avoid-implicit-demotion-in-64-bit-arithmetic.patch 2019-01-02 23:59:12.103815000 -0800 @@ -1,8 +1,10 @@ -From ef5092e16b137fd5e23d19b4b17b32f330d4a4ad Mon Sep 17 00:00:00 2001 +From cf80647272d6586f2032059361162f0ad2f9f14f Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 22 May 2018 09:24:32 +0800 Subject: [PATCH] mbuf: avoid implicit demotion in 64-bit arithmetic +[ upstream commit ef5092e16b137fd5e23d19b4b17b32f330d4a4ad ] + GCC 8.1 warned: In function 'rte_validate_tx_offload': @@ -26,7 +28,6 @@ the type of the result is correct to be stored in the u64. Fixes: 4fb7e803eb ("ethdev: add Tx preparation") -Cc: stable@dpdk.org Signed-off-by: Andy Green Acked-by: Bruce Richardson @@ -35,10 +36,10 @@ 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h -index 715f90ea0..0e89a6927 100644 +index ee94ec6b2..8c63a9fdb 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h -@@ -2112,7 +2112,11 @@ rte_validate_tx_offload(const struct rte_mbuf *m) +@@ -1870,7 +1870,11 @@ rte_validate_tx_offload(const struct rte_mbuf *m) return 0; if (ol_flags & PKT_TX_OUTER_IP_CKSUM)