[v1,2/3] devargs: make bus key parsing optional
Checks
Commit Message
Global devargs syntax is used as device iteration filter like
"class=vdpa", a devargs without bus args is valid from parsing
perspective.
This patch makes bus args optional.
Fixes: d2a66ad79480 ("bus: add device arguments name parsing")
Cc: stable@dpdk.org
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
---
drivers/bus/pci/pci_params.c | 8 +++-----
lib/eal/common/eal_common_devargs.c | 2 +-
2 files changed, 4 insertions(+), 6 deletions(-)
Comments
On Tue, Oct 5, 2021, at 17:54, Xueming Li wrote:
> Global devargs syntax is used as device iteration filter like
> "class=vdpa", a devargs without bus args is valid from parsing
> perspective.
>
> This patch makes bus args optional.
>
> Fixes: d2a66ad79480 ("bus: add device arguments name parsing")
> Cc: stable@dpdk.org
I agree with the change, but I'm not sure it should go into stable.
The question goes further than that: is there a spec describing the valid
syntax to users, that would allow to say the current parsing is buggy?
I haven't found it in the doc.
If there is a change such as this one, it should also be notified in the release notes.
This is user-facing.
So, not saying you should do it and not part of this patch, but a doc might help
in doc/guides/howto maybe. The general grammar of a devargs could be formally
described (in BNF?).
Each layers should document their supported keys as well. Not sure it would be better
gathered in a single file or within each driver.
Now that the global syntax has been enabled for users, it should be documented.
>
> Signed-off-by: Xueming Li <xuemingl@nvidia.com>
For this patch and beside the stable considerations,
Reviewed-by: Gaetan Rivet <grive@u256.net>
@@ -85,11 +85,10 @@ rte_pci_devargs_parse(struct rte_devargs *da)
struct rte_kvargs *kvargs;
const char *addr_str;
struct rte_pci_addr addr;
- int ret;
+ int ret = 0;
- if (da == NULL)
+ if (da == NULL || da->bus_str == NULL)
return 0;
- RTE_ASSERT(da->bus_str != NULL);
kvargs = rte_kvargs_parse(da->bus_str, NULL);
if (kvargs == NULL) {
@@ -101,9 +100,8 @@ rte_pci_devargs_parse(struct rte_devargs *da)
addr_str = rte_kvargs_get(kvargs, pci_params_keys[RTE_PCI_PARAM_ADDR]);
if (addr_str == NULL) {
- RTE_LOG(ERR, EAL, "No PCI address specified using '%s=<id>' in: %s\n",
+ RTE_LOG(DEBUG, EAL, "No PCI address specified using '%s=<id>' in: %s\n",
pci_params_keys[RTE_PCI_PARAM_ADDR], da->bus_str);
- ret = -ENODEV;
goto out;
}
@@ -39,7 +39,7 @@ devargs_bus_parse_default(struct rte_devargs *devargs,
/* Parse devargs name from bus key-value list. */
name = rte_kvargs_get(bus_args, "name");
if (name == NULL) {
- RTE_LOG(INFO, EAL, "devargs name not found: %s\n",
+ RTE_LOG(DEBUG, EAL, "devargs name not found: %s\n",
devargs->data);
return 0;
}