Skip to content

Commit 8eab8ba

Browse files
yishaihSomasundaram Krishnasamy
authored andcommitted
mlx4_core: log_num_mtt handling
Fixed a bug when calculating based on system RAM size limit of 25 was fixed - was set to 28 V2: adjusted for rebase to kernel 3.7-rc4. In this kernel, part of the patch appears as commit 89dd86d Signed-off-by: Yishai Hadas <[email protected]> Signed-off-by: Vladimir Sokolovsky <[email protected]> Signed-off-by: Jack Morgenstein <[email protected]> (Ported from Mellanox OFED 2.4) Signed-off-by: Mukesh Kacker <[email protected]> Orabug: 2751050 (cherry picked from commit 719f7fc) cherry-pick-repo=linux-uek.git Signed-off-by: Qing Huang <[email protected]> Signed-off-by: Aron Silverton <[email protected]> Signed-off-by: Somasundaram Krishnasamy <[email protected]>
1 parent 0292054 commit 8eab8ba

File tree

1 file changed

+14
-3
lines changed
  • drivers/net/ethernet/mellanox/mlx4

1 file changed

+14
-3
lines changed

drivers/net/ethernet/mellanox/mlx4/main.c

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ static inline void mlx4_set_num_reserved_uars(struct mlx4_dev *dev,
183183
}
184184

185185
#define MLX4_LOG_NUM_MTT 20
186+
/* When a higher value than 28 is used we get a failure via initializing
187+
the event queue table.
188+
*/
189+
#define MLX4_MAX_LOG_NUM_MTT 28
186190
static struct mlx4_profile mod_param_profile = {
187191
.num_qp = 18,
188192
.num_srq = 16,
@@ -249,9 +253,11 @@ static void process_mod_param_profile(struct mlx4_profile *profile)
249253
else {
250254
si_meminfo(&si);
251255
profile->num_mtt =
252-
roundup_pow_of_two(max_t(unsigned, 1 << MLX4_LOG_NUM_MTT,
253-
min(1UL << 31,
254-
si.totalram >> (log_mtts_per_seg - 1))));
256+
roundup_pow_of_two(max_t(unsigned,
257+
1 << MLX4_LOG_NUM_MTT,
258+
min(1UL << MLX4_MAX_LOG_NUM_MTT,
259+
(si.totalram << 1)
260+
>> log_mtts_per_seg)));
255261
}
256262
}
257263

@@ -4370,6 +4376,11 @@ static int __init mlx4_verify_params(void)
43704376
return -1;
43714377
}
43724378

4379+
if (mod_param_profile.num_mtt > MLX4_MAX_LOG_NUM_MTT) {
4380+
pr_warning("mlx4_core: too high log_num_mtt: %d\n",
4381+
mod_param_profile.num_mtt);
4382+
return -1;
4383+
}
43734384
return 0;
43744385
}
43754386

0 commit comments

Comments
 (0)