[dpdk-dev,v4,1/2] net/failsafe: fix hotplug alarm cancel

Message ID 1518092427-4333-2-git-send-email-matan@mellanox.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Matan Azrad Feb. 8, 2018, 12:20 p.m. UTC
  The hot-plug alarm mechanism of fail-safe PMD is responsible for
handling removed devices during a plug-out event and to restore them
back to activity following a plug-in event.

Fail-safe sets a flag called "pending_alarm" to validate that only one
alarm callback is pending at any time. While this flag is required to
avoid simultaneous initiations of the alarm thread - it should not be
considered during alarm thread cancellation.

So, when failsafe_hotplug_alarm_cancel() was called while the alarm
callback was being executed the alarm mechanism was not stopped.

Skip checking the "pending_alarm" flag to allow alarm thread
cancellation all the times.

Fixes: ebea83f899d8 ("net/failsafe: add plug-in support")
Cc: stable@dpdk.org

Signed-off-by: Matan Azrad <matan@mellanox.com>
---
 drivers/net/failsafe/failsafe.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)
  

Patch

diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 2665a39..7b2cdbb 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -85,16 +85,14 @@ 
 {
 	int ret = 0;
 
-	if (PRIV(dev)->pending_alarm) {
-		rte_errno = 0;
-		rte_eal_alarm_cancel(fs_hotplug_alarm, dev);
-		if (rte_errno) {
-			ERROR("rte_eal_alarm_cancel failed (errno: %s)",
-			      strerror(rte_errno));
-			ret = -rte_errno;
-		} else {
-			PRIV(dev)->pending_alarm = 0;
-		}
+	rte_errno = 0;
+	rte_eal_alarm_cancel(fs_hotplug_alarm, dev);
+	if (rte_errno) {
+		ERROR("rte_eal_alarm_cancel failed (errno: %s)",
+		      strerror(rte_errno));
+		ret = -rte_errno;
+	} else {
+		PRIV(dev)->pending_alarm = 0;
 	}
 	return ret;
 }