summaryrefslogtreecommitdiff
path: root/drivers/net/failsafe
AgeCommit message (Collapse)Author
2019-03-29net/failsafe: support secondary processRaslan Darawsheh
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>
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>
2019-03-29net/failsafe: replace local device with shared dataRaslan Darawsheh
In multiprocess context, the private structure is shared between processes. The back reference from private to generic data was using a pointer to a per process eth_dev. It's now changed to a reference of the shared data. Signed-off-by: Raslan Darawsheh <rasland@mellanox.com> Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2019-03-12build/freebsd: rename macro BSDPAPP to FREEBSDBruce Richardson
Rename the macro and all instances in DPDK code, but keep a copy of the old macro defined for legacy code linking against DPDK Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2019-03-12build/linux: rename macro from LINUXAPP to LINUXBruce Richardson
Rename the macro to make things shorter and more comprehensible. For both meson and make builds, keep the old macro around for backward compatibility. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2018-12-21net/failsafe: add default Tx mbuf fast free capabilityIvan Malov
This capability is reported when supported by the current emitting sub-device. Failsafe PMD itself does not exercise fast free logic. Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-12-21net/failsafe: remove unnecessary debug messagesStephen Hemminger
The failsafe driver spews messages every time it is polling making debugging other things more difficult. Just remove it. Example: net_failsafe: Hot-plug mutex was locked by thread 140182066431744 by the hot-plug alarm net_failsafe: Hot-plug mutex was locked by thread 140182066431744 by the hot-plug alarm ... Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-10-29drivers: prefix global variables with module nameFerruh Yigit
Some global variables are defined with generic names, add component name as prefix to variables to prevent collusion with application variables. Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
2018-10-29add missing static keyword to globalsFerruh Yigit
Some global variables can indeed be static, add static keyword to them. Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
2018-10-26ethdev: free all common data when releasing portThomas Monjalon
This is a clean-up of common ethdev data freeing. All data freeing are moved to rte_eth_dev_release_port() and done only in case of primary process. It is probably fixing some memory leaks for PMDs which were not freeing all data. Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-10-11net/failsafe: use prefix for functionStephen Hemminger
All other visible functions in failsafe driver have 'failsafe_' prefix. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-10-11net/failsafe: switch to flow API object conversion functionAdrien Mazarguil
This patch replaces rte_flow_copy() with rte_flow_conv(). Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2018-10-11net/failsafe: report actual device capabilitiesIgor Romanov
Failsafe device capabilities depend on supported by the failsafe itself plus capabilities supported by sub-devices. Make fs_dev_infos_get() take failsafe device capabilities into account. Fixes: cac923cfea47 ("ethdev: support runtime queue setup") Cc: stable@dpdk.org Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> 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-09-28net/failsafe: support multicast address list setEvgeny Im
Signed-off-by: Evgeny Im <evgeny.im@oktetlabs.com> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-09-28net/failsafe: support runtime Tx queues setupIan Dolzhansky
Signed-off-by: Ian Dolzhansky <ian.dolzhansky@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-09-28net/failsafe: support runtime Rx queues setupIan Dolzhansky
Signed-off-by: Ian Dolzhansky <ian.dolzhansky@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-09-28net/failsafe: add Tx queue start and stop functionsIan Dolzhansky
Support Tx queue deferred start. Signed-off-by: Ian Dolzhansky <ian.dolzhansky@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-09-28net/failsafe: add Rx queue start and stop functionsIan Dolzhansky
Support Rx queue deferred start. Signed-off-by: Ian Dolzhansky <ian.dolzhansky@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-09-28net/failsafe: add checks for deferred queue setupIan Dolzhansky
Fixes: a46f8d584eb8 ("net/failsafe: add fail-safe PMD") Cc: stable@dpdk.org Signed-off-by: Ian Dolzhansky <ian.dolzhansky@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-09-28net/failsafe: fix crash on slave queue releaseIgor Romanov
Releasing a queue that is already released by slave may cause a segmentation fault. For example, after a successfull device configuration a queue is set up. Afterwards the device is reconfigured with an invalid argument, forcing slaves to release the queues (e.g. rte_eth_dev.data.tx_queues). Finally the failsafe's queues are released. The queue release functions also try to release slaves' queues using ETH(sdev)->data->tx_queues which is NULL at the time. Add checks for NULL slaves' Tx and Rx queues before releasing them. Fixes: a46f8d584eb8 ("net/failsafe: add fail-safe PMD") Cc: stable@dpdk.org Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru> Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-09-14ethdev: make default behavior CRC strip on RxFerruh Yigit
Removed DEV_RX_OFFLOAD_CRC_STRIP offload flag. Without any specific Rx offload flag, default behavior by PMDs is to strip CRC. PMDs that support keeping CRC should advertise DEV_RX_OFFLOAD_KEEP_CRC Rx offload capability. Applications that require keeping CRC should check PMD capability first and if it is supported can enable this feature by setting DEV_RX_OFFLOAD_KEEP_CRC in Rx offload flag in rte_eth_dev_configure() Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Acked-by: Tomasz Duszynski <tdu@semihalf.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com> Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com> Acked-by: Jan Remes <remes@netcope.com> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com> Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
2018-07-26drivers/net: fix crash in secondary processFerruh Yigit
Calling rte_eth_dev_info_get() on secondary process cause a crash because eth_dev->device is not set properly. Fixes: ee27edbe0c10 ("drivers/net: share vdev data to secondary process") Cc: stable@dpdk.org Reported-by: Vipin Varghese <vipin.varghese@intel.com> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
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-07-12remove useless constructor headersThomas Monjalon
A constructor is usually declared with RTE_INIT* macros. As it is a static function, no need to declare before its definition. The macro is used directly in the function definition. Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2018-06-14net/failsafe: add to meson buildBruce Richardson
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-05-25use SPDX license tag in Mellanox copyrighted filesThomas Monjalon
Some files were left with full license and wrong copyright format. They are switched to this format: SPDX-License-Identifier: BSD-3-Clause Copyright 2017 Mellanox Technologies, Ltd Fixes: 5feecc57d90b ("align SPDX Mellanox copyrights") Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com> Acked-by: Shahaf Shuler <shahafs@mellanox.com>
2018-05-23net/failsafe: fix duplicate event registrationMatan Azrad
When the fail-safe device is reconfigured, it attempts to register again for the sub-devices LSC and RMV events. Prevent an event registration if it is already done. Fixes: 598fb8aec6f6 ("net/failsafe: support device removal") Cc: stable@dpdk.org Signed-off-by: Matan Azrad <matan@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-05-23net/failsafe: fix removed sub-device cleanupMatan Azrad
The fail-safe PMD registers to RMV event for each removable sub-device port in order to cleanup the sub-device resources and switch the Tx sub-device directly when it is plugged-out. During removal time, the fail-safe PMD stops and closes the sub-device but it doesn't unregister the LSC and RMV callbacks of the sub-device port. It can lead the callbacks to be called for a port which is no more associated with the fail-safe sub-device, because there is not a guarantee that a sub-device gets the same port ID for each plug-in process. This port, for example, may belong to another sub-device of a different fail-safe device. Unregister the LSC and RMV callbacks for sub-devices which are not used. Fixes: 598fb8aec6f6 ("net/failsafe: support device removal") Cc: stable@dpdk.org Signed-off-by: Matan Azrad <matan@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-05-14net/failsafe: add an RSS hash update callbackOphir Munk
Add an RSS hash update callback to eth_dev_ops. Signed-off-by: Ophir Munk <ophirmu@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
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-14ethdev: add probing finish functionThomas Monjalon
A new hook function is added and called inside the PMDs at the end of the device probing: - in primary process, after allocating, init and config - in secondary process, after attaching and local init This new function is almost empty for now. It will be used later to add some post-initialization processing. For the PMDs calling the helpers rte_eth_dev_create() or rte_eth_dev_pci_generic_probe(), the hook rte_eth_dev_probing_finish() is called from here, and not in the PMD itself. Note that the helper rte_eth_dev_create() could be used more, especially for vdevs, avoiding some code duplication in PMDs. Cc: stable@dpdk.org Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.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-05-14ethdev: new Rx/Tx offloads APIWei Dai
This patch check if a input requested offloading is valid or not. Any reuqested offloading must be supported in the device capabilities. Any offloading is disabled by default if it is not set in the parameter dev_conf->[rt]xmode.offloads to rte_eth_dev_configure() and [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup(). If any offloading is enabled in rte_eth_dev_configure() by application, it is enabled on all queues no matter whether it is per-queue or per-port type and no matter whether it is set or cleared in [rt]x_conf->offloads to rte_eth_[rt]x_queue_setup(). If a per-queue offloading hasn't be enabled in rte_eth_dev_configure(), it can be enabled or disabled for individual queue in ret_eth_[rt]x_queue_setup(). A new added offloading is the one which hasn't been enabled in rte_eth_dev_configure() and is reuqested to be enabled in rte_eth_[rt]x_queue_setup(), it must be per-queue type, otherwise trigger an error log. The underlying PMD must be aware that the requested offloadings to PMD specific queue_setup() function only carries those new added offloadings of per-queue type. This patch can make above such checking in a common way in rte_ethdev layer to avoid same checking in underlying PMD. This patch assumes that all PMDs in 18.05-rc2 have already converted to offload API defined in 17.11 . It also assumes that all PMDs can return correct offloading capabilities in rte_eth_dev_infos_get(). In the beginning of [rt]x_queue_setup() of underlying PMD, add offloads = [rt]xconf->offloads | dev->data->dev_conf.[rt]xmode.offloads; to keep same as offload API defined in 17.11 to avoid upper application broken due to offload API change. PMD can use the info that input [rt]xconf->offloads only carry the new added per-queue offloads to do some optimization or some code change on base of this patch. Signed-off-by: Wei Dai <wei.dai@intel.com> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
2018-05-14net/failsafe: fix probe cleanupRaslan Darawsheh
The hot-plug alarm mechanism is responsible to practically execute both plug in and out operations. It periodically tries to detect missed sub-devices to be reconfigured and clean the resources of the removed sub-devices. The hot-plug alarm is started by the failsafe probe function, and it's wrongly not stopped if failsafe instance got an error. for example when starting failsafe with a MAC option, and giving it an invalid MAC address this will lead to a NULL pointer for the dev private field. Then when the hotplug alarm is called it will try to access this pointer, which will lead to a segmentation fault. Uninstall the hot-plug alarm in case of error in probe function. Fixes: ebea83f8 ("net/failsafe: add plug-in support") Cc: stable@dpdk.org Signed-off-by: Raslan Darawsheh <rasland@mellanox.com> Acked-by: Matan Azrad <matan@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-05-14net/failsafe: advertise supported RSS functionsOphir Munk
Advertise failsafe supported RSS functions as part of dev_infos_get callback. Set failsafe default RSS hash functions to be: ETH_RSS_IP, ETH_RSS_UDP, and ETH_RSS_TCP. The result of failsafe RSS hash functions is the logical AND of the RSS hash functions among all failsafe sub_devices and failsafe own defaults. Previous to this commit RSS support was reported as none. Since the introduction of [1] it is required that all RSS configurations be verified. [1] commit 8863a1fbfc66 ("ethdev: add supported hash function check") Signed-off-by: Ophir Munk <ophirmu@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-04-27net/failsafe: convert to dynamic loggingStephen Hemminger
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-04-27ethdev: add shared counter to flow APIDeclan Doherty
Add rte_flow_action_count action data structure to enable shared counters across multiple flows on a single port or across multiple flows on multiple ports within the same switch domain. Also this enables multiple count actions to be specified in a single flow action. This patch also modifies the existing rte_flow_query API to take the rte_flow_action structure as an input parameter instead of the rte_flow_action_type enumeration to allow querying a specific action from a flow rule when multiple actions of the same type are specified. This patch also contains updates for the bonding, failsafe and mlx5 PMDs and testpmd application which are affected by this API change. Signed-off-by: Declan Doherty <declan.doherty@intel.com>
2018-04-27net/failsafe: add TCP TSO default Tx capabilityOphir Munk
Add DEV_TX_OFFLOAD_TCP_TSO to failsafe Tx offload default capabilities. The net result of failsafe Tx capabilities is the logical AND of Tx capabilities among all failsafe sub_devices and failsafe own default capabilities. Signed-off-by: Ophir Munk <ophirmu@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
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-24drivers/net: share vdev data to secondary processJianfeng Tan
dpdk-procinfo, as a secondary process, cannot fetch stats for vdev. This patch enables that by attaching the port from the shared data. We also fill the eth dev ops, with only some ops works in secondary process, for example, stats_get(). Note that, we still cannot Rx/Tx packets on the ports which do not support multi-process. Reported-by: Signed-off-by: Vipin Varghese <vipin.varghese@intel.com> Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com> Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
2018-04-14ethdev: return diagnostic when setting MAC addressOlivier Matz
Change the prototype and the behavior of dev_ops->eth_mac_addr_set(): a return code is added to notify the caller (librte_ether) if an error occurred in the PMD. The new default MAC address is now copied in dev->data->mac_addrs[0] only if the operation is successful. The patch also updates all the PMDs accordingly. Signed-off-by: Olivier Matz <olivier.matz@6wind.com> Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru> Acked-by: Andrew Rybchenko <arybchenko@solarflare.com> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com> Acked-by: Thomas Monjalon <thomas@monjalon.net> Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
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-04-04convert snprintf to strlcpyBruce Richardson
Since we have support for the strlcpy function in DPDK, replace all instances where a string is copied using snprintf. Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
2018-02-14net/failsafe: fix Rx interrupt reinstallationMatan Azrad
Fail-safe dev_start() operation can be called by both the application and the hot-plug alarm mechanism. The installation of Rx interrupt are triggered from dev_start() in any time it is called while actually the Rx interrupt should be installed only by the application calls. So, each plug-in event causes reinstallation which causes memory leak and spoils the fail-safe Rx interrupt mechanism. Trigger the Rx interrupt installation only when it does not exist. Fixes: 9e0360aebf23 ("net/failsafe: register as Rx interrupt mode") Signed-off-by: Matan Azrad <matan@mellanox.com> Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
2018-02-13net/failsafe: fix FreeBSD buildThomas Monjalon
The type pthread_t is not portable because it is freely defined. On Linux, it is an unsigned long int which can be printed with %l. On FreeBSD, it is a pointer which can be printed with %p. That's why there was this error: drivers/net/failsafe/failsafe_private.h:377:53: error: format specifies type 'unsigned long' but the argument has type 'pthread_t' (aka 'struct pthread *') Fixes: 655fcd68c7d2 ("net/failsafe: fix hotplug races") Reported-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> Signed-off-by: Thomas Monjalon <thomas@monjalon.net> Tested-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> Acked-by: Matan Azrad <matan@mellanox.com>
2018-02-13net/failsafe: fix reconfigurationMatan Azrad
Fail-safe PMD manages the states of its sub-devices gradually: DEV_UNDEFINED, DEV_PARSED, DEV_PROBED, DEV_ACTIVE, DEV_STARTED. When the sub-device arguments successfully was parsed, the state is raised from DEV_UNDEFINED to DEV_PARSED. When the sub-device successfully was probed, the state is raised from DEV_PARSED to DEV_PROBED. When the sub-device successfully was configured by rte_eth_dev_configure(), the state is raised from DEV_PROBED to DEV_ACTIVE. When the sub-device successfully was started by rte_eth_dev_start(), the state is raised from DEV_ACTIVE to DEV_STARTED. When the sub-device successfully was stopped by rte_eth_dev_stop(), the state is degraded from DEV_STARTED to DEV_ACTIVE. When the sub-device successfully was closed by rte_eth_dev_close(), the state is degraded from DEV_ACTIVE to DEV_PROBED. When the sub-device successfully was removed by rte_eal_hotplug_remove(), the state is degraded from DEV_PROBED to DEV_UNDEFINED. Fail-safe dev_configure() operation calls to its sub-devices dev_configure() operation, but only for sub-devices which are in DEV_PROBED state, means that sub-devices which are in DEV_ACTIVE state because the application triggered dev_stop() operation cannot be reconfigured again by dev_configure() operation which is really problematic when application wants to reconfigure its ports. Actually, the application may get success report when some of the sub-devices are not in the wanted configuration. The current behavior of fail-safe dev_configure() is correct only for the first time dev_configure() is triggered by the application or for sub-device synchronization in plug-in event, but it ignores the option for reconfiguration from application side. Allow calling to sub-devices dev_configure() operations also in DEV_ACTIVE state when the call was triggered by 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>
2018-02-13net/failsafe: fix hotplug racesMatan Azrad
Fail-safe uses a periodic alarm mechanism, running from the host thread, to manage the hot-plug events of its sub-devices. This management requires a lot of sub-devices PMDs operations (stop, close, start, configure, etc.). While the hot-plug alarm runs in the host thread, the application may call fail-safe operations, which directly trigger the sub-devices PMDs operations as well. This call may occur from any thread decided by the application (probably the master thread). Thus, more than one operation can be executed to a sub-device at the same time. This can initiate a lot of races in the sub-PMDs. Moreover, some control operations update the fail-safe internal databases, which can be used by the alarm mechanism at the same time. This can also initiate races and crashes. Fail-safe is the owner of its sub-devices and must synchronize their use according to the ETHDEV ownership rules. Synchronize hot-plug management by a new lock mechanism uses a mutex to atomically defend each critical section in the fail-safe hot-plug mechanism and control operations to prevent any races between them. Fixes: a46f8d5 ("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>