DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/7] Assorted fixes for mlx4 and mlx5
@ 2016-02-22 18:18 Adrien Mazarguil
  2016-02-22 18:18 ` [dpdk-dev] [PATCH 1/7] mlx5: fix possible crash during initialization Adrien Mazarguil
                   ` (7 more replies)
  0 siblings, 8 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-02-22 18:18 UTC (permalink / raw)
  To: dev

This patchset addresses several minor issues, release notes are updated
accordingly.

Note: should be applied after "Performance optimizations for mlx5 and mlx4".

Adrien Mazarguil (3):
  mlx5: manage all special flow types at once
  mlx5: remove redundant debugging message
  mlx5: apply VLAN filtering to broadcast and IPv6 multicast flows

Or Ami (2):
  mlx5: fix possible crash during initialization
  mlx5: check if port is configured as Ethernet device

Robin Jarry (1):
  mlx4: make sure that number of RX queues is a power of 2

Yaacov Hazan (1):
  mlx5: fix RX checksum offload in non L3/L4 packets

 doc/guides/rel_notes/release_16_04.rst |  17 ++++
 drivers/net/mlx4/mlx4.c                |   6 ++
 drivers/net/mlx5/Makefile              |   5 ++
 drivers/net/mlx5/mlx5.c                |  18 ++--
 drivers/net/mlx5/mlx5.h                |   2 +
 drivers/net/mlx5/mlx5_rxmode.c         | 147 +++++++++++++++++++++++++++++----
 drivers/net/mlx5/mlx5_rxq.c            |   5 +-
 drivers/net/mlx5/mlx5_rxtx.c           |  26 ++++--
 drivers/net/mlx5/mlx5_rxtx.h           |   4 +-
 drivers/net/mlx5/mlx5_trigger.c        |  10 +--
 drivers/net/mlx5/mlx5_vlan.c           |   5 +-
 11 files changed, 204 insertions(+), 41 deletions(-)

-- 
2.1.4

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

* [dpdk-dev] [PATCH 1/7] mlx5: fix possible crash during initialization
  2016-02-22 18:18 [dpdk-dev] [PATCH 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
@ 2016-02-22 18:18 ` Adrien Mazarguil
  2016-02-22 18:18 ` [dpdk-dev] [PATCH 2/7] mlx5: check if port is configured as Ethernet device Adrien Mazarguil
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-02-22 18:18 UTC (permalink / raw)
  To: dev

From: Or Ami <ora@mellanox.com>

RSS configuration should not be freed when priv is NULL.

Fixes: 2f97422e7759 ("mlx5: support RSS hash update and get")

Signed-off-by: Or Ami <ora@mellanox.com>
---
 doc/guides/rel_notes/release_16_04.rst | 4 ++++
 drivers/net/mlx5/mlx5.c                | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index 4d2f76c..09afff9 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -142,6 +142,10 @@ Drivers
 
 * **vmxnet3: add TSO support.**
 
+* **mlx5: Fixed possible crash during initialization.**
+
+  A crash could occur when failing to allocate private device context.
+
 
 Libraries
 ~~~~~~~~~
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 575420e..41dcbbf 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -497,8 +497,10 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		continue;
 
 port_error:
-		rte_free(priv->rss_conf);
-		rte_free(priv);
+		if (priv) {
+			rte_free(priv->rss_conf);
+			rte_free(priv);
+		}
 		if (pd)
 			claim_zero(ibv_dealloc_pd(pd));
 		if (ctx)
-- 
2.1.4

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

* [dpdk-dev] [PATCH 2/7] mlx5: check if port is configured as Ethernet device
  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 ` Adrien Mazarguil
  2016-02-22 18:18 ` [dpdk-dev] [PATCH 3/7] mlx5: manage all special flow types at once Adrien Mazarguil
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-02-22 18:18 UTC (permalink / raw)
  To: dev

From: Or Ami <ora@mellanox.com>

If the port link layer is not Ethernet, notify the user.

Signed-off-by: Or Ami <ora@mellanox.com>
---
 doc/guides/rel_notes/release_16_04.rst | 5 +++++
 drivers/net/mlx5/mlx5.c                | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index 09afff9..ab7c64d 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -146,6 +146,11 @@ Drivers
 
   A crash could occur when failing to allocate private device context.
 
+* **mlx5: Added port type check.**
+
+  Done to prevent port initialization on non-Ethernet link layers and
+  to report an error.
+
 
 Libraries
 ~~~~~~~~~
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 41dcbbf..ae2576f 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -348,6 +348,13 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 			ERROR("port query failed: %s", strerror(err));
 			goto port_error;
 		}
+
+		if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) {
+			ERROR("port %d is not configured in Ethernet mode",
+			      port);
+			goto port_error;
+		}
+
 		if (port_attr.state != IBV_PORT_ACTIVE)
 			DEBUG("port %d is not active: \"%s\" (%d)",
 			      port, ibv_port_state_str(port_attr.state),
-- 
2.1.4

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

* [dpdk-dev] [PATCH 3/7] mlx5: manage all special flow types at once
  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 ` Adrien Mazarguil
  2016-02-22 18:18 ` [dpdk-dev] [PATCH 4/7] mlx5: remove redundant debugging message Adrien Mazarguil
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-02-22 18:18 UTC (permalink / raw)
  To: dev

This commit adds helpers to remove redundant code.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 drivers/net/mlx5/mlx5.c         |  5 +----
 drivers/net/mlx5/mlx5.h         |  2 ++
 drivers/net/mlx5/mlx5_rxmode.c  | 40 ++++++++++++++++++++++++++++++++++++++++
 drivers/net/mlx5/mlx5_trigger.c | 10 ++--------
 4 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index ae2576f..ad69ec2 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -88,10 +88,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)
 	      ((priv->ctx != NULL) ? priv->ctx->device->name : ""));
 	/* In case mlx5_dev_stop() has not been called. */
 	priv_dev_interrupt_handler_uninstall(priv, dev);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI);
+	priv_special_flow_disable_all(priv);
 	priv_mac_addrs_disable(priv);
 	priv_destroy_hash_rxqs(priv);
 
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 8442016..43b24fb 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -199,6 +199,8 @@ int mlx5_dev_rss_reta_update(struct rte_eth_dev *,
 
 int priv_special_flow_enable(struct priv *, enum hash_rxq_flow_type);
 void priv_special_flow_disable(struct priv *, enum hash_rxq_flow_type);
+int priv_special_flow_enable_all(struct priv *);
+void priv_special_flow_disable_all(struct priv *);
 void mlx5_promiscuous_enable(struct rte_eth_dev *);
 void mlx5_promiscuous_disable(struct rte_eth_dev *);
 void mlx5_allmulticast_enable(struct rte_eth_dev *);
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index 9ac7a41..bcf4231 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -268,6 +268,46 @@ priv_special_flow_disable(struct priv *priv, enum hash_rxq_flow_type flow_type)
 }
 
 /**
+ * Enable all special flows in all hash RX queues.
+ *
+ * @param priv
+ *   Private structure.
+ */
+int
+priv_special_flow_enable_all(struct priv *priv)
+{
+	enum hash_rxq_flow_type flow_type;
+
+	for (flow_type = 0; flow_type != HASH_RXQ_FLOW_TYPE_MAC; ++flow_type) {
+		int ret;
+
+		ret = priv_special_flow_enable(priv, flow_type);
+		if (!ret)
+			continue;
+		/* Failure, rollback. */
+		while (flow_type)
+			priv_special_flow_disable(priv, --flow_type);
+		return ret;
+	}
+	return 0;
+}
+
+/**
+ * Disable all special flows in all hash RX queues.
+ *
+ * @param priv
+ *   Private structure.
+ */
+void
+priv_special_flow_disable_all(struct priv *priv)
+{
+	enum hash_rxq_flow_type flow_type;
+
+	for (flow_type = 0; flow_type != HASH_RXQ_FLOW_TYPE_MAC; ++flow_type)
+		priv_special_flow_disable(priv, flow_type);
+}
+
+/**
  * DPDK callback to enable promiscuous mode.
  *
  * @param dev
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index db7890f..b5ca7d4 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -80,10 +80,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 		      " %s",
 		      (void *)priv, strerror(err));
 		/* Rollback. */
