summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRaslan Darawsheh <rasland@mellanox.com>2019-03-18 16:05:27 +0000
committerFerruh Yigit <ferruh.yigit@intel.com>2019-03-29 17:25:32 +0100
commit493779087466f788ae1b72e137718b23b944aedb (patch)
treeebf7e1cd559ea804657d1ef9f16bf3dd629c17ff
parent2f4b99831c2528a9b3e0fbadda34f590313b330b (diff)
downloaddpdk-next-eventdev-493779087466f788ae1b72e137718b23b944aedb.zip
dpdk-next-eventdev-493779087466f788ae1b72e137718b23b944aedb.tar.gz
dpdk-next-eventdev-493779087466f788ae1b72e137718b23b944aedb.tar.xz
net/failsafe: support secondary process
Add implementation for probe in secondary. Failsafe will attempt to attach all the sub-devices in secondary process. Signed-off-by: Raslan Darawsheh <rasland@mellanox.com> Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
-rw-r--r--drivers/net/failsafe/failsafe.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index e53a89d..42dfaca 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -3,6 +3,8 @@
* Copyright 2017 Mellanox Technologies, Ltd
*/
+#include <stdbool.h>
+
#include <rte_alarm.h>
#include <rte_malloc.h>
#include <rte_ethdev_driver.h>
@@ -318,11 +320,28 @@ fs_rte_eth_free(const char *name)
return ret;
}
+static bool
+devargs_already_listed(struct rte_devargs *devargs)
+{
+ struct rte_devargs *list_da;
+
+ RTE_EAL_DEVARGS_FOREACH(devargs->bus->name, list_da) {
+ if (strcmp(list_da->name, devargs->name) == 0)
+ /* devargs already in the list */
+ return true;
+ }
+ return false;
+}
+
static int
rte_pmd_failsafe_probe(struct rte_vdev_device *vdev)
{
const char *name;
struct rte_eth_dev *eth_dev;
+ struct sub_device *sdev;
+ struct rte_devargs devargs;
+ uint8_t i;
+ int ret;
name = rte_vdev_device_name(vdev);
INFO("Initializing " FAILSAFE_DRIVER_NAME " for %s",
@@ -335,9 +354,33 @@ rte_pmd_failsafe_probe(struct rte_vdev_device *vdev)
ERROR("Failed to probe %s", name);
return -1;
}
- /* TODO: request info from primary to set up Rx and Tx */
eth_dev->dev_ops = &failsafe_ops;
eth_dev->device = &vdev->device;
+ eth_dev->rx_pkt_burst = (eth_rx_burst_t)&failsafe_rx_burst;
+ eth_dev->tx_pkt_burst = (eth_tx_burst_t)&failsafe_tx_burst;
+ /*
+ * Failsafe will attempt to probe all of its sub-devices.
+ * Any failure in sub-devices is not a fatal error.
+ * A sub-device can be plugged later.
+ */
+ FOREACH_SUBDEV(sdev, i, eth_dev) {
+ /* rebuild devargs to be able to get the bus name. */
+ ret = rte_devargs_parse(&devargs,
+ sdev->devargs.name);
+ if (ret != 0) {
+ ERROR("Failed to parse devargs %s",
+ devargs.name);
+ continue;
+ }
+ if (!devargs_already_listed(&devargs)) {
+ ret = rte_dev_probe(devargs.name);
+ if (ret != 0) {
+ ERROR("Failed to probe devargs %s",
+ devargs.name);
+ continue;
+ }
+ }
+ }
rte_eth_dev_probing_finish(eth_dev);
return 0;
}