From 104e695f2aa8d66a83a1511ca3544964c5bd9179 Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Tue, 23 Jan 2024 14:56:03 +0100 Subject: [PATCH] [nrf fromtree] net: openthread: upmerge to `7761b81` additionaly, implement `otPlatRadioResetCsl` functionality Signed-off-by: Maciej Baczmanski (cherry picked from commit 0f1747e4e73fa1db67f65dfb251d202e8d552db6) --- drivers/ieee802154/ieee802154_nrf5.c | 6 ++++++ include/zephyr/net/ieee802154_radio.h | 9 +++++++++ modules/openthread/platform/radio.c | 16 ++++++++++++++++ west.yml | 2 +- 4 files changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/ieee802154/ieee802154_nrf5.c b/drivers/ieee802154/ieee802154_nrf5.c index 16eb2cb0022..553d71188e9 100644 --- a/drivers/ieee802154/ieee802154_nrf5.c +++ b/drivers/ieee802154/ieee802154_nrf5.c @@ -901,6 +901,12 @@ static int nrf5_configure(const struct device *dev, uint8_t element_id; bool valid_vendor_specific_ie = false; + if (config->ack_ie.purge_ie) { + nrf_802154_ack_data_remove_all(false, NRF_802154_ACK_DATA_IE); + nrf_802154_ack_data_remove_all(true, NRF_802154_ACK_DATA_IE); + break; + } + if (config->ack_ie.short_addr == IEEE802154_BROADCAST_ADDRESS || config->ack_ie.ext_addr == NULL) { return -ENOTSUP; diff --git a/include/zephyr/net/ieee802154_radio.h b/include/zephyr/net/ieee802154_radio.h index de0cf89da4c..259d67b4321 100644 --- a/include/zephyr/net/ieee802154_radio.h +++ b/include/zephyr/net/ieee802154_radio.h @@ -1241,6 +1241,15 @@ struct ieee802154_config { * in CPU byte order */ uint16_t short_addr; + + /** + * Flag for purging enh ACK header IEs. + * When flag is set to true, driver should remove all existing + * header IEs, and all other entries in config should be ignored. + * This means that purging current header IEs and + * configuring a new one in the same call is not allowed. + */ + bool purge_ie; } ack_ie; }; }; diff --git a/modules/openthread/platform/radio.c b/modules/openthread/platform/radio.c index c0df98367af..d405539bcc0 100644 --- a/modules/openthread/platform/radio.c +++ b/modules/openthread/platform/radio.c @@ -1294,6 +1294,22 @@ otError otPlatRadioEnableCsl(otInstance *aInstance, uint32_t aCslPeriod, otShort return result ? OT_ERROR_FAILED : OT_ERROR_NONE; } +otError otPlatRadioResetCsl(otInstance *aInstance) +{ + struct ieee802154_config config = { 0 }; + int result; + + result = radio_api->configure(radio_dev, IEEE802154_CONFIG_CSL_PERIOD, &config); + if (result) { + return OT_ERROR_FAILED; + } + + config.ack_ie.purge_ie = true; + result = radio_api->configure(radio_dev, IEEE802154_CONFIG_ENH_ACK_HEADER_IE, &config); + + return result ? OT_ERROR_FAILED : OT_ERROR_NONE; +} + void otPlatRadioUpdateCslSampleTime(otInstance *aInstance, uint32_t aCslSampleTime) { ARG_UNUSED(aInstance); diff --git a/west.yml b/west.yml index 2892d3db451..ea8352aa7cf 100644 --- a/west.yml +++ b/west.yml @@ -301,7 +301,7 @@ manifest: revision: 214f9fc1539f8e5937c0474cb6ee29b6dcb2d4b8 path: modules/lib/open-amp - name: openthread - revision: 00076aff3ae571db7c90509ec9dc293457098c35 + revision: 7761b81d23b10b3d5ee21b8504c67535cde10896 path: modules/lib/openthread - name: percepio path: modules/debug/percepio