-		priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI);
-		priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST);
-		priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI);
-		priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC);
+		priv_special_flow_disable_all(priv);
 		priv_mac_addrs_disable(priv);
 		priv_destroy_hash_rxqs(priv);
 	}
@@ -113,10 +110,7 @@ mlx5_dev_stop(struct rte_eth_dev *dev)
 		return;
 	}
 	DEBUG("%p: cleaning up and destroying hash RX queues", (void *)dev);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC);
+	priv_special_flow_disable_all(priv);
 	priv_mac_addrs_disable(priv);
 	priv_destroy_hash_rxqs(priv);
 	priv_fdir_disable(priv);
-- 
2.1.4

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

* [dpdk-dev] [PATCH 4/7] mlx5: remove redundant debugging message
  2016-02-22 18:18 [dpdk-dev] [PATCH 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
                   ` (2 preceding siblings ...)
  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 ` Adrien Mazarguil
  2016-02-22 18:18 ` [dpdk-dev] [PATCH 5/7] mlx5: apply VLAN filtering to broadcast and IPv6 multicast flows Adrien Mazarguil
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-02-22 18:18 UTC (permalink / raw)
  To: dev

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

diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index bcf4231..730527e 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -204,8 +204,6 @@ hash_rxq_special_flow_disable(struct hash_rxq *hash_rxq,
 {
 	if (hash_rxq->special_flow[flow_type] == NULL)
 		return;
-	DEBUG("%p: disabling special flow %s (%d)",
-	      (void *)hash_rxq, hash_rxq_flow_type_str(flow_type), flow_type);
 	claim_zero(ibv_exp_destroy_flow(hash_rxq->special_flow[flow_type]));
 	hash_rxq->special_flow[flow_type] = NULL;
 	DEBUG("%p: special flow %s (%d) disabled",
-- 
2.1.4

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

* [dpdk-dev] [PATCH 5/7] mlx5: apply VLAN filtering to broadcast and IPv6 multicast flows
  2016-02-22 18:18 [dpdk-dev] [PATCH 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
                   ` (3 preceding siblings ...)
  2016-02-22 18:18 ` [dpdk-dev] [PATCH 4/7] mlx5: remove redundant debugging message Adrien Mazarguil
@ 2016-02-22 18:18 ` Adrien Mazarguil
  2016-02-22 18:18 ` [dpdk-dev] [PATCH 6/7] mlx5: fix RX checksum offload in non L3/L4 packets Adrien Mazarguil
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-02-22 18:18 UTC (permalink / raw)
  To: dev

Unlike promiscuous and allmulticast flows, those should remain
VLAN-specific.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 doc/guides/rel_notes/release_16_04.rst |   4 ++
 drivers/net/mlx5/mlx5_rxmode.c         | 105 +++++++++++++++++++++++++++++----
 drivers/net/mlx5/mlx5_rxq.c            |   5 +-
 drivers/net/mlx5/mlx5_rxtx.h           |   4 +-
 drivers/net/mlx5/mlx5_vlan.c           |   5 +-
 5 files changed, 106 insertions(+), 17 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index ab7c64d..eebe768460 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -151,6 +151,10 @@ Drivers
   Done to prevent port initialization on non-Ethernet link layers and
   to report an error.
 
+* **mlx5: Applied VLAN filtering to broadcast and IPv6 multicast flows.**
+
+  Prevented reception of multicast frames outside of configured VLANs.
+
 
 Libraries
 ~~~~~~~~~
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index 730527e..2bc005e 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -74,6 +74,7 @@ static const struct special_flow_init special_flow_init[] = {
 #endif /* HAVE_FLOW_SPEC_IPV6 */
 			1 << HASH_RXQ_ETH |
 			0,
+		.per_vlan = 0,
 	},
 	[HASH_RXQ_FLOW_TYPE_ALLMULTI] = {
 		.dst_mac_val = "\x01\x00\x00\x00\x00\x00",
@@ -87,6 +88,7 @@ static const struct special_flow_init special_flow_init[] = {
 #endif /* HAVE_FLOW_SPEC_IPV6 */
 			1 << HASH_RXQ_ETH |
 			0,
+		.per_vlan = 0,
 	},
 	[HASH_RXQ_FLOW_TYPE_BROADCAST] = {
 		.dst_mac_val = "\xff\xff\xff\xff\xff\xff",
@@ -100,6 +102,7 @@ static const struct special_flow_init special_flow_init[] = {
 #endif /* HAVE_FLOW_SPEC_IPV6 */
 			1 << HASH_RXQ_ETH |
 			0,
+		.per_vlan = 1,
 	},
 #ifdef HAVE_FLOW_SPEC_IPV6
 	[HASH_RXQ_FLOW_TYPE_IPV6MULTI] = {
@@ -110,24 +113,28 @@ static const struct special_flow_init special_flow_init[] = {
 			1 << HASH_RXQ_IPV6 |
 			1 << HASH_RXQ_ETH |
 			0,
+		.per_vlan = 1,
 	},
 #endif /* HAVE_FLOW_SPEC_IPV6 */
 };
 
 /**
- * Enable a special flow in a hash RX queue.
+ * Enable a special flow in a hash RX queue for a given VLAN index.
  *
  * @param hash_rxq
  *   Pointer to hash RX queue structure.
  * @param flow_type
  *   Special flow type.
+ * @param vlan_index
+ *   VLAN index to use.
  *
  * @return
  *   0 on success, errno value on failure.
  */
 static int
-hash_rxq_special_flow_enable(struct hash_rxq *hash_rxq,
-			     enum hash_rxq_flow_type flow_type)
+hash_rxq_special_flow_enable_vlan(struct hash_rxq *hash_rxq,
+				  enum hash_rxq_flow_type flow_type,
+				  unsigned int vlan_index)
 {
 	struct priv *priv = hash_rxq->priv;
 	struct ibv_exp_flow *flow;
@@ -136,12 +143,15 @@ hash_rxq_special_flow_enable(struct hash_rxq *hash_rxq,
 	struct ibv_exp_flow_spec_eth *spec = &data->spec;
 	const uint8_t *mac;
 	const uint8_t *mask;
+	unsigned int vlan_enabled = (priv->vlan_filter_n &&
+				     special_flow_init[flow_type].per_vlan);
+	unsigned int vlan_id = priv->vlan_filter[vlan_index];
 
 	/* Check if flow is relevant for this hash_rxq. */
 	if (!(special_flow_init[flow_type].hash_types & (1 << hash_rxq->type)))
 		return 0;
 	/* Check if flow already exists. */
-	if (hash_rxq->special_flow[flow_type] != NULL)
+	if (hash_rxq->special_flow[flow_type][vlan_index] != NULL)
 		return 0;
 
 	/*
@@ -164,12 +174,14 @@ hash_rxq_special_flow_enable(struct hash_rxq *hash_rxq,
 				mac[0], mac[1], mac[2],
 				mac[3], mac[4], mac[5],
 			},
+			.vlan_tag = (vlan_enabled ? htons(vlan_id) : 0),
 		},
 		.mask = {
 			.dst_mac = {
 				mask[0], mask[1], mask[2],
 				mask[3], mask[4], mask[5],
 			},
+			.vlan_tag = (vlan_enabled ? htons(0xfff) : 0),
 		},
 	};
 
@@ -184,9 +196,77 @@ hash_rxq_special_flow_enable(struct hash_rxq *hash_rxq,
 			return errno;
 		return EINVAL;
 	}
-	hash_rxq->special_flow[flow_type] = flow;
-	DEBUG("%p: enabling special flow %s (%d)",
-	      (void *)hash_rxq, hash_rxq_flow_type_str(flow_type), flow_type);
+	hash_rxq->special_flow[flow_type][vlan_index] = flow;
+	DEBUG("%p: special flow %s (index %d) VLAN %u (index %u) enabled",
+	      (void *)hash_rxq, hash_rxq_flow_type_str(flow_type), flow_type,
+	      vlan_id, vlan_index);
+	return 0;
+}
+
+/**
+ * Disable a special flow in a hash RX queue for a given VLAN index.
+ *
+ * @param hash_rxq
+ *   Pointer to hash RX queue structure.
+ * @param flow_type
+ *   Special flow type.
+ * @param vlan_index
+ *   VLAN index to use.
+ */
+static void
+hash_rxq_special_flow_disable_vlan(struct hash_rxq *hash_rxq,
+				   enum hash_rxq_flow_type flow_type,
+				   unsigned int vlan_index)
+{
+	struct ibv_exp_flow *flow =
+		hash_rxq->special_flow[flow_type][vlan_index];
+
+	if (flow == NULL)
+		return;
+	claim_zero(ibv_exp_destroy_flow(flow));
+	hash_rxq->special_flow[flow_type][vlan_index] = NULL;
+	DEBUG("%p: special flow %s (index %d) VLAN %u (index %u) disabled",
+	      (void *)hash_rxq, hash_rxq_flow_type_str(flow_type), flow_type,
+	      hash_rxq->priv->vlan_filter[vlan_index], vlan_index);
+}
+
+/**
+ * Enable a special flow in a hash RX queue.
+ *
+ * @param hash_rxq
+ *   Pointer to hash RX queue structure.
+ * @param flow_type
+ *   Special flow type.
+ * @param vlan_index
+ *   VLAN index to use.
+ *
+ * @return
+ *   0 on success, errno value on failure.
+ */
+static int
+hash_rxq_special_flow_enable(struct hash_rxq *hash_rxq,
+			     enum hash_rxq_flow_type flow_type)
+{
+	struct priv *priv = hash_rxq->priv;
+	unsigned int i = 0;
+	int ret;
+
+	assert((unsigned int)flow_type < RTE_DIM(hash_rxq->special_flow));
+	assert(RTE_DIM(hash_rxq->special_flow[flow_type]) ==
+	       RTE_DIM(priv->vlan_filter));
+	/* Add a special flow for each VLAN filter when relevant. */
+	do {
+		ret = hash_rxq_special_flow_enable_vlan(hash_rxq, flow_type, i);
+		if (ret) {
+			/* Failure, rollback. */
+			while (i != 0)
+				hash_rxq_special_flow_disable_vlan(hash_rxq,
+								   flow_type,
+								   --i);
+			return ret;
+		}
+	} while (special_flow_init[flow_type].per_vlan &&
+		 ++i < priv->vlan_filter_n);
 	return 0;
 }
 
@@ -202,12 +282,11 @@ static void
 hash_rxq_special_flow_disable(struct hash_rxq *hash_rxq,
 			      enum hash_rxq_flow_type flow_type)
 {
-	if (hash_rxq->special_flow[flow_type] == NULL)
-		return;
-	claim_zero(ibv_exp_destroy_flow(hash_rxq->special_flow[flow_type]));
-	hash_rxq->special_flow[flow_type] = NULL;
-	DEBUG("%p: special flow %s (%d) disabled",
-	      (void *)hash_rxq, hash_rxq_flow_type_str(flow_type), flow_type);
+	unsigned int i;
+
+	assert((unsigned int)flow_type < RTE_DIM(hash_rxq->special_flow));
+	for (i = 0; (i != RTE_DIM(hash_rxq->special_flow[flow_type])); ++i)
+		hash_rxq_special_flow_disable_vlan(hash_rxq, flow_type, i);
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 0f5ac65..df6fd92 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -541,7 +541,10 @@ priv_destroy_hash_rxqs(struct priv *priv)
 		assert(hash_rxq->qp != NULL);
 		/* Also check that there are no remaining flows. */
 		for (j = 0; (j != RTE_DIM(hash_rxq->special_flow)); ++j)
-			assert(hash_rxq->special_flow[j] == NULL);
+			for (k = 0;
+			     (k != RTE_DIM(hash_rxq->special_flow[j]));
+			     ++k)
+				assert(hash_rxq->special_flow[j][k] == NULL);
 		for (j = 0; (j != RTE_DIM(hash_rxq->mac_flow)); ++j)
 			for (k = 0; (k != RTE_DIM(hash_rxq->mac_flow[j])); ++k)
 				assert(hash_rxq->mac_flow[j][k] == NULL);
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index e85cf93..6ac1a5a 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -195,6 +195,7 @@ struct special_flow_init {
 	uint8_t dst_mac_val[6];
 	uint8_t dst_mac_mask[6];
 	unsigned int hash_types;
+	unsigned int per_vlan:1;
 };
 
 enum hash_rxq_flow_type {
@@ -231,7 +232,8 @@ struct hash_rxq {
 	enum hash_rxq_type type; /* Hash RX queue type. */
 	/* MAC flow steering rules, one per VLAN ID. */
 	struct ibv_exp_flow *mac_flow[MLX5_MAX_MAC_ADDRESSES][MLX5_MAX_VLAN_IDS];
-	struct ibv_exp_flow *special_flow[MLX5_MAX_SPECIAL_FLOWS];
+	struct ibv_exp_flow *special_flow
+		[MLX5_MAX_SPECIAL_FLOWS][MLX5_MAX_VLAN_IDS];
 };
 
 /* TX element. */
diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c
index fa9e3b8..ea7af1e 100644
--- a/drivers/net/mlx5/mlx5_vlan.c
+++ b/drivers/net/mlx5/mlx5_vlan.c
@@ -98,9 +98,10 @@ vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 		priv->vlan_filter[priv->vlan_filter_n] = vlan_id;
 		++priv->vlan_filter_n;
 	}
-	/* Rehash MAC flows in all hash RX queues. */
+	/* Rehash flows in all hash RX queues. */
 	priv_mac_addrs_disable(priv);
-	return priv_mac_addrs_enable(priv);
+	priv_special_flow_disable_all(priv);
+	return priv_rehash_flows(priv);
 }
 
 /**
-- 
2.1.4

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

* [dpdk-dev] [PATCH 6/7] mlx5: fix RX checksum offload in non L3/L4 packets
  2016-02-22 18:18 [dpdk-dev] [PATCH 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
                   ` (4 preceding siblings ...)
  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 ` 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
  7 siblings, 0 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-02-22 18:18 UTC (permalink / raw)
  To: dev

From: Yaacov Hazan <yaacovh@mellanox.com>

Change rxq_cq_to_ol_flags() to set checksum flags according to packet type,
so for non L3/L4 packets the mbuf chksum_bad flags will not be set.

Fixes: 67fa62bc672d ("mlx5: support checksum offload")

Signed-off-by: Yaacov Hazan <yaacovh@mellanox.com>
---
 doc/guides/rel_notes/release_16_04.rst |  4 ++++
 drivers/net/mlx5/Makefile              |  5 +++++
 drivers/net/mlx5/mlx5_rxtx.c           | 26 ++++++++++++++++++--------
 3 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index eebe768460..4750205 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -155,6 +155,10 @@ Drivers
 
   Prevented reception of multicast frames outside of configured VLANs.
 
+* **mlx5: Fixed RX checksum offload in non L3/L4 packets.**
+
+  Fixed report of bad checksum for packets of unknown type.
+
 
 Libraries
 ~~~~~~~~~
diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
index 39cdf2c..7076ae3 100644
--- a/drivers/net/mlx5/Makefile
+++ b/drivers/net/mlx5/Makefile
@@ -132,6 +132,11 @@ mlx5_autoconf.h: $(RTE_SDK)/scripts/auto-config-h.sh
 		infiniband/verbs.h \
 		enum IBV_EXP_DEVICE_ATTR_VLAN_OFFLOADS \
 		$(AUTOCONF_OUTPUT)
+	$Q sh -- '$<' '$@' \
+		HAVE_EXP_CQ_RX_TCP_PACKET \
+		infiniband/verbs.h \
+		enum IBV_EXP_CQ_RX_TCP_PACKET \
+		$(AUTOCONF_OUTPUT)
 
 $(SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD):.c=.o): mlx5_autoconf.h
 
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 4c53c7a..4919189 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -719,14 +719,24 @@ rxq_cq_to_ol_flags(const struct rxq *rxq, uint32_t flags)
 {
 	uint32_t ol_flags = 0;
 
-	if (rxq->csum)
-		ol_flags |=
-			TRANSPOSE(~flags,
-				  IBV_EXP_CQ_RX_IP_CSUM_OK,
-				  PKT_RX_IP_CKSUM_BAD) |
-			TRANSPOSE(~flags,
-				  IBV_EXP_CQ_RX_TCP_UDP_CSUM_OK,
-				  PKT_RX_L4_CKSUM_BAD);
+	if (rxq->csum) {
+		/* Set IP checksum flag only for IPv4/IPv6 packets. */
+		if (flags &
+		    (IBV_EXP_CQ_RX_IPV4_PACKET | IBV_EXP_CQ_RX_IPV6_PACKET))
+			ol_flags |=
+				TRANSPOSE(~flags,
+					IBV_EXP_CQ_RX_IP_CSUM_OK,
+					PKT_RX_IP_CKSUM_BAD);
+#ifdef HAVE_EXP_CQ_RX_TCP_PACKET
+		/* Set L4 checksum flag only for TCP/UDP packets. */
+		if (flags &
+		    (IBV_EXP_CQ_RX_TCP_PACKET | IBV_EXP_CQ_RX_UDP_PACKET))
+#endif /* HAVE_EXP_CQ_RX_TCP_PACKET */
+			ol_flags |=
+				TRANSPOSE(~flags,
+					IBV_EXP_CQ_RX_TCP_UDP_CSUM_OK,
+					PKT_RX_L4_CKSUM_BAD);
+	}
 	/*
 	 * PKT_RX_IP_CKSUM_BAD and PKT_RX_L4_CKSUM_BAD are used in place
 	 * of PKT_RX_EIP_CKSUM_BAD because the latter is not functional
-- 
2.1.4

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

* [dpdk-dev] [PATCH 7/7] mlx4: make sure that number of RX queues is a power of 2
  2016-02-22 18:18 [dpdk-dev] [PATCH 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
                   ` (5 preceding siblings ...)
  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 ` Adrien Mazarguil
  2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
  7 siblings, 0 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-02-22 18:18 UTC (permalink / raw)
  To: dev

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

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

* [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5
  2016-02-22 18:18 [dpdk-dev] [PATCH 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
                   ` (6 preceding siblings ...)
  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 ` Adrien Mazarguil
  2016-03-03 14:27   ` [dpdk-dev] [PATCH v2 1/7] mlx5: fix possible crash during initialization Adrien Mazarguil
                     ` (7 more replies)
  7 siblings, 8 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-03-03 14:27 UTC (permalink / raw)
  To: dev

This patchset addresses several minor issues, release notes are updated
accordingly.

Note: should be applied after "Performance optimizations for mlx5 and mlx4".

Changes in v2:
- None, submitted again due to dependency with previous patchset.

Adrien Mazarguil (3):
  mlx5: manage all special flow types at once
  mlx5: remove redundant debugging message
  mlx5: apply VLAN filtering to broadcast and IPv6 multicast flows

Or Ami (2):
  mlx5: fix possible crash during initialization
  mlx5: check if port is configured as Ethernet device

Robin Jarry (1):
  mlx4: make sure that number of RX queues is a power of 2

Yaacov Hazan (1):
  mlx5: fix RX checksum offload in non L3/L4 packets

 doc/guides/rel_notes/release_16_04.rst |  17 ++++
 drivers/net/mlx4/mlx4.c                |   6 ++
 drivers/net/mlx5/Makefile              |   5 ++
 drivers/net/mlx5/mlx5.c                |  18 ++--
 drivers/net/mlx5/mlx5.h                |   2 +
 drivers/net/mlx5/mlx5_rxmode.c         | 147 +++++++++++++++++++++++++++++----
 drivers/net/mlx5/mlx5_rxq.c            |   5 +-
 drivers/net/mlx5/mlx5_rxtx.c           |  26 ++++--
 drivers/net/mlx5/mlx5_rxtx.h           |   4 +-
 drivers/net/mlx5/mlx5_trigger.c        |  10 +--
 drivers/net/mlx5/mlx5_vlan.c           |   5 +-
 11 files changed, 204 insertions(+), 41 deletions(-)

-- 
2.1.4

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

* [dpdk-dev] [PATCH v2 1/7] mlx5: fix possible crash during initialization
  2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
@ 2016-03-03 14:27   ` Adrien Mazarguil
  2016-03-03 14:27   ` [dpdk-dev] [PATCH v2 2/7] mlx5: check if port is configured as Ethernet device Adrien Mazarguil
                     ` (6 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-03-03 14:27 UTC (permalink / raw)
  To: dev

From: Or Ami <ora@mellanox.com>

RSS configuration should not be freed when priv is NULL.

Fixes: 2f97422e7759 ("mlx5: support RSS hash update and get")

Signed-off-by: Or Ami <ora@mellanox.com>
---
 doc/guides/rel_notes/release_16_04.rst | 4 ++++
 drivers/net/mlx5/mlx5.c                | 6 ++++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index c69e55e..953eaa1 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -150,6 +150,10 @@ Drivers
 
 * **vmxnet3: add TSO support.**
 
+* **mlx5: Fixed possible crash during initialization.**
+
+  A crash could occur when failing to allocate private device context.
+
 
 Libraries
 ~~~~~~~~~
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 575420e..41dcbbf 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -497,8 +497,10 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 		continue;
 
 port_error:
-		rte_free(priv->rss_conf);
-		rte_free(priv);
+		if (priv) {
+			rte_free(priv->rss_conf);
+			rte_free(priv);
+		}
 		if (pd)
 			claim_zero(ibv_dealloc_pd(pd));
 		if (ctx)
-- 
2.1.4

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

* [dpdk-dev] [PATCH v2 2/7] mlx5: check if port is configured as Ethernet device
  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   ` Adrien Mazarguil
  2016-03-03 14:27   ` [dpdk-dev] [PATCH v2 3/7] mlx5: manage all special flow types at once Adrien Mazarguil
                     ` (5 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-03-03 14:27 UTC (permalink / raw)
  To: dev

From: Or Ami <ora@mellanox.com>

If the port link layer is not Ethernet, notify the user.

Signed-off-by: Or Ami <ora@mellanox.com>
---
 doc/guides/rel_notes/release_16_04.rst | 5 +++++
 drivers/net/mlx5/mlx5.c                | 7 +++++++
 2 files changed, 12 insertions(+)

diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index 953eaa1..73d0cfc 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -154,6 +154,11 @@ Drivers
 
   A crash could occur when failing to allocate private device context.
 
+* **mlx5: Added port type check.**
+
+  Done to prevent port initialization on non-Ethernet link layers and
+  to report an error.
+
 
 Libraries
 ~~~~~~~~~
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 41dcbbf..ae2576f 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -348,6 +348,13 @@ mlx5_pci_devinit(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 			ERROR("port query failed: %s", strerror(err));
 			goto port_error;
 		}
+
+		if (port_attr.link_layer != IBV_LINK_LAYER_ETHERNET) {
+			ERROR("port %d is not configured in Ethernet mode",
+			      port);
+			goto port_error;
+		}
+
 		if (port_attr.state != IBV_PORT_ACTIVE)
 			DEBUG("port %d is not active: \"%s\" (%d)",
 			      port, ibv_port_state_str(port_attr.state),
-- 
2.1.4

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

* [dpdk-dev] [PATCH v2 3/7] mlx5: manage all special flow types at once
  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   ` Adrien Mazarguil
  2016-03-03 14:27   ` [dpdk-dev] [PATCH v2 4/7] mlx5: remove redundant debugging message Adrien Mazarguil
                     ` (4 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-03-03 14:27 UTC (permalink / raw)
  To: dev

This commit adds helpers to remove redundant code.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 drivers/net/mlx5/mlx5.c         |  5 +----
 drivers/net/mlx5/mlx5.h         |  2 ++
 drivers/net/mlx5/mlx5_rxmode.c  | 40 ++++++++++++++++++++++++++++++++++++++++
 drivers/net/mlx5/mlx5_trigger.c | 10 ++--------
 4 files changed, 45 insertions(+), 12 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index ae2576f..ad69ec2 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -88,10 +88,7 @@ mlx5_dev_close(struct rte_eth_dev *dev)
 	      ((priv->ctx != NULL) ? priv->ctx->device->name : ""));
 	/* In case mlx5_dev_stop() has not been called. */
 	priv_dev_interrupt_handler_uninstall(priv, dev);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI);
+	priv_special_flow_disable_all(priv);
 	priv_mac_addrs_disable(priv);
 	priv_destroy_hash_rxqs(priv);
 
diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h
index 8442016..43b24fb 100644
--- a/drivers/net/mlx5/mlx5.h
+++ b/drivers/net/mlx5/mlx5.h
@@ -199,6 +199,8 @@ int mlx5_dev_rss_reta_update(struct rte_eth_dev *,
 
 int priv_special_flow_enable(struct priv *, enum hash_rxq_flow_type);
 void priv_special_flow_disable(struct priv *, enum hash_rxq_flow_type);
+int priv_special_flow_enable_all(struct priv *);
+void priv_special_flow_disable_all(struct priv *);
 void mlx5_promiscuous_enable(struct rte_eth_dev *);
 void mlx5_promiscuous_disable(struct rte_eth_dev *);
 void mlx5_allmulticast_enable(struct rte_eth_dev *);
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index 9ac7a41..bcf4231 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -268,6 +268,46 @@ priv_special_flow_disable(struct priv *priv, enum hash_rxq_flow_type flow_type)
 }
 
 /**
+ * Enable all special flows in all hash RX queues.
+ *
+ * @param priv
+ *   Private structure.
+ */
+int
+priv_special_flow_enable_all(struct priv *priv)
+{
+	enum hash_rxq_flow_type flow_type;
+
+	for (flow_type = 0; flow_type != HASH_RXQ_FLOW_TYPE_MAC; ++flow_type) {
+		int ret;
+
+		ret = priv_special_flow_enable(priv, flow_type);
+		if (!ret)
+			continue;
+		/* Failure, rollback. */
+		while (flow_type)
+			priv_special_flow_disable(priv, --flow_type);
+		return ret;
+	}
+	return 0;
+}
+
+/**
+ * Disable all special flows in all hash RX queues.
+ *
+ * @param priv
+ *   Private structure.
+ */
+void
+priv_special_flow_disable_all(struct priv *priv)
+{
+	enum hash_rxq_flow_type flow_type;
+
+	for (flow_type = 0; flow_type != HASH_RXQ_FLOW_TYPE_MAC; ++flow_type)
+		priv_special_flow_disable(priv, flow_type);
+}
+
+/**
  * DPDK callback to enable promiscuous mode.
  *
  * @param dev
diff --git a/drivers/net/mlx5/mlx5_trigger.c b/drivers/net/mlx5/mlx5_trigger.c
index db7890f..b5ca7d4 100644
--- a/drivers/net/mlx5/mlx5_trigger.c
+++ b/drivers/net/mlx5/mlx5_trigger.c
@@ -80,10 +80,7 @@ mlx5_dev_start(struct rte_eth_dev *dev)
 		      " %s",
 		      (void *)priv, strerror(err));
 		/* Rollback. */
-		priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI);
-		priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST);
-		priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI);
-		priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC);
+		priv_special_flow_disable_all(priv);
 		priv_mac_addrs_disable(priv);
 		priv_destroy_hash_rxqs(priv);
 	}
