Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752749AbdGJJiw (ORCPT ); Mon, 10 Jul 2017 05:38:52 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:51942 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751674AbdGJJiv (ORCPT ); Mon, 10 Jul 2017 05:38:51 -0400 From: Arnd Bergmann To: Saeed Mahameed , Ilan Tayari Cc: Arnd Bergmann , Matan Barak , Leon Romanovsky , Yossi Kuperman , Yevgeny Kliteynik , Boris Pismenny , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net/mlx5: IPSec, fix 64-bit division correctly Date: Mon, 10 Jul 2017 11:37:51 +0200 Message-Id: <20170710093842.2921914-1-arnd@arndb.de> X-Mailer: git-send-email 2.9.0 X-Provags-ID: V03:K0:1yWDgmaK2lCrGiBca0trE8kRDqNVoMJ59IFGhPJKDyoHSlwzVgv +fE+Pe6exVNDIi3TfFDzedBu9r2xtldZ2iN6i+iJm/zEK6RKaCdhjOB9Bjim58TFXgCVhJK CuJR9x1xzk0Pw9lt2/rkNeVKPYZ7hx2wI5jQqsuQxBFMUBn+uPQhreGbXKksIw4O0cDsYhs YyMDpQBuZ2ISm0vH4nMuw== X-UI-Out-Filterresults: notjunk:1;V01:K0:guQQfiEWiAU=:FvnaQWd1gVgmVAVJNeLvrU bPa3b2O6MIEFl/l9ZE3kTAfymJiX2CoSUtlPM9y+vCZLSLHQddEPigt4zfGU2XeAAugOMIxBB 9chXmlcE/eU3OFW+t4mqtodu7C7GGpBDku04HO12vmkEQUy/vaQplfUh+6loJ2BglVbcGqPSb eYAgmEwKY67I40Aq+yeMDXATqy683C9W8qtOThs1guWJYlGTeboQMmF65J1XY+uw4BTGcdUo+ 99SsxZ3hIW3PCeP7EFeNObqK+GSH9C6ucQN1ee21aCkn6sR/1IKbRXZFnH0U29f0KfDL2Bw0R nN+PV2pa7hShXeQLLC0q7iC3uvfOznJDx8M5PzQ72pNMi8G9tCdBR5NufGhQhe7BTaCycrgFm lj7+y4J5N5aPR8qjcSV6XzSlRtwXbp4OcyNvVjj7ZrPt0HmDA9x2cOkx6QXPIHYGWenL2i+Tz 6OBdfe7mpEY7qQEP4yK3FRrDglgwGDkm90STXs+8GjbErWmYkZq5g9ziuw/3RxeBWrWw1643y J3JW1o8TEDta8eUYiIAX9JTWN10jrjsMfJC2bKFBpWI6LOm2EGaZfabu8wpb51U9Helxmvfo7 D8GnhP8LfjFSMD6Sel+WErvqOWoBJO8/7t0NrsRS8bx/T79cB7IpAXh24DCw1OxHjghzRK4lC tCKZjUY1GIeGCrNPX7h/Pl8dzaPnLJ4H2FjZFCMtU49oDBOgrkbDLU9T969dZsa5MqiY= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1632 Lines: 42 The new IPSec offload code introduced a build error: drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.o: In function `mlx5e_ipsec_build_inverse_table': ipsec_rxtx.c:(.text+0x556): undefined reference Another patch was added on top to fix the build error, but that introduced a new bug, as we now use the remainder of the division rather than the result. This makes it use the correct helper function instead. Fixes: 5dfd87b67cd9 ("net/mlx5: IPSec, Fix 64-bit division on 32-bit builds") Fixes: 2ac9cfe78223 ("net/mlx5e: IPSec, Add Innova IPSec offload TX data path") Signed-off-by: Arnd Bergmann --- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c index 7d06c673851a..4614ddfa91eb 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c @@ -363,7 +363,6 @@ void mlx5e_ipsec_build_inverse_table(void) { u16 mss_inv; u32 mss; - u64 n; /* Calculate 1/x inverse table for use in GSO data path. * Using this table, we provide the IPSec accelerator with the value of @@ -373,8 +372,7 @@ void mlx5e_ipsec_build_inverse_table(void) */ mlx5e_ipsec_inverse_table[1] = htons(0xFFFF); for (mss = 2; mss < MAX_LSO_MSS; mss++) { - n = 1ULL << 32; - mss_inv = do_div(n, mss) >> 16; + mss_inv = div_u64(1ULL << 32, mss) >> 16; mlx5e_ipsec_inverse_table[mss] = htons(mss_inv); } } -- 2.9.0