Skip to content

Commit bda50c8

Browse files
committed
Bluetooth: Controller: Port HCI Command buffer allocation
Refer to commit zephyrproject-rtos/zephyr@d382fca Signed-off-by: Vinayak Kariappa Chettimada <[email protected]> (cherry picked from commit beadde7) Signed-off-by: Vinayak Kariappa Chettimada <[email protected]>
1 parent 51349d2 commit bda50c8

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

subsys/bluetooth/controller/hci_internal_wrappers.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@
3636
* to avoid deadlocks due to missing CMD buffers, if the host is only allocating the next command
3737
* once the previous is completed.
3838
*/
39-
BUILD_ASSERT(BT_BUF_ACL_RX_COUNT < CONFIG_BT_BUF_CMD_TX_COUNT,
39+
#define BT_BUF_CMD_TX_COUNT CONFIG_BT_BUF_CMD_TX_COUNT
40+
41+
BUILD_ASSERT(BT_BUF_ACL_RX_COUNT < BT_BUF_CMD_TX_COUNT,
4042
"Too low HCI command buffers compared to ACL Rx buffers.");
4143
#else /* controller-only build */
4244
/*
@@ -46,7 +48,9 @@ BUILD_ASSERT(BT_BUF_ACL_RX_COUNT < CONFIG_BT_BUF_CMD_TX_COUNT,
4648
* do flow control, at least one more buffer is needed.
4749
*
4850
*/
49-
BUILD_ASSERT((CONFIG_BT_BUF_CMD_TX_COUNT - 1) > 0,
51+
#define BT_BUF_CMD_TX_COUNT (BT_BUF_RX_COUNT + 1)
52+
53+
BUILD_ASSERT((BT_BUF_CMD_TX_COUNT - 1) > 0,
5054
"We need at least two HCI command buffers to avoid deadlocks.");
5155
#endif /* CONFIG_BT_CONN && CONFIG_BT_HCI_HOST */
5256

@@ -71,7 +75,7 @@ int sdc_hci_cmd_cb_host_buffer_size_wrapper(const sdc_hci_cmd_cb_host_buffer_siz
7175
sdc_hci_cmd_cb_host_buffer_size_t ctrl_cmd_params = *cmd_params;
7276

7377
ctrl_cmd_params.host_total_num_acl_data_packets = MIN(
74-
ctrl_cmd_params.host_total_num_acl_data_packets, (CONFIG_BT_BUF_CMD_TX_COUNT - 1));
78+
ctrl_cmd_params.host_total_num_acl_data_packets, (BT_BUF_CMD_TX_COUNT - 1));
7579

7680
return sdc_hci_cmd_cb_host_buffer_size(&ctrl_cmd_params);
7781
}

0 commit comments

Comments
 (0)