Skip to content

Commit a42d6c9

Browse files
rlubosjukkar
authored andcommitted
drivers: ieee802154_nrf5: Block on net_pkt allocation in the RX path
Currently, if no net_pkt's are available, the radio driver RX thread drops the 802.15.4 frame silently. This causes undesired behaviour, where we can drop the packet which has already been acknowledged at the 802.15.4 level. Fix this, by blocking the RX thread if no net_pkt is avaliable. The packets received while the RX thread is blocked will be accumulated in the underlying nRF 802.15.4 driver, and eventually when it runs out of internal buffers before the thread is unblocked, it'll stop acknowledging the incoming frames. Signed-off-by: Robert Lubos <[email protected]>
1 parent a8d3c8e commit a42d6c9

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

drivers/ieee802154/ieee802154_nrf5.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,14 @@ static void nrf5_rx_thread(void *arg1, void *arg2, void *arg3)
133133

134134
LOG_DBG("Frame received");
135135

136+
/* Block the RX thread until net_pkt is available, so that we
137+
* don't drop already ACKed frame in case of temporary net_pkt
138+
* scarcity. The nRF 802154 radio driver will accumulate any
139+
* incoming frames until it runs out of internal buffers (and
140+
* thus stops acknowledging consecutive frames).
141+
*/
136142
pkt = net_pkt_rx_alloc_with_buffer(nrf5_radio->iface, pkt_len,
137-
AF_UNSPEC, 0, K_NO_WAIT);
138-
if (!pkt) {
139-
LOG_ERR("No pkt available");
140-
goto drop;
141-
}
143+
AF_UNSPEC, 0, K_FOREVER);
142144

143145
if (net_pkt_write(pkt, rx_frame->psdu + 1, pkt_len)) {
144146
goto drop;

0 commit comments

Comments
 (0)