Skip to content

Commit

Permalink
[link-metrics] fix the endian-ness of mPduCountValue
Browse files Browse the repository at this point in the history
This commit updates `LinkMetrics::AppendReport()` to ensure
the `values.mPduCountValue` (which is a `uint32_t`) is stored in
the host MCU encoding and not in big-endian encoding.

This was originally added in openthread#7046 as a fix (basically saving the
value in local variable in the encoding we expect to later include
in the Report TLV), however openthread#8006 updates the `ReportSubTlv` methods
to do the encoding change in the `Get/SetMetricsValue32()` (similar
to other OT `Tlv` definitions).
  • Loading branch information
abtink committed Aug 17, 2022
1 parent 1b5298e commit c0813d9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/thread/link_metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ Error LinkMetrics::AppendReport(Message &aMessage, const Message &aRequestMessag

if (queryId == kQueryIdSingleProbe)
{
values.mPduCountValue = HostSwap32(aRequestMessage.GetPsduCount());
values.mPduCountValue = aRequestMessage.GetPsduCount();
values.mLqiValue = aRequestMessage.GetAverageLqi();
// Linearly scale Link Margin from [0, 130] to [0, 255]
values.mLinkMarginValue =
Expand All @@ -318,7 +318,7 @@ Error LinkMetrics::AppendReport(Message &aMessage, const Message &aRequestMessag
else
{
values.SetMetrics(seriesInfo->GetLinkMetrics());
values.mPduCountValue = HostSwap32(seriesInfo->GetPduCount());
values.mPduCountValue = seriesInfo->GetPduCount();
values.mLqiValue = seriesInfo->GetAverageLqi();
// Linearly scale Link Margin from [0, 130] to [0, 255]
values.mLinkMarginValue =
Expand Down

0 comments on commit c0813d9

Please sign in to comment.