Bluetooth: Add support for reporting completed ACL buffers

Every time we put a BT_ACL_IN buffer back to the pool we should report
this to the controller so it knows it can send us more data. This
patch makes the necessary modifications to the bt_buf_put() function
to trigger the HCI command.

The Host Number of Completed Packets command is special in that it
doesn't need to obey the reported ncmd value and also doesn't generate
any command status/complete events. Because of this we need an
exception for it in the bt_hci_cmd_send() function.

Change-Id: If65f28078fd0d81af853447e95bc53822fea75b7
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2015-04-28 15:22:17 +03:00 committed by Anas Nashif
commit 586d76b12a
3 changed files with 49 additions and 5 deletions

View file

@ -91,6 +91,17 @@ struct bt_hci_cp_host_buffer_size {
uint16_t sco_pkts;
} PACK_STRUCT;
struct bt_hci_handle_count {
uint16_t handle;
uint16_t count;
} PACK_STRUCT;
#define BT_HCI_OP_HOST_NUM_COMPLETED_PACKETS BT_OP(BT_OGF_BASEBAND, 0x0035)
struct bt_hci_cp_host_num_completed_packets {
uint8_t num_handles;
struct bt_hci_handle_count h[0];
} PACK_STRUCT;
#define BT_HCI_OP_LE_WRITE_LE_HOST_SUPP BT_OP(BT_OGF_BASEBAND, 0x006d)
struct bt_hci_cp_write_le_host_supp {
uint8_t le;
@ -199,10 +210,7 @@ struct bt_hci_evt_cmd_status {
#define BT_HCI_EVT_NUM_COMPLETED_PACKETS 0x13
struct bt_hci_evt_num_completed_packets {
uint8_t num_handles;
struct {
uint16_t handle;
uint16_t count;
} h[0] PACK_STRUCT;
struct bt_hci_handle_count h[0];
} PACK_STRUCT;
#define BT_HCI_EVT_LE_META_EVENT 0x3e