summaryrefslogtreecommitdiff
path: root/net/bluetooth
diff options
context:
space:
mode:
authorSuraj Sumangala <suraj@atheros.com>2010-07-14 13:02:19 +0530
committerMarcel Holtmann <marcel@holtmann.org>2010-07-21 10:39:12 -0700
commit9981151086385eecc2febf4ba95a14593f834b3d (patch)
tree3cdda7fe4c3d5d3bf05e9ca6fb8f9f1b6ab1c226 /net/bluetooth
parentf39a3c06404d01ef2ce47e821bc778dfb1836df9 (diff)
downloadlinux-3.10-9981151086385eecc2febf4ba95a14593f834b3d.tar.gz
linux-3.10-9981151086385eecc2febf4ba95a14593f834b3d.tar.bz2
linux-3.10-9981151086385eecc2febf4ba95a14593f834b3d.zip
Bluetooth: Implemented HCI frame reassembly for RX from stream
Implemented frame reassembly implementation for reassembling fragments received from stream. Signed-off-by: Suraj Sumangala <suraj@atheros.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_core.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 451e266840a..995c9f9b84d 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1163,6 +1163,41 @@ int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count)
}
EXPORT_SYMBOL(hci_recv_fragment);
+#define STREAM_REASSEMBLY 0
+
+int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count)
+{
+ int type;
+ int rem = 0;
+
+ do {
+ struct sk_buff *skb = hdev->reassembly[STREAM_REASSEMBLY];
+
+ if (!skb) {
+ struct { char type; } *pkt;
+
+ /* Start of the frame */
+ pkt = data;
+ type = pkt->type;
+
+ data++;
+ count--;
+ } else
+ type = bt_cb(skb)->pkt_type;
+
+ rem = hci_reassembly(hdev, type, data,
+ count, STREAM_REASSEMBLY, GFP_ATOMIC);
+ if (rem < 0)
+ return rem;
+
+ data += (count - rem);
+ count = rem;
+ } while (count);
+
+ return rem;
+}
+EXPORT_SYMBOL(hci_recv_stream_fragment);
+
/* ---- Interface to upper protocols ---- */
/* Register/Unregister protocols.