Add common devargs key definition for "bus", "class" and "driver".
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
int mlx5_get_ifname_sysfs(const char *ibdev_path, char *ifname);
-#define MLX5_CLASS_ARG_NAME "class"
-
enum mlx5_class {
MLX5_CLASS_INVALID,
MLX5_CLASS_NET = RTE_BIT64(0),
static int
parse_class_options(const struct rte_devargs *devargs)
{
- const char *key = MLX5_CLASS_ARG_NAME;
+ const char *key = RTE_DEVARGS_KEY_CLASS;
struct rte_kvargs *kvlist;
int ret = 0;
sfc_efx_dev_class_get(struct rte_devargs *devargs)
{
struct rte_kvargs *kvargs;
- const char *key = SFC_EFX_KVARG_DEV_CLASS;
enum sfc_efx_dev_class dev_class = SFC_EFX_DEV_CLASS_NET;
if (devargs == NULL)
if (kvargs == NULL)
return dev_class;
- if (rte_kvargs_count(kvargs, key) != 0) {
- rte_kvargs_process(kvargs, key, sfc_efx_kvarg_dev_class_handler,
- &dev_class);
+ if (rte_kvargs_count(kvargs, RTE_DEVARGS_KEY_CLASS) != 0) {
+ rte_kvargs_process(kvargs, RTE_DEVARGS_KEY_CLASS,
+ sfc_efx_kvarg_dev_class_handler, &dev_class);
}
rte_kvargs_free(kvargs);
extern "C" {
#endif
-#define SFC_EFX_KVARG_DEV_CLASS "class"
-
enum sfc_efx_dev_class {
SFC_EFX_DEV_CLASS_INVALID = 0,
SFC_EFX_DEV_CLASS_NET,
PMD_BOND_SOCKET_ID_KVARG,
PMD_BOND_MAC_ADDR_KVARG,
PMD_BOND_AGG_MODE_KVARG,
- "driver",
+ RTE_DEVARGS_KEY_DRIVER,
NULL
};
i40evf_driver_selected(struct rte_devargs *devargs)
{
struct rte_kvargs *kvlist;
- const char *key = "driver";
int ret = 0;
if (devargs == NULL)
if (kvlist == NULL)
return 0;
- if (!rte_kvargs_count(kvlist, key))
+ if (!rte_kvargs_count(kvlist, RTE_DEVARGS_KEY_DRIVER))
goto exit;
/* i40evf driver selected when there's a key-value pair:
* driver=i40evf
*/
- if (rte_kvargs_process(kvlist, key,
+ if (rte_kvargs_process(kvlist, RTE_DEVARGS_KEY_DRIVER,
i40evf_check_driver_handler, NULL) < 0)
goto exit;
iavf_drv_i40evf_selected(struct rte_devargs *devargs, uint16_t device_id)
{
struct rte_kvargs *kvlist;
- const char *key = "driver";
int ret = 0;
if (device_id != IAVF_DEV_ID_VF &&
if (kvlist == NULL)
return 0;
- if (!rte_kvargs_count(kvlist, key))
+ if (!rte_kvargs_count(kvlist, RTE_DEVARGS_KEY_DRIVER))
goto exit;
/* i40evf driver selected when there's a key-value pair:
* driver=i40evf
*/
- if (rte_kvargs_process(kvlist, key,
+ if (rte_kvargs_process(kvlist, RTE_DEVARGS_KEY_DRIVER,
iavf_drv_i40evf_check_handler, NULL) < 0)
goto exit;
config->max_dump_files_num = tmp;
} else if (strcmp(MLX5_LRO_TIMEOUT_USEC, key) == 0) {
config->lro.timeout = tmp;
- } else if (strcmp(MLX5_CLASS_ARG_NAME, key) == 0) {
+ } else if (strcmp(RTE_DEVARGS_KEY_CLASS, key) == 0) {
DRV_LOG(DEBUG, "class argument is %s.", val);
} else if (strcmp(MLX5_HP_BUF_SIZE, key) == 0) {
config->log_hp_size = tmp;
MLX5_REPRESENTOR,
MLX5_MAX_DUMP_FILES_NUM,
MLX5_LRO_TIMEOUT_USEC,
- MLX5_CLASS_ARG_NAME,
+ RTE_DEVARGS_KEY_CLASS,
MLX5_HP_BUF_SIZE,
MLX5_RECLAIM_MEM,
MLX5_SYS_MEM_EN,
SFC_KVARG_TX_DATAPATH,
SFC_KVARG_FW_VARIANT,
SFC_KVARG_RXD_WAIT_TIMEOUT_NS,
- SFC_EFX_KVARG_DEV_CLASS,
+ RTE_DEVARGS_KEY_CLASS,
NULL,
};
unsigned long tmp;
int n_cores = sysconf(_SC_NPROCESSORS_ONLN);
- if (strcmp(key, "class") == 0)
+ if (strcmp(key, RTE_DEVARGS_KEY_CLASS) == 0)
return 0;
errno = 0;
tmp = strtoul(val, NULL, 0);
const char *str;
struct rte_kvargs *kvlist;
} layers[] = {
- { "bus=", NULL, NULL, },
- { "class=", NULL, NULL, },
- { "driver=", NULL, NULL, },
+ { RTE_DEVARGS_KEY_BUS "=", NULL, NULL, },
+ { RTE_DEVARGS_KEY_CLASS "=", NULL, NULL, },
+ { RTE_DEVARGS_KEY_DRIVER "=", NULL, NULL, },
};
struct rte_kvargs_pair *kv = NULL;
struct rte_class *cls = NULL;
if (layers[i].kvlist == NULL)
continue;
kv = &layers[i].kvlist->pairs[0];
- if (strcmp(kv->key, "bus") == 0) {
+ if (strcmp(kv->key, RTE_DEVARGS_KEY_BUS) == 0) {
bus = rte_bus_find_by_name(kv->value);
if (bus == NULL) {
RTE_LOG(ERR, EAL, "Could not find bus \"%s\"\n",
ret = -EFAULT;
goto get_out;
}
- } else if (strcmp(kv->key, "class") == 0) {
+ } else if (strcmp(kv->key, RTE_DEVARGS_KEY_CLASS) == 0) {
cls = rte_class_find_by_name(kv->value);
if (cls == NULL) {
RTE_LOG(ERR, EAL, "Could not find class \"%s\"\n",
ret = -EFAULT;
goto get_out;
}
- } else if (strcmp(kv->key, "driver") == 0) {
+ } else if (strcmp(kv->key, RTE_DEVARGS_KEY_DRIVER) == 0) {
/* Ignore */
continue;
}
#include <rte_compat.h>
#include <rte_bus.h>
+/**
+ * Bus type key in global devargs syntax.
+ *
+ * Legacy devargs parser doesn't use this key as bus type
+ * is resolved as first optional value separated by ":".
+ */
+#define RTE_DEVARGS_KEY_BUS "bus"
+
+/**
+ * Class type key in global devargs syntax.
+ *
+ * Legacy devargs parser doesn't parse class type. PMD driver is
+ * encouraged to use this key to resolve class type.
+ */
+#define RTE_DEVARGS_KEY_CLASS "class"
+
+/**
+ * Driver type key in global devargs syntax.
+ *
+ * Legacy devargs parser doesn't parse driver type. PMD driver is
+ * encouraged to use this key to resolve driver type.
+ */
+#define RTE_DEVARGS_KEY_DRIVER "driver"
+
/**
* Type of generic device
*/