* [RFC 1/2] Bluetooth: Add HCI Read Flow Control Mode function
@ 2011-11-23 15:35 Emeltchenko Andrei
2011-11-23 15:35 ` [RFC 2/2] Bluetooth: Add HCI Read Data Block Size function Emeltchenko Andrei
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Emeltchenko Andrei @ 2011-11-23 15:35 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Upstream Code Aurora function with minor trivial fixes.
Origin: git://codeaurora.org/kernel/msm.git
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
include/net/bluetooth/hci.h | 6 ++++++
include/net/bluetooth/hci_core.h | 2 ++
net/bluetooth/hci_event.c | 19 +++++++++++++++++++
3 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 376c574..ee83c36 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -677,6 +677,12 @@ struct hci_rp_read_local_oob_data {
#define HCI_OP_READ_INQ_RSP_TX_POWER 0x0c58
+#define HCI_OP_READ_FLOW_CONTROL_MODE 0x0c66
+struct hci_rp_read_flow_control_mode {
+ __u8 status;
+ __u8 mode;
+} __packed;
+
#define HCI_OP_WRITE_LE_HOST_SUPPORTED 0x0c6d
struct hci_cp_write_le_host_supported {
__u8 le;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 1795257..a7fd63a 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -170,6 +170,8 @@ struct hci_dev {
__u32 amp_max_flush_to;
__u32 amp_be_flush_to;
+ __u8 flow_ctl_mode;
+
unsigned int auto_accept_delay;
unsigned long quirks;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 7790108..23ccb61 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -717,6 +717,21 @@ static void hci_cc_read_local_ext_features(struct hci_dev *hdev,
hci_req_complete(hdev, HCI_OP_READ_LOCAL_EXT_FEATURES, rp->status);
}
+static void hci_cc_read_flow_control_mode(struct hci_dev *hdev,
+ struct sk_buff *skb)
+{
+ struct hci_rp_read_flow_control_mode *rp = (void *) skb->data;
+
+ BT_DBG("%s status 0x%x", hdev->name, rp->status);
+
+ if (rp->status)
+ return;
+
+ hdev->flow_ctl_mode = rp->mode;
+
+ hci_req_complete(hdev, HCI_OP_READ_FLOW_CONTROL_MODE, rp->status);
+}
+
static void hci_cc_read_buffer_size(struct hci_dev *hdev, struct sk_buff *skb)
{
struct hci_rp_read_buffer_size *rp = (void *) skb->data;
@@ -1967,6 +1982,10 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk
hci_cc_write_ca_timeout(hdev, skb);
break;
+ case HCI_OP_READ_FLOW_CONTROL_MODE:
+ hci_cc_read_flow_control_mode(hdev, skb);
+ break;
+
case HCI_OP_READ_LOCAL_AMP_INFO:
hci_cc_read_local_amp_info(hdev, skb);
break;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* [RFC 2/2] Bluetooth: Add HCI Read Data Block Size function
2011-11-23 15:35 [RFC 1/2] Bluetooth: Add HCI Read Flow Control Mode function Emeltchenko Andrei
@ 2011-11-23 15:35 ` Emeltchenko Andrei
2011-11-25 11:42 ` Marcel Holtmann
2011-11-25 11:39 ` [RFC 1/2] Bluetooth: Add HCI Read Flow Control Mode function Marcel Holtmann
2011-12-02 11:42 ` Gustavo Padovan
2 siblings, 1 reply; 5+ messages in thread
From: Emeltchenko Andrei @ 2011-11-23 15:35 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Upstream Code Aurora function with minor trivial fixes.
Origin: git://codeaurora.org/kernel/msm.git
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
include/net/bluetooth/hci.h | 11 +++++++++++
include/net/bluetooth/hci_core.h | 2 ++
net/bluetooth/hci_event.c | 31 +++++++++++++++++++++++++++++++
3 files changed, 44 insertions(+), 0 deletions(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index ee83c36..324883a 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -271,6 +271,9 @@ enum {
#define HCI_ERROR_LOCAL_HOST_TERM 0x16
#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
+/* Flow control modes */
+#define HCI_BLOCK_BASED_FLOW_CTL_MODE 0x01
+
/* ----- HCI Commands ---- */
#define HCI_OP_NOP 0x0000
@@ -737,6 +740,14 @@ struct hci_rp_read_bd_addr {
bdaddr_t bdaddr;
} __packed;
+#define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a
+struct hci_rp_read_data_block_size {
+ __u8 status;
+ __le16 max_acl_len;
+ __le16 block_len;
+ __le16 num_blocks;
+} __packed;
+
#define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c
struct hci_cp_write_page_scan_activity {
__le16 interval;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index a7fd63a..869ab72 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -172,6 +172,8 @@ struct hci_dev {
__u8 flow_ctl_mode;
+ __u16 block_len;
+
unsigned int auto_accept_delay;
unsigned long quirks;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 23ccb61..8413b29 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -771,6 +771,33 @@ static void hci_cc_read_bd_addr(struct hci_dev *hdev, struct sk_buff *skb)
hci_req_complete(hdev, HCI_OP_READ_BD_ADDR, rp->status);
}
+static void hci_cc_read_data_block_size(struct hci_dev *hdev,
+ struct sk_buff *skb)
+{
+ struct hci_rp_read_data_block_size *rp = (void *) skb->data;
+
+ BT_DBG("%s status 0x%x", hdev->name, rp->status);
+
+ if (rp->status)
+ return;
+
+ if (hdev->flow_ctl_mode == HCI_BLOCK_BASED_FLOW_CTL_MODE) {
+ hdev->acl_mtu = __le16_to_cpu(rp->max_acl_len);
+ hdev->sco_mtu = 0;
+ hdev->block_len = __le16_to_cpu(rp->block_len);
+ /* acl_pkts indicates the number of blocks */
+ hdev->acl_pkts = __le16_to_cpu(rp->num_blocks);
+ hdev->sco_pkts = 0;
+ hdev->acl_cnt = hdev->acl_pkts;
+ hdev->sco_cnt = 0;
+ }
+
+ BT_DBG("%s acl mtu %d:%d, block len %d", hdev->name, hdev->acl_mtu,
+ hdev->acl_cnt, hdev->block_len);
+
+ hci_req_complete(hdev, HCI_OP_READ_DATA_BLOCK_SIZE, rp->status);
+}
+
static void hci_cc_write_ca_timeout(struct hci_dev *hdev, struct sk_buff *skb)
{
__u8 status = *((__u8 *) skb->data);
@@ -1978,6 +2005,10 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk
hci_cc_read_bd_addr(hdev, skb);
break;
+ case HCI_OP_READ_DATA_BLOCK_SIZE:
+ hci_cc_read_data_block_size(hdev, skb);
+ break;
+
case HCI_OP_WRITE_CA_TIMEOUT:
hci_cc_write_ca_timeout(hdev, skb);
break;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [RFC 2/2] Bluetooth: Add HCI Read Data Block Size function
2011-11-23 15:35 ` [RFC 2/2] Bluetooth: Add HCI Read Data Block Size function Emeltchenko Andrei
@ 2011-11-25 11:42 ` Marcel Holtmann
0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2011-11-25 11:42 UTC (permalink / raw)
To: Emeltchenko Andrei; +Cc: linux-bluetooth
Hi Andrei,
> Upstream Code Aurora function with minor trivial fixes.
> Origin: git://codeaurora.org/kernel/msm.git
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> include/net/bluetooth/hci.h | 11 +++++++++++
> include/net/bluetooth/hci_core.h | 2 ++
> net/bluetooth/hci_event.c | 31 +++++++++++++++++++++++++++++++
> 3 files changed, 44 insertions(+), 0 deletions(-)
>
> diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
> index ee83c36..324883a 100644
> --- a/include/net/bluetooth/hci.h
> +++ b/include/net/bluetooth/hci.h
> @@ -271,6 +271,9 @@ enum {
> #define HCI_ERROR_LOCAL_HOST_TERM 0x16
> #define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
>
> +/* Flow control modes */
> +#define HCI_BLOCK_BASED_FLOW_CTL_MODE 0x01
> +
isn't this better HCI_FLOW_CTL_MODE_BLOCK_BASED. Especially if you also
wanna define the packet based one.
> /* ----- HCI Commands ---- */
> #define HCI_OP_NOP 0x0000
>
> @@ -737,6 +740,14 @@ struct hci_rp_read_bd_addr {
> bdaddr_t bdaddr;
> } __packed;
>
> +#define HCI_OP_READ_DATA_BLOCK_SIZE 0x100a
> +struct hci_rp_read_data_block_size {
> + __u8 status;
> + __le16 max_acl_len;
> + __le16 block_len;
> + __le16 num_blocks;
> +} __packed;
> +
> #define HCI_OP_WRITE_PAGE_SCAN_ACTIVITY 0x0c1c
> struct hci_cp_write_page_scan_activity {
> __le16 interval;
> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> index a7fd63a..869ab72 100644
> --- a/include/net/bluetooth/hci_core.h
> +++ b/include/net/bluetooth/hci_core.h
> @@ -172,6 +172,8 @@ struct hci_dev {
>
> __u8 flow_ctl_mode;
>
> + __u16 block_len;
> +
> unsigned int auto_accept_delay;
>
> unsigned long quirks;
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 23ccb61..8413b29 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -771,6 +771,33 @@ static void hci_cc_read_bd_addr(struct hci_dev *hdev, struct sk_buff *skb)
> hci_req_complete(hdev, HCI_OP_READ_BD_ADDR, rp->status);
> }
>
> +static void hci_cc_read_data_block_size(struct hci_dev *hdev,
> + struct sk_buff *skb)
> +{
> + struct hci_rp_read_data_block_size *rp = (void *) skb->data;
> +
> + BT_DBG("%s status 0x%x", hdev->name, rp->status);
> +
> + if (rp->status)
> + return;
> +
> + if (hdev->flow_ctl_mode == HCI_BLOCK_BASED_FLOW_CTL_MODE) {
> + hdev->acl_mtu = __le16_to_cpu(rp->max_acl_len);
> + hdev->sco_mtu = 0;
> + hdev->block_len = __le16_to_cpu(rp->block_len);
> + /* acl_pkts indicates the number of blocks */
> + hdev->acl_pkts = __le16_to_cpu(rp->num_blocks);
> + hdev->sco_pkts = 0;
> + hdev->acl_cnt = hdev->acl_pkts;
> + hdev->sco_cnt = 0;
> + }
Do we just wanna use use previous packet based flow variables. Is that
really a good idea? Shouldn't we separate it?
> +
> + BT_DBG("%s acl mtu %d:%d, block len %d", hdev->name, hdev->acl_mtu,
> + hdev->acl_cnt, hdev->block_len);
> +
> + hci_req_complete(hdev, HCI_OP_READ_DATA_BLOCK_SIZE, rp->status);
> +}
> +
> static void hci_cc_write_ca_timeout(struct hci_dev *hdev, struct sk_buff *skb)
> {
> __u8 status = *((__u8 *) skb->data);
> @@ -1978,6 +2005,10 @@ static inline void hci_cmd_complete_evt(struct hci_dev *hdev, struct sk_buff *sk
> hci_cc_read_bd_addr(hdev, skb);
> break;
>
> + case HCI_OP_READ_DATA_BLOCK_SIZE:
> + hci_cc_read_data_block_size(hdev, skb);
> + break;
> +
> case HCI_OP_WRITE_CA_TIMEOUT:
> hci_cc_write_ca_timeout(hdev, skb);
> break;
Regards
Marcel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC 1/2] Bluetooth: Add HCI Read Flow Control Mode function
2011-11-23 15:35 [RFC 1/2] Bluetooth: Add HCI Read Flow Control Mode function Emeltchenko Andrei
2011-11-23 15:35 ` [RFC 2/2] Bluetooth: Add HCI Read Data Block Size function Emeltchenko Andrei
@ 2011-11-25 11:39 ` Marcel Holtmann
2011-12-02 11:42 ` Gustavo Padovan
2 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2011-11-25 11:39 UTC (permalink / raw)
To: Emeltchenko Andrei; +Cc: linux-bluetooth
Hi Andrei,
> Upstream Code Aurora function with minor trivial fixes.
> Origin: git://codeaurora.org/kernel/msm.git
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> include/net/bluetooth/hci.h | 6 ++++++
> include/net/bluetooth/hci_core.h | 2 ++
> net/bluetooth/hci_event.c | 19 +++++++++++++++++++
> 3 files changed, 27 insertions(+), 0 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC 1/2] Bluetooth: Add HCI Read Flow Control Mode function
2011-11-23 15:35 [RFC 1/2] Bluetooth: Add HCI Read Flow Control Mode function Emeltchenko Andrei
2011-11-23 15:35 ` [RFC 2/2] Bluetooth: Add HCI Read Data Block Size function Emeltchenko Andrei
2011-11-25 11:39 ` [RFC 1/2] Bluetooth: Add HCI Read Flow Control Mode function Marcel Holtmann
@ 2011-12-02 11:42 ` Gustavo Padovan
2 siblings, 0 replies; 5+ messages in thread
From: Gustavo Padovan @ 2011-12-02 11:42 UTC (permalink / raw)
To: Emeltchenko Andrei; +Cc: linux-bluetooth
Hi Andrei,
* Emeltchenko Andrei <Andrei.Emeltchenko.news@gmail.com> [2011-11-23 17:35:14 +0200]:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> Upstream Code Aurora function with minor trivial fixes.
> Origin: git://codeaurora.org/kernel/msm.git
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Applied, thanks.
Gustavo
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-12-02 11:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-23 15:35 [RFC 1/2] Bluetooth: Add HCI Read Flow Control Mode function Emeltchenko Andrei
2011-11-23 15:35 ` [RFC 2/2] Bluetooth: Add HCI Read Data Block Size function Emeltchenko Andrei
2011-11-25 11:42 ` Marcel Holtmann
2011-11-25 11:39 ` [RFC 1/2] Bluetooth: Add HCI Read Flow Control Mode function Marcel Holtmann
2011-12-02 11:42 ` Gustavo Padovan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).