Bluetooth: Introduce dummy data type

We're already sending 'dummy' buffers to wake up the connection
fibers. The problem is that if we provide a real buffer type it may
have unintended consequences. E.g. with BT_ACL_OUT when bt_buf_put()
is called it may trigger an invalid HCI_Host_Num_Completed_Packets
command.

This patch creates a new BT_DUMMY buffer type to avoid this scenario.
The new type is an alias for BT_CMD since the pool where these buffers
come from is not quota-controlled and synced up with the controller.

Change-Id: I42ac235811dc242345853f7858c10bfc43e4f07d
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2015-04-29 12:33:30 +03:00 committed by Anas Nashif
commit 041c84c3e6
2 changed files with 7 additions and 6 deletions

View file

@ -42,10 +42,11 @@
/* Type of data contained in this buffer */
enum bt_buf_type {
BT_CMD, /* HCI command */
BT_EVT, /* HCI event */
BT_ACL_OUT, /* Outgoing ACL data */
BT_ACL_IN, /* Incoming ACL data */
BT_CMD, /* HCI command */
BT_EVT, /* HCI event */
BT_ACL_OUT, /* Outgoing ACL data */
BT_ACL_IN, /* Incoming ACL data */
BT_DUMMY = BT_CMD, /* Only used for waking up fibers */
};
/* HCI command specific info */

View file

@ -257,8 +257,8 @@ void bt_conn_del(struct bt_conn *conn)
conn->state = BT_CONN_DISCONNECTED;
/* Send dummy buffers to wake up and kill the fibers */
nano_fifo_put(&conn->tx_queue, bt_buf_get(BT_ACL_OUT, 0));
nano_fifo_put(&conn->rx_queue, bt_buf_get(BT_ACL_IN, 0));
nano_fifo_put(&conn->tx_queue, bt_buf_get(BT_DUMMY, 0));
nano_fifo_put(&conn->rx_queue, bt_buf_get(BT_DUMMY, 0));
bt_conn_put(conn);
}