[dpdk-dev] [PATCH v2 14/18] net/failsafe: keep legacy sub-device declaration
Gaetan Rivet
gaetan.rivet at 6wind.com
Thu Oct 12 10:21:21 CEST 2017
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 at 6wind.com>
---
drivers/net/failsafe/failsafe_args.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c
index 08ce4ad..0c98264 100644
--- a/drivers/net/failsafe/failsafe_args.c
+++ b/drivers/net/failsafe/failsafe_args.c
@@ -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;
--
2.1.4
More information about the dev
mailing list