Skip to content

Commit 815dd27

Browse files
Thalleynashif
authored andcommitted
Bluetooth: buf: Update BT_BUF_RX_SIZE with ISO
The BT_BUF_RX_SIZE did not take the CONFIG_BT_ISO_RX_MTU into account. Add BT_BUF_ISO_RX_SIZE which depend on CONFIG_BT_ISO and use that for the BT_BUF_RX_SIZE macro. Furthermore, move the BT_BUF_RX_COUNT macro definitions into buf.h and update that to account for ISO RX as well. Signed-off-by: Emil Gydesen <[email protected]>
1 parent 1fb6c63 commit 815dd27

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

include/bluetooth/buf.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,22 @@ struct bt_buf_data {
7979
/** Data size needed for HCI Event RX buffers */
8080
#define BT_BUF_EVT_RX_SIZE BT_BUF_EVT_SIZE(CONFIG_BT_BUF_EVT_RX_SIZE)
8181

82-
/** Data size needed for HCI ACL or Event RX buffers */
83-
#define BT_BUF_RX_SIZE (MAX(BT_BUF_ACL_RX_SIZE, BT_BUF_EVT_RX_SIZE))
82+
#if defined(CONFIG_BT_ISO)
83+
#define BT_BUF_ISO_RX_SIZE BT_BUF_ISO_SIZE(CONFIG_BT_ISO_RX_MTU)
84+
#define BT_BUF_ISO_RX_COUNT CONFIG_BT_ISO_RX_BUF_COUNT
85+
#else
86+
#define BT_BUF_ISO_RX_SIZE 0
87+
#define BT_BUF_ISO_RX_COUNT 0
88+
#endif /* CONFIG_BT_ISO */
89+
90+
/** Data size needed for HCI ACL, HCI ISO or Event RX buffers */
91+
#define BT_BUF_RX_SIZE (MAX(MAX(BT_BUF_ACL_RX_SIZE, BT_BUF_EVT_RX_SIZE), \
92+
BT_BUF_ISO_RX_SIZE))
93+
94+
/** Buffer count needed for HCI ACL, HCI ISO or Event RX buffers */
95+
#define BT_BUF_RX_COUNT (MAX(MAX(CONFIG_BT_BUF_EVT_RX_COUNT, \
96+
CONFIG_BT_BUF_ACL_RX_COUNT), \
97+
BT_BUF_ISO_RX_COUNT))
8498

8599
/** Data size needed for HCI Command buffers. */
86100
#define BT_BUF_CMD_TX_SIZE BT_BUF_CMD_SIZE(CONFIG_BT_BUF_CMD_TX_SIZE)

subsys/bluetooth/host/buf.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ NET_BUF_POOL_FIXED_DEFINE(evt_pool, CONFIG_BT_BUF_EVT_RX_COUNT,
5353
BT_BUF_EVT_RX_SIZE, 8,
5454
NULL);
5555
#else
56-
#define BT_BUF_RX_COUNT MAX(CONFIG_BT_BUF_EVT_RX_COUNT, CONFIG_BT_BUF_ACL_RX_COUNT)
5756
NET_BUF_POOL_FIXED_DEFINE(hci_rx_pool, BT_BUF_RX_COUNT,
5857
BT_BUF_RX_SIZE, 8,
5958
NULL);

subsys/bluetooth/host/hci_raw.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ static uint8_t raw_mode = BT_HCI_RAW_MODE_H4;
3838
static uint8_t raw_mode;
3939
#endif
4040

41-
#define BT_BUF_RX_COUNT MAX(CONFIG_BT_BUF_EVT_RX_COUNT, CONFIG_BT_BUF_ACL_RX_COUNT)
4241
NET_BUF_POOL_FIXED_DEFINE(hci_rx_pool, BT_BUF_RX_COUNT,
4342
BT_BUF_RX_SIZE, 8, NULL);
4443
NET_BUF_POOL_FIXED_DEFINE(hci_cmd_pool, CONFIG_BT_BUF_CMD_TX_COUNT,

0 commit comments

Comments
 (0)