Bluetooth: Remove unnecessary controller-side buffers tracking
When there's no support for connections there's also no need to track the controller side buffers. Change-Id: I7eac3af486f139f1ab32efda8ccfa188ed8359eb Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
3136aa2ced
commit
757fd755a6
4 changed files with 23 additions and 12 deletions
|
@ -64,6 +64,17 @@ static const uint8_t ssp_method[4 /* remote */][4 /* local */] = {
|
|||
};
|
||||
#endif /* CONFIG_BLUETOOTH_BREDR */
|
||||
|
||||
struct k_sem *bt_conn_get_pkts(struct bt_conn *conn)
|
||||
{
|
||||
#if defined(CONFIG_BLUETOOTH_BREDR)
|
||||
if (conn->type == BT_CONN_TYPE_BR || !bt_dev.le.mtu) {
|
||||
return &bt_dev.br.pkts;
|
||||
}
|
||||
#endif /* CONFIG_BLUETOOTH_BREDR */
|
||||
|
||||
return &bt_dev.le.pkts;
|
||||
}
|
||||
|
||||
static inline const char *state2str(bt_conn_state_t state)
|
||||
{
|
||||
switch (state) {
|
||||
|
|
|
@ -186,16 +186,7 @@ struct net_buf *bt_conn_create_pdu(struct net_buf_pool *pool, size_t reserve);
|
|||
int bt_conn_init(void);
|
||||
|
||||
/* Selects based on connecton type right semaphore for ACL packets */
|
||||
static inline struct k_sem *bt_conn_get_pkts(struct bt_conn *conn)
|
||||
{
|
||||
#if defined(CONFIG_BLUETOOTH_BREDR)
|
||||
if (conn->type == BT_CONN_TYPE_BR || !bt_dev.le.mtu) {
|
||||
return &bt_dev.br.pkts;
|
||||
}
|
||||
#endif /* CONFIG_BLUETOOTH_BREDR */
|
||||
|
||||
return &bt_dev.le.pkts;
|
||||
}
|
||||
struct k_sem *bt_conn_get_pkts(struct bt_conn *conn);
|
||||
|
||||
/* k_poll related helpers for the TX thread */
|
||||
int bt_conn_prepare_events(struct k_poll_event events[]);
|
||||
|
|
|
@ -2836,7 +2836,7 @@ static void read_buffer_size_complete(struct net_buf *buf)
|
|||
|
||||
k_sem_init(&bt_dev.br.pkts, pkts, pkts);
|
||||
}
|
||||
#else
|
||||
#elif defined(CONFIG_BLUETOOTH_CONN)
|
||||
static void read_buffer_size_complete(struct net_buf *buf)
|
||||
{
|
||||
struct bt_hci_rp_read_buffer_size *rp = (void *)buf->data;
|
||||
|
@ -2858,6 +2858,7 @@ static void read_buffer_size_complete(struct net_buf *buf)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_CONN)
|
||||
static void le_read_buffer_size_complete(struct net_buf *buf)
|
||||
{
|
||||
struct bt_hci_rp_le_read_buffer_size *rp = (void *)buf->data;
|
||||
|
@ -2872,6 +2873,7 @@ static void le_read_buffer_size_complete(struct net_buf *buf)
|
|||
bt_dev.le.mtu);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static void read_supported_commands_complete(struct net_buf *buf)
|
||||
{
|
||||
|
@ -2994,13 +2996,16 @@ static int le_init(void)
|
|||
read_le_features_complete(rsp);
|
||||
net_buf_unref(rsp);
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_CONN)
|
||||
/* Read LE Buffer Size */
|
||||
err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_READ_BUFFER_SIZE, NULL, &rsp);
|
||||
err = bt_hci_cmd_send_sync(BT_HCI_OP_LE_READ_BUFFER_SIZE,
|
||||
NULL, &rsp);
|
||||
if (err) {
|
||||
return err;
|
||||
}
|
||||
le_read_buffer_size_complete(rsp);
|
||||
net_buf_unref(rsp);
|
||||
#endif
|
||||
|
||||
if (BT_FEAT_BREDR(bt_dev.features)) {
|
||||
buf = bt_hci_cmd_create(BT_HCI_OP_LE_WRITE_LE_HOST_SUPP,
|
||||
|
@ -3262,6 +3267,7 @@ static int br_init(void)
|
|||
#else
|
||||
static int br_init(void)
|
||||
{
|
||||
#if defined(CONFIG_BLUETOOTH_CONN)
|
||||
struct net_buf *rsp;
|
||||
int err;
|
||||
|
||||
|
@ -3277,6 +3283,7 @@ static int br_init(void)
|
|||
|
||||
read_buffer_size_complete(rsp);
|
||||
net_buf_unref(rsp);
|
||||
#endif /* CONFIG_BLUETOOTH_CONN */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -57,9 +57,11 @@ struct bt_dev_le {
|
|||
/* LE states */
|
||||
uint64_t states;
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_CONN)
|
||||
/* Controller buffer information */
|
||||
uint16_t mtu;
|
||||
struct k_sem pkts;
|
||||
#endif /* CONFIG_BLUETOOTH_CONN */
|
||||
};
|
||||
|
||||
#if defined(CONFIG_BLUETOOTH_BREDR)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue