Merge branch 'feat/update_ot_upstream' into 'master'

feat(openthread): update OT upstream to 3b3dd203b

See merge request espressif/esp-idf!42040
This commit is contained in:
Shu Chen
2025-09-23 10:57:24 +00:00
8 changed files with 28 additions and 112 deletions

View File

@@ -113,6 +113,7 @@ if(CONFIG_OPENTHREAD_ENABLED)
"openthread/src/core/thread/mesh_forwarder.cpp" "openthread/src/core/thread/mesh_forwarder.cpp"
"openthread/src/core/thread/mesh_forwarder_ftd.cpp" "openthread/src/core/thread/mesh_forwarder_ftd.cpp"
"openthread/src/core/thread/mesh_forwarder_mtd.cpp" "openthread/src/core/thread/mesh_forwarder_mtd.cpp"
"openthread/src/core/thread/message_framer.cpp"
"openthread/src/core/thread/mle.cpp" "openthread/src/core/thread/mle.cpp"
"openthread/src/core/thread/mle_router.cpp" "openthread/src/core/thread/mle_router.cpp"
"openthread/src/core/thread/mle_types.cpp" "openthread/src/core/thread/mle_types.cpp"

View File

@@ -57,12 +57,6 @@ typedef struct
void (*energy_scan_done)(int8_t max_rssi); /* Callback for Energy Scan Done.*/ void (*energy_scan_done)(int8_t max_rssi); /* Callback for Energy Scan Done.*/
void (*transmit_started)(const uint8_t *frame); /* Callback for Transmit Started.*/ void (*transmit_started)(const uint8_t *frame); /* Callback for Transmit Started.*/
void (*switchover_done)(bool success); /* Callback for Switchover Done.*/ void (*switchover_done)(bool success); /* Callback for Switchover Done.*/
#if CONFIG_OPENTHREAD_DIAG
void (*diag_receive_done)(const uint8_t *frame, esp_ieee802154_frame_info_t *frame_info); /* Callback for Receive Done (diag).*/
void (*diag_transmit_done)(const uint8_t *frame, esp_ieee802154_frame_info_t *frame_info); /* Callback for Transmit Done (diag).*/
void (*diag_transmit_failed)(esp_ieee802154_tx_error_t error); /* Callback for Transmit Failed (diag).*/
#endif // CONFIG_OPENTHREAD_DIAG
} esp_radio_spinel_callbacks_t; /* ESP Radio Spinel Callbacks.*/ } esp_radio_spinel_callbacks_t; /* ESP Radio Spinel Callbacks.*/
/** /**

View File

@@ -5,4 +5,4 @@ supplier: 'Organization: Espressif Systems (Shanghai) CO LTD'
originator: 'Organization: Google LLC' originator: 'Organization: Google LLC'
description: OpenThread released by Google is an open-source implementation of the Thread networking description: OpenThread released by Google is an open-source implementation of the Thread networking
url: https://github.com/espressif/openthread url: https://github.com/espressif/openthread
hash: b945928d722177cd9caeab2e1025499628c101ef hash: 3b3dd203be690995d1a89b110322e4eafafc3a3b

View File

@@ -165,51 +165,39 @@ esp_err_t esp_openthread_radio_process(otInstance *aInstance, const esp_openthre
if (get_event(EVENT_TX_DONE)) { if (get_event(EVENT_TX_DONE)) {
clr_event(EVENT_TX_DONE); clr_event(EVENT_TX_DONE);
#if CONFIG_OPENTHREAD_DIAG
if (otPlatDiagModeGet()) { if (s_ack_frame.mPsdu == NULL) {
otPlatDiagRadioTransmitDone(aInstance, &s_transmit_frame, OT_ERROR_NONE); otPlatRadioTxDone(aInstance, &s_transmit_frame, NULL, OT_ERROR_NONE);
} else } else {
#endif otPlatRadioTxDone(aInstance, &s_transmit_frame, &s_ack_frame, OT_ERROR_NONE);
{ esp_ieee802154_receive_handle_done(s_ack_frame.mPsdu - 1);
if (s_ack_frame.mPsdu == NULL) { s_ack_frame.mPsdu = NULL;
otPlatRadioTxDone(aInstance, &s_transmit_frame, NULL, OT_ERROR_NONE);
} else {
otPlatRadioTxDone(aInstance, &s_transmit_frame, &s_ack_frame, OT_ERROR_NONE);
esp_ieee802154_receive_handle_done(s_ack_frame.mPsdu - 1);
s_ack_frame.mPsdu = NULL;
}
} }
} }
if (get_event(EVENT_TX_FAILED)) { if (get_event(EVENT_TX_FAILED)) {
clr_event(EVENT_TX_FAILED); clr_event(EVENT_TX_FAILED);
#if CONFIG_OPENTHREAD_DIAG
if (otPlatDiagModeGet()) {
otPlatDiagRadioTransmitDone(aInstance, &s_transmit_frame, OT_ERROR_CHANNEL_ACCESS_FAILURE);
} else
#endif
{
otError err = OT_ERROR_NONE;
switch (s_tx_error) { otError err = OT_ERROR_NONE;
case ESP_IEEE802154_TX_ERR_CCA_BUSY:
case ESP_IEEE802154_TX_ERR_ABORT:
case ESP_IEEE802154_TX_ERR_COEXIST:
err = OT_ERROR_CHANNEL_ACCESS_FAILURE;
break;
case ESP_IEEE802154_TX_ERR_NO_ACK: switch (s_tx_error) {
case ESP_IEEE802154_TX_ERR_INVALID_ACK: case ESP_IEEE802154_TX_ERR_CCA_BUSY:
err = OT_ERROR_NO_ACK; case ESP_IEEE802154_TX_ERR_ABORT:
break; case ESP_IEEE802154_TX_ERR_COEXIST:
err = OT_ERROR_CHANNEL_ACCESS_FAILURE;
break;
default: case ESP_IEEE802154_TX_ERR_NO_ACK:
ETS_ASSERT(false); case ESP_IEEE802154_TX_ERR_INVALID_ACK:
break; err = OT_ERROR_NO_ACK;
} break;
otPlatRadioTxDone(aInstance, &s_transmit_frame, NULL, err); default:
ETS_ASSERT(false);
break;
} }
otPlatRadioTxDone(aInstance, &s_transmit_frame, NULL, err);
} }
if (get_event(EVENT_ENERGY_DETECT_DONE)) { if (get_event(EVENT_ENERGY_DETECT_DONE)) {
@@ -219,14 +207,7 @@ esp_err_t esp_openthread_radio_process(otInstance *aInstance, const esp_openthre
while (atomic_load(&s_recv_queue.used)) { while (atomic_load(&s_recv_queue.used)) {
if (s_receive_frame[s_recv_queue.head].mPsdu != NULL) { if (s_receive_frame[s_recv_queue.head].mPsdu != NULL) {
#if CONFIG_OPENTHREAD_DIAG otPlatRadioReceiveDone(aInstance, &s_receive_frame[s_recv_queue.head], OT_ERROR_NONE);
if (otPlatDiagModeGet()) {
otPlatDiagRadioReceiveDone(aInstance, &s_receive_frame[s_recv_queue.head], OT_ERROR_NONE);
} else
#endif
{
otPlatRadioReceiveDone(aInstance, &s_receive_frame[s_recv_queue.head], OT_ERROR_NONE);
}
esp_ieee802154_receive_handle_done(s_receive_frame[s_recv_queue.head].mPsdu - 1); esp_ieee802154_receive_handle_done(s_receive_frame[s_recv_queue.head].mPsdu - 1);
s_receive_frame[s_recv_queue.head].mPsdu = NULL; s_receive_frame[s_recv_queue.head].mPsdu = NULL;
s_recv_queue.head = (s_recv_queue.head + 1) % CONFIG_IEEE802154_RX_BUFFER_SIZE; s_recv_queue.head = (s_recv_queue.head + 1) % CONFIG_IEEE802154_RX_BUFFER_SIZE;

View File

@@ -100,10 +100,6 @@ esp_err_t esp_openthread_radio_init(const esp_openthread_platform_config_t *conf
ot::Spinel::RadioSpinelCallbacks callbacks; ot::Spinel::RadioSpinelCallbacks callbacks;
memset(&callbacks, 0, sizeof(callbacks)); memset(&callbacks, 0, sizeof(callbacks));
#if CONFIG_OPENTHREAD_DIAG
callbacks.mDiagReceiveDone = otPlatDiagRadioReceiveDone;
callbacks.mDiagTransmitDone = otPlatDiagRadioTransmitDone;
#endif // CONFIG_OPENTHREAD_DIAG
callbacks.mEnergyScanDone = otPlatRadioEnergyScanDone; callbacks.mEnergyScanDone = otPlatRadioEnergyScanDone;
callbacks.mReceiveDone = otPlatRadioReceiveDone; callbacks.mReceiveDone = otPlatRadioReceiveDone;
callbacks.mTransmitDone = otPlatRadioTxDone; callbacks.mTransmitDone = otPlatRadioTxDone;

View File

@@ -185,58 +185,6 @@ void SwitchoverDone(otInstance *aInstance, bool aSuccess)
s_esp_radio_spinel_callbacks[idx].switchover_done(aSuccess); s_esp_radio_spinel_callbacks[idx].switchover_done(aSuccess);
} }
#if CONFIG_OPENTHREAD_DIAG
void DiagReceiveDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
esp_radio_spinel_idx_t idx = get_index_from_instance(aInstance);
assert(s_esp_radio_spinel_callbacks[idx].diag_receive_done);
uint8_t *frame = (uint8_t *)malloc(aFrame->mLength + 1);
esp_ieee802154_frame_info_t frame_info;
if (frame) {
frame[0] = aFrame->mLength;
memcpy((void *)(frame + 1), aFrame->mPsdu, frame[0]);
frame_info.rssi = aFrame->mInfo.mRxInfo.mRssi;
frame_info.timestamp = aFrame->mInfo.mRxInfo.mTimestamp;
frame_info.pending = aFrame->mInfo.mRxInfo.mAckedWithFramePending;
s_esp_radio_spinel_callbacks[idx].diag_receive_done(frame, &frame_info);
free(frame);
} else {
ESP_LOGE(ESP_SPINEL_LOG_TAG, "Fail to alloc memory for frame");
}
}
void DiagTransmitDone(otInstance *aInstance, otRadioFrame *aFrame, otError aError)
{
esp_radio_spinel_idx_t idx = get_index_from_instance(aInstance);
assert(s_esp_radio_spinel_callbacks[idx].diag_transmit_done && s_esp_radio_spinel_callbacks[idx].diag_transmit_failed);
if (aError == OT_ERROR_NONE) {
uint8_t *frame = (uint8_t *)malloc(aFrame->mLength + 1);
if (frame) {
esp_ieee802154_frame_info_t ack_info;
frame[0] = aFrame->mLength;
memcpy((void *)(frame + 1), aFrame->mPsdu, frame[0]);
s_esp_radio_spinel_callbacks[idx].diag_transmit_done(frame, &ack_info);
free(frame);
} else {
ESP_LOGE(ESP_SPINEL_LOG_TAG, "Fail to alloc memory for frame");
}
} else {
switch (aError) {
case OT_ERROR_CHANNEL_ACCESS_FAILURE:
s_esp_radio_spinel_callbacks[idx].diag_transmit_failed(ESP_IEEE802154_TX_ERR_CCA_BUSY);
break;
case OT_ERROR_NO_ACK:
s_esp_radio_spinel_callbacks[idx].diag_transmit_failed(ESP_IEEE802154_TX_ERR_NO_ACK);
break;
default:
s_esp_radio_spinel_callbacks[idx].diag_transmit_failed(ESP_IEEE802154_TX_ERR_CCA_BUSY);
break;
}
}
}
#endif // CONFIG_OPENTHREAD_DIAG
void esp_radio_spinel_set_callbacks(const esp_radio_spinel_callbacks_t aCallbacks, esp_radio_spinel_idx_t idx) void esp_radio_spinel_set_callbacks(const esp_radio_spinel_callbacks_t aCallbacks, esp_radio_spinel_idx_t idx)
{ {
s_esp_radio_spinel_callbacks[idx] = aCallbacks; s_esp_radio_spinel_callbacks[idx] = aCallbacks;
@@ -247,10 +195,6 @@ void esp_radio_spinel_set_callbacks(const esp_radio_spinel_callbacks_t aCallback
Callbacks.mEnergyScanDone = EnergyScanDone; Callbacks.mEnergyScanDone = EnergyScanDone;
Callbacks.mTxStarted = TxStarted; Callbacks.mTxStarted = TxStarted;
Callbacks.mSwitchoverDone = SwitchoverDone; Callbacks.mSwitchoverDone = SwitchoverDone;
#if CONFIG_OPENTHREAD_DIAG
Callbacks.mDiagReceiveDone = DiagReceiveDone;
Callbacks.mDiagTransmitDone = DiagTransmitDone;
#endif // CONFIG_OPENTHREAD_DIAG
s_radio[idx].SetCallbacks(Callbacks); s_radio[idx].SetCallbacks(Callbacks);
} }