@@ -536,76 +536,14 @@ void lll_conn_pdu_tx_prep(struct lll_conn *lll, struct pdu_data **pdu_data_tx)
536536 p -> len = lll -> packet_tx_head_len - lll -> packet_tx_head_offset ;
537537 p -> md = 0 ;
538538
539- #if defined(CONFIG_BT_CTLR_DATA_LENGTH )
540- #if defined(CONFIG_BT_CTLR_PHY )
541- switch (lll -> phy_tx_time ) {
542- default :
543- case BIT (0 ):
544- /* 1M PHY, 1us = 1 bit, hence divide by 8.
545- * Deduct 10 bytes for preamble (1), access address (4),
546- * header (2), and CRC (3).
547- */
548- max_tx_octets = (lll -> max_tx_time >> 3 ) - 10 ;
549- break ;
550-
551- case BIT (1 ):
552- /* 2M PHY, 1us = 2 bits, hence divide by 4.
553- * Deduct 11 bytes for preamble (2), access address (4),
554- * header (2), and CRC (3).
555- */
556- max_tx_octets = (lll -> max_tx_time >> 2 ) - 11 ;
557- break ;
558-
559- #if defined(CONFIG_BT_CTLR_PHY_CODED )
560- case BIT (2 ):
561- if (lll -> phy_flags & 0x01 ) {
562- /* S8 Coded PHY, 8us = 1 bit, hence divide by
563- * 64.
564- * Subtract time for preamble (80), AA (256),
565- * CI (16), TERM1 (24), CRC (192) and
566- * TERM2 (24), total 592 us.
567- * Subtract 2 bytes for header.
568- */
569- max_tx_octets = ((lll -> max_tx_time - 592 ) >>
570- 6 ) - 2 ;
571- } else {
572- /* S2 Coded PHY, 2us = 1 bit, hence divide by
573- * 16.
574- * Subtract time for preamble (80), AA (256),
575- * CI (16), TERM1 (24), CRC (48) and
576- * TERM2 (6), total 430 us.
577- * Subtract 2 bytes for header.
578- */
579- max_tx_octets = ((lll -> max_tx_time - 430 ) >>
580- 4 ) - 2 ;
581- }
582- break ;
583- #endif /* CONFIG_BT_CTLR_PHY_CODED */
584- }
585-
586- #if defined(CONFIG_BT_CTLR_LE_ENC )
587- if (lll -> enc_tx ) {
588- /* deduct the MIC */
589- max_tx_octets -= 4U ;
590- }
591- #endif /* CONFIG_BT_CTLR_LE_ENC */
592-
593- if (max_tx_octets > lll -> max_tx_octets ) {
594- max_tx_octets = lll -> max_tx_octets ;
595- }
596- #else /* !CONFIG_BT_CTLR_PHY */
597- max_tx_octets = lll -> max_tx_octets ;
598- #endif /* !CONFIG_BT_CTLR_PHY */
599- #else /* !CONFIG_BT_CTLR_DATA_LENGTH */
600- max_tx_octets = PDU_DC_PAYLOAD_SIZE_MIN ;
601- #endif /* !CONFIG_BT_CTLR_DATA_LENGTH */
539+ max_tx_octets = ull_conn_lll_max_tx_octets_get (lll );
602540
603541 if (p -> len > max_tx_octets ) {
604542 p -> len = max_tx_octets ;
605543 p -> md = 1 ;
606544 }
607545
608- if (link -> next ) {
546+ if (link -> next != lll -> memq_tx . tail ) {
609547 p -> md = 1 ;
610548 }
611549 }
0 commit comments