3737
3838static int init_reset (void );
3939static void isr_done (void * param );
40- static int isr_rx_pdu (struct lll_conn * lll , struct pdu_data * pdu_data_rx ,
41- struct node_tx * * tx_release , uint8_t * is_rx_enqueue );
40+ static inline int isr_rx_pdu (struct lll_conn * lll , struct pdu_data * pdu_data_rx ,
41+ uint8_t * is_rx_enqueue ,
42+ struct node_tx * * tx_release , uint8_t * is_done );
4243static struct pdu_data * empty_tx_enqueue (struct lll_conn * lll );
4344
4445static uint16_t const sca_ppm_lut [] = {500 , 250 , 150 , 100 , 75 , 50 , 30 , 20 };
@@ -132,12 +133,11 @@ void lll_conn_isr_rx(void *param)
132133 struct pdu_data * pdu_data_tx ;
133134 struct node_rx_pdu * node_rx ;
134135 uint8_t is_empty_pdu_tx_retry ;
135- uint8_t is_crc_backoff = 0U ;
136136 uint8_t is_rx_enqueue = 0U ;
137137 uint8_t is_ull_rx = 0U ;
138+ uint8_t is_done = 0U ;
138139 uint8_t rssi_ready ;
139140 uint8_t trx_done ;
140- uint8_t is_done ;
141141 uint8_t crc_ok ;
142142
143143#if defined(CONFIG_BT_CTLR_PROFILE_ISR )
@@ -174,7 +174,8 @@ void lll_conn_isr_rx(void *param)
174174 if (crc_ok ) {
175175 uint32_t err ;
176176
177- err = isr_rx_pdu (lll , pdu_data_rx , & tx_release , & is_rx_enqueue );
177+ err = isr_rx_pdu (lll , pdu_data_rx , & is_rx_enqueue , & tx_release ,
178+ & is_done );
178179 if (err ) {
179180 goto lll_conn_isr_rx_exit ;
180181 }
@@ -192,16 +193,16 @@ void lll_conn_isr_rx(void *param)
192193
193194 /* CRC error countdown */
194195 crc_expire -- ;
195- is_crc_backoff = (crc_expire == 0U );
196+ is_done = (crc_expire == 0U );
196197 }
197198
198199 /* prepare tx packet */
199200 is_empty_pdu_tx_retry = lll -> empty ;
200201 lll_conn_pdu_tx_prep (lll , & pdu_data_tx );
201202
202203 /* Decide on event continuation and hence Radio Shorts to use */
203- is_done = is_crc_backoff || ((crc_ok ) && (pdu_data_rx -> md == 0 ) &&
204- (pdu_data_tx -> len == 0 ));
204+ is_done = is_done || ((crc_ok ) && (pdu_data_rx -> md == 0 ) &&
205+ (pdu_data_tx -> len == 0 ));
205206
206207 if (is_done ) {
207208 radio_isr_set (isr_done , param );
@@ -607,8 +608,9 @@ static inline bool ctrl_pdu_len_check(uint8_t len)
607608
608609}
609610
610- static int isr_rx_pdu (struct lll_conn * lll , struct pdu_data * pdu_data_rx ,
611- struct node_tx * * tx_release , uint8_t * is_rx_enqueue )
611+ static inline int isr_rx_pdu (struct lll_conn * lll , struct pdu_data * pdu_data_rx ,
612+ uint8_t * is_rx_enqueue ,
613+ struct node_tx * * tx_release , uint8_t * is_done )
612614{
613615#if defined(CONFIG_SOC_COMPATIBLE_NRF52832 ) && \
614616 defined(CONFIG_BT_CTLR_LE_ENC ) && \
@@ -625,10 +627,11 @@ static int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx,
625627
626628 /* Ack for tx-ed data */
627629 if (pdu_data_rx -> nesn != lll -> sn ) {
630+ struct pdu_data * pdu_data_tx ;
628631 struct node_tx * tx ;
629632 memq_link_t * link ;
630633
631- /* Increment serial number */
634+ /* Increment sequence number */
632635 lll -> sn ++ ;
633636
634637#if defined(CONFIG_BT_PERIPHERAL )
@@ -645,11 +648,16 @@ static int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx,
645648 (void * * )& tx );
646649 } else {
647650 lll -> empty = 0 ;
651+
652+ pdu_data_tx = (void * )radio_pkt_empty_get ();
653+ if (IS_ENABLED (CONFIG_BT_CENTRAL ) && !lll -> role ) {
654+ * is_done = !pdu_data_tx -> md ;
655+ }
656+
648657 link = NULL ;
649658 }
650659
651660 if (link ) {
652- struct pdu_data * pdu_data_tx ;
653661 uint8_t pdu_data_tx_len ;
654662 uint8_t offset ;
655663
@@ -684,6 +692,10 @@ static int isr_rx_pdu(struct lll_conn *lll, struct pdu_data *pdu_data_rx,
684692
685693 * tx_release = tx ;
686694 }
695+
696+ if (IS_ENABLED (CONFIG_BT_CENTRAL ) && !lll -> role ) {
697+ * is_done = !pdu_data_tx -> md ;
698+ }
687699 }
688700 }
689701
0 commit comments