Bluetooth: Move outgoing ACL buffer management to l2cap.c
The only user of this is l2cap.c so move the buffer pool there to avoid unnecessary calls between c-files. Change-Id: Ia9335b21c34546e2252fa40d9eec2e09156b0d67 Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
3822aecd24
commit
e000290627
2 changed files with 7 additions and 8 deletions
|
@ -87,12 +87,9 @@ static void report_completed_packet(struct net_buf *buf)
|
|||
}
|
||||
|
||||
static struct nano_fifo avail_acl_in;
|
||||
static struct nano_fifo avail_acl_out;
|
||||
static NET_BUF_POOL(acl_in_pool, BT_BUF_ACL_IN_MAX, BT_BUF_MAX_DATA,
|
||||
&avail_acl_in, report_completed_packet,
|
||||
sizeof(struct bt_acl_data));
|
||||
static NET_BUF_POOL(acl_out_pool, BT_BUF_ACL_OUT_MAX, BT_BUF_MAX_DATA,
|
||||
&avail_acl_out, NULL, sizeof(struct bt_acl_data));
|
||||
#endif /* CONFIG_BLUETOOTH_CONN */
|
||||
|
||||
struct net_buf *bt_buf_get(enum bt_buf_type type, size_t reserve_head)
|
||||
|
@ -108,9 +105,6 @@ struct net_buf *bt_buf_get(enum bt_buf_type type, size_t reserve_head)
|
|||
case BT_ACL_IN:
|
||||
buf = net_buf_get(&avail_acl_in, reserve_head);
|
||||
break;
|
||||
case BT_ACL_OUT:
|
||||
buf = net_buf_get(&avail_acl_out, reserve_head);
|
||||
break;
|
||||
#endif /* CONFIG_BLUETOOTH_CONN */
|
||||
default:
|
||||
return NULL;
|
||||
|
@ -1599,7 +1593,6 @@ int bt_enable(bt_ready_cb_t cb)
|
|||
net_buf_pool_init(hci_pool);
|
||||
#if defined(CONFIG_BLUETOOTH_CONN)
|
||||
net_buf_pool_init(acl_in_pool);
|
||||
net_buf_pool_init(acl_out_pool);
|
||||
#endif /* CONFIG_BLUETOOTH_CONN */
|
||||
|
||||
/* Give cmd_sem allowing to send first HCI_Reset cmd */
|
||||
|
|
|
@ -62,6 +62,10 @@ struct bt_l2cap {
|
|||
|
||||
static struct bt_l2cap bt_l2cap_pool[CONFIG_BLUETOOTH_MAX_CONN];
|
||||
|
||||
static struct nano_fifo avail_acl_out;
|
||||
static NET_BUF_POOL(acl_out_pool, BT_BUF_ACL_OUT_MAX, BT_BUF_MAX_DATA,
|
||||
&avail_acl_out, NULL, sizeof(struct bt_acl_data));
|
||||
|
||||
static struct bt_l2cap *l2cap_chan_get(struct bt_conn *conn)
|
||||
{
|
||||
struct bt_l2cap_chan *chan;
|
||||
|
@ -197,7 +201,7 @@ struct net_buf *bt_l2cap_create_pdu(struct bt_conn *conn)
|
|||
sizeof(struct bt_hci_acl_hdr) +
|
||||
bt_dev.drv->head_reserve;
|
||||
|
||||
return bt_buf_get(BT_ACL_OUT, head_reserve);
|
||||
return net_buf_get(&avail_acl_out, head_reserve);
|
||||
}
|
||||
|
||||
void bt_l2cap_send(struct bt_conn *conn, uint16_t cid, struct net_buf *buf)
|
||||
|
@ -598,6 +602,8 @@ int bt_l2cap_init(void)
|
|||
return err;
|
||||
}
|
||||
|
||||
net_buf_pool_init(acl_out_pool);
|
||||
|
||||
bt_l2cap_fixed_chan_register(&chan);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue