]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
net/mlx5: IPSec, fix 64-bit division correctly
authorArnd Bergmann <arnd@arndb.de>
Mon, 10 Jul 2017 09:37:51 +0000 (11:37 +0200)
committerDavid S. Miller <davem@davemloft.net>
Mon, 10 Jul 2017 18:34:00 +0000 (19:34 +0100)
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 <arnd@arndb.de>
Reviewed-by: Ilan Tayari <ilant@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c

index 7d06c673851a531a4b3c06f49ec8520e5df8b442..4614ddfa91ebc10f0255fc5c90c86f8018c10191 100644 (file)
@@ -363,7 +363,6 @@ void mlx5e_ipsec_build_inverse_table(void)
 {
        u16 mss_inv;
        u32 mss;
 {
        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
 
        /* 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++) {
         */
        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);
        }
 }
                mlx5e_ipsec_inverse_table[mss] = htons(mss_inv);
        }
 }