@@ -119,41 +119,12 @@ static uint8_t force_md_cnt_calc(struct lll_conn *lll_conn, uint32_t tx_rate);
119119 (LL_LENGTH_OCTETS_TX_MAX + \
120120 BT_CTLR_USER_TX_BUFFER_OVERHEAD))
121121
122- /* Encryption request is enqueued in thread context from the Tx buffer pool,
123- * so that it is serialized alongwith the already enqueued data buffers ensuring
124- * they are transmitted out to peer before encryption is setup.
125- * Allocate additional Tx buffers to accommodate simultaneous encryption setup
126- * across active connections.
127- * TODO: verify that we don't need this for the refactored LLCP
128- */
129- #define CONN_ENC_REQ_BUFFERS 0
130- #define CONN_DATA_BUFFERS (CONFIG_BT_BUF_ACL_TX_COUNT + CONN_ENC_REQ_BUFFERS)
131-
132- /**
133- * One connection may take up to 4 TX buffers for procedures
134- * simultaneously, for example 2 for encryption, 1 for termination,
135- * and 1 one that is in flight and has not been returned to the pool
136- */
137- #define CONN_TX_CTRL_BUFFERS LLCP_TX_CTRL_BUF_COUNT
138- #define CONN_TX_CTRL_BUF_SIZE MROUND(offsetof(struct node_tx, pdu) + \
139- offsetof(struct pdu_data, llctrl) + \
140- PDU_DC_CTRL_TX_SIZE_MAX)
141-
142- /* Terminate procedure state values */
143- #define TERM_REQ 1
144- #define TERM_ACKED 3
145-
146- /* CIS Establishment procedure state values */
147- #define CIS_REQUEST_AWAIT_HOST 2
122+ #define CONN_DATA_BUFFERS CONFIG_BT_BUF_ACL_TX_COUNT
148123
149- /*
150- * TODO: when the legacy LLCP is removed we can replace 'CONN_TX_CTRL_BUFFERS'
151- * with 'LLCP_TX_CTRL_BUF_COUNT'
152- */
153124static MFIFO_DEFINE (conn_tx , sizeof (struct lll_tx ), CONN_DATA_BUFFERS );
154125static MFIFO_DEFINE (conn_ack , sizeof (struct lll_tx ),
155126 (CONN_DATA_BUFFERS +
156- CONN_TX_CTRL_BUFFERS ));
127+ LLCP_TX_CTRL_BUF_COUNT ));
157128
158129static struct {
159130 void * free ;
@@ -164,7 +135,7 @@ static struct {
164135 void * free ;
165136 uint8_t pool [sizeof (memq_link_t ) *
166137 (CONN_DATA_BUFFERS +
167- CONN_TX_CTRL_BUFFERS )];
138+ LLCP_TX_CTRL_BUF_COUNT )];
168139} mem_link_tx ;
169140
170141#if defined(CONFIG_BT_CTLR_DATA_LENGTH )
@@ -984,14 +955,6 @@ void ull_conn_done(struct node_rx_event_done *done)
984955 }
985956#endif /* CONFIG_BT_CTLR_LE_ENC */
986957
987- /* Legacy LLCP:
988- * Peripheral received terminate ind or
989- * Central received ack for the transmitted terminate ind or
990- * Central transmitted ack for the received terminate ind or
991- * there has been MIC failure
992- * Refactored LLCP:
993- * reason_final is set exactly under the above conditions
994- */
995958 reason_final = conn -> llcp_terminate .reason_final ;
996959 if (reason_final ) {
997960 conn_cleanup (conn , reason_final );
@@ -1568,7 +1531,7 @@ static int init_reset(void)
15681531 /* Initialize tx link pool. */
15691532 mem_init (mem_link_tx .pool , sizeof (memq_link_t ),
15701533 (CONN_DATA_BUFFERS +
1571- CONN_TX_CTRL_BUFFERS ),
1534+ LLCP_TX_CTRL_BUF_COUNT ),
15721535 & mem_link_tx .free );
15731536
15741537 /* Initialize control procedure system. */
@@ -1756,10 +1719,8 @@ static void conn_cleanup_iso_cis_released_cb(struct ll_conn *conn)
17561719static void conn_cleanup_finalize (struct ll_conn * conn )
17571720{
17581721 struct lll_conn * lll = & conn -> lll ;
1759- struct node_rx_pdu * rx ;
17601722 uint32_t ticker_status ;
17611723
1762- ARG_UNUSED (rx );
17631724 ull_cp_state_set (conn , ULL_CP_DISCONNECTED );
17641725
17651726 /* Update tx buffer queue handling */
@@ -1921,13 +1882,13 @@ static void tx_lll_flush(void *param)
19211882 (void * * )& tx );
19221883 while (link ) {
19231884 uint8_t idx ;
1924- struct lll_tx * lll_tx2 ;
1885+ struct lll_tx * tx_buf ;
19251886
1926- idx = MFIFO_ENQUEUE_GET (conn_ack , (void * * )& lll_tx2 );
1927- LL_ASSERT (lll_tx2 );
1887+ idx = MFIFO_ENQUEUE_GET (conn_ack , (void * * )& tx_buf );
1888+ LL_ASSERT (tx_buf );
19281889
1929- lll_tx2 -> handle = LLL_HANDLE_INVALID ;
1930- lll_tx2 -> node = tx ;
1890+ tx_buf -> handle = LLL_HANDLE_INVALID ;
1891+ tx_buf -> node = tx ;
19311892
19321893 /* TX node UPSTREAM, i.e. Tx node ack path */
19331894 link -> next = tx -> next ; /* Indicates ctrl pool or data pool */
@@ -1949,8 +1910,7 @@ static void tx_lll_flush(void *param)
19491910 rx -> hdr .link = NULL ;
19501911
19511912 /* Enqueue the terminate towards ULL context */
1952- ull_rx_put (link , rx );
1953- ull_rx_sched ();
1913+ ull_rx_put_sched (link , rx );
19541914}
19551915
19561916#if defined(CONFIG_BT_CTLR_LLID_DATA_START_EMPTY )
@@ -2484,11 +2444,6 @@ void ull_dle_local_tx_update(struct ll_conn *conn, uint16_t tx_octets, uint16_t
24842444
24852445void ull_dle_init (struct ll_conn * conn , uint8_t phy )
24862446{
2487- /*
2488- * TODO:
2489- * legacy code uses the maximum of the time for 1M phy and actual phy
2490- * for max_time_min, to be verified if that is required here as well
2491- */
24922447#if defined(CONFIG_BT_CTLR_PHY )
24932448 const uint16_t max_time_min = PDU_DC_MAX_US (PDU_DC_PAYLOAD_SIZE_MIN , phy );
24942449 const uint16_t max_time_max = PDU_DC_MAX_US (LL_LENGTH_OCTETS_RX_MAX , phy );
0 commit comments