[v1,1/2] common/mlx5: support device global syntax

Message ID 20210108151500.30308-2-xuemingl@nvidia.com (mailing list archive)
State Superseded, archived
Delegated to: Raslan Darawsheh
Headers
Series [v1,1/2] common/mlx5: support device global syntax |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Performance-Testing fail build patch failure

Commit Message

Xueming Li Jan. 8, 2021, 3:14 p.m. UTC
  This patch support new device global syntax:
bus=<bus>,k=v,,,/class=<cls>,k=v,,,/driver=<pmd>,k=v,,,,

To reuse class name of global 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@nvidia.com>
---
 drivers/common/mlx5/mlx5_common_pci.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/common/mlx5/mlx5_common_pci.c b/drivers/common/mlx5/mlx5_common_pci.c
index 5208972bb6..b1eda7b3c8 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)
+		/* support new global syntax */
+		return class_name_to_value(devargs->cls->name);
 	kvlist = rte_kvargs_parse(devargs->args, NULL);
 	if (kvlist == NULL)
 		return 0;