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:
commit
57f0dc9e9a
@ -151,6 +151,9 @@ void ieee802154_submac_ack_timer_cancel(ieee802154_submac_t *submac)
|
|||||||
submac);
|
submac);
|
||||||
|
|
||||||
xtimer_remove(&netdev_submac->ack_timer);
|
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)
|
static int _send(netdev_t *netdev, const iolist_t *pkt)
|
||||||
|
@ -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.
|
* 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
|
* @param[in] submac pointer to the SubMAC descriptor
|
||||||
*/
|
*/
|
||||||
|
@ -139,6 +139,10 @@ void ieee802154_submac_ack_timer_cancel(ieee802154_submac_t *submac)
|
|||||||
{
|
{
|
||||||
(void)submac;
|
(void)submac;
|
||||||
ztimer_remove(ZTIMER_USEC, &ack_timer);
|
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)
|
static void _ack_timeout(void *arg)
|
||||||
|
Loading…
Reference in New Issue
Block a user