]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mlx4_core: limit min profile numbers
authorDotan Barak <dotanb@dev.mellanox.co.il>
Wed, 2 May 2012 07:13:20 +0000 (10:13 +0300)
committerMukesh Kacker <mukesh.kacker@oracle.com>
Tue, 7 Jul 2015 21:38:07 +0000 (14:38 -0700)
We can't use arbitrarily low profile numbers for resources since
the device needs some of its own. The best way to do it is to
query the device and then set the minimum values, but the values
chosen here are good enough and do not complicate the implementation.

Signed-off-by: Eli Cohen <eli@mellanox.co.il>
Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il>
Reviewed-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Vladimir Sokolovsky <vlad@mellanox.com>
(Ported from Mellanox OFED 2.4)

Signed-off-by: Mukesh Kacker <mukesh.kacker@oracle.com>
drivers/net/ethernet/mellanox/mlx4/main.c

index 41b7c220d4a877942052069868fbff6cabdc7d4e..7622ffd1fa874bd92826646061300175595aae68 100644 (file)
@@ -3781,6 +3781,36 @@ static int __init mlx4_verify_params(void)
                return -1;
        }
 
+       if (mod_param_profile.num_qp < 12 || mod_param_profile.num_qp > 23) {
+               pr_warning("mlx4_core: bad log_num_qp: %d\n",
+                          mod_param_profile.num_qp);
+               return -1;
+       }
+
+       if (mod_param_profile.num_srq < 10) {
+               pr_warning("mlx4_core: too low log_num_srq: %d\n",
+                          mod_param_profile.num_srq);
+               return -1;
+       }
+
+       if (mod_param_profile.num_cq < 10) {
+               pr_warning("mlx4_core: too low log_num_cq: %d\n",
+                          mod_param_profile.num_cq);
+               return -1;
+       }
+
+       if (mod_param_profile.num_mpt < 10) {
+               pr_warning("mlx4_core: too low log_num_mpt: %d\n",
+                          mod_param_profile.num_mpt);
+               return -1;
+       }
+
+       if (mod_param_profile.num_mtt && mod_param_profile.num_mtt < 15) {
+               pr_warning("mlx4_core: too low log_num_mtt: %d\n",
+                          mod_param_profile.num_mtt);
+               return -1;
+       }
+
        return 0;
 }