mirror of
https://github.com/espressif/openthread.git
synced 2026-07-29 15:17:47 +00:00
[low-power] implement enhanced-ack based probing (#5780)
This commit implements Enhanced-ACK Probing (on simulation platform). - Add a new public API otLinkMetricsConfigEnhAckProbing which sends Link Metrics Management Request to configure the probing. This is called on Probing Initiator side. - Add a new radio platform API otPlatRadioConfigureEnhAckProbing. This API should be called on Probing Subject side when handling the requests from Initiators. This API notifies the radio to start/stop aggregating link metrics info and include the data into Vendor IE in enhanced-ACK for the specific neighbor. As discussed in #5746, the code for doing such thing should be put in radio driver. - Add a util module util/link_metrics, which provides a group of APIs to implement Probing Subject side logic for Enh-ACK Probing. Any platform could use this module to implement the feature easily in radio driver. - Add new util APIs in util/mac_frame to generate Enh-ACK Probing IE (Vendor IE with Thread OUI and SubType = 0) and set value for this IE. - Update the implementation in simulation/radio.c to support Probing Subject side logic for Enh-ACK Probing, using APIs in util/link_metrics and util/mac_frame. - Add a test v1_2_LowPower_7_1_01_SingleProbeLinkMetricsWithEnhancedAcks.py for testing. Misc: - Add check for all the public Link Metrics APIs (Initiator side) to ensure that the Subject is a neighbor of the Initiator. If the address is not link-local or the neighbor is not found, an error UNKNOWN_NEIGHBOR would be returned. - Update PrepareEmptyFrame so that when it's called for reference device, its frame version would be set to 2015.
This commit is contained in:
@@ -205,3 +205,47 @@ void otMacFrameSetFrameCounter(otRadioFrame *aFrame, uint32_t aFrameCounter)
|
||||
{
|
||||
static_cast<Mac::Frame *>(aFrame)->SetFrameCounter(aFrameCounter);
|
||||
}
|
||||
|
||||
#if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE
|
||||
uint8_t otMacFrameGenerateCslIeTemplate(uint8_t *aDest)
|
||||
{
|
||||
assert(aDest != nullptr);
|
||||
|
||||
reinterpret_cast<Mac::HeaderIe *>(aDest)->SetId(Mac::Frame::kHeaderIeCsl);
|
||||
reinterpret_cast<Mac::HeaderIe *>(aDest)->SetLength(sizeof(Mac::CslIe));
|
||||
|
||||
return sizeof(Mac::HeaderIe) + sizeof(Mac::CslIe);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if OPENTHREAD_CONFIG_MLE_LINK_METRICS_ENABLE
|
||||
uint8_t otMacFrameGenerateEnhAckProbingIe(uint8_t *aDest, const uint8_t *aIeData, uint8_t aIeDataLength)
|
||||
{
|
||||
uint8_t len = sizeof(Mac::VendorIeHeader) + aIeDataLength;
|
||||
|
||||
assert(aDest != nullptr);
|
||||
|
||||
reinterpret_cast<Mac::HeaderIe *>(aDest)->SetId(Mac::Frame::kHeaderIeVendor);
|
||||
reinterpret_cast<Mac::HeaderIe *>(aDest)->SetLength(len);
|
||||
|
||||
aDest += sizeof(Mac::HeaderIe);
|
||||
|
||||
reinterpret_cast<Mac::VendorIeHeader *>(aDest)->SetVendorOui(Mac::ThreadIe::kVendorOuiThreadCompanyId);
|
||||
reinterpret_cast<Mac::VendorIeHeader *>(aDest)->SetSubType(Mac::ThreadIe::kEnhAckProbingIe);
|
||||
|
||||
if (aIeData != nullptr)
|
||||
{
|
||||
aDest += sizeof(Mac::VendorIeHeader);
|
||||
memcpy(aDest, aIeData, aIeDataLength);
|
||||
}
|
||||
|
||||
return sizeof(Mac::HeaderIe) + len;
|
||||
}
|
||||
|
||||
void otMacFrameSetEnhAckProbingIe(otRadioFrame *aFrame, const uint8_t *aData, uint8_t aDataLen)
|
||||
{
|
||||
assert(aFrame != nullptr && aData != nullptr);
|
||||
|
||||
reinterpret_cast<Mac::Frame *>(aFrame)->SetEnhAckProbingIe(aData, aDataLen);
|
||||
}
|
||||
#endif // OPENTHREAD_CONFIG_MLE_LINK_METRICS_ENABLE
|
||||
|
||||
Reference in New Issue
Block a user