aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
diff options
context:
space:
mode:
authorDotan Barak <dotanb@dev.mellanox.co.il>2014-12-11 03:57:55 -0500
committerDavid S. Miller <davem@davemloft.net>2014-12-11 14:47:35 -0500
commitab256e5ad02b36951f01bf6b5cfda25f14820847 (patch)
treee2c913bca56b7f514ad9f37a49c69a838290a491 /drivers/net/ethernet
parentddae0349fdb78bcc5e7219061847012aa1a29069 (diff)
net/mlx4: Add a check if there are too many reserved QPs
The number of reserved QPs is affected both from the firmware and from the driver's requirements. This patch adds a check that validates that this number is indeed feasable. Signed-off-by: Dotan Barak <dotanb@dev.mellanox.co.il> Signed-off-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet')
-rw-r--r--drivers/net/ethernet/mellanox/mlx4/qp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/net/ethernet/mellanox/mlx4/qp.c b/drivers/net/ethernet/mellanox/mlx4/qp.c
index 40e82edac99d..8720428c9807 100644
--- a/drivers/net/ethernet/mellanox/mlx4/qp.c
+++ b/drivers/net/ethernet/mellanox/mlx4/qp.c
@@ -478,6 +478,7 @@ int mlx4_init_qp_table(struct mlx4_dev *dev)
478 struct mlx4_qp_table *qp_table = &mlx4_priv(dev)->qp_table; 478 struct mlx4_qp_table *qp_table = &mlx4_priv(dev)->qp_table;
479 int err; 479 int err;
480 int reserved_from_top = 0; 480 int reserved_from_top = 0;
481 int reserved_from_bot;
481 int k; 482 int k;
482 483
483 spin_lock_init(&qp_table->lock); 484 spin_lock_init(&qp_table->lock);
@@ -534,9 +535,14 @@ int mlx4_init_qp_table(struct mlx4_dev *dev)
534 * b. All the proxy SQPs (8 per function) 535 * b. All the proxy SQPs (8 per function)
535 * c. All the tunnel QPs (8 per function) 536 * c. All the tunnel QPs (8 per function)
536 */ 537 */
538 reserved_from_bot = mlx4_num_reserved_sqps(dev);
539 if (reserved_from_bot + reserved_from_top > dev->caps.num_qps) {
540 mlx4_err(dev, "Number of reserved QPs is higher than number of QPs\n");
541 return -EINVAL;
542 }
537 543
538 err = mlx4_bitmap_init(&qp_table->bitmap, dev->caps.num_qps, 544 err = mlx4_bitmap_init(&qp_table->bitmap, dev->caps.num_qps,
539 (1 << 23) - 1, mlx4_num_reserved_sqps(dev), 545 (1 << 23) - 1, reserved_from_bot,
540 reserved_from_top); 546 reserved_from_top);
541 if (err) 547 if (err)
542 return err; 548 return err;