|
28 | 28 | #define NUM_COMLETE_EVENT_SIZE BT_BUF_EVT_SIZE( \
|
29 | 29 | sizeof(struct bt_hci_cp_host_num_completed_packets) + \
|
30 | 30 | MAX_EVENT_COUNT * sizeof(struct bt_hci_handle_count))
|
31 |
| -/* Dedicated pool for HCI_Number_of_Completed_Packets. This event is always |
32 |
| - * consumed synchronously by bt_recv_prio() so a single buffer is enough. |
33 |
| - * Having a dedicated pool for it ensures that exhaustion of the RX pool |
34 |
| - * cannot block the delivery of this priority event. |
| 31 | + |
| 32 | +/* Pool for RX HCI buffers that are always freed by `bt_recv` |
| 33 | + * before it returns. |
| 34 | + * |
| 35 | + * A singleton buffer shall be sufficient for correct operation. |
| 36 | + * The buffer count may be increased as an optimization to allow |
| 37 | + * the HCI transport to fill buffers in parallel with `bt_recv` |
| 38 | + * consuming them. |
35 | 39 | */
|
36 |
| -NET_BUF_POOL_FIXED_DEFINE(num_complete_pool, 1, NUM_COMLETE_EVENT_SIZE, |
37 |
| - sizeof(struct bt_buf_data), NULL); |
| 40 | +#define SYNC_EVT_SIZE NUM_COMLETE_EVENT_SIZE |
| 41 | +NET_BUF_POOL_FIXED_DEFINE(sync_evt_pool, 1, SYNC_EVT_SIZE, sizeof(struct bt_buf_data), NULL); |
38 | 42 | #endif /* CONFIG_BT_CONN || CONFIG_BT_ISO */
|
39 | 43 |
|
40 | 44 | NET_BUF_POOL_FIXED_DEFINE(discardable_pool, CONFIG_BT_BUF_EVT_DISCARDABLE_COUNT,
|
@@ -92,7 +96,7 @@ struct net_buf *bt_buf_get_evt(uint8_t evt, bool discardable,
|
92 | 96 | switch (evt) {
|
93 | 97 | #if defined(CONFIG_BT_CONN) || defined(CONFIG_BT_ISO)
|
94 | 98 | case BT_HCI_EVT_NUM_COMPLETED_PACKETS:
|
95 |
| - buf = net_buf_alloc(&num_complete_pool, timeout); |
| 99 | + buf = net_buf_alloc(&sync_evt_pool, timeout); |
96 | 100 | break;
|
97 | 101 | #endif /* CONFIG_BT_CONN || CONFIG_BT_ISO */
|
98 | 102 | default:
|
@@ -139,7 +143,7 @@ struct net_buf_pool *bt_buf_get_discardable_pool(void)
|
139 | 143 | #if defined(CONFIG_BT_CONN) || defined(CONFIG_BT_ISO)
|
140 | 144 | struct net_buf_pool *bt_buf_get_num_complete_pool(void)
|
141 | 145 | {
|
142 |
| - return &num_complete_pool; |
| 146 | + return &sync_evt_pool; |
143 | 147 | }
|
144 | 148 | #endif /* CONFIG_BT_CONN || CONFIG_BT_ISO */
|
145 | 149 | #endif /* ZTEST_UNITTEST */
|
0 commit comments