Netdev List
 help / color / mirror / Atom feed
From: Or Gerlitz <ogerlitz@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Matan Barak <matanb@mellanox.com>,
	Amir Vadai <amirv@mellanox.com>, Tal Alon <talal@mellanox.com>,
	Jack Morgenstein <jackm@dev.mellanox.co.il>,
	Dotan Barak <dotanb@dev.mellanox.co.il>,
	Or Gerlitz <ogerlitz@mellanox.com>
Subject: [PATCH V2 net-next 05/10] net/mlx4: Add a check if there are too many reserved QPs
Date: Thu, 11 Dec 2014 10:57:55 +0200	[thread overview]
Message-ID: <1418288280-334-6-git-send-email-ogerlitz@mellanox.com> (raw)
In-Reply-To: <1418288280-334-1-git-send-email-ogerlitz@mellanox.com>

From: Dotan Barak <dotanb@dev.mellanox.co.il>

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>
---
 drivers/net/ethernet/mellanox/mlx4/qp.c |    8 +++++++-
 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 40e82ed..8720428 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)
 	struct mlx4_qp_table *qp_table = &mlx4_priv(dev)->qp_table;
 	int err;
 	int reserved_from_top = 0;
+	int reserved_from_bot;
 	int k;
 
 	spin_lock_init(&qp_table->lock);
@@ -534,9 +535,14 @@ int mlx4_init_qp_table(struct mlx4_dev *dev)
 	* b. All the proxy SQPs (8 per function)
 	* c. All the tunnel QPs (8 per function)
 	*/
+	reserved_from_bot = mlx4_num_reserved_sqps(dev);
+	if (reserved_from_bot + reserved_from_top > dev->caps.num_qps) {
+		mlx4_err(dev, "Number of reserved QPs is higher than number of QPs\n");
+		return -EINVAL;
+	}
 
 	err = mlx4_bitmap_init(&qp_table->bitmap, dev->caps.num_qps,
-			       (1 << 23) - 1, mlx4_num_reserved_sqps(dev),
+			       (1 << 23) - 1, reserved_from_bot,
 			       reserved_from_top);
 	if (err)
 		return err;
-- 
1.7.1

  parent reply	other threads:[~2014-12-11  8:59 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-11  8:57 [PATCH V2 net-next 00/10] mlx4 driver update Or Gerlitz
2014-12-11  8:57 ` [PATCH V2 net-next 01/10] net/mlx4_en: Set csum level for encapsulated packets Or Gerlitz
2014-12-11  8:57 ` [PATCH V2 net-next 02/10] net/mlx4_core: Mask out host side virtualization features for guests Or Gerlitz
2014-12-11  8:57 ` [PATCH V2 net-next 03/10] net/mlx4_core: Use tasklet for user-space CQ completion events Or Gerlitz
2014-12-11  8:57 ` [PATCH V2 net-next 04/10] net/mlx4: Change QP allocation scheme Or Gerlitz
2014-12-11  8:57 ` Or Gerlitz [this message]
2014-12-11  8:57 ` [PATCH V2 net-next 06/10] net/mlx4: Add mlx4_bitmap zone allocator Or Gerlitz
2014-12-11  8:57 ` [PATCH V2 net-next 07/10] net/mlx4: Add A0 hybrid steering Or Gerlitz
2014-12-11  8:57 ` [PATCH V2 net-next 08/10] net/mlx4_core: Add explicit error message when rule doesn't meet configuration Or Gerlitz
2014-12-11  8:57 ` [PATCH V2 net-next 09/10] net/mlx4: Refactor QUERY_PORT Or Gerlitz
2014-12-11  8:58 ` [PATCH V2 net-next 10/10] net/mlx4: Add support for A0 steering Or Gerlitz
2014-12-11 19:48 ` [PATCH V2 net-next 00/10] mlx4 driver update David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1418288280-334-6-git-send-email-ogerlitz@mellanox.com \
    --to=ogerlitz@mellanox.com \
    --cc=amirv@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=dotanb@dev.mellanox.co.il \
    --cc=jackm@dev.mellanox.co.il \
    --cc=matanb@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=talal@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox