From bef804c6be9ca483a755d175e34651629515f16b Mon Sep 17 00:00:00 2001 From: Ashish <104561745+aashu216@users.noreply.github.com> Date: Thu, 30 May 2024 23:51:35 +0530 Subject: [PATCH] [utils] add API to reset/clear linked list of enh-ack link metrics (#10294) Enh-ack link metrics required to reset/clear when radio(RCP) is reset to clear existing data. To support it, added API to reset/clear linked list of enh-ack link metrics. Signed-off-by: Ashishkumar Vara --- examples/platforms/utils/link_metrics.cpp | 12 +++++++++++- examples/platforms/utils/link_metrics.h | 6 ++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/examples/platforms/utils/link_metrics.cpp b/examples/platforms/utils/link_metrics.cpp index 301fc08c5..e62c4f595 100644 --- a/examples/platforms/utils/link_metrics.cpp +++ b/examples/platforms/utils/link_metrics.cpp @@ -177,7 +177,11 @@ static inline bool IsLinkMetricsClear(otLinkMetrics aLinkMetrics) return !aLinkMetrics.mPduCount && !aLinkMetrics.mLqi && !aLinkMetrics.mLinkMargin && !aLinkMetrics.mRssi; } -void otLinkMetricsInit(int8_t aNoiseFloor) { sNoiseFloor = aNoiseFloor; } +void otLinkMetricsInit(int8_t aNoiseFloor) +{ + sNoiseFloor = aNoiseFloor; + otLinkMetricsResetEnhAckProbing(); +} otError otLinkMetricsConfigureEnhAckProbing(otShortAddress aShortAddress, const otExtAddress *aExtAddress, @@ -257,4 +261,10 @@ uint8_t otLinkMetricsEnhAckGetDataLen(const otMacAddress *aMacAddress) exit: return len; } + +void otLinkMetricsResetEnhAckProbing(void) +{ + GetLinkMetricsDataInfoActiveList().Clear(); + GetLinkMetricsDataInfoPool().FreeAll(); +} #endif // OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE || OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE diff --git a/examples/platforms/utils/link_metrics.h b/examples/platforms/utils/link_metrics.h index 1cde18b9f..610dfd3d9 100644 --- a/examples/platforms/utils/link_metrics.h +++ b/examples/platforms/utils/link_metrics.h @@ -107,6 +107,12 @@ uint8_t otLinkMetricsEnhAckGenData(const otMacAddress *aMacAddress, uint8_t aLqi */ uint8_t otLinkMetricsEnhAckGetDataLen(const otMacAddress *aMacAddress); +/** + * This method resets Enhanced-ACK Based Probing data. + * + */ +void otLinkMetricsResetEnhAckProbing(void); + #ifdef __cplusplus } // extern "C" #endif