@@ -113,10 +110,7 @@ mlx5_dev_stop(struct rte_eth_dev *dev)
 		return;
 	}
 	DEBUG("%p: cleaning up and destroying hash RX queues", (void *)dev);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_IPV6MULTI);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_BROADCAST);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_ALLMULTI);
-	priv_special_flow_disable(priv, HASH_RXQ_FLOW_TYPE_PROMISC);
+	priv_special_flow_disable_all(priv);
 	priv_mac_addrs_disable(priv);
 	priv_destroy_hash_rxqs(priv);
 	priv_fdir_disable(priv);
-- 
2.1.4

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

* [dpdk-dev] [PATCH v2 4/7] mlx5: remove redundant debugging message
  2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
                     ` (2 preceding siblings ...)
  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   ` 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
                     ` (3 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-03-03 14:27 UTC (permalink / raw)
  To: dev

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

diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index bcf4231..730527e 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -204,8 +204,6 @@ hash_rxq_special_flow_disable(struct hash_rxq *hash_rxq,
 {
 	if (hash_rxq->special_flow[flow_type] == NULL)
 		return;
-	DEBUG("%p: disabling special flow %s (%d)",
-	      (void *)hash_rxq, hash_rxq_flow_type_str(flow_type), flow_type);
 	claim_zero(ibv_exp_destroy_flow(hash_rxq->special_flow[flow_type]));
 	hash_rxq->special_flow[flow_type] = NULL;
 	DEBUG("%p: special flow %s (%d) disabled",
-- 
2.1.4

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

* [dpdk-dev] [PATCH v2 5/7] mlx5: apply VLAN filtering to broadcast and IPv6 multicast flows
  2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
                     ` (3 preceding siblings ...)
  2016-03-03 14:27   ` [dpdk-dev] [PATCH v2 4/7] mlx5: remove redundant debugging message Adrien Mazarguil
@ 2016-03-03 14:27   ` 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
                     ` (2 subsequent siblings)
  7 siblings, 0 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-03-03 14:27 UTC (permalink / raw)
  To: dev

Unlike promiscuous and allmulticast flows, those should remain
VLAN-specific.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 doc/guides/rel_notes/release_16_04.rst |   4 ++
 drivers/net/mlx5/mlx5_rxmode.c         | 105 +++++++++++++++++++++++++++++----
 drivers/net/mlx5/mlx5_rxq.c            |   5 +-
 drivers/net/mlx5/mlx5_rxtx.h           |   4 +-
 drivers/net/mlx5/mlx5_vlan.c           |   5 +-
 5 files changed, 106 insertions(+), 17 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index 73d0cfc..6e94bbe 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -159,6 +159,10 @@ Drivers
   Done to prevent port initialization on non-Ethernet link layers and
   to report an error.
 
+* **mlx5: Applied VLAN filtering to broadcast and IPv6 multicast flows.**
+
+  Prevented reception of multicast frames outside of configured VLANs.
+
 
 Libraries
 ~~~~~~~~~
diff --git a/drivers/net/mlx5/mlx5_rxmode.c b/drivers/net/mlx5/mlx5_rxmode.c
index 730527e..2bc005e 100644
--- a/drivers/net/mlx5/mlx5_rxmode.c
+++ b/drivers/net/mlx5/mlx5_rxmode.c
@@ -74,6 +74,7 @@ static const struct special_flow_init special_flow_init[] = {
 #endif /* HAVE_FLOW_SPEC_IPV6 */
 			1 << HASH_RXQ_ETH |
 			0,
+		.per_vlan = 0,
 	},
 	[HASH_RXQ_FLOW_TYPE_ALLMULTI] = {
 		.dst_mac_val = "\x01\x00\x00\x00\x00\x00",
@@ -87,6 +88,7 @@ static const struct special_flow_init special_flow_init[] = {
 #endif /* HAVE_FLOW_SPEC_IPV6 */
 			1 << HASH_RXQ_ETH |
 			0,
+		.per_vlan = 0,
 	},
 	[HASH_RXQ_FLOW_TYPE_BROADCAST] = {
 		.dst_mac_val = "\xff\xff\xff\xff\xff\xff",
@@ -100,6 +102,7 @@ static const struct special_flow_init special_flow_init[] = {
 #endif /* HAVE_FLOW_SPEC_IPV6 */
 			1 << HASH_RXQ_ETH |
 			0,
+		.per_vlan = 1,
 	},
 #ifdef HAVE_FLOW_SPEC_IPV6
 	[HASH_RXQ_FLOW_TYPE_IPV6MULTI] = {
@@ -110,24 +113,28 @@ static const struct special_flow_init special_flow_init[] = {
 			1 << HASH_RXQ_IPV6 |
 			1 << HASH_RXQ_ETH |
 			0,
+		.per_vlan = 1,
 	},
 #endif /* HAVE_FLOW_SPEC_IPV6 */
 };
 
 /**
- * Enable a special flow in a hash RX queue.
+ * Enable a special flow in a hash RX queue for a given VLAN index.
  *
  * @param hash_rxq
  *   Pointer to hash RX queue structure.
  * @param flow_type
  *   Special flow type.
+ * @param vlan_index
+ *   VLAN index to use.
  *
  * @return
  *   0 on success, errno value on failure.
  */
 static int
-hash_rxq_special_flow_enable(struct hash_rxq *hash_rxq,
-			     enum hash_rxq_flow_type flow_type)
+hash_rxq_special_flow_enable_vlan(struct hash_rxq *hash_rxq,
+				  enum hash_rxq_flow_type flow_type,
+				  unsigned int vlan_index)
 {
 	struct priv *priv = hash_rxq->priv;
 	struct ibv_exp_flow *flow;
@@ -136,12 +143,15 @@ hash_rxq_special_flow_enable(struct hash_rxq *hash_rxq,
 	struct ibv_exp_flow_spec_eth *spec = &data->spec;
 	const uint8_t *mac;
 	const uint8_t *mask;
+	unsigned int vlan_enabled = (priv->vlan_filter_n &&
+				     special_flow_init[flow_type].per_vlan);
+	unsigned int vlan_id = priv->vlan_filter[vlan_index];
 
 	/* Check if flow is relevant for this hash_rxq. */
 	if (!(special_flow_init[flow_type].hash_types & (1 << hash_rxq->type)))
 		return 0;
 	/* Check if flow already exists. */
-	if (hash_rxq->special_flow[flow_type] != NULL)
+	if (hash_rxq->special_flow[flow_type][vlan_index] != NULL)
 		return 0;
 
 	/*
@@ -164,12 +174,14 @@ hash_rxq_special_flow_enable(struct hash_rxq *hash_rxq,
 				mac[0], mac[1], mac[2],
 				mac[3], mac[4], mac[5],
 			},
+			.vlan_tag = (vlan_enabled ? htons(vlan_id) : 0),
 		},
 		.mask = {
 			.dst_mac = {
 				mask[0], mask[1], mask[2],
 				mask[3], mask[4], mask[5],
 			},
+			.vlan_tag = (vlan_enabled ? htons(0xfff) : 0),
 		},
 	};
 
@@ -184,9 +196,77 @@ hash_rxq_special_flow_enable(struct hash_rxq *hash_rxq,
 			return errno;
 		return EINVAL;
 	}
-	hash_rxq->special_flow[flow_type] = flow;
-	DEBUG("%p: enabling special flow %s (%d)",
-	      (void *)hash_rxq, hash_rxq_flow_type_str(flow_type), flow_type);
+	hash_rxq->special_flow[flow_type][vlan_index] = flow;
+	DEBUG("%p: special flow %s (index %d) VLAN %u (index %u) enabled",
+	      (void *)hash_rxq, hash_rxq_flow_type_str(flow_type), flow_type,
+	      vlan_id, vlan_index);
+	return 0;
+}
+
+/**
+ * Disable a special flow in a hash RX queue for a given VLAN index.
+ *
+ * @param hash_rxq
+ *   Pointer to hash RX queue structure.
+ * @param flow_type
+ *   Special flow type.
+ * @param vlan_index
+ *   VLAN index to use.
+ */
+static void
+hash_rxq_special_flow_disable_vlan(struct hash_rxq *hash_rxq,
+				   enum hash_rxq_flow_type flow_type,
+				   unsigned int vlan_index)
+{
+	struct ibv_exp_flow *flow =
+		hash_rxq->special_flow[flow_type][vlan_index];
+
+	if (flow == NULL)
+		return;
+	claim_zero(ibv_exp_destroy_flow(flow));
+	hash_rxq->special_flow[flow_type][vlan_index] = NULL;
+	DEBUG("%p: special flow %s (index %d) VLAN %u (index %u) disabled",
+	      (void *)hash_rxq, hash_rxq_flow_type_str(flow_type), flow_type,
+	      hash_rxq->priv->vlan_filter[vlan_index], vlan_index);
+}
+
+/**
+ * Enable a special flow in a hash RX queue.
+ *
+ * @param hash_rxq
+ *   Pointer to hash RX queue structure.
+ * @param flow_type
+ *   Special flow type.
+ * @param vlan_index
+ *   VLAN index to use.
+ *
+ * @return
+ *   0 on success, errno value on failure.
+ */
+static int
+hash_rxq_special_flow_enable(struct hash_rxq *hash_rxq,
+			     enum hash_rxq_flow_type flow_type)
+{
+	struct priv *priv = hash_rxq->priv;
+	unsigned int i = 0;
+	int ret;
+
+	assert((unsigned int)flow_type < RTE_DIM(hash_rxq->special_flow));
+	assert(RTE_DIM(hash_rxq->special_flow[flow_type]) ==
+	       RTE_DIM(priv->vlan_filter));
+	/* Add a special flow for each VLAN filter when relevant. */
+	do {
+		ret = hash_rxq_special_flow_enable_vlan(hash_rxq, flow_type, i);
+		if (ret) {
+			/* Failure, rollback. */
+			while (i != 0)
+				hash_rxq_special_flow_disable_vlan(hash_rxq,
+								   flow_type,
+								   --i);
+			return ret;
+		}
+	} while (special_flow_init[flow_type].per_vlan &&
+		 ++i < priv->vlan_filter_n);
 	return 0;
 }
 
@@ -202,12 +282,11 @@ static void
 hash_rxq_special_flow_disable(struct hash_rxq *hash_rxq,
 			      enum hash_rxq_flow_type flow_type)
 {
-	if (hash_rxq->special_flow[flow_type] == NULL)
-		return;
-	claim_zero(ibv_exp_destroy_flow(hash_rxq->special_flow[flow_type]));
-	hash_rxq->special_flow[flow_type] = NULL;
-	DEBUG("%p: special flow %s (%d) disabled",
-	      (void *)hash_rxq, hash_rxq_flow_type_str(flow_type), flow_type);
+	unsigned int i;
+
+	assert((unsigned int)flow_type < RTE_DIM(hash_rxq->special_flow));
+	for (i = 0; (i != RTE_DIM(hash_rxq->special_flow[flow_type])); ++i)
+		hash_rxq_special_flow_disable_vlan(hash_rxq, flow_type, i);
 }
 
 /**
diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c
index 0f5ac65..df6fd92 100644
--- a/drivers/net/mlx5/mlx5_rxq.c
+++ b/drivers/net/mlx5/mlx5_rxq.c
@@ -541,7 +541,10 @@ priv_destroy_hash_rxqs(struct priv *priv)
 		assert(hash_rxq->qp != NULL);
 		/* Also check that there are no remaining flows. */
 		for (j = 0; (j != RTE_DIM(hash_rxq->special_flow)); ++j)
-			assert(hash_rxq->special_flow[j] == NULL);
+			for (k = 0;
+			     (k != RTE_DIM(hash_rxq->special_flow[j]));
+			     ++k)
+				assert(hash_rxq->special_flow[j][k] == NULL);
 		for (j = 0; (j != RTE_DIM(hash_rxq->mac_flow)); ++j)
 			for (k = 0; (k != RTE_DIM(hash_rxq->mac_flow[j])); ++k)
 				assert(hash_rxq->mac_flow[j][k] == NULL);
diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index e85cf93..6ac1a5a 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -195,6 +195,7 @@ struct special_flow_init {
 	uint8_t dst_mac_val[6];
 	uint8_t dst_mac_mask[6];
 	unsigned int hash_types;
+	unsigned int per_vlan:1;
 };
 
 enum hash_rxq_flow_type {
@@ -231,7 +232,8 @@ struct hash_rxq {
 	enum hash_rxq_type type; /* Hash RX queue type. */
 	/* MAC flow steering rules, one per VLAN ID. */
 	struct ibv_exp_flow *mac_flow[MLX5_MAX_MAC_ADDRESSES][MLX5_MAX_VLAN_IDS];
-	struct ibv_exp_flow *special_flow[MLX5_MAX_SPECIAL_FLOWS];
+	struct ibv_exp_flow *special_flow
+		[MLX5_MAX_SPECIAL_FLOWS][MLX5_MAX_VLAN_IDS];
 };
 
 /* TX element. */
diff --git a/drivers/net/mlx5/mlx5_vlan.c b/drivers/net/mlx5/mlx5_vlan.c
index fa9e3b8..ea7af1e 100644
--- a/drivers/net/mlx5/mlx5_vlan.c
+++ b/drivers/net/mlx5/mlx5_vlan.c
@@ -98,9 +98,10 @@ vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on)
 		priv->vlan_filter[priv->vlan_filter_n] = vlan_id;
 		++priv->vlan_filter_n;
 	}
-	/* Rehash MAC flows in all hash RX queues. */
+	/* Rehash flows in all hash RX queues. */
 	priv_mac_addrs_disable(priv);
-	return priv_mac_addrs_enable(priv);
+	priv_special_flow_disable_all(priv);
+	return priv_rehash_flows(priv);
 }
 
 /**
-- 
2.1.4

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

* [dpdk-dev] [PATCH v2 6/7] mlx5: fix RX checksum offload in non L3/L4 packets
  2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
                     ` (4 preceding siblings ...)
  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   ` Adrien Mazarguil
  2016-03-03 14:27   ` [dpdk-dev] [PATCH v2 7/7] mlx4: make sure that number of RX queues is a power of 2 Adrien Mazarguil
  2016-03-10 22:15   ` [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5 Bruce Richardson
  7 siblings, 0 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-03-03 14:27 UTC (permalink / raw)
  To: dev

From: Yaacov Hazan <yaacovh@mellanox.com>

Change rxq_cq_to_ol_flags() to set checksum flags according to packet type,
so for non L3/L4 packets the mbuf chksum_bad flags will not be set.

Fixes: 67fa62bc672d ("mlx5: support checksum offload")

Signed-off-by: Yaacov Hazan <yaacovh@mellanox.com>
---
 doc/guides/rel_notes/release_16_04.rst |  4 ++++
 drivers/net/mlx5/Makefile              |  5 +++++
 drivers/net/mlx5/mlx5_rxtx.c           | 26 ++++++++++++++++++--------
 3 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst
index 6e94bbe..8669515 100644
--- a/doc/guides/rel_notes/release_16_04.rst
+++ b/doc/guides/rel_notes/release_16_04.rst
@@ -163,6 +163,10 @@ Drivers
 
   Prevented reception of multicast frames outside of configured VLANs.
 
+* **mlx5: Fixed RX checksum offload in non L3/L4 packets.**
+
+  Fixed report of bad checksum for packets of unknown type.
+
 
 Libraries
 ~~~~~~~~~
diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
index 39cdf2c..7076ae3 100644
--- a/drivers/net/mlx5/Makefile
+++ b/drivers/net/mlx5/Makefile
@@ -132,6 +132,11 @@ mlx5_autoconf.h: $(RTE_SDK)/scripts/auto-config-h.sh
 		infiniband/verbs.h \
 		enum IBV_EXP_DEVICE_ATTR_VLAN_OFFLOADS \
 		$(AUTOCONF_OUTPUT)
+	$Q sh -- '$<' '$@' \
+		HAVE_EXP_CQ_RX_TCP_PACKET \
+		infiniband/verbs.h \
+		enum IBV_EXP_CQ_RX_TCP_PACKET \
+		$(AUTOCONF_OUTPUT)
 
 $(SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD):.c=.o): mlx5_autoconf.h
 
diff --git a/drivers/net/mlx5/mlx5_rxtx.c b/drivers/net/mlx5/mlx5_rxtx.c
index 4c53c7a..4919189 100644
--- a/drivers/net/mlx5/mlx5_rxtx.c
+++ b/drivers/net/mlx5/mlx5_rxtx.c
@@ -719,14 +719,24 @@ rxq_cq_to_ol_flags(const struct rxq *rxq, uint32_t flags)
 {
 	uint32_t ol_flags = 0;
 
-	if (rxq->csum)
-		ol_flags |=
-			TRANSPOSE(~flags,
-				  IBV_EXP_CQ_RX_IP_CSUM_OK,
-				  PKT_RX_IP_CKSUM_BAD) |
-			TRANSPOSE(~flags,
-				  IBV_EXP_CQ_RX_TCP_UDP_CSUM_OK,
-				  PKT_RX_L4_CKSUM_BAD);
+	if (rxq->csum) {
+		/* Set IP checksum flag only for IPv4/IPv6 packets. */
+		if (flags &
+		    (IBV_EXP_CQ_RX_IPV4_PACKET | IBV_EXP_CQ_RX_IPV6_PACKET))
+			ol_flags |=
+				TRANSPOSE(~flags,
+					IBV_EXP_CQ_RX_IP_CSUM_OK,
+					PKT_RX_IP_CKSUM_BAD);
+#ifdef HAVE_EXP_CQ_RX_TCP_PACKET
+		/* Set L4 checksum flag only for TCP/UDP packets. */
+		if (flags &
+		    (IBV_EXP_CQ_RX_TCP_PACKET | IBV_EXP_CQ_RX_UDP_PACKET))
+#endif /* HAVE_EXP_CQ_RX_TCP_PACKET */
+			ol_flags |=
+				TRANSPOSE(~flags,
+					IBV_EXP_CQ_RX_TCP_UDP_CSUM_OK,
+					PKT_RX_L4_CKSUM_BAD);
+	}
 	/*
 	 * PKT_RX_IP_CKSUM_BAD and PKT_RX_L4_CKSUM_BAD are used in place
 	 * of PKT_RX_EIP_CKSUM_BAD because the latter is not functional
-- 
2.1.4

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

* [dpdk-dev] [PATCH v2 7/7] mlx4: make sure that number of RX queues is a power of 2
  2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
                     ` (5 preceding siblings ...)
  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
  2016-03-10 22:15   ` [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5 Bruce Richardson
  7 siblings, 0 replies; 17+ messages in thread
From: Adrien Mazarguil @ 2016-03-03 14:27 UTC (permalink / raw)
  To: dev

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

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

* Re: [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5
  2016-03-03 14:27 ` [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5 Adrien Mazarguil
                     ` (6 preceding siblings ...)
  2016-03-03 14:27   ` [dpdk-dev] [PATCH v2 7/7] mlx4: make sure that number of RX queues is a power of 2 Adrien Mazarguil
@ 2016-03-10 22:15   ` Bruce Richardson
  7 siblings, 0 replies; 17+ messages in thread
From: Bruce Richardson @ 2016-03-10 22:15 UTC (permalink / raw)
  To: Adrien Mazarguil; +Cc: dev

On Thu, Mar 03, 2016 at 03:27:33PM +0100, Adrien Mazarguil wrote:
> This patchset addresses several minor issues, release notes are updated
> accordingly.
> 
> Note: should be applied after "Performance optimizations for mlx5 and mlx4".
> 
> Changes in v2:
> - None, submitted again due to dependency with previous patchset.
> 
> Adrien Mazarguil (3):
>   mlx5: manage all special flow types at once
>   mlx5: remove redundant debugging message
>   mlx5: apply VLAN filtering to broadcast and IPv6 multicast flows
> 
> Or Ami (2):
>   mlx5: fix possible crash during initialization
>   mlx5: check if port is configured as Ethernet device
> 
> Robin Jarry (1):
>   mlx4: make sure that number of RX queues is a power of 2
> 
> Yaacov Hazan (1):
>   mlx5: fix RX checksum offload in non L3/L4 packets
> 
Applied to dpdk-next-net/rel_16_04

/Bruce

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

end of thread, other threads:[~2016-03-10 22:15 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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   ` [dpdk-dev] [PATCH v2 7/7] mlx4: make sure that number of RX queues is a power of 2 Adrien Mazarguil
2016-03-10 22:15   ` [dpdk-dev] [PATCH v2 0/7] Assorted fixes for mlx4 and mlx5 Bruce Richardson

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