Skip to content
Permalink
Browse files

Bluetooth: controller: Fix Rx and Tx buffer sizes

Fix incorrectly defined Rx and Tx buffer sizes. Wrong
calculation allocated more memory than necessary.

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
  • Loading branch information...
cvinayak authored and aescolar committed May 1, 2019
1 parent a4370b7 commit 06ddc2bbec50684fcc476eefc6e281d3f7c108ac
Showing with 5 additions and 10 deletions.
  1. +2 −6 subsys/bluetooth/controller/ll_sw/ull.c
  2. +3 −4 subsys/bluetooth/controller/ll_sw/ull_conn.c
@@ -145,16 +145,12 @@ 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);

#if defined(CONFIG_BT_RX_BUF_LEN)
#define PDU_RX_OCTETS_MAX (CONFIG_BT_RX_BUF_LEN - 11)
#endif

#define NODE_RX_HEADER_SIZE (offsetof(struct node_rx_pdu, pdu))
#define NODE_RX_FOOTER_SIZE (sizeof(struct node_rx_ftr))
#define NODE_RX_STRUCT_OVERHEAD (NODE_RX_HEADER_SIZE + NODE_RX_FOOTER_SIZE)

#define PDU_ADVERTIZE_SIZE (PDU_AC_SIZE_MAX + PDU_AC_SIZE_EXTRA)
#define PDU_DATA_SIZE (PDU_DC_LL_HEADER_SIZE + PDU_RX_OCTETS_MAX)
#define PDU_ADVERTIZE_SIZE (PDU_AC_SIZE_MAX + PDU_AC_SIZE_EXTRA)
#define PDU_DATA_SIZE (PDU_DC_LL_HEADER_SIZE + LL_LENGTH_OCTETS_RX_MAX)

#define PDU_RX_NODE_POOL_ELEMENT_SIZE \
MROUND( \
@@ -95,10 +95,9 @@ static void ticker_op_cb(u32_t status, void *params);
CONFIG_BT_CTLR_TX_BUFFER_SIZE)

#define CONN_TX_CTRL_BUFFERS 2
#define CONN_TX_CTRL_BUF_SIZE (MROUND(offsetof(struct node_tx, pdu) + \
offsetof(struct pdu_data, llctrl) + \
sizeof(struct pdu_data_llctrl)) * \
CONN_TX_CTRL_BUFFERS)
#define CONN_TX_CTRL_BUF_SIZE MROUND(offsetof(struct node_tx, pdu) + \
offsetof(struct pdu_data, llctrl) + \
sizeof(struct pdu_data_llctrl))

static MFIFO_DEFINE(conn_tx, sizeof(struct lll_tx), CONFIG_BT_CTLR_TX_BUFFERS);
static MFIFO_DEFINE(conn_ack, sizeof(struct lll_tx), CONFIG_BT_CTLR_TX_BUFFERS);

0 comments on commit 06ddc2b

Please sign in to comment.
You can’t perform that action at this time.