fw-update: reduce log spam for requestFwData
1) Printing every requestFwData tends to cause log spam. For example:
248KB/4KB=63 times, 8MB/4KB=2048 times. Here we chunk the firmware size
by 10, and only print out message if the offset is crossing the chunk
boundary.
2) Add the EID prefix so we know the message comes from which
device.
3) Add message inside UpdateComponent to indicate the start of firmware
xfer.
Tested:
https://paste.googleplex.com/5464565169127424
Google-Bug-Id: 438567747
Change-Id: Ie7aee15856b4f0dc6edfe5bb199c280c6dc3d92c
Signed-off-by: Jinliang Wang <jinliangw@google.com>
diff --git a/fw-update/device_updater.cpp b/fw-update/device_updater.cpp
index 20bca0c..e616bdd 100644
--- a/fw-update/device_updater.cpp
+++ b/fw-update/device_updater.cpp
@@ -348,6 +348,10 @@
"EID", unsigned(eid), "CC", unsigned(completionCode));
return;
}
+
+ info(
+ "EID {EID}: Got successfully response for UpdateComponent, device will start to RequestFirmwareData...",
+ "EID", unsigned(eid));
}
Response DeviceUpdater::requestFwData(const pldm_msg* request,
@@ -382,8 +386,18 @@
const auto& comp = compImageInfos[applicableComponents[componentIndex]];
auto compOffset = std::get<5>(comp);
auto compSize = std::get<6>(comp);
- error("offset = {OFFSET}, length = {LEN}", "OFFSET", unsigned(offset),
- "LEN", unsigned(length));
+
+ // Print out progress around 10 times to prevent log spam
+ uint32_t chunk = (compSize >= 10) ? compSize / 10 : 1;
+ uint32_t boundary = offset / chunk * chunk;
+ if ((offset < boundary + length) && (offset >= boundary))
+ {
+ info(
+ "EID {EID}: offset = {OFFSET}, length = {LEN}, boundary = {BOUNDARY}",
+ "EID", unsigned(eid), "OFFSET", unsigned(offset), "LEN",
+ unsigned(length), "BOUNDARY", boundary);
+ }
+
if (length < PLDM_FWUP_BASELINE_TRANSFER_SIZE || length > maxTransferSize)
{
rc = encode_request_firmware_data_resp(