From: Matan Azrad <matan@mellanox.com>
To: Ferruh Yigit <ferruh.yigit@intel.com>
Cc: Thomas Monjalon <thomas@monjalon.net>,
dev@dpdk.org, stephen@networkplumber.org,
Gaetan Rivet <gaetan.rivet@6wind.com>
Subject: [dpdk-dev] [PATCH v5 3/8] net/failsafe: add probed etherdev capture
Date: Thu, 18 Jan 2018 10:01:44 +0000 [thread overview]
Message-ID: <1516269709-15252-4-git-send-email-matan@mellanox.com> (raw)
In-Reply-To: <1516269709-15252-1-git-send-email-matan@mellanox.com>
Previous fail-safe code didn't support probed sub-devices capture and
failed when it tried to probe them.
Skip fail-safe sub-device probing when it already was probed.
Signed-off-by: Matan Azrad <matan@mellanox.com>
Cc: Gaetan Rivet <gaetan.rivet@6wind.com>
---
doc/guides/nics/fail_safe.rst | 17 +++++++
drivers/net/failsafe/failsafe_args.c | 2 -
drivers/net/failsafe/failsafe_eal.c | 78 ++++++++++++++++++++++++---------
drivers/net/failsafe/failsafe_private.h | 2 +
4 files changed, 77 insertions(+), 22 deletions(-)
diff --git a/doc/guides/nics/fail_safe.rst b/doc/guides/nics/fail_safe.rst
index 5b1b47e..3f72b59 100644
--- a/doc/guides/nics/fail_safe.rst
+++ b/doc/guides/nics/fail_safe.rst
@@ -93,6 +93,14 @@ Fail-safe command line parameters
additional sub-device parameters if need be. They will be passed on to the
sub-device.
+.. note::
+
+ In case of whitelist sub-device probed by EAL, fail-safe PMD will take the device
+ as is, which means that EAL device options are taken in this case.
+ When trying to use a PCI device automatically probed in blacklist mode,
+ the syntax for the fail-safe must be with the full PCI id:
+ Domain:Bus:Device.Function. See the usage example section.
+
- **exec(<shell command>)** parameter
This parameter allows the user to provide a command to the fail-safe PMD to
@@ -169,6 +177,15 @@ This section shows some example of using **testpmd** with a fail-safe PMD.
$RTE_TARGET/build/app/testpmd -c 0xff -n 4 --no-pci \
--vdev='net_failsafe0,exec(echo 84:00.0)' -- -i
+#. Start testpmd, automatically probing the device 84:00.0 and using it with
+ the fail-safe.
+
+ .. code-block:: console
+
+ $RTE_TARGET/build/app/testpmd -c 0xff -n 4 \
+ --vdev 'net_failsafe0,dev(0000:84:00.0),dev(net_ring0)' -- -i
+
+
Using the Fail-safe PMD from an application
-------------------------------------------
diff --git a/drivers/net/failsafe/failsafe_args.c b/drivers/net/failsafe/failsafe_args.c
index c711da4..583bf05 100644
--- a/drivers/net/failsafe/failsafe_args.c
+++ b/drivers/net/failsafe/failsafe_args.c
@@ -45,8 +45,6 @@
#include "failsafe_private.h"
-#define DEVARGS_MAXLEN 4096
-
/* Callback used when a new device is found in devargs */
typedef int (parse_cb)(struct rte_eth_dev *dev, const char *params,
uint8_t head);
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index 19d26f5..33a5adf 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -36,39 +36,77 @@
#include "failsafe_private.h"
static int
+fs_ethdev_portid_get(const char *name, uint16_t *port_id)
+{
+ uint16_t pid;
+ size_t len;
+
+ if (name == NULL) {
+ DEBUG("Null pointer is specified\n");
+ return -EINVAL;
+ }
+ len = strlen(name);
+ RTE_ETH_FOREACH_DEV(pid) {
+ if (!strncmp(name, rte_eth_devices[pid].device->name, len)) {
+ *port_id = pid;
+ return 0;
+ }
+ }
+ return -ENODEV;
+}
+
+static int
fs_bus_init(struct rte_eth_dev *dev)
{
struct sub_device *sdev;
struct rte_devargs *da;
uint8_t i;
- uint16_t j;
+ uint16_t pid;
int ret;
FOREACH_SUBDEV(sdev, i, dev) {
if (sdev->state != DEV_PARSED)
continue;
da = &sdev->devargs;
- ret = rte_eal_hotplug_add(da->bus->name,
- da->name,
- da->args);
- if (ret) {
- ERROR("sub_device %d probe failed %s%s%s", i,
- rte_errno ? "(" : "",
- rte_errno ? strerror(rte_errno) : "",
- rte_errno ? ")" : "");
- continue;
- }
- RTE_ETH_FOREACH_DEV(j) {
- if (strcmp(rte_eth_devices[j].device->name,
- da->name) == 0) {
- ETH(sdev) = &rte_eth_devices[j];
- break;
+ if (fs_ethdev_portid_get(da->name, &pid) != 0) {
+ ret = rte_eal_hotplug_add(da->bus->name,
+ da->name,
+ da->args);
+ if (ret) {
+ ERROR("sub_device %d probe failed %s%s%s", i,
+ rte_errno ? "(" : "",
+ rte_errno ? strerror(rte_errno) : "",
+ rte_errno ? ")" : "");
+ continue;
}
+ if (fs_ethdev_portid_get(da->name, &pid) != 0) {
+ ERROR("sub_device %d init went wrong", i);
+ return -ENODEV;
+ }
+ } else {
+ char devstr[DEVARGS_MAXLEN] = "";
+ struct rte_devargs *probed_da =
+ rte_eth_devices[pid].device->devargs;
+
+ /* Take control of device probed by EAL options. */
+ free(da->args);
+ memset(da, 0, sizeof(*da));
+ if (probed_da != NULL)
+ snprintf(devstr, sizeof(devstr), "%s,%s",
+ probed_da->name, probed_da->args);
+ else
+ snprintf(devstr, sizeof(devstr), "%s",
+ rte_eth_devices[pid].device->name);
+ ret = rte_eal_devargs_parse(devstr, da);
+ if (ret) {
+ ERROR("Probed devargs parsing failed with code"
+ " %d", ret);
+ return ret;
+ }
+ INFO("Taking control of a probed sub device"
+ " %d named %s", i, da->name);
}
- if (ETH(sdev) == NULL) {
- ERROR("sub_device %d init went wrong", i);
- return -ENODEV;
- }
+ ETH(sdev) = &rte_eth_devices[pid];
SUB_ID(sdev) = i;
sdev->fs_dev = dev;
sdev->dev = ETH(sdev)->device;
diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h
index 5e04ffe..9fcf72e 100644
--- a/drivers/net/failsafe/failsafe_private.h
+++ b/drivers/net/failsafe/failsafe_private.h
@@ -58,6 +58,8 @@
#define FAILSAFE_MAX_ETHPORTS 2
#define FAILSAFE_MAX_ETHADDR 128
+#define DEVARGS_MAXLEN 4096
+
/* TYPES */
struct rxq {
--
1.8.3.1
next prev parent reply other threads:[~2018-01-18 10:02 UTC|newest]
Thread overview: 112+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20171124160801.GU4062@6wind.com>
[not found] ` <20171124164812.GV4062@6wind.com>
2017-11-24 17:21 ` [dpdk-dev] [RFC] Introduce virtual PMD for Hyper-V/Azure platforms Adrien Mazarguil
2017-12-18 16:46 ` [dpdk-dev] [PATCH v1 0/3] " Adrien Mazarguil
2017-12-18 16:46 ` [dpdk-dev] [PATCH v1 1/3] net/hyperv: introduce MS Hyper-V platform driver Adrien Mazarguil
2017-12-18 18:28 ` Stephen Hemminger
2017-12-18 19:54 ` Thomas Monjalon
2017-12-18 21:17 ` Stephen Hemminger
2017-12-19 10:01 ` Adrien Mazarguil
2017-12-19 11:15 ` Thomas Monjalon
2017-12-19 13:13 ` Adrien Mazarguil
2017-12-18 16:46 ` [dpdk-dev] [PATCH v1 2/3] net/hyperv: implement core functionality Adrien Mazarguil
2017-12-18 17:04 ` Wiles, Keith
2017-12-18 17:59 ` Adrien Mazarguil
2017-12-18 18:43 ` Wiles, Keith
2017-12-19 8:25 ` Nelio Laranjeiro
2017-12-18 18:26 ` Stephen Hemminger
2017-12-18 20:21 ` Adrien Mazarguil
2017-12-18 21:03 ` Thomas Monjalon
2017-12-18 21:19 ` Stephen Hemminger
2017-12-18 18:34 ` Stephen Hemminger
2017-12-18 20:23 ` Adrien Mazarguil
2017-12-19 9:53 ` Bruce Richardson
2017-12-19 10:15 ` Adrien Mazarguil
2017-12-19 15:31 ` Stephen Hemminger
2017-12-18 23:59 ` Stephen Hemminger
2017-12-19 10:01 ` Adrien Mazarguil
2017-12-19 15:37 ` Stephen Hemminger
2017-12-19 1:54 ` Ferruh Yigit
2017-12-19 15:06 ` Adrien Mazarguil
2017-12-19 20:44 ` Ferruh Yigit
2017-12-20 14:13 ` Thomas Monjalon
2017-12-21 16:19 ` Adrien Mazarguil
2017-12-18 16:46 ` [dpdk-dev] [PATCH v1 3/3] net/hyperv: add "force" parameter Adrien Mazarguil
2017-12-18 18:23 ` [dpdk-dev] [PATCH v1 0/3] Introduce virtual PMD for Hyper-V/Azure platforms Stephen Hemminger
2017-12-18 20:13 ` Thomas Monjalon
2017-12-19 0:40 ` Stephen Hemminger
2017-12-18 20:21 ` Adrien Mazarguil
2017-12-22 18:01 ` [dpdk-dev] [PATCH v2 0/5] " Adrien Mazarguil
2017-12-22 18:01 ` [dpdk-dev] [PATCH v2 1/5] net/failsafe: fix invalid free Adrien Mazarguil
2017-12-22 18:01 ` [dpdk-dev] [PATCH v2 2/5] net/failsafe: add "fd" parameter Adrien Mazarguil
2017-12-22 18:01 ` [dpdk-dev] [PATCH v2 3/5] net/vdev_netvsc: introduce Hyper-V platform driver Adrien Mazarguil
2017-12-22 18:01 ` [dpdk-dev] [PATCH v2 4/5] net/vdev_netvsc: implement core functionality Adrien Mazarguil
2017-12-22 18:01 ` [dpdk-dev] [PATCH v2 5/5] net/vdev_netvsc: add "force" parameter Adrien Mazarguil
2017-12-23 2:06 ` [dpdk-dev] [PATCH v2 0/5] Introduce virtual PMD for Hyper-V/Azure platforms Stephen Hemminger
2017-12-23 14:28 ` Thomas Monjalon
2018-01-09 14:47 ` [dpdk-dev] [PATCH v3 0/8] Introduce virtual driver " Matan Azrad
2018-01-09 14:47 ` [dpdk-dev] [PATCH v3 1/8] net/failsafe: fix invalid free Matan Azrad
2018-01-16 10:24 ` Gaëtan Rivet
2018-01-09 14:47 ` [dpdk-dev] [PATCH v3 2/8] net/failsafe: add "fd" parameter Matan Azrad
2018-01-16 10:54 ` Gaëtan Rivet
2018-01-16 11:19 ` Gaëtan Rivet
2018-01-16 16:17 ` Matan Azrad
2018-01-09 14:47 ` [dpdk-dev] [PATCH v3 3/8] net/failsafe: support probed sub-devices getting Matan Azrad
2018-01-16 11:09 ` Gaëtan Rivet
2018-01-16 12:27 ` Matan Azrad
2018-01-16 14:40 ` Gaëtan Rivet
2018-01-16 16:15 ` Matan Azrad
2018-01-16 16:54 ` Gaëtan Rivet
2018-01-16 17:20 ` Matan Azrad
2018-01-16 22:31 ` Gaëtan Rivet
2018-01-17 8:40 ` Matan Azrad
2018-01-09 14:47 ` [dpdk-dev] [PATCH v3 4/8] net/vdev_netvsc: introduce Hyper-V platform driver Matan Azrad
2018-01-09 14:47 ` [dpdk-dev] [PATCH v3 5/8] net/vdev_netvsc: implement core functionality Matan Azrad
2018-01-09 18:49 ` Stephen Hemminger
2018-01-10 15:02 ` Matan Azrad
2018-01-17 16:51 ` Thomas Monjalon
2018-01-09 14:47 ` [dpdk-dev] [PATCH v3 6/8] net/vdev_netvsc: skip routed netvsc probing Matan Azrad
2018-01-09 18:51 ` Stephen Hemminger
2018-01-10 15:07 ` Matan Azrad
2018-01-10 16:43 ` Stephen Hemminger
2018-01-11 9:00 ` Matan Azrad
2018-01-17 16:59 ` Thomas Monjalon
2018-01-09 14:47 ` [dpdk-dev] [PATCH v3 7/8] net/vdev_netvsc: add "force" parameter Matan Azrad
2018-01-09 14:47 ` [dpdk-dev] [PATCH v3 8/8] net/vdev_netvsc: add automatic probing Matan Azrad
2018-01-18 8:43 ` [dpdk-dev] [PATCH v4 0/8] Introduce virtual driver for Hyper-V/Azure platforms Matan Azrad
2018-01-18 8:43 ` [dpdk-dev] [PATCH v4 1/8] net/failsafe: fix invalid free Matan Azrad
2018-01-18 8:43 ` [dpdk-dev] [PATCH v4 2/8] net/failsafe: add "fd" parameter Matan Azrad
2018-01-18 8:51 ` Gaëtan Rivet
2018-01-18 8:43 ` [dpdk-dev] [PATCH v4 3/8] net/failsafe: add probed etherdev capture Matan Azrad
2018-01-18 9:10 ` Gaëtan Rivet
2018-01-18 9:33 ` Matan Azrad
2018-01-18 8:43 ` [dpdk-dev] [PATCH v4 4/8] net/vdev_netvsc: introduce Hyper-V platform driver Matan Azrad
2018-01-18 8:43 ` [dpdk-dev] [PATCH v4 5/8] net/vdev_netvsc: implement core functionality Matan Azrad
2018-01-18 18:25 ` Stephen Hemminger
2018-01-18 18:28 ` Matan Azrad
2018-01-18 8:43 ` [dpdk-dev] [PATCH v4 6/8] net/vdev_netvsc: skip routed netvsc probing Matan Azrad
2018-01-18 18:26 ` Stephen Hemminger
2018-01-18 18:47 ` Thomas Monjalon
2018-01-18 8:43 ` [dpdk-dev] [PATCH v4 7/8] net/vdev_netvsc: add "force" parameter Matan Azrad
2018-01-18 18:27 ` Stephen Hemminger
2018-01-18 18:30 ` Matan Azrad
2018-01-18 8:43 ` [dpdk-dev] [PATCH v4 8/8] net/vdev_netvsc: add automatic probing Matan Azrad
2018-01-18 10:01 ` [dpdk-dev] [PATCH v5 0/8] Introduce virtual driver for Hyper-V/Azure platforms Matan Azrad
2018-01-18 10:01 ` [dpdk-dev] [PATCH v5 1/8] net/failsafe: fix invalid free Matan Azrad
2018-01-18 10:01 ` [dpdk-dev] [PATCH v5 2/8] net/failsafe: add "fd" parameter Matan Azrad
2018-01-18 10:01 ` Matan Azrad [this message]
2018-01-18 10:08 ` [dpdk-dev] [PATCH v5 3/8] net/failsafe: add probed etherdev capture Gaëtan Rivet
2018-01-18 10:01 ` [dpdk-dev] [PATCH v5 4/8] net/vdev_netvsc: introduce Hyper-V platform driver Matan Azrad
2018-01-18 10:01 ` [dpdk-dev] [PATCH v5 5/8] net/vdev_netvsc: implement core functionality Matan Azrad
2018-01-18 10:01 ` [dpdk-dev] [PATCH v5 6/8] net/vdev_netvsc: skip routed netvsc probing Matan Azrad
2018-01-18 10:01 ` [dpdk-dev] [PATCH v5 7/8] net/vdev_netvsc: add "force" parameter Matan Azrad
2018-01-18 10:01 ` [dpdk-dev] [PATCH v5 8/8] net/vdev_netvsc: add automatic probing Matan Azrad
2018-01-18 13:51 ` [dpdk-dev] [PATCH v6 0/8] Introduce virtual driver for Hyper-V/Azure platforms Matan Azrad
2018-01-18 13:51 ` [dpdk-dev] [PATCH v6 1/8] net/failsafe: fix invalid free Matan Azrad
2018-01-18 13:51 ` [dpdk-dev] [PATCH v6 2/8] net/failsafe: add "fd" parameter Matan Azrad
2018-01-18 13:51 ` [dpdk-dev] [PATCH v6 3/8] net/failsafe: add probed etherdev capture Matan Azrad
2018-01-18 22:34 ` Thomas Monjalon
2018-01-18 13:51 ` [dpdk-dev] [PATCH v6 4/8] net/vdev_netvsc: introduce Hyper-V platform driver Matan Azrad
2018-01-18 13:51 ` [dpdk-dev] [PATCH v6 5/8] net/vdev_netvsc: implement core functionality Matan Azrad
2018-01-18 13:51 ` [dpdk-dev] [PATCH v6 6/8] net/vdev_netvsc: skip routed netvsc probing Matan Azrad
2018-01-18 13:51 ` [dpdk-dev] [PATCH v6 7/8] net/vdev_netvsc: add "force" parameter Matan Azrad
2018-01-18 13:51 ` [dpdk-dev] [PATCH v6 8/8] net/vdev_netvsc: add automatic probing Matan Azrad
2018-01-20 1:15 ` [dpdk-dev] [PATCH v6 0/8] Introduce virtual driver for Hyper-V/Azure platforms Ferruh Yigit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1516269709-15252-4-git-send-email-matan@mellanox.com \
--to=matan@mellanox.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=gaetan.rivet@6wind.com \
--cc=stephen@networkplumber.org \
--cc=thomas@monjalon.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).