Bluetooth: Add ACL user data to bt_buf
To track which ACL handle each buffer belongs to (needed for host flow control) add the necessary information into a new ACL-specific struct. Change-Id: Ie6cc7c32a70b43a4ff5954bb9dca34e4f62da292 Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
5626788eb7
commit
25af03265c
3 changed files with 12 additions and 7 deletions
|
@ -54,12 +54,17 @@ struct bt_buf_hci_data {
|
||||||
uint16_t opcode;
|
uint16_t opcode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct bt_buf_acl_data {
|
||||||
|
uint16_t handle;
|
||||||
|
};
|
||||||
|
|
||||||
struct bt_buf {
|
struct bt_buf {
|
||||||
/* FIFO uses first 4 bytes itself, reserve space */
|
/* FIFO uses first 4 bytes itself, reserve space */
|
||||||
int __unused;
|
int __unused;
|
||||||
|
|
||||||
union {
|
union {
|
||||||
struct bt_buf_hci_data hci;
|
struct bt_buf_hci_data hci;
|
||||||
|
struct bt_buf_acl_data acl;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Type of data contained in the buffer */
|
/* Type of data contained in the buffer */
|
||||||
|
|
|
@ -76,12 +76,12 @@ struct bt_buf *bt_buf_get(enum bt_buf_type type, size_t reserve_head)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(buf, 0, sizeof(*buf));
|
||||||
|
|
||||||
buf->type = type;
|
buf->type = type;
|
||||||
buf->data = buf->buf + reserve_head;
|
buf->data = buf->buf + reserve_head;
|
||||||
buf->len = 0;
|
|
||||||
buf->hci.sync = NULL;
|
|
||||||
|
|
||||||
BT_DBG("buf %p reserve %u\n", buf, reserve_head);
|
BT_DBG("buf %p type %d reserve %u\n", buf, buf->type, reserve_head);
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -125,11 +125,11 @@ static void hci_acl(struct bt_buf *buf)
|
||||||
|
|
||||||
handle = sys_le16_to_cpu(hdr->handle);
|
handle = sys_le16_to_cpu(hdr->handle);
|
||||||
flags = (handle >> 12);
|
flags = (handle >> 12);
|
||||||
handle = bt_acl_handle(handle);
|
buf->acl.handle = bt_acl_handle(handle);
|
||||||
|
|
||||||
bt_buf_pull(buf, sizeof(*hdr));
|
bt_buf_pull(buf, sizeof(*hdr));
|
||||||
|
|
||||||
BT_DBG("handle %u len %u flags %u\n", handle, len, flags);
|
BT_DBG("handle %u len %u flags %u\n", buf->acl.handle, len, flags);
|
||||||
|
|
||||||
if (buf->len != len) {
|
if (buf->len != len) {
|
||||||
BT_ERR("ACL data length mismatch (%u != %u)\n", buf->len, len);
|
BT_ERR("ACL data length mismatch (%u != %u)\n", buf->len, len);
|
||||||
|
@ -137,9 +137,9 @@ static void hci_acl(struct bt_buf *buf)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
conn = bt_conn_lookup(handle);
|
conn = bt_conn_lookup(buf->acl.handle);
|
||||||
if (!conn) {
|
if (!conn) {
|
||||||
BT_ERR("Unable to find conn for handle %u\n", handle);
|
BT_ERR("Unable to find conn for handle %u\n", buf->acl.handle);
|
||||||
bt_buf_put(buf);
|
bt_buf_put(buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue