summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Geissler <andrewg@us.ibm.com>2017-03-22 14:02:30 -0500
committerAndrew Geissler <andrewg@us.ibm.com>2017-05-09 12:50:40 -0500
commit0c07c320a5872aaf3cf9efc8f162a33b25d577c3 (patch)
tree3e20869e251f881ba80f7f577ea7b0f01f5f289d
parent1286637013b65a615e37d8677d75a1bba4c53e4b (diff)
downloadphosphor-host-ipmid-0c07c320a5872aaf3cf9efc8f162a33b25d577c3.tar.gz
phosphor-host-ipmid-0c07c320a5872aaf3cf9efc8f162a33b25d577c3.zip
Enable multiple commands to be queued at once
With this commit, the control host interface allows multiple commands to be queued up and sent in a FIFO order to the host Change-Id: I76908d988608ef6dcc1d7f945c6c4a1c5c29e44b Signed-off-by: Andrew Geissler <andrewg@us.ibm.com>
-rw-r--r--host-interface.cpp35
-rw-r--r--host-interface.hpp4
2 files changed, 31 insertions, 8 deletions
diff --git a/host-interface.cpp b/host-interface.cpp
index aa32ff0..160c127 100644
--- a/host-interface.cpp
+++ b/host-interface.cpp
@@ -16,15 +16,14 @@ using namespace phosphor::logging;
// When you see base:: you know we're referencing our base class
namespace base = sdbusplus::xyz::openbmc_project::Control::server;
-void Host::execute(base::Host::Command command)
-{
- log<level::INFO>("Pushing cmd on to queue",
- entry("CONTROL_HOST_CMD=%s",
- convertForMessage(command)));
- this->workQueue.push(command);
+// TODO - Add timeout function?
+// - If host does not respond to SMS, need to signal a failure
+// - Flush queue on power off? - Timeout would do this for us for free
+// - Ignore requests when host state not running? - Timeout handles too
- // If this was the only entry then send the SMS attention
- if(this->workQueue.size() == 1)
+void Host::checkQueue()
+{
+ if (this->workQueue.size() >= 1)
{
log<level::INFO>("Asserting SMS Attention");
@@ -46,6 +45,26 @@ void Host::execute(base::Host::Command command)
}
log<level::INFO>("SMS Attention asserted");
}
+}
+
+void Host::execute(base::Host::Command command)
+{
+ log<level::INFO>("Pushing cmd on to queue",
+ entry("CONTROL_HOST_CMD=%s",
+ convertForMessage(command)));
+
+ this->workQueue.push(command);
+
+ // Alert host if this is only command in queue otherwise host will
+ // be notified of next message after processing the current one
+ if (this->workQueue.size() == 1)
+ {
+ this->checkQueue();
+ }
+ else
+ {
+ log<level::INFO>("Command in process, no attention");
+ }
return;
}
diff --git a/host-interface.hpp b/host-interface.hpp
index 36b41d9..0ad3bfb 100644
--- a/host-interface.hpp
+++ b/host-interface.hpp
@@ -61,11 +61,15 @@ class Host : public sdbusplus::server::object::object<
Command command = this->workQueue.front();
this->workQueue.pop();
this->commandComplete(command, Result::Success);
+ this->checkQueue();
return command;
}
private:
+ /** @brief Check if anything in queue and alert host if so */
+ void checkQueue();
+
/** @brief Persistent sdbusplus DBus bus connection. */
sdbusplus::bus::bus& bus;
OpenPOWER on IntegriCloud