net/mlx5: IPSec, Fix 64-bit division on 32-bit builds
authorIlan Tayari <ilant@mellanox.com>
Sun, 2 Jul 2017 07:57:56 +0000 (10:57 +0300)
committerSaeed Mahameed <saeedm@mellanox.com>
Thu, 6 Jul 2017 12:13:19 +0000 (15:13 +0300)
Fix warnings when building 386 kernel:
>> ERROR: "__udivdi3" [drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.ko] undefined!

Fixes: 2ac9cfe78223 ("net/mlx5e: IPSec, Add Innova IPSec offload TX data path")
Reported-by: kbuild test robot <fengguang.wu@intel.com>
Signed-off-by: Ilan Tayari <ilant@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c

index 4a78aefdf15779e4c50935bf1db858a0b756b9a8..7d06c673851a531a4b3c06f49ec8520e5df8b442 100644 (file)
@@ -363,6 +363,7 @@ 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
@@ -372,7 +373,8 @@ void mlx5e_ipsec_build_inverse_table(void)
         */
        mlx5e_ipsec_inverse_table[1] = htons(0xFFFF);
        for (mss = 2; mss < MAX_LSO_MSS; mss++) {
-               mss_inv = ((1ULL << 32) / mss) >> 16;
+               n = 1ULL << 32;
+               mss_inv = do_div(n, mss) >> 16;
                mlx5e_ipsec_inverse_table[mss] = htons(mss_inv);
        }
 }