diff options
author | Matt Spinler <spinler@us.ibm.com> | 2019-12-11 15:24:45 -0600 |
---|---|---|
committer | Matt Spinler <spinler@us.ibm.com> | 2020-01-27 08:06:26 -0600 |
commit | 3019c6fb08b99af5e550910f241836e6e46f1c7b (patch) | |
tree | 2730875131e9d7eda79d3c385b207b25ce49eb72 /extensions/openpower-pels | |
parent | f869fcf81a23a8b80b110753d9c7ad8c2a3f60ae (diff) | |
download | phosphor-logging-3019c6fb08b99af5e550910f241836e6e46f1c7b.tar.gz phosphor-logging-3019c6fb08b99af5e550910f241836e6e46f1c7b.zip |
PEL: Fill in host state change callback
If the host is up, start sending PELs.
If the host is off, move all of the PELs that are sent but
not acked back to the queue to be sent again next time.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I66d382a85afc88f6b23367fb515df4dbe5326be1
Diffstat (limited to 'extensions/openpower-pels')
-rw-r--r-- | extensions/openpower-pels/host_notifier.cpp | 41 | ||||
-rw-r--r-- | extensions/openpower-pels/host_notifier.hpp | 12 |
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; |