[dpdk-dev] [PATCH v1 60/72] net/mlx5/linux: wrap adjust flow priority with OS calls

Ophir Munk ophirmu at nvidia.com
Wed Oct 28 00:23:23 CET 2020


mlx5_flow_adjust_priority() is used to adjust priorities according to
priorities levels. It is Verbs based and it is called from shared code
(mlx5_flow_dv.c). Therefore, wrap it in an OS API.

Signed-off-by: Ophir Munk <ophirmu at nvidia.com>
---
 drivers/net/mlx5/linux/mlx5_flow_os.h | 20 ++++++++++++++++++++
 drivers/net/mlx5/mlx5_flow_dv.c       |  5 +++--
 2 files changed, 23 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx5/linux/mlx5_flow_os.h b/drivers/net/mlx5/linux/mlx5_flow_os.h
index a6bd2c0..c7003a1 100644
--- a/drivers/net/mlx5/linux/mlx5_flow_os.h
+++ b/drivers/net/mlx5/linux/mlx5_flow_os.h
@@ -365,4 +365,24 @@ mlx5_flow_os_destroy_flow_action(void *action)
 	return mlx5_glue->destroy_flow_action(action);
 }
 
+/**
+ * OS wrapper over Verbs API.
+ * Adjust flow priority based on the highest layer and the request priority.
+ *
+ * @param[in] dev
+ *    Pointer to the Ethernet device structure.
+ * @param[in] priority
+ *    The rule base priority.
+ * @param[in] subpriority
+ *    The priority based on the items.
+ *
+ * @return
+ *    The new priority.
+ */
+static inline uint32_t
+mlx5_os_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
+			  uint32_t subpriority)
+{
+	return mlx5_flow_adjust_priority(dev, priority, subpriority);
+}
 #endif /* RTE_PMD_MLX5_FLOW_OS_H_ */
diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c
index 2560559..18ab409 100644
--- a/drivers/net/mlx5/mlx5_flow_dv.c
+++ b/drivers/net/mlx5/mlx5_flow_dv.c
@@ -10172,8 +10172,9 @@ __flow_dv_translate(struct rte_eth_dev *dev,
 	/* Register matcher. */
 	matcher.crc = rte_raw_cksum((const void *)matcher.mask.buf,
 				    matcher.mask.size);
-	matcher.priority = mlx5_flow_adjust_priority(dev, priority,
-						     matcher.priority);
+	matcher.priority = mlx5_os_flow_adjust_priority(dev,
+							priority,
+							matcher.priority);
 	/* reserved field no needs to be set to 0 here. */
 	tbl_key.domain = attr->transfer;
 	tbl_key.direction = attr->egress;
-- 
2.8.4



More information about the dev mailing list