Bluetooth: Use event/cmd lengths instead of buffer sizes in KConfig
It's more intuitive to specify needed command or event lengths rather than the raw buffer size in Kconfig. The exact buffer size calculation can be done in the code itself. Change-Id: I2760cc1182a689b26405e4c2b1428f140b4aa88a Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
8167ababe0
commit
3bc43254e0
2 changed files with 22 additions and 14 deletions
|
@ -62,12 +62,12 @@ config BLUETOOTH_HCI_CMD_COUNT
|
||||||
help
|
help
|
||||||
Number of buffers available for HCI commands.
|
Number of buffers available for HCI commands.
|
||||||
|
|
||||||
config BLUETOOTH_HCI_CMD_SIZE
|
config BLUETOOTH_MAX_CMD_LEN
|
||||||
int "Size of HCI command buffers"
|
int "Maximum supported HCI command length"
|
||||||
default 68
|
default 64
|
||||||
range 68 260
|
range 64 255
|
||||||
help
|
help
|
||||||
Maximum size of each HCI command buffer.
|
Maximum length of each HCI command.
|
||||||
|
|
||||||
config BLUETOOTH_HCI_EVT_COUNT
|
config BLUETOOTH_HCI_EVT_COUNT
|
||||||
int "Number of HCI event buffers"
|
int "Number of HCI event buffers"
|
||||||
|
@ -79,12 +79,15 @@ config BLUETOOTH_HCI_EVT_COUNT
|
||||||
sure we've got enough buffers to handle bursts of Number of
|
sure we've got enough buffers to handle bursts of Number of
|
||||||
Completed Packets HCI events.
|
Completed Packets HCI events.
|
||||||
|
|
||||||
config BLUETOOTH_HCI_EVT_SIZE
|
config BLUETOOTH_MAX_EVT_LEN
|
||||||
int "Size of HCI event buffers"
|
int "Maximum supported HCI event length"
|
||||||
default 72
|
default 68
|
||||||
range 72 260
|
range 68 255
|
||||||
help
|
help
|
||||||
Maximum size of each HCI event buffer.
|
Maximum size of each HCI event buffer. E.g. one big event
|
||||||
|
for LE is the Command Complete for Read Local Supported
|
||||||
|
Commands. It is a 3 byte Command Complete header + 65 byte
|
||||||
|
return parameters = 68 bytes in total.
|
||||||
|
|
||||||
if BLUETOOTH_CONN
|
if BLUETOOTH_CONN
|
||||||
config BLUETOOTH_ACL_IN_COUNT
|
config BLUETOOTH_ACL_IN_COUNT
|
||||||
|
|
|
@ -75,15 +75,20 @@ struct acl_data {
|
||||||
#define acl(buf) ((struct acl_data *)net_buf_user_data(buf))
|
#define acl(buf) ((struct acl_data *)net_buf_user_data(buf))
|
||||||
|
|
||||||
/* HCI command buffers */
|
/* HCI command buffers */
|
||||||
|
#define CMD_BUF_SIZE (CONFIG_BLUETOOTH_HCI_SEND_RESERVE + \
|
||||||
|
sizeof(struct bt_hci_cmd_hdr) + \
|
||||||
|
CONFIG_BLUETOOTH_MAX_CMD_LEN)
|
||||||
static struct nano_fifo avail_hci_cmd;
|
static struct nano_fifo avail_hci_cmd;
|
||||||
static NET_BUF_POOL(hci_cmd_pool, CONFIG_BLUETOOTH_HCI_CMD_COUNT,
|
static NET_BUF_POOL(hci_cmd_pool, CONFIG_BLUETOOTH_HCI_CMD_COUNT, CMD_BUF_SIZE,
|
||||||
CONFIG_BLUETOOTH_HCI_CMD_SIZE, &avail_hci_cmd, NULL,
|
&avail_hci_cmd, NULL, sizeof(struct cmd_data));
|
||||||
sizeof(struct cmd_data));
|
|
||||||
|
|
||||||
/* HCI event buffers */
|
/* HCI event buffers */
|
||||||
|
#define EVT_BUF_SIZE (CONFIG_BLUETOOTH_HCI_RECV_RESERVE + \
|
||||||
|
sizeof(struct bt_hci_evt_hdr) + \
|
||||||
|
CONFIG_BLUETOOTH_MAX_EVT_LEN)
|
||||||
static struct nano_fifo avail_hci_evt;
|
static struct nano_fifo avail_hci_evt;
|
||||||
static NET_BUF_POOL(hci_evt_pool, CONFIG_BLUETOOTH_HCI_EVT_COUNT,
|
static NET_BUF_POOL(hci_evt_pool, CONFIG_BLUETOOTH_HCI_EVT_COUNT,
|
||||||
CONFIG_BLUETOOTH_HCI_EVT_SIZE, &avail_hci_evt, NULL, 0);
|
CONFIG_BLUETOOTH_MAX_EVT_LEN, &avail_hci_evt, NULL, 0);
|
||||||
|
|
||||||
#if defined(CONFIG_BLUETOOTH_CONN)
|
#if defined(CONFIG_BLUETOOTH_CONN)
|
||||||
static void report_completed_packet(struct net_buf *buf)
|
static void report_completed_packet(struct net_buf *buf)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue