summaryrefslogtreecommitdiff
path: root/drivers/net/failsafe/failsafe_eal.c
AgeCommit message (Collapse)Author
2019-06-29eal: fix positive error codes from probe/removeIlya Maximets
According to API, 'rte_dev_probe()' and 'rte_dev_remove()' must return 0 or negative error code. Bus code returns positive values if device wasn't recognized by any driver, so the result of 'bus->plug/unplug()' must be converted. 'local_dev_probe()' and 'local_dev_remove()' also has their internal API, so the conversion should be done there. Positive on remove means that device not found by driver. Positive on probe means that there are no suitable buses/drivers, i.e. device is not supported. Users of these API fixed to provide a good example by respecting DPDK API. This also will allow to catch such issues in the future. Fixes: a3ee360f4440 ("eal: add hotplug add/remove device") Fixes: 244d5130719c ("eal: enable hotplug on multi-process") Cc: stable@dpdk.org Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Reviewed-by: David Marchand <david.marchand@redhat.com>
2019-04-04replace snprintf with strlcpyBruce Richardson
Do a global replace of snprintf(..."%s",...) with strlcpy, adding in the rte_string_fns.h header if needed. The function changes in this patch were auto-generated via command: spatch --sp-file devtools/cocci/strlcpy.cocci --dir . --in-place and then the files edited using awk to add in the missing header: gawk -i inplace '/include <rte_/ && ! seen { \ print "#include <rte_string_fns.h>"; seen=1} {print}' Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2019-03-29net/failsafe: replace sub-device pointer with port idRaslan Darawsheh
In multiprocess context, the pointer to sub-device is shared between processes. Previously, it was a pointer to per process eth_dev so it's needed to replace this dependency. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Signed-off-by: Raslan Darawsheh <rasland@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2019-03-29net/failsafe: change back-reference from sub-deviceRaslan Darawsheh
In multiprocess context, the sub-device structure is shared between processes. The reference to the failsafe device was a per process pointer. It's changed to port id which is the same for all processes. Signed-off-by: Raslan Darawsheh <rasland@mellanox.com> Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-10-11eal: simplify parameters of hotplug functionsThomas Monjalon
All information about a device to probe can be grouped in a common string, which is what we usually call devargs. An application should not have to parse this string before calling the EAL probe function. And the syntax could evolve to be more complex and support matching multiple devices in one string. That's why the bus name and device name should be removed from rte_eal_hotplug_add(). Instead of changing this function, a simpler one is added and used in the old one, which may be deprecated later. When removing a device, we already know its rte_device handle which can be directly passed as parameter of rte_eal_hotplug_remove(). If the rte_device is not known, it can be retrieved with the devargs, by iterating in the device list (future RTE_DEV_FOREACH()). Similarly to the probing case, a new function is added and used in the old one, which may be deprecated later. The new function is used in failsafe, because the replacement is easy. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
2018-07-15devargs: add non-variadic parsing functionGaetan Rivet
rte_devargs_parse becomes non-variadic, rte_devargs_parsef becomes the variadic version, to be used to compose device strings. Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-05-14net/failsafe: fix sub-device ownership raceMatan Azrad
There is time between the sub-device port probing by the sub-device PMD to the sub-device port ownership taking by a fail-safe port. In this time, the port is available for the application usage. For example, the port will be exposed to the applications which use RTE_ETH_FOREACH_DEV iterator. Thus, ownership unaware applications may manage the port in this time what may cause a lot of problematic behaviors in the fail-safe sub-device initialization. Register to the ethdev NEW event to take the sub-device port ownership before it becomes exposed to the application. Fixes: a46f8d584eb8 ("net/failsafe: add fail-safe PMD") Cc: stable@dpdk.org Signed-off-by: Matan Azrad <matan@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
2018-05-14net/failsafe: fix sub-device visibilityThomas Monjalon
The iterator function rte_eth_find_next_owned_by(), used by the iterator macro RTE_ETH_FOREACH_DEV_OWNED_BY, are ignoring the devices which are neither ATTACHED nor REMOVED. Thus sub-devices, having the state DEFERRED, cannot be seen with the ethdev iterator. The state RTE_ETH_DEV_DEFERRED can be replaced by RTE_ETH_DEV_ATTACHED + owner. Fixes: dcd0c9c32b8d ("net/failsafe: use ownership mechanism for slaves") Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Matan Azrad <matan@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com> Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
2018-04-25devargs: use proper namespace prefixGaetan Rivet
rte_eal_devargs is useless, rte_devargs is sufficient. Only experimental functions are changed for now. Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com> Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-04-25devargs: make parsing variadicGaetan Rivet
rte_eal_devargs_parse can be used by EAL subsystems, drivers, applications alike. Device parameters may be presented with different structure each time; as a single declaration string or several strings each describing different parts of the declaration. To simplify the use of this parsing facility, its parameters are made variadic. Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com> Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-04-11align SPDX Mellanox copyrightsShahaf Shuler
Aligning Mellanox SPDX copyrights to a single format. In addition replace to SPDX licence files which were missed. Signed-off-by: Shahaf Shuler <shahafs@mellanox.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2018-02-05net/failsafe: fix error string after ownership callGaetan Rivet
Ownership API returns a negative value, strerror expects a valid errno value, thus positive. Coverity issue: 260401 Fixes: dcd0c9c32b8d ("net/failsafe: use ownership mechanism for slaves") Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-02-01net/failsafe: use SPDX tags in 6WIND copyrighted filesOlivier Matz
Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com> Acked-by: Thomas Monjalon <thomas@monjalon.net>
2018-01-31net/failsafe: use ownership mechanism for slavesMatan Azrad
Fail-safe PMD sub devices management is based on ethdev port mechanism. So, the sub-devices management structures are exposed to other DPDK entities which may use them in parallel to fail-safe PMD. Use the new port ownership mechanism to avoid multiple managments of fail-safe PMD sub-devices. Signed-off-by: Matan Azrad <matan@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-01-21net/failsafe: add probed device captureMatan Azrad
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> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2017-10-26net/failsafe: fix PCI devices initRaslan Darawsheh
When trying to attach a port as a sub-device, the ethdev port was compared with devargs. In the case of a PCI device, the name in devargs is the PCI address. And since DPDK 17.08, the devargs name of the underlying device was used to match an ethdev port: a1e7c17555e8 ("ethdev: use device name from device structure") But the recent commit 72e3efb149cc has reverted this wrong matching to use the ethdev port name as identifier of the port. It impacts functions like rte_eth_dev_allocated() used in failsafe for matching ports with given devargs. The fix is to search for matching devargs in underlying device of all ethdev ports. If many ports match the same PCI device, only the first one is matched. This limitation was already present in previous implementation of rte_eth_dev_allocated(), and must be adressed later with a better devargs syntax. Fixes: 72e3efb149cc ("ethdev: revert use port name from device structure") Cc: stable@dpdk.org Signed-off-by: Raslan Darawsheh <rasland@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2017-10-06net/failsafe: fix failsafe bus uninit return valueRaslan Darawsheh
fs_bus_uninit is always returning 0 no matter what was the status of each sub device bus_uninit value. Fixes: a46f8d584eb8 ("net/failsafe: add fail-safe PMD") Cc: stable@dpdk.org Signed-off-by: Raslan Darawsheh <rasland@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2017-07-19net/failsafe: support device removalGaetan Rivet
Listen to INTR_RMV events issued by slaves. Add atomic flags on slave queues to detect use of slave bursts function. If a removal is detected, set the recollection flag on this slave. During a slave upkeep round, if its recollection flag is set and its burst functions are not in use by any thread, remove that slave. Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com> Acked-by: Olga Shern <olgas@mellanox.com>
2017-07-19net/failsafe: support flow APIGaetan Rivet
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com> Acked-by: Olga Shern <olgas@mellanox.com>
2017-07-19net/failsafe: add plug-in supportGaetan Rivet
Periodically check for the existence of a device. If a device has not been initialized and exists on the system, then it is probed and configured. The configuration process strives to synchronize the states between the plugged-in sub-device and the fail-safe device. Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com> Acked-by: Olga Shern <olgas@mellanox.com>
2017-07-19net/failsafe: add fail-safe PMDGaetan Rivet
Introduce the fail-safe poll mode driver initialization and enable its build infrastructure. This PMD allows for applications to benefit from true hot-plugging support without having to implement it. It intercepts and manages Ethernet device removal events issued by slave PMDs and re-initializes them transparently when brought back. It also allows defining a contingency to the removal of a device, by designating a fail-over device that will take on transmitting operations if the preferred device is removed. Applications only see a fail-safe instance, without caring for underlying activity ensuring their continued operations. Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com> Acked-by: Olga Shern <olgas@mellanox.com>