bluetooth: controller: Static mem_pdu_rx, remove PDU_RX_SIZE_MIN
mem_pdu_rx is not runtime resized meaning PDU_RX_SIZE_MIN is no longer relevant. Dynamic resizing was a left-over from the old bt controller. Its size field was only ever set to PDU_RX_SIZE_MIN. PDU_RX_SIZE_MIN only accounted for advertise PDUs. So we remove size field from mem_pdu_rx. However, the rest of the BT controller expects to be able to pull RX_CNT-number of valid nodes from the pool at init/reset (rx_alloc) time. This will fail unless we inflate the capacity by one. To avoid inflation-by-one, mem_* would have to be rewritten to avoid always-one-extra pattern. Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
This commit is contained in:
parent
e24d1efe7c
commit
406dc2cb0e
2 changed files with 18 additions and 14 deletions
|
@ -7,12 +7,23 @@
|
|||
|
||||
#define BDADDR_SIZE 6
|
||||
|
||||
/* PDU Sizes */
|
||||
/*
|
||||
* PDU Sizes
|
||||
*/
|
||||
/* Advertisement channel maximum payload size */
|
||||
#define PDU_AC_PAYLOAD_SIZE_MAX 37
|
||||
#define PDU_AC_SIZE_MAX (offsetof(struct pdu_adv, payload) + \
|
||||
PDU_AC_PAYLOAD_SIZE_MAX)
|
||||
/* Link Layer header size of Adv PDU. Assumes pdu_adv is packed */
|
||||
#define PDU_AC_LL_HEADER_SIZE (offsetof(struct pdu_adv, payload))
|
||||
/* Advertisement channel maximum PDU size */
|
||||
#define PDU_AC_SIZE_MAX (PDU_AC_LL_HEADER_SIZE + PDU_AC_PAYLOAD_SIZE_MAX)
|
||||
|
||||
/* Data channel minimum payload */
|
||||
#define PDU_DC_PAYLOAD_SIZE_MIN 27
|
||||
#define PDU_EM_SIZE_MAX offsetof(struct pdu_data, lldata)
|
||||
/* Link Layer header size of Data PDU. Assumes pdu_data is packed */
|
||||
#define PDU_DC_LL_HEADER_SIZE (offsetof(struct pdu_data, lldata))
|
||||
|
||||
/* Max size of an empty PDU. TODO: Remove; only used in Nordic LLL */
|
||||
#define PDU_EM_SIZE_MAX (PDU_DC_LL_HEADER_SIZE)
|
||||
|
||||
/* Extra bytes for enqueued node_rx metadata: rssi (always), resolving
|
||||
* index, directed adv report, and mesh channel and instant.
|
||||
|
|
|
@ -144,10 +144,6 @@ static struct {
|
|||
static MFIFO_DEFINE(pdu_rx_free, sizeof(void *), PDU_RX_CNT);
|
||||
static MFIFO_DEFINE(ll_pdu_rx_free, sizeof(void *), LL_PDU_RX_CNT);
|
||||
|
||||
#define PDU_RX_SIZE_MIN MROUND(offsetof(struct node_rx_pdu, pdu) + \
|
||||
sizeof(struct node_rx_ftr) + \
|
||||
(PDU_AC_SIZE_MAX + PDU_AC_SIZE_EXTRA))
|
||||
|
||||
#if defined(CONFIG_BT_RX_BUF_LEN)
|
||||
#define PDU_RX_OCTETS_MAX (CONFIG_BT_RX_BUF_LEN - 11)
|
||||
#else
|
||||
|
@ -167,11 +163,9 @@ static MFIFO_DEFINE(ll_pdu_rx_free, sizeof(void *), LL_PDU_RX_CNT);
|
|||
+ MAX(PDU_ADVERTIZE_SIZE, PDU_DATA_SIZE) \
|
||||
)
|
||||
|
||||
#define PDU_RX_POOL_SIZE (PDU_RX_NODE_POOL_ELEMENT_SIZE * RX_CNT)
|
||||
#define PDU_RX_POOL_SIZE (PDU_RX_NODE_POOL_ELEMENT_SIZE * (RX_CNT + 1))
|
||||
|
||||
static struct {
|
||||
u16_t size; /* Runtime (re)sized info */
|
||||
|
||||
void *free;
|
||||
u8_t pool[PDU_RX_POOL_SIZE];
|
||||
} mem_pdu_rx;
|
||||
|
@ -1103,9 +1097,8 @@ static inline int init_reset(void)
|
|||
done_alloc();
|
||||
|
||||
/* Initialize rx pool. */
|
||||
mem_pdu_rx.size = PDU_RX_SIZE_MIN;
|
||||
mem_init(mem_pdu_rx.pool, mem_pdu_rx.size,
|
||||
sizeof(mem_pdu_rx.pool) / mem_pdu_rx.size,
|
||||
mem_init(mem_pdu_rx.pool, (PDU_RX_NODE_POOL_ELEMENT_SIZE),
|
||||
sizeof(mem_pdu_rx.pool) / (PDU_RX_NODE_POOL_ELEMENT_SIZE),
|
||||
&mem_pdu_rx.free);
|
||||
|
||||
/* Initialize rx link pool. */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue