devargs: parse global device syntax
When parsing a devargs, try to parse using the global device syntax first. Fallback on legacy syntax on error. Example of new global device syntax: -a bus=pci,addr=82:00.0/class=eth/driver=mlx5,dv_flow_en=1 Signed-off-by: Xueming Li <xuemingl@nvidia.com> Reviewed-by: Gaetan Rivet <grive@u256.net>
This commit is contained in:
parent
d2a66ad794
commit
b344eb5d94
@ -55,6 +55,13 @@ New Features
|
||||
Also, make sure to start the actual text at the margin.
|
||||
=======================================================
|
||||
|
||||
* **Enabled new devargs parser.**
|
||||
|
||||
* Enabled devargs syntax
|
||||
``bus=X,paramX=x/class=Y,paramY=y/driver=Z,paramZ=z``
|
||||
* Added bus-level parsing of the devargs syntax.
|
||||
* Kept compatibility with the legacy syntax as parsing fallback.
|
||||
|
||||
|
||||
Removed Items
|
||||
-------------
|
||||
|
@ -125,7 +125,6 @@ rte_devargs_layers_parse(struct rte_devargs *devargs,
|
||||
layers[i].str = s;
|
||||
layers[i].kvlist = rte_kvargs_parse_delim(s, NULL, "/");
|
||||
if (layers[i].kvlist == NULL) {
|
||||
RTE_LOG(ERR, EAL, "Could not parse %s\n", s);
|
||||
ret = -EINVAL;
|
||||
goto get_out;
|
||||
}
|
||||
@ -224,6 +223,15 @@ rte_devargs_parse(struct rte_devargs *da, const char *dev)
|
||||
if (da == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
/* First parse according global device syntax. */
|
||||
if (rte_devargs_layers_parse(da, dev) == 0) {
|
||||
if (da->bus != NULL || da->cls != NULL)
|
||||
return 0;
|
||||
rte_devargs_reset(da);
|
||||
}
|
||||
|
||||
/* Otherwise fallback to legacy syntax: */
|
||||
|
||||
/* Retrieve eventual bus info */
|
||||
do {
|
||||
devname = dev;
|
||||
|
@ -214,7 +214,6 @@ rte_eth_iterator_init(struct rte_dev_iterator *iter, const char *devargs_str)
|
||||
* - 0000:08:00.0,representor=[1-3]
|
||||
* - pci:0000:06:00.0,representor=[0,5]
|
||||
* - class=eth,mac=00:11:22:33:44:55
|
||||
* A new syntax is in development (not yet supported):
|
||||
* - bus=X,paramX=x/class=Y,paramY=y/driver=Z,paramZ=z
|
||||
*/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user