From patchwork Mon Jul 10 09:37:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9832633 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3DC9860318 for ; Mon, 10 Jul 2017 09:38:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2F389283DA for ; Mon, 10 Jul 2017 09:38:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 20F002847A; Mon, 10 Jul 2017 09:38:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9BBAD283DA for ; Mon, 10 Jul 2017 09:38:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752387AbdGJJiw (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 Received: from wuerfel.lan ([5.56.224.194]) by mrelayeu.kundenserver.de (mreue003 [212.227.15.129]) with ESMTPA (Nemesis) id 0MBo9r-1dM0p72nxf-00Angz; Mon, 10 Jul 2017 11:38:46 +0200 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-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Ilan Tayari --- 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); } }