vdev_dev_match(const struct rte_device *dev,
const void *_kvlist)
{
- int ret;
const struct rte_kvargs *kvlist = _kvlist;
- char *name;
+ const char *key = vdev_params_keys[RTE_VDEV_PARAM_NAME];
+ const char *name;
- /* cannot pass const dev->name to rte_kvargs_process() */
- name = strdup(dev->name);
- if (name == NULL)
- return -1;
- ret = rte_kvargs_process(kvlist,
- vdev_params_keys[RTE_VDEV_PARAM_NAME],
- rte_kvargs_strcmp, name);
- free(name);
- if (ret != 0)
+ /* no kvlist arg, all devices match */
+ if (kvlist == NULL)
+ return 0;
+
+ /* if key is present in kvlist and does not match, filter device */
+ name = rte_kvargs_get(kvlist, key);
+ if (name != NULL && strcmp(name, dev->name))
return -1;
return 0;