summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/openpower-pels/host_notifier.cpp41
-rw-r--r--extensions/openpower-pels/host_notifier.hpp12
2 files changed, 53 insertions, 0 deletions
diff --git a/extensions/openpower-pels/host_notifier.cpp b/extensions/openpower-pels/host_notifier.cpp
index b935f7e..f9e0418 100644
--- a/extensions/openpower-pels/host_notifier.cpp
+++ b/extensions/openpower-pels/host_notifier.cpp
@@ -128,6 +128,26 @@ void HostNotifier::doNewLogNotify()
void HostNotifier::hostStateChange(bool hostUp)
{
+ _retryCount = 0;
+
+ if (hostUp && !_pelQueue.empty())
+ {
+ doNewLogNotify();
+ }
+ else if (!hostUp)
+ {
+ stopCommand();
+
+ // Reset the state on any PELs that were sent but not acked back
+ // to new so they'll get sent again.
+ for (auto id : _sentPELs)
+ {
+ _pelQueue.push_back(id);
+ _repo.setPELHostTransState(id, TransmissionState::newPEL);
+ }
+
+ _sentPELs.clear();
+ }
}
void HostNotifier::commandResponse(ResponseStatus status)
@@ -169,4 +189,25 @@ void HostNotifier::retryTimerExpired()
}
}
+void HostNotifier::stopCommand()
+{
+ _retryCount = 0;
+
+ if (_inProgressPEL != 0)
+ {
+ _pelQueue.push_front(_inProgressPEL);
+ _inProgressPEL = 0;
+ }
+
+ if (_retryTimer.isEnabled())
+ {
+ _retryTimer.setEnabled(false);
+ }
+
+ if (_hostIface->cmdInProgress())
+ {
+ _hostIface->cancelCmd();
+ }
+}
+
} // namespace openpower::pels
diff --git a/extensions/openpower-pels/host_notifier.hpp b/extensions/openpower-pels/host_notifier.hpp
index 8436e06..1bb7538 100644
--- a/extensions/openpower-pels/host_notifier.hpp
+++ b/extensions/openpower-pels/host_notifier.hpp
@@ -96,6 +96,11 @@ class HostNotifier
/**
* @brief Called when the host changes state.
*
+ * If the new state is host up and there are PELs to send, it
+ * will trigger the first command. If the new state is off, then
+ * it will transfer any PELs that were sent but not acked yet back
+ * to the queue to be sent again.
+ *
* @param[in] hostUp - The new host state
*/
void hostStateChange(bool hostUp);
@@ -124,6 +129,13 @@ class HostNotifier
void retryTimerExpired();
/**
+ * @brief Stops an in progress command
+ *
+ * In progress meaning after the send but before the response.
+ */
+ void stopCommand();
+
+ /**
* @brief The PEL repository object
*/
Repository& _repo;
OpenPOWER on IntegriCloud