[dpdk-dev] [PATCH v2 13/15] net/mlx5: setup RSS flow regardless of queue count

Xueming Li xuemingl at mellanox.com
Tue Apr 10 15:34:13 CEST 2018


In some environments it is desirable to have the NIC perform RSS
normally on the packet regardless of the number of queues configured.
The RSS hash result that is stored in the mbuf can then be used by
the application to make decisions about how to distribute workloads
to threads, secondary processes, or even virtual machines if the
application is a virtual switch.

Signed-off-by: Xueming Li <xuemingl at mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 71 +++++++++++++++++++-------------------------
 1 file changed, 30 insertions(+), 41 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 5784f2ee0..9efe00086 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -1252,48 +1252,37 @@ mlx5_flow_convert_rss(struct rte_eth_dev *dev, struct mlx5_flow_parse *parser)
 			parser->queue[i].ibv_attr = NULL;
 		}
 	}
-	if (parser->rss_conf.types) {
-		/* Remove impossible flow according to the RSS configuration. */
-		for (i = hmin; i != (hmax + 1); ++i) {
-			if (!parser->queue[i].ibv_attr)
-				continue;
-			if (parser->rss_conf.types &
-			    hash_rxq_init[i].dpdk_rss_hf) {
-				parser->queue[i].hash_fields =
-					hash_rxq_init[i].hash_fields;
-				found = 1;
-				continue;
-			}
-			/* L4 flow could be used for L3 RSS. */
-			if (i == parser->layer && i < ip &&
-			    (hash_rxq_init[ip].dpdk_rss_hf &
-			     parser->rss_conf.types)) {
-				parser->queue[i].hash_fields =
-					hash_rxq_init[ip].hash_fields;
-				found = 1;
-				continue;
-			}
-			/* L3 flow and L4 hash: non-rss L3 flow. */
-			if (i == parser->layer && i == ip && found)
-				/* IP pattern and L4 HF. */
-				continue;
-			rte_free(parser->queue[i].ibv_attr);
-			parser->queue[i].ibv_attr = NULL;
+	/* Remove impossible flow according to the RSS configuration. */
+	for (i = hmin; i != (hmax + 1); ++i) {
+		if (!parser->queue[i].ibv_attr)
+			continue;
+		if (parser->rss_conf.types &
+		    hash_rxq_init[i].dpdk_rss_hf) {
+			parser->queue[i].hash_fields =
+				hash_rxq_init[i].hash_fields;
+			found = 1;
+			continue;
 		}
-		if (!found)
-			DRV_LOG(WARNING,
-				"port %u rss hash function doesn't match "
-				"pattern", dev->data->port_id);
-	} else {
-		/* Remove any other flow. */
-		for (i = hmin; i != (hmax + 1); ++i) {
-			if (i == parser->layer || !parser->queue[i].ibv_attr)
-				continue;
-			rte_free(parser->queue[i].ibv_attr);
-			parser->queue[i].ibv_attr = NULL;
+		/* L4 flow could be used for L3 RSS. */
+		if (i == parser->layer && i < ip &&
+		    (hash_rxq_init[ip].dpdk_rss_hf &
+		     parser->rss_conf.types)) {
+			parser->queue[i].hash_fields =
+				hash_rxq_init[ip].hash_fields;
+			found = 1;
+			continue;
 		}
-		parser->rss_conf.queue_num = 1;
+		/* L3 flow and L4 hash: non-rss L3 flow. */
+		if (i == parser->layer && i == ip && found)
+			/* IP pattern and L4 HF. */
+			continue;
+		rte_free(parser->queue[i].ibv_attr);
+		parser->queue[i].ibv_attr = NULL;
 	}
+	if (!found)
+		DRV_LOG(WARNING,
+			"port %u rss hash function doesn't match "
+			"pattern", dev->data->port_id);
 	return 0;
 }
 
@@ -2326,8 +2315,8 @@ mlx5_flow_dump(struct rte_eth_dev *dev __rte_unused,
 		(void *)flow->frxq[i].hrxq->ind_table,
 		flow->frxq[i].hash_fields |
 		(flow->tunnel &&
-		 flow->rss_conf.rss_level ? (uint32_t)IBV_RX_HASH_INNER : 0),
-		flow->queues_n,
+		 flow->rss_conf.level ? (uint32_t)IBV_RX_HASH_INNER : 0),
+		flow->rss_conf.queue_num,
 		flow->frxq[i].ibv_attr->num_of_specs,
 		flow->frxq[i].ibv_attr->size,
 		flow->frxq[i].ibv_attr->priority,
-- 
2.13.3



More information about the dev mailing list