1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Merge pull request #16964 from jia200x/pr/submac/rx_ack_race_condition

ieee802154/submac: avoid race condition between RX_DONE and ACK_TIMEOUT
This commit is contained in:
benpicco 2021-10-11 23:43:45 +02:00 committed by GitHub
commit 57f0dc9e9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View File

@ -151,6 +151,9 @@ void ieee802154_submac_ack_timer_cancel(ieee802154_submac_t *submac)
submac);
xtimer_remove(&netdev_submac->ack_timer);
/* Prevent a race condition between the RX_DONE event and the ACK timeout */
netdev_submac->isr_flags &= ~NETDEV_SUBMAC_FLAGS_ACK_TIMEOUT;
}
static int _send(netdev_t *netdev, const iolist_t *pkt)

View File

@ -544,7 +544,9 @@ ieee802154_fsm_state_t ieee802154_submac_process_ev(ieee802154_submac_t *submac,
*
* This function must be called when the ACK timeout timer fires.
*
* @note this function should not be called inside ISR context.
* @note this function should not be called inside ISR context and MUST NOT
* be invoked if @ref ieee802154_submac_ack_timer_cancel was already
* called.
*
* @param[in] submac pointer to the SubMAC descriptor
*/

View File

@ -139,6 +139,10 @@ void ieee802154_submac_ack_timer_cancel(ieee802154_submac_t *submac)
{
(void)submac;
ztimer_remove(ZTIMER_USEC, &ack_timer);
/* Avoid race conditions between RX_DONE and ACK_TIMEOUT */
if (ev_ack_timeout.list_node.next) {
event_cancel(EVENT_PRIO_HIGHEST, &ev_ack_timeout);
}
}
static void _ack_timeout(void *arg)