[dpdk-dev] [PATCH v2 1/2] common/mlx5: support device global syntax

Xueming Li xuemingl at nvidia.com
Mon Jan 18 16:26:46 CET 2021


This patch supports new device global device syntax, resolve class type
from "class" section if the devarg is global device syntax:
bus=<bus>,k=v,,,/class=<cls>,k=v,,,/driver=<pmd>,k=v,,,,

To reuse class name of global device syntax, this patch also changes
internal class name introduced by commit [1] to algin with RTE class
name.

[1]
8a41f4deccc3: common/mlx5: introduce layer for multiple class drivers

Signed-off-by: Xueming Li <xuemingl at nvidia.com>
---
 drivers/common/mlx5/mlx5_common_pci.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index 5208972bb6..c03bdbf4eb 100644
--- a/drivers/common/mlx5/mlx5_common_pci.c
+++ b/drivers/common/mlx5/mlx5_common_pci.c
@@ -4,6 +4,7 @@
 
 #include <stdlib.h>
 #include <rte_malloc.h>
+#include <rte_class.h>
 #include "mlx5_common_utils.h"
 #include "mlx5_common_pci.h"
 
@@ -26,7 +27,7 @@ static const struct {
 	unsigned int driver_class;
 } mlx5_classes[] = {
 	{ .name = "vdpa", .driver_class = MLX5_CLASS_VDPA },
-	{ .name = "net", .driver_class = MLX5_CLASS_NET },
+	{ .name = "eth", .driver_class = MLX5_CLASS_NET },
 	{ .name = "regex", .driver_class = MLX5_CLASS_REGEX },
 };
 
@@ -115,6 +116,9 @@ parse_class_options(const struct rte_devargs *devargs)
 
 	if (devargs == NULL)
 		return 0;
+	if (devargs->cls != NULL)
+		/* support new global syntax */
+		return class_name_to_value(devargs->cls->name);
 	kvlist = rte_kvargs_parse(devargs->args, NULL);
 	if (kvlist == NULL)
 		return 0;
-- 
2.25.1



More information about the dev mailing list