Bluetooth: Controller: Use bt_buf_get_rx for buffer allocation

The controller uses K_FOREVER for the allocations so there's no
benefit in trying to use specialized pools (which exist to try to
guarantee availability of buffers for critical data).

Change-Id: I130f2c44a2f28af1284290e6a0b17dcba438862f
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2016-12-26 17:22:48 +02:00
commit d79bdd74e9

View file

@ -218,16 +218,11 @@ static void recv_thread(void *p1, void *p2, void *p3)
while ((num_cmplt = radio_rx_get(&node_rx, &handle))) {
buf = bt_buf_get_evt(BT_HCI_EVT_NUM_COMPLETED_PACKETS,
K_FOREVER);
if (buf) {
buf = bt_buf_get_rx(K_FOREVER);
bt_buf_set_type(buf, BT_BUF_EVT);
hci_num_cmplt_encode(buf, handle, num_cmplt);
BT_DBG("Num Complete: 0x%04x:%u", handle,
num_cmplt);
BT_DBG("Num Complete: 0x%04x:%u", handle, num_cmplt);
bt_recv(buf);
} else {
BT_ERR("Cannot allocate Num Complete");
}
k_yield();
}
@ -241,20 +236,14 @@ static void recv_thread(void *p1, void *p2, void *p3)
if (node_rx->hdr.type != NODE_RX_TYPE_DC_PDU ||
pdu_data->ll_id == PDU_DATA_LLID_CTRL) {
/* generate a (non-priority) HCI event */
buf = bt_buf_get_evt(0, K_FOREVER);
if (buf) {
buf = bt_buf_get_rx(K_FOREVER);
bt_buf_set_type(buf, BT_BUF_EVT);
hci_evt_encode(node_rx, buf);
} else {
BT_ERR("Cannot allocate RX event");
}
} else {
/* generate ACL data */
buf = bt_buf_get_acl(K_FOREVER);
if (buf) {
buf = bt_buf_get_rx(K_FOREVER);
bt_buf_set_type(buf, BT_BUF_ACL_IN);
hci_acl_encode(node_rx, buf);
} else {
BT_ERR("Cannot allocate RX ACL");
}
}
if (buf) {
@ -293,11 +282,8 @@ static int cmd_handle(struct net_buf *buf)
* actual point is to retrieve the event from the priority
* queue
*/
evt = bt_buf_get_evt(BT_HCI_EVT_CMD_COMPLETE, K_FOREVER);
if (!evt) {
BT_ERR("No available event buffers");
return -ENOMEM;
}
evt = bt_buf_get_rx(K_FOREVER);
bt_buf_set_type(evt, BT_BUF_EVT);
err = hci_cmd_handle(buf, evt);
if (!err && evt->len) {
BT_DBG("Replying with event of %u bytes", evt->len);