DPDK patches and discussions
 help / color / mirror / Atom feed
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 7/7] mlx4: make sure that number of RX queues is a power of 2
Date: Thu,  3 Mar 2016 15:27:40 +0100	[thread overview]
Message-ID: <1457015260-3041-8-git-send-email-adrien.mazarguil@6wind.com> (raw)
In-Reply-To: <1457015260-3041-1-git-send-email-adrien.mazarguil@6wind.com>

From: Robin Jarry <robin.jarry@6wind.com>

In the documentation it is specified that the hardware only supports a
number of RX queues if it is a power of 2.

Since ibv_exp_create_qp may not return an error when the number of
queues is unsupported by hardware, sanitize the value in dev_configure.

Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
---
 drivers/net/mlx4/mlx4.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 3c1f4c2..67025c7 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -734,6 +734,12 @@ dev_configure(struct rte_eth_dev *dev)
 	}
 	if (rxqs_n == priv->rxqs_n)
 		return 0;
+	if ((rxqs_n & (rxqs_n - 1)) != 0) {
+		ERROR("%p: invalid number of RX queues (%u),"
+		      " must be a power of 2",
+		      (void *)dev, rxqs_n);
+		return EINVAL;
+	}
 	INFO("%p: RX queues number update: %u -> %u",
 	     (void *)dev, priv->rxqs_n, rxqs_n);
 	/* If RSS is enabled, disable it first. */
-- 
2.1.4

  parent reply	other threads:[~2016-03-03 14:28 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-22 18:18 [dpdk-dev] [PATCH 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
2016-02-22 18:18 ` [dpdk-dev] [PATCH 1/7] mlx5: fix possible crash during initialization Adrien Mazarguil
2016-02-22 18:18 ` [dpdk-dev] [PATCH 2/7] mlx5: check if port is configured as Ethernet device Adrien Mazarguil
2016-02-22 18:18 ` [dpdk-dev] [PATCH 3/7] mlx5: manage all special flow types at once Adrien Mazarguil
2016-02-22 18:18 ` [dpdk-dev] [PATCH 4/7] mlx5: remove redundant debugging message Adrien Mazarguil
2016-02-22 18:18 ` [dpdk-dev] [PATCH 5/7] mlx5: apply VLAN filtering to broadcast and IPv6 multicast flows Adrien Mazarguil
2016-02-22 18:18 ` [dpdk-dev] [PATCH 6/7] mlx5: fix RX checksum offload in non L3/L4 packets Adrien Mazarguil
2016-02-22 18:18 ` [dpdk-dev] [PATCH 7/7] mlx4: make sure that number of RX queues is a power of 2 Adrien Mazarguil
2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
2016-03-03 14:27   ` [dpdk-dev] [PATCH v2 1/7] mlx5: fix possible crash during initialization Adrien Mazarguil
2016-03-03 14:27   ` [dpdk-dev] [PATCH v2 2/7] mlx5: check if port is configured as Ethernet device Adrien Mazarguil
2016-03-03 14:27   ` [dpdk-dev] [PATCH v2 3/7] mlx5: manage all special flow types at once Adrien Mazarguil
2016-03-03 14:27   ` [dpdk-dev] [PATCH v2 4/7] mlx5: remove redundant debugging message Adrien Mazarguil
2016-03-03 14:27   ` [dpdk-dev] [PATCH v2 5/7] mlx5: apply VLAN filtering to broadcast and IPv6 multicast flows Adrien Mazarguil
2016-03-03 14:27   ` [dpdk-dev] [PATCH v2 6/7] mlx5: fix RX checksum offload in non L3/L4 packets Adrien Mazarguil
2016-03-03 14:27   ` Adrien Mazarguil [this message]
2016-03-10 22:15   ` [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5 Bruce Richardson

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=1457015260-3041-8-git-send-email-adrien.mazarguil@6wind.com \
    --to=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.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).