This is an automated email from the ASF dual-hosted git repository.
andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git
The following commit(s) were added to refs/heads/master by this push:
new e4f97e24a nimble/ll: Fix closing connection event on CRC error
e4f97e24a is described below
commit e4f97e24a1c5844bae9fa45ad846324008cf14e0
Author: Andrzej Kaczmarek <[email protected]>
AuthorDate: Mon Nov 25 15:27:12 2024 +0100
nimble/ll: Fix closing connection event on CRC error
If single CRC error is received we should always reply to allow other
side to retransmit the packet.
If two consecutive CRC errors are received, we will close the connection
event.
---
nimble/controller/src/ble_ll_conn.c | 29 +++++++----------------------
1 file changed, 7 insertions(+), 22 deletions(-)
diff --git a/nimble/controller/src/ble_ll_conn.c
b/nimble/controller/src/ble_ll_conn.c
index c671a3996..65ff4cb0d 100644
--- a/nimble/controller/src/ble_ll_conn.c
+++ b/nimble/controller/src/ble_ll_conn.c
@@ -3750,30 +3750,15 @@ ble_ll_conn_rx_isr_end(uint8_t *rxbuf, struct
ble_mbuf_hdr *rxhdr)
*/
if (!BLE_MBUF_HDR_CRC_OK(rxhdr)) {
/*
- * Increment # of consecutively received CRC errors. If more than
- * one we will end the connection event.
+ * Increment # of consecutively received CRC errors.
+ *
+ * If more than one, we will end the connection event and no reply is
needed.
+ * If less or equal to one, we always reply:
+ * - peripheral always replies
+ * - central replies to allow peripheral retransmit the packet
*/
++connsm->cons_rxd_bad_crc;
- if (connsm->cons_rxd_bad_crc >= 2) {
- reply = 0;
- } else {
- switch (connsm->conn_role) {
-#if MYNEWT_VAL(BLE_LL_ROLE_CENTRAL)
- case BLE_LL_CONN_ROLE_CENTRAL:
- reply = connsm->flags.last_txd_md;
- break;
-#endif
-#if MYNEWT_VAL(BLE_LL_ROLE_PERIPHERAL)
- case BLE_LL_CONN_ROLE_PERIPHERAL:
- /* A peripheral always responds with a packet */
- reply = 1;
- break;
-#endif
- default:
- BLE_LL_ASSERT(0);
- break;
- }
- }
+ reply = connsm->cons_rxd_bad_crc < 2;
} else {
/* Reset consecutively received bad crcs (since this one was good!) */
connsm->cons_rxd_bad_crc = 0;