[dpdk-dev,v2,14/18] net/failsafe: keep legacy sub-device declaration
Checks
Commit Message
Allow users to use the same sub-device declaration format.
The rte_devargs library now requires the bus name to be prepended to
device declarations. While it is possible to use this new format, the
transition to the new one can be made smoother.
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
---
drivers/net/failsafe/failsafe_args.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
@@ -34,6 +34,7 @@
#include <string.h>
#include <errno.h>
+#include <rte_bus.h>
#include <rte_debug.h>
#include <rte_devargs.h>
#include <rte_malloc.h>
@@ -83,12 +84,20 @@ closing_paren(const char *text)
static int
fs_parse_device(struct sub_device *sdev, char *args)
{
+ struct rte_bus *bus;
struct rte_devargs *d;
int ret;
d = &sdev->devargs;
DEBUG("%s", args);
- ret = rte_eal_devargs_parse(d, "%s", args);
+ bus = rte_bus_find_by_device_name(args);
+ if (bus == NULL)
+ /* args may contain the bus name */
+ ret = rte_eal_devargs_parse(d, "%s", args);
+ else
+ /* args is a device name */
+ ret = rte_eal_devargs_parse(d, "%s:%s",
+ bus->name, args);
if (ret) {
DEBUG("devargs parsing failed with code %d", ret);
return ret;