From: Or Gerlitz <ogerlitz@mellanox.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, amirv@mellanox.com, roland@kernel.org,
jackm@dev.mellanox.co.il, Or Gerlitz <ogerlitz@mellanox.com>
Subject: [PATCH net-next V1 6/9] net/mlx4_core: Fix checking order in MR table init
Date: Sun, 3 Nov 2013 10:03:22 +0200 [thread overview]
Message-ID: <1383465805-28640-7-git-send-email-ogerlitz@mellanox.com> (raw)
In-Reply-To: <1383465805-28640-1-git-send-email-ogerlitz@mellanox.com>
From: Jack Morgenstein <jackm@dev.mellanox.co.il>
In procedure mlx4_init_mr_table(), slaves should do no processing,
but should return success. This initialization is hypervisor-only.
However, the check for num_mpts being a power-of-2 was performed
before the check to return immediately if the driver is for a slave.
This resulted in spurious failures.
The order of performing the checks is reversed, so that if the
driver is for a slave, no processing is done and success is returned.
Signed-off-by: Jack Morgenstein <jackm@dev.mellanox.co.il>
Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx4/mr.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx4/mr.c b/drivers/net/ethernet/mellanox/mlx4/mr.c
index f91719a..63391a1 100644
--- a/drivers/net/ethernet/mellanox/mlx4/mr.c
+++ b/drivers/net/ethernet/mellanox/mlx4/mr.c
@@ -755,14 +755,14 @@ int mlx4_init_mr_table(struct mlx4_dev *dev)
struct mlx4_mr_table *mr_table = &priv->mr_table;
int err;
- if (!is_power_of_2(dev->caps.num_mpts))
- return -EINVAL;
-
/* Nothing to do for slaves - all MR handling is forwarded
* to the master */
if (mlx4_is_slave(dev))
return 0;
+ if (!is_power_of_2(dev->caps.num_mpts))
+ return -EINVAL;
+
err = mlx4_bitmap_init(&mr_table->mpt_bitmap, dev->caps.num_mpts,
~0, dev->caps.reserved_mrws, 0);
if (err)
--
1.7.1
next prev parent reply other threads:[~2013-11-03 8:03 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-03 8:03 [PATCH net-next V1 0/9] Mellanox driver updates Or Gerlitz
2013-11-03 8:03 ` [PATCH net-next V1 1/9] net/mlx4_core: Fix register/unreg vlan flow Or Gerlitz
2013-11-03 8:03 ` [PATCH net-next V1 2/9] net/mlx4_core: Fix reg/unreg vlan/mac to conform to the firmware spec Or Gerlitz
2013-11-03 8:03 ` [PATCH net-next V1 3/9] net/mlx4_en: Use vlan id instead of vlan index for unregistration Or Gerlitz
2013-11-03 8:03 ` [PATCH net-next V1 4/9] net/mlx4_core: Resource tracker for reg/unreg vlans Or Gerlitz
2013-11-03 8:03 ` [PATCH net-next V1 5/9] net/mlx4_core: Don't fail reg/unreg vlan for older guests Or Gerlitz
2013-11-03 8:03 ` Or Gerlitz [this message]
2013-11-03 8:03 ` [PATCH net-next V1 7/9] mlx4: Structures and init/teardown for VF resource quotas Or Gerlitz
2013-11-03 8:03 ` [PATCH net-next V1 8/9] net/mlx4_core: Fix quota handling in the QUERY_FUNC_CAP wrapper Or Gerlitz
2013-11-03 8:03 ` [PATCH net-next V1 9/9] net/mlx4_core: Implement resource quota enforcement Or Gerlitz
2013-11-04 21:20 ` [PATCH net-next V1 0/9] Mellanox driver updates 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=1383465805-28640-7-git-send-email-ogerlitz@mellanox.com \
--to=ogerlitz@mellanox.com \
--cc=amirv@mellanox.com \
--cc=davem@davemloft.net \
--cc=jackm@dev.mellanox.co.il \
--cc=netdev@vger.kernel.org \
--cc=roland@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).