Commit 1ffa4ad0 authored by Marcel Holtmann's avatar Marcel Holtmann Committed by Johan Hedberg

Bluetooth: btusb: Split fragement receiption into separate functions

The actual packet reassembly should be done inside the driver. To allow
this to happen cleanly in future patches, split the fragment reception
into its own functions.
Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
parent 89e7533d
...@@ -296,6 +296,21 @@ struct btusb_data { ...@@ -296,6 +296,21 @@ struct btusb_data {
int suspend_count; int suspend_count;
}; };
static int btusb_recv_intr(struct btusb_data *data, void *buffer, int count)
{
return hci_recv_fragment(data->hdev, HCI_EVENT_PKT, buffer, count);
}
static int btusb_recv_bulk(struct btusb_data *data, void *buffer, int count)
{
return hci_recv_fragment(data->hdev, HCI_ACLDATA_PKT, buffer, count);
}
static int btusb_recv_isoc(struct btusb_data *data, void *buffer, int count)
{
return hci_recv_fragment(data->hdev, HCI_SCODATA_PKT, buffer, count);
}
static void btusb_intr_complete(struct urb *urb) static void btusb_intr_complete(struct urb *urb)
{ {
struct hci_dev *hdev = urb->context; struct hci_dev *hdev = urb->context;
...@@ -311,9 +326,8 @@ static void btusb_intr_complete(struct urb *urb) ...@@ -311,9 +326,8 @@ static void btusb_intr_complete(struct urb *urb)
if (urb->status == 0) { if (urb->status == 0) {
hdev->stat.byte_rx += urb->actual_length; hdev->stat.byte_rx += urb->actual_length;
if (hci_recv_fragment(hdev, HCI_EVENT_PKT, if (btusb_recv_intr(data, urb->transfer_buffer,
urb->transfer_buffer, urb->actual_length) < 0) {
urb->actual_length) < 0) {
BT_ERR("%s corrupted event packet", hdev->name); BT_ERR("%s corrupted event packet", hdev->name);
hdev->stat.err_rx++; hdev->stat.err_rx++;
} }
...@@ -401,9 +415,8 @@ static void btusb_bulk_complete(struct urb *urb) ...@@ -401,9 +415,8 @@ static void btusb_bulk_complete(struct urb *urb)
if (urb->status == 0) { if (urb->status == 0) {
hdev->stat.byte_rx += urb->actual_length; hdev->stat.byte_rx += urb->actual_length;
if (hci_recv_fragment(hdev, HCI_ACLDATA_PKT, if (btusb_recv_bulk(data, urb->transfer_buffer,
urb->transfer_buffer, urb->actual_length) < 0) {
urb->actual_length) < 0) {
BT_ERR("%s corrupted ACL packet", hdev->name); BT_ERR("%s corrupted ACL packet", hdev->name);
hdev->stat.err_rx++; hdev->stat.err_rx++;
} }
...@@ -497,9 +510,8 @@ static void btusb_isoc_complete(struct urb *urb) ...@@ -497,9 +510,8 @@ static void btusb_isoc_complete(struct urb *urb)
hdev->stat.byte_rx += length; hdev->stat.byte_rx += length;
if (hci_recv_fragment(hdev, HCI_SCODATA_PKT, if (btusb_recv_isoc(data, urb->transfer_buffer + offset,
urb->transfer_buffer + offset, length) < 0) {
length) < 0) {
BT_ERR("%s corrupted SCO packet", hdev->name); BT_ERR("%s corrupted SCO packet", hdev->name);
hdev->stat.err_rx++; hdev->stat.err_rx++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment