From: Suraj Sumangala Date: Wed, 14 Jul 2010 07:32:19 +0000 (+0530) Subject: Bluetooth: Implemented HCI frame reassembly for RX from stream X-Git-Tag: v2.6.36-rc1~571^2~64^2~48^2~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9981151086385eecc2febf4ba95a14593f834b3d;p=platform%2Fkernel%2Flinux-exynos.git Bluetooth: Implemented HCI frame reassembly for RX from stream Implemented frame reassembly implementation for reassembling fragments received from stream. Signed-off-by: Suraj Sumangala Signed-off-by: Marcel Holtmann --- diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 28e5eee..350b3e6 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -437,6 +437,7 @@ void hci_event_packet(struct hci_dev *hdev, struct sk_buff *skb); int hci_recv_frame(struct sk_buff *skb); int hci_recv_fragment(struct hci_dev *hdev, int type, void *data, int count); +int hci_recv_stream_fragment(struct hci_dev *hdev, void *data, int count); int hci_register_sysfs(struct hci_dev *hdev); void hci_unregister_sysfs(struct hci_dev *hdev); diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 451e266..995c9f9 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.