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 E4AF65424 for ; Thu, 3 Jan 2019 09:15:21 +0100 (CET) Received: from Internal Mail-Server by MTLPINE1 (envelope-from yskoh@mellanox.com) with ESMTPS (AES256-SHA encrypted); 3 Jan 2019 10:15:19 +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 x038EJg1008603; Thu, 3 Jan 2019 10:15:18 +0200 From: Yongseok Koh To: Andy Green Cc: Bruce Richardson , dpdk stable Date: Thu, 3 Jan 2019 00:13:55 -0800 Message-Id: <20190103081400.14191-32-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 'net: explicit cast in L4 checksum' 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:22 -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 088f43cdcf2114776815930e8ecad2b047d986dc Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 22 May 2018 09:24:22 +0800 Subject: [PATCH] net: explicit cast in L4 checksum [ upstream commit f37a2e7c747b0758fcd8390482aeeac490f688b5 ] GCC 8.1 warned: In function 'rte_ipv4_udptcp_cksum': rte_byteorder.h:51:24: warning: conversion from 'long unsigned int' to 'uint32_t' {aka 'unsigned int'} may change value [-Wconversion] #define rte_bswap16(x) ((uint16_t) (__builtin_constant_p(x) ? \ ^ rte_byteorder.h:85:29: note: in expansion of macro 'rte_bswap16' #define rte_be_to_cpu_16(x) rte_bswap16(x) ^~~~~~~~~~~ rte_ip.h:321:11: note: in expansion of macro 'rte_be_to_cpu_16' l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) - ^~~~~~~~~~~~~~~~ Also with this one, it is a cast that always occurred and is just being done explicitly, with no changes to the generated code. The warning stack is misleading, it points to the last element in the macro that produced the lhs of the subtraction above. But the only "unsigned long int" in the expression is the result of the sizeof() on the rhs, it promotes the subtraction result to unsigned long. So the error actually relates to the result of the outer subtraction. The actual error is "you are trying to put an unsigned long into a uint32_t". We always did so, the fix is just to inform the compiler it is intentional with an explicit cast. Fixes: 6006818cfb ("net: new checksum functions") Signed-off-by: Andy Green Acked-by: Bruce Richardson --- lib/librte_net/rte_ip.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h index 6a7426049..b22c1f800 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h @@ -380,8 +380,8 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) uint32_t cksum; uint32_t l4_len; - l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) - - sizeof(struct ipv4_hdr); + l4_len = (uint32_t)(rte_be_to_cpu_16(ipv4_hdr->total_length) - + sizeof(struct ipv4_hdr)); cksum = rte_raw_cksum(l4_hdr, l4_len); cksum += rte_ipv4_phdr_cksum(ipv4_hdr, 0); -- 2.11.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-01-02 23:59:13.771837365 -0800 +++ 0032-net-explicit-cast-in-L4-checksum.patch 2019-01-02 23:59:12.097819000 -0800 @@ -1,8 +1,10 @@ -From f37a2e7c747b0758fcd8390482aeeac490f688b5 Mon Sep 17 00:00:00 2001 +From 088f43cdcf2114776815930e8ecad2b047d986dc Mon Sep 17 00:00:00 2001 From: Andy Green Date: Tue, 22 May 2018 09:24:22 +0800 Subject: [PATCH] net: explicit cast in L4 checksum +[ upstream commit f37a2e7c747b0758fcd8390482aeeac490f688b5 ] + GCC 8.1 warned: In function 'rte_ipv4_udptcp_cksum': @@ -33,7 +35,6 @@ the compiler it is intentional with an explicit cast. Fixes: 6006818cfb ("net: new checksum functions") -Cc: stable@dpdk.org Signed-off-by: Andy Green Acked-by: Bruce Richardson @@ -42,10 +43,10 @@ 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/librte_net/rte_ip.h b/lib/librte_net/rte_ip.h -index c924aca7f..72dc2456a 100644 +index 6a7426049..b22c1f800 100644 --- a/lib/librte_net/rte_ip.h +++ b/lib/librte_net/rte_ip.h -@@ -318,8 +318,8 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) +@@ -380,8 +380,8 @@ rte_ipv4_udptcp_cksum(const struct ipv4_hdr *ipv4_hdr, const void *l4_hdr) uint32_t cksum; uint32_t l4_len;