diff --git a/source/MAC/IEEE802_15_4/mac_mcps_sap.c b/source/MAC/IEEE802_15_4/mac_mcps_sap.c index ff39b591c79..8389ba959b1 100644 --- a/source/MAC/IEEE802_15_4/mac_mcps_sap.c +++ b/source/MAC/IEEE802_15_4/mac_mcps_sap.c @@ -1423,13 +1423,20 @@ static void mcps_data_confirm_handle(protocol_interface_rf_mac_setup_s *rf_ptr, // FHSS checks if this failed buffer needs to be pushed back to TX queue and retransmitted if ((rf_ptr->mac_tx_result == MAC_TX_FAIL) || (rf_ptr->mac_tx_result == MAC_CCA_FAIL)) { if (rf_ptr->fhss_api->data_tx_fail(rf_ptr->fhss_api, buffer->msduHandle, mac_convert_frame_type_to_fhss(buffer->fcf_dsn.frametype)) == true) { + + if (rf_ptr->mac_tx_result == MAC_TX_FAIL) { + buffer->fhss_retry_count += 1 + rf_ptr->mac_tx_status.retry; + } else { + buffer->fhss_retry_count += rf_ptr->mac_tx_status.retry; + } + buffer->fhss_cca_retry_count += rf_ptr->mac_tx_status.cca_cnt; mcps_sap_pd_req_queue_write(rf_ptr, buffer); return; } } } - confirm.cca_retries = rf_ptr->mac_tx_status.cca_cnt; - confirm.tx_retries = rf_ptr->mac_tx_status.retry; + confirm.cca_retries = rf_ptr->mac_tx_status.cca_cnt + buffer->fhss_cca_retry_count; + confirm.tx_retries = rf_ptr->mac_tx_status.retry + buffer->fhss_retry_count; mac_common_data_confirmation_handle(rf_ptr, buffer); confirm.msduHandle = buffer->msduHandle; confirm.status = buffer->status; diff --git a/source/MAC/IEEE802_15_4/mac_mcps_sap.h b/source/MAC/IEEE802_15_4/mac_mcps_sap.h index e5cd63995ab..ea8acee933d 100644 --- a/source/MAC/IEEE802_15_4/mac_mcps_sap.h +++ b/source/MAC/IEEE802_15_4/mac_mcps_sap.h @@ -132,6 +132,8 @@ typedef struct mac_pre_build_frame { uint8_t status; uint8_t asynch_channel; uint8_t csma_periods_left; + uint8_t fhss_retry_count; + uint8_t fhss_cca_retry_count; uint32_t tx_time; bool upper_layer_request; bool mac_allocated_payload_ptr: 1;