DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 1/2] mlx5: fix compilation error with debugging enabled
@ 2015-11-03 17:15 Adrien Mazarguil
  2015-11-03 17:15 ` [dpdk-dev] [PATCH 2/2] mlx5: fix wrong hash RX queue type in RSS mode Adrien Mazarguil
  0 siblings, 1 reply; 3+ messages in thread
From: Adrien Mazarguil @ 2015-11-03 17:15 UTC (permalink / raw)
  To: dev

The following error occurs when CONFIG_RTE_LIBRTE_MLX5_DEBUG=y:

 drivers/net/mlx5/mlx5.c:381:4: error: ISO C forbids braced-groups within expressions

RTE_MIN() uses the non-standard ({ ... }) syntax to declare variables within
parentheses, which is rejected by -pedantic.

Since the RSS_INDIRECTION_TABLE_SIZE check is meant to go away as soon as
DPDK supports larger/variable indirection tables, put it in a separate
condition.

Fixes: 634efbc2c8c0 ("mlx5: support RETA query and update")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 drivers/net/mlx5/mlx5.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 5a95260..0cd7208 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -65,6 +65,7 @@
 #include "mlx5_utils.h"
 #include "mlx5_rxtx.h"
 #include "mlx5_autoconf.h"
+#include "mlx5_defs.h"
 
 /**
  * DPDK callback to close the device.
@@ -377,9 +378,11 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		DEBUG("L2 tunnel checksum offloads are %ssupported",
 		      (priv->hw_csum_l2tun ? "" : "not "));
 
-		priv->ind_table_max_size =
-			RTE_MIN((unsigned int)RSS_INDIRECTION_TABLE_SIZE,
-				exp_device_attr.rx_hash_caps.max_rwq_indirection_table_size);
+		priv->ind_table_max_size = exp_device_attr.rx_hash_caps.max_rwq_indirection_table_size;
+		/* Remove this check once DPDK supports larger/variable
+		 * indirection tables. */
+		if (priv->ind_table_max_size > (unsigned int)RSS_INDIRECTION_TABLE_SIZE)
+			priv->ind_table_max_size = RSS_INDIRECTION_TABLE_SIZE;
 		DEBUG("maximum RX indirection table size is %u",
 		      priv->ind_table_max_size);
 
-- 
2.1.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-dev] [PATCH 2/2] mlx5: fix wrong hash RX queue type in RSS mode
  2015-11-03 17:15 [dpdk-dev] [PATCH 1/2] mlx5: fix compilation error with debugging enabled Adrien Mazarguil
@ 2015-11-03 17:15 ` Adrien Mazarguil
  2015-11-03 22:00   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Adrien Mazarguil @ 2015-11-03 17:15 UTC (permalink / raw)
  To: dev

Only seen since IPv6 RSS support was added, confusion about the purpose of
the hash_rxq_type_from_n() function has caused it to return invalid hash RX
queue types.

Refactor function for its intended purpose, rename it
hash_rxq_type_from_pos() and update comment with a better description.

Fixes: a76133214d88 ("mlx5: use separate indirection table for default hash Rx queue")

Reported-by: Olga Shern <olgas@mellanox.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
---
 drivers/net/mlx5/mlx5_rxq.c | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 3d7ae7e..37b4efd 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -259,23 +259,29 @@ hash_rxq_flow_attr(const struct hash_rxq *hash_rxq,
 }
 
 /**
- * Return the type corresponding to the n'th bit set.
+ * Convert hash type position in indirection table initializer to
+ * hash RX queue type.
  *
  * @param table
- *   The indirection table.
- * @param n
- *   The n'th bit set.
+ *   Indirection table initializer.
+ * @param pos
+ *   Hash type position.
  *
  * @return
- *   The corresponding hash_rxq_type.
+ *   Hash RX queue type.
  */
 static enum hash_rxq_type
-hash_rxq_type_from_n(const struct ind_table_init *table, unsigned int n)
+hash_rxq_type_from_pos(const struct ind_table_init *table, unsigned int pos)
 {
-	assert(n < table->hash_types_n);
-	while (((table->hash_types >> n) & 0x1) == 0)
-		++n;
-	return n;
+	enum hash_rxq_type type = 0;
+
+	assert(pos < table->hash_types_n);
+	do {
+		if ((table->hash_types & (1 << type)) && (pos-- == 0))
+			break;
+		++type;
+	} while (1);
+	return type;
 }
 
 /**
@@ -429,7 +435,7 @@ priv_create_hash_rxqs(struct priv *priv)
 	     ++i) {
 		struct hash_rxq *hash_rxq = &(*hash_rxqs)[i];
 		enum hash_rxq_type type =
-			hash_rxq_type_from_n(&ind_table_init[j], k);
+			hash_rxq_type_from_pos(&ind_table_init[j], k);
 		struct rte_eth_rss_conf *priv_rss_conf =
 			(*priv->rss_conf)[type];
 		struct ibv_exp_rx_hash_conf hash_conf = {
@@ -453,8 +459,8 @@ priv_create_hash_rxqs(struct priv *priv)
 			.port_num = priv->port,
 		};
 
-		DEBUG("using indirection table %u for hash RX queue %u",
-		      j, i);
+		DEBUG("using indirection table %u for hash RX queue %u type %d",
+		      j, i, type);
 		*hash_rxq = (struct hash_rxq){
 			.priv = priv,
 			.qp = ibv_exp_create_qp(priv->ctx, &qp_init_attr),
-- 
2.1.0

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH 2/2] mlx5: fix wrong hash RX queue type in RSS mode
  2015-11-03 17:15 ` [dpdk-dev] [PATCH 2/2] mlx5: fix wrong hash RX queue type in RSS mode Adrien Mazarguil
@ 2015-11-03 22:00   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2015-11-03 22:00 UTC (permalink / raw)
  To: Adrien Mazarguil; +Cc: dev

2015-11-03 18:15, Adrien Mazarguil:
> Only seen since IPv6 RSS support was added, confusion about the purpose of
> the hash_rxq_type_from_n() function has caused it to return invalid hash RX
> queue types.
> 
> Refactor function for its intended purpose, rename it
> hash_rxq_type_from_pos() and update comment with a better description.
> 
> Fixes: a76133214d88 ("mlx5: use separate indirection table for default hash Rx queue")
> 
> Reported-by: Olga Shern <olgas@mellanox.com>
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> Signed-off-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>

Series applied, thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-11-03 22:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-03 17:15 [dpdk-dev] [PATCH 1/2] mlx5: fix compilation error with debugging enabled Adrien Mazarguil
2015-11-03 17:15 ` [dpdk-dev] [PATCH 2/2] mlx5: fix wrong hash RX queue type in RSS mode Adrien Mazarguil
2015-11-03 22:00   ` Thomas Monjalon

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).