提交 99811510 编写于 作者: S Suraj Sumangala 提交者: Marcel Holtmann

Bluetooth: Implemented HCI frame reassembly for RX from stream

Implemented frame reassembly implementation for reassembling fragments
received from stream.
Signed-off-by: NSuraj Sumangala <suraj@atheros.com>
Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
上级 f39a3c06
......@@ -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);
......
......@@ -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.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册