diff options
author | Ville Tervo <ville.tervo@nokia.com> | 2011-02-10 20:38:48 -0500 |
---|---|---|
committer | Gustavo F. Padovan <padovan@profusion.mobi> | 2011-02-16 14:32:51 -0500 |
commit | 6ed58ec520ad2b2fe3f955c8a5fd0eecafccebdf (patch) | |
tree | 5e53b20a64214c811dda8625c14af394a7800718 /net/bluetooth/hci_event.c | |
parent | fcd89c09a59a054fb986861e0862aa2fff7d7c40 (diff) |
Bluetooth: Use LE buffers for LE traffic
Bluetooth chips may have separate buffers for LE traffic.
This patch add support to use LE buffers provided by the chip.
Signed-off-by: Ville Tervo <ville.tervo@nokia.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r-- | net/bluetooth/hci_event.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 47c6e9316ce8..3155ad588076 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -776,6 +776,25 @@ static void hci_cc_pin_code_neg_reply(struct hci_dev *hdev, struct sk_buff *skb) | |||
776 | mgmt_pin_code_neg_reply_complete(hdev->id, &rp->bdaddr, | 776 | mgmt_pin_code_neg_reply_complete(hdev->id, &rp->bdaddr, |
777 | rp->status); | 777 | rp->status); |
778 | } | 778 | } |
779 | static void hci_cc_le_read_buffer_size(struct hci_dev *hdev, | ||
780 | struct sk_buff *skb) | ||
781 | { | ||
782 | struct hci_rp_le_read_buffer_size *rp = (void *) skb->data; | ||
783 | |||
784 | BT_DBG("%s status 0x%x", hdev->name, rp->status); | ||
785 | |||
786 | if (rp->status) | ||
787 | return; | ||
788 | |||
789 | hdev->le_mtu = __le16_to_cpu(rp->le_mtu); | ||
790 | hdev->le_pkts = rp->le_max_pkt; | ||
791 | |||
792 | hdev->le_cnt = hdev->le_pkts; | ||
793 | |||
794 | BT_DBG("%s le mtu %d:%d", hdev->name, hdev->le_mtu, hdev->le_pkts); | ||
795 | |||
796 | hci_req_complete(hdev, HCI_OP_LE_READ_BUFFER_SIZE, rp->status); | ||
797 | } | ||
779 | 798 | ||
780 | static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) | 799 | static inline void hci_cs_inquiry(struct hci_dev *hdev, __u8 status) |
781 | { | 800 | { |
@@ -1704,6 +1723,10 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk | |||
1704 | hci_cc_pin_code_neg_reply(hdev, skb); | 1723 | hci_cc_pin_code_neg_reply(hdev, skb); |
1705 | break; | 1724 | break; |
1706 | 1725 | ||
1726 | case HCI_OP_LE_READ_BUFFER_SIZE: | ||
1727 | hci_cc_le_read_buffer_size(hdev, skb); | ||
1728 | break; | ||
1729 | |||
1707 | default: | 1730 | default: |
1708 | BT_DBG("%s opcode 0x%x", hdev->name, opcode); | 1731 | BT_DBG("%s opcode 0x%x", hdev->name, opcode); |
1709 | break; | 1732 | break; |
@@ -1849,6 +1872,16 @@ static inline void hci_num_comp_pkts_evt(struct hci_dev *hdev, struct sk_buff *s | |||
1849 | hdev->acl_cnt += count; | 1872 | hdev->acl_cnt += count; |
1850 | if (hdev->acl_cnt > hdev->acl_pkts) | 1873 | if (hdev->acl_cnt > hdev->acl_pkts) |
1851 | hdev->acl_cnt = hdev->acl_pkts; | 1874 | hdev->acl_cnt = hdev->acl_pkts; |
1875 | } else if (conn->type == LE_LINK) { | ||
1876 | if (hdev->le_pkts) { | ||
1877 | hdev->le_cnt += count; | ||
1878 | if (hdev->le_cnt > hdev->le_pkts) | ||
1879 | hdev->le_cnt = hdev->le_pkts; | ||
1880 | } else { | ||
1881 | hdev->acl_cnt += count; | ||
1882 | if (hdev->acl_cnt > hdev->acl_pkts) | ||
1883 | hdev->acl_cnt = hdev->acl_pkts; | ||
1884 | } | ||
1852 | } else { | 1885 | } else { |
1853 | hdev->sco_cnt += count; | 1886 | hdev->sco_cnt += count; |
1854 | if (hdev->sco_cnt > hdev->sco_pkts) | 1887 | if (hdev->sco_cnt > hdev->sco_pkts) |