Suppress I2C error logs while it's retrying
I2C IPMB channel is not an error-free channel because it's in
a multi-master environment basically so IPMB spec itself suggests
retries on I2C communication.
To prevent misunderstanding of the log in journal, this commit
suppress the error log printing out with making it print a log
only when it fails all tries.
Change-Id: I710d5aff63f69cf822cdd35b2bfcd7d91fb0410b
Signed-off-by: Jae Hyun Yoo <jae.hyun.yoo@linux.intel.com>
diff --git a/ipmbbridged.cpp b/ipmbbridged.cpp
index e5fd196..72c2e1d 100644
--- a/ipmbbridged.cpp
+++ b/ipmbbridged.cpp
@@ -547,8 +547,9 @@
for (int i = 0; i < ipmbNumberOfTries; i++)
{
boost::system::error_code ec;
+ int i2cRetryCnt = 0;
- for (int j = 0; j < ipmbI2cNumberOfRetries; j++)
+ for (; i2cRetryCnt < ipmbI2cNumberOfRetries; i2cRetryCnt++)
{
boost::asio::async_write(
i2cMasterSocket,
@@ -558,13 +559,17 @@
if (ec)
{
- phosphor::logging::log<phosphor::logging::level::INFO>(
- "requestAdd: Sent to I2C failed");
- continue;
+ continue; // retry
}
break;
}
+ if (i2cRetryCnt == ipmbI2cNumberOfRetries)
+ {
+ phosphor::logging::log<phosphor::logging::level::INFO>(
+ "requestAdd: Sent to I2C failed after retries");
+ }
+
request->timer->expires_after(
std::chrono::milliseconds(ipmbRequestRetryTimeout));
request->timer->async_wait(yield[ec]);