Skip to content

Commit 719f7fc

Browse files
yishaihMukesh Kacker
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]>
1 parent 652ba7c commit 719f7fc

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
@@ -160,6 +160,10 @@ struct mlx4_port_config {
160160
static atomic_t pf_loading = ATOMIC_INIT(0);
161161

162162
#define MLX4_LOG_NUM_MTT 20
163+
/* When a higher value than 28 is used we get a failure via initializing
164+
the event queue table.
165+
*/
166+
#define MLX4_MAX_LOG_NUM_MTT 28
163167
static struct mlx4_profile mod_param_profile = {
164168
.num_qp = 18,
165169
.num_srq = 16,
@@ -226,9 +230,11 @@ static void process_mod_param_profile(struct mlx4_profile *profile)
226230
else {
227231
si_meminfo(&si);
228232
profile->num_mtt =
229-
roundup_pow_of_two(max_t(unsigned, 1 << MLX4_LOG_NUM_MTT,
230-
min(1UL << 31,
231-
si.totalram >> (log_mtts_per_seg - 1))));
233+
roundup_pow_of_two(max_t(unsigned,
234+
1 << MLX4_LOG_NUM_MTT,
235+
min(1UL << MLX4_MAX_LOG_NUM_MTT,
236+
(si.totalram << 1)
237+
>> log_mtts_per_seg)));
232238
}
233239
}
234240

@@ -3811,6 +3817,11 @@ static int __init mlx4_verify_params(void)
38113817
return -1;
38123818
}
38133819

3820+
if (mod_param_profile.num_mtt > MLX4_MAX_LOG_NUM_MTT) {
3821+
pr_warning("mlx4_core: too high log_num_mtt: %d\n",
3822+
mod_param_profile.num_mtt);
3823+
return -1;
3824+
}
38143825
return 0;
38153826
}
38163827

0 commit comments

Comments
 (0)