* Re: [PATCH 1/2] heartrate: Fix registration of notification handler
From: Johan Hedberg @ 2012-10-13 16:49 UTC (permalink / raw)
To: Andrzej Kaczmarek; +Cc: linux-bluetooth
In-Reply-To: <1350141502-4385-1-git-send-email-andrzej.kaczmarek@tieto.com>
Hi Andrzej,
On Sat, Oct 13, 2012, Andrzej Kaczmarek wrote:
> Notification handler is registered only when CCC is written during
> descriptors discovery, i.e. at least one watcher is registered before
> device is connected. This means there will be no handler registered in
> case watcher is registered after device already connected.
> This is side-effect of 74a9fc7.
>
> This patch registers handler immediately when measurement characteristic
> is discovered so it does not matter when watcher is registered.
>
> ccc_write_cb() is reduntant in this case so it's removed.
> ---
> profiles/heartrate/heartrate.c | 24 ++++++++----------------
> 1 file changed, 8 insertions(+), 16 deletions(-)
Both patches have been applied. Thanks.
Johan
^ permalink raw reply
* [PATCH 2/2] heartrate: Remove unused measurement characteristic value handle
From: Andrzej Kaczmarek @ 2012-10-13 15:18 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
In-Reply-To: <1350141502-4385-1-git-send-email-andrzej.kaczmarek@tieto.com>
Since notification handler is now registered only for measurement
characteristic value handle it's no longer needed to keep this handle.
---
profiles/heartrate/heartrate.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/profiles/heartrate/heartrate.c b/profiles/heartrate/heartrate.c
index 81ff310..28c1932 100644
--- a/profiles/heartrate/heartrate.c
+++ b/profiles/heartrate/heartrate.c
@@ -66,7 +66,6 @@ struct heartrate {
struct att_range *svc_range; /* primary svc range */
- uint16_t measurement_val_handle;
uint16_t measurement_ccc_handle;
uint16_t hrcp_val_handle;
@@ -478,8 +477,6 @@ static void discover_char_cb(GSList *chars, guint8 status, gpointer user_data)
struct gatt_char *c_next =
(chars->next ? chars->next->data : NULL);
- hr->measurement_val_handle = c->value_handle;
-
hr->attionotid = g_attrib_register(hr->attrib,
ATT_OP_HANDLE_NOTIFY,
c->value_handle,
--
1.7.11.3
^ permalink raw reply related
* [PATCH 1/2] heartrate: Fix registration of notification handler
From: Andrzej Kaczmarek @ 2012-10-13 15:18 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Andrzej Kaczmarek
Notification handler is registered only when CCC is written during
descriptors discovery, i.e. at least one watcher is registered before
device is connected. This means there will be no handler registered in
case watcher is registered after device already connected.
This is side-effect of 74a9fc7.
This patch registers handler immediately when measurement characteristic
is discovered so it does not matter when watcher is registered.
ccc_write_cb() is reduntant in this case so it's removed.
---
profiles/heartrate/heartrate.c | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/profiles/heartrate/heartrate.c b/profiles/heartrate/heartrate.c
index 871b74e..81ff310 100644
--- a/profiles/heartrate/heartrate.c
+++ b/profiles/heartrate/heartrate.c
@@ -389,21 +389,6 @@ static void notify_handler(const uint8_t *pdu, uint16_t len, gpointer user_data)
process_measurement(hr, pdu + 3, len - 3);
}
-static void ccc_write_cb(guint8 status, const guint8 *pdu, guint16 len,
- gpointer user_data)
-{
- struct heartrate *hr = user_data;
-
- if (status != 0) {
- error("Enable measurement failed");
- return;
- }
-
- hr->attionotid = g_attrib_register(hr->attrib, ATT_OP_HANDLE_NOTIFY,
- hr->measurement_val_handle,
- notify_handler, hr, NULL);
-}
-
static void discover_ccc_cb(guint8 status, const guint8 *pdu,
guint16 len, gpointer user_data)
{
@@ -434,6 +419,7 @@ static void discover_ccc_cb(guint8 status, const guint8 *pdu,
uuid = att_get_u16(value + 2);
if (uuid == GATT_CLIENT_CHARAC_CFG_UUID) {
+ char *msg;
uint8_t value[2];
hr->measurement_ccc_handle = handle;
@@ -442,9 +428,10 @@ static void discover_ccc_cb(guint8 status, const guint8 *pdu,
break;
att_put_u16(GATT_CLIENT_CHARAC_CFG_NOTIF_BIT, value);
+ msg = g_strdup("Enable measurement");
gatt_write_char(hr->attrib, handle, value,
- sizeof(value), ccc_write_cb, hr);
+ sizeof(value), char_write_cb, msg);
break;
}
@@ -493,6 +480,11 @@ static void discover_char_cb(GSList *chars, guint8 status, gpointer user_data)
hr->measurement_val_handle = c->value_handle;
+ hr->attionotid = g_attrib_register(hr->attrib,
+ ATT_OP_HANDLE_NOTIFY,
+ c->value_handle,
+ notify_handler, hr, NULL);
+
discover_measurement_ccc(hr, c, c_next);
} else if (g_strcmp0(c->uuid, BODY_SENSOR_LOCATION_UUID) == 0) {
DBG("Body Sensor Location supported");
--
1.7.11.3
^ permalink raw reply related
* Re: [PATCH BlueZ] input: Convert to DBus.Properties
From: Johan Hedberg @ 2012-10-13 9:20 UTC (permalink / raw)
To: Lucas De Marchi; +Cc: linux-bluetooth
In-Reply-To: <1349981868-1263-1-git-send-email-lucas.demarchi@profusion.mobi>
Hi Lucas,
On Thu, Oct 11, 2012, Lucas De Marchi wrote:
> ---
> profiles/input/device.c | 44 +++++++++++++-------------------------------
> 1 file changed, 13 insertions(+), 31 deletions(-)
Applied. Thanks.
Johan
^ permalink raw reply
* Re: [RFCv1 7/7] Bluetooth: Zero bredr pointer when chan is deleted
From: Marcel Holtmann @ 2012-10-12 23:54 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1350051005-6015-7-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/l2cap_core.c | 4 ++++
> 1 file changed, 4 insertions(+)
same here. Please write a commit message.
Regards
Marcel
^ permalink raw reply
* Re: [RFCv1 6/7] Bluetooth: AMP: Zero amp_mgr pointer if removed
From: Marcel Holtmann @ 2012-10-12 23:54 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1350051005-6015-6-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
>
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/hci_conn.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
I want a commit messages that is more than just a subject.
Regards
Marcel
^ permalink raw reply
* Re: [RFCv1 5/7] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn
From: Marcel Holtmann @ 2012-10-12 23:53 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1350051005-6015-5-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> When assigning amp_mgr in hci_conn (type AMP_LINK) get also reference.
> In hci_conn_del those references would be put for both types.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/amp.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
> diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
> index 59da0f1..e525e23 100644
> --- a/net/bluetooth/amp.c
> +++ b/net/bluetooth/amp.c
> @@ -123,9 +123,11 @@ struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
> hcon->attempt++;
> hcon->handle = __next_handle(mgr);
> hcon->remote_id = remote_id;
> - hcon->amp_mgr = mgr;
> hcon->out = out;
>
> + hcon->amp_mgr = mgr;
> + amp_mgr_get(mgr);
> +
We could discuss that amp_mgt_get(mgr) should just return mgr and you
can write this like this:
hcon->amp_mgr = amp_mgr_get(mgr);
Regards
Marcel
^ permalink raw reply
* Re: [RFCv1 4/7] Bluetooth: Send EFS Conf Rsp only for BR/EDR chan
From: Marcel Holtmann @ 2012-10-12 23:51 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1350051005-6015-4-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> Do not send EFS Configuration Response for High Speed channel yet.
> It will be sent after receiving Logical Link Complete event.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/l2cap_core.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [RFCv1 3/7] Bluetooth: AMP: Drop packets when no l2cap conn exist
From: Marcel Holtmann @ 2012-10-12 23:50 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1350051005-6015-3-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> HS hci conn should always have l2cap_conn associated with it.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/l2cap_core.c | 4 ++++
> 1 file changed, 4 insertions(+)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [RFCv1 2/7] Bluetooth: AMP: Handle complete frames in l2cap
From: Marcel Holtmann @ 2012-10-12 23:50 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1350051005-6015-2-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> Check flags type in switch statement and handle new frame
> type ACL_COMPLETE used for High Speed data over AMP.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> include/net/bluetooth/hci.h | 1 +
> net/bluetooth/l2cap_core.c | 15 ++++++++++-----
> 2 files changed, 11 insertions(+), 5 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field
From: Marcel Holtmann @ 2012-10-12 23:49 UTC (permalink / raw)
To: Andrei Emeltchenko; +Cc: linux-bluetooth
In-Reply-To: <1350051005-6015-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> For AMP HCI controller use Logical Link handle in HCI ACL
> Handle field.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/hci_core.c | 15 ++++++++++++++-
> 1 file changed, 14 insertions(+), 1 deletion(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 2e72c41..32c4dbe 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -2162,7 +2162,20 @@ static void hci_queue_acl(struct hci_chan *chan, struct sk_buff_head *queue,
> skb->data_len = 0;
>
> bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT;
> - hci_add_acl_hdr(skb, conn->handle, flags);
> +
> + switch (hdev->dev_type) {
> + case HCI_BREDR:
> + hci_add_acl_hdr(skb, conn->handle, flags);
> + break;
> +
However, remove the empty lines here. It is fine to condense this
statement since they are single statements.
> + case HCI_AMP:
> + hci_add_acl_hdr(skb, chan->handle, flags);
> + break;
> +
> + default:
> + BT_ERR("%s unknown dev_type %d", hdev->name, hdev->dev_type);
> + return;
> + }
>
> list = skb_shinfo(skb)->frag_list;
> if (!list) {
regards
Marcel
^ permalink raw reply
* Re: [PATCH] Bluetooth: Rename __l2cap_connect() to l2cap_connect()
From: Marcel Holtmann @ 2012-10-12 23:48 UTC (permalink / raw)
To: Gustavo Padovan; +Cc: linux-bluetooth, Gustavo Padovan
In-Reply-To: <1350042040-1908-1-git-send-email-gustavo@padovan.org>
Hi Gustavo,
> Use of "__" usually means we need to call the function with a lock held,
> which is not the case here.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
> net/bluetooth/l2cap_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index 1d773b9..9060eec 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -3389,7 +3389,7 @@ static inline int l2cap_command_rej(struct l2cap_conn *conn,
> return 0;
> }
>
> -static void __l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd,
> +static void l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd,
> u8 *data, u8 rsp_code, u8 amp_id)
Don't you need to fix the coding style for the indentation of the second
line.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH -v3 2/2] Bluetooth: Add chan->ops->defer()
From: Marcel Holtmann @ 2012-10-12 23:46 UTC (permalink / raw)
To: Gustavo Padovan; +Cc: linux-bluetooth, Gustavo Padovan
In-Reply-To: <1350041724-29948-2-git-send-email-gustavo@padovan.org>
Hi Gustavo,
> When DEFER_SETUP is set defer() will trigger an authorization
> request to the userspace.
>
> l2cap_chan_no_defer() is meant to be used when one does not want to
> support DEFER_SETUP (A2MP for example).
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
> include/net/bluetooth/l2cap.h | 5 +++++
> net/bluetooth/a2mp.c | 1 +
> net/bluetooth/l2cap_core.c | 10 +++-------
> net/bluetooth/l2cap_sock.c | 10 ++++++++++
> 4 files changed, 19 insertions(+), 7 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [PATCH -v3 1/2] Bluetooth: Move bt_accept_enqueue() to l2cap_sock.c
From: Marcel Holtmann @ 2012-10-12 23:46 UTC (permalink / raw)
To: Gustavo Padovan; +Cc: linux-bluetooth, Gustavo Padovan
In-Reply-To: <1350041724-29948-1-git-send-email-gustavo@padovan.org>
Hi Gustavo,
> This is part of the move the parent socket usage to l2cap_sock.c
>
> The change is safe when it cames to locking, bt_accept_enqueue() is still
it is "comes".
> protected by the parent socket lock inside the
> l2cap_sock_new_connection_cb() code.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
> net/bluetooth/l2cap_core.c | 4 ----
> net/bluetooth/l2cap_sock.c | 2 ++
> 2 files changed, 2 insertions(+), 4 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply
* Re: [PATCH -v4 1/2] rctest: add automated test
From: Johan Hedberg @ 2012-10-12 14:58 UTC (permalink / raw)
To: Gustavo Padovan; +Cc: linux-bluetooth, Gustavo Padovan
In-Reply-To: <1349668203-10782-1-git-send-email-gustavo@padovan.org>
Hi Gustavo,
On Mon, Oct 08, 2012, Gustavo Padovan wrote:
> adds -a option to enable automated tests. We use the -i option to define
> the receiving side and the -a define the sending side:
>
> ./rctest -i hci0 -a hci1
> ---
> test/rctest.c | 46 ++++++++++++++++++++++++++++++++++++++++++----
> 1 file changed, 42 insertions(+), 4 deletions(-)
Both patches have been applied. Thanks.
Johan
^ permalink raw reply
* [RFCv1 7/7] Bluetooth: Zero bredr pointer when chan is deleted
From: Andrei Emeltchenko @ 2012-10-12 14:10 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1350051005-6015-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
net/bluetooth/l2cap_core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 1e717fd..eb286ca 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -531,6 +531,7 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err)
BT_DBG("chan %p, conn %p, err %d", chan, conn, err);
if (conn) {
+ struct amp_mgr *mgr = conn->hcon->amp_mgr;
/* Delete from channel list */
list_del(&chan->list);
@@ -540,6 +541,9 @@ void l2cap_chan_del(struct l2cap_chan *chan, int err)
if (chan->chan_type != L2CAP_CHAN_CONN_FIX_A2MP)
hci_conn_put(conn->hcon);
+
+ if (mgr && mgr->bredr_chan == chan)
+ mgr->bredr_chan = NULL;
}
if (chan->ops->teardown)
--
1.7.9.5
^ permalink raw reply related
* [RFCv1 6/7] Bluetooth: AMP: Zero amp_mgr pointer if removed
From: Andrei Emeltchenko @ 2012-10-12 14:10 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1350051005-6015-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
net/bluetooth/hci_conn.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index fe64621..eed9c8e 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -439,8 +439,10 @@ int hci_conn_del(struct hci_conn *conn)
hci_chan_list_flush(conn);
- if (conn->amp_mgr)
- amp_mgr_put(conn->amp_mgr);
+ if (conn->amp_mgr) {
+ if (amp_mgr_put(conn->amp_mgr))
+ conn->amp_mgr = NULL;
+ }
hci_conn_hash_del(hdev, conn);
if (hdev->notify)
--
1.7.9.5
^ permalink raw reply related
* [RFCv1 5/7] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn
From: Andrei Emeltchenko @ 2012-10-12 14:10 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1350051005-6015-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
When assigning amp_mgr in hci_conn (type AMP_LINK) get also reference.
In hci_conn_del those references would be put for both types.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
net/bluetooth/amp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 59da0f1..e525e23 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -123,9 +123,11 @@ struct hci_conn *phylink_add(struct hci_dev *hdev, struct amp_mgr *mgr,
hcon->attempt++;
hcon->handle = __next_handle(mgr);
hcon->remote_id = remote_id;
- hcon->amp_mgr = mgr;
hcon->out = out;
+ hcon->amp_mgr = mgr;
+ amp_mgr_get(mgr);
+
return hcon;
}
--
1.7.9.5
^ permalink raw reply related
* [RFCv1 4/7] Bluetooth: Send EFS Conf Rsp only for BR/EDR chan
From: Andrei Emeltchenko @ 2012-10-12 14:10 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1350051005-6015-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Do not send EFS Configuration Response for High Speed channel yet.
It will be sent after receiving Logical Link Complete event.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
net/bluetooth/l2cap_core.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 38b058d..1e717fd 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3718,7 +3718,11 @@ static inline int l2cap_config_req(struct l2cap_conn *conn,
/* check compatibility */
- l2cap_send_efs_conf_rsp(chan, rsp, cmd->ident, flags);
+ /* Send rsp for BR/EDR channel */
+ if (!chan->ctrl_id)
+ l2cap_send_efs_conf_rsp(chan, rsp, cmd->ident, flags);
+ else
+ chan->ident = cmd->ident;
}
unlock:
@@ -3767,7 +3771,11 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn,
/* check compatibility */
- l2cap_send_efs_conf_rsp(chan, buf, cmd->ident, 0);
+ if (!chan->ctrl_id)
+ l2cap_send_efs_conf_rsp(chan, buf, cmd->ident,
+ 0);
+ else
+ chan->ident = cmd->ident;
}
goto done;
--
1.7.9.5
^ permalink raw reply related
* [RFCv1 3/7] Bluetooth: AMP: Drop packets when no l2cap conn exist
From: Andrei Emeltchenko @ 2012-10-12 14:10 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1350051005-6015-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
HS hci conn should always have l2cap_conn associated with it.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
net/bluetooth/l2cap_core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 38f311e..38b058d 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5582,6 +5582,10 @@ int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
struct l2cap_hdr *hdr;
int len;
+ /* For AMP controller do not create l2cap conn */
+ if (!conn && hcon->hdev->dev_type != HCI_BREDR)
+ goto drop;
+
if (!conn)
conn = l2cap_conn_add(hcon, 0);
--
1.7.9.5
^ permalink raw reply related
* [RFCv1 2/7] Bluetooth: AMP: Handle complete frames in l2cap
From: Andrei Emeltchenko @ 2012-10-12 14:10 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1350051005-6015-1-git-send-email-Andrei.Emeltchenko.news@gmail.com>
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Check flags type in switch statement and handle new frame
type ACL_COMPLETE used for High Speed data over AMP.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
include/net/bluetooth/hci.h | 1 +
net/bluetooth/l2cap_core.c | 15 ++++++++++-----
2 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 77b6a19..88cbbda 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -198,6 +198,7 @@ enum {
#define ACL_START_NO_FLUSH 0x00
#define ACL_CONT 0x01
#define ACL_START 0x02
+#define ACL_COMPLETE 0x03
#define ACL_ACTIVE_BCAST 0x04
#define ACL_PICO_BCAST 0x08
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 207b4a8..38f311e 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5579,6 +5579,8 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
{
struct l2cap_conn *conn = hcon->l2cap_data;
+ struct l2cap_hdr *hdr;
+ int len;
if (!conn)
conn = l2cap_conn_add(hcon, 0);
@@ -5588,10 +5590,10 @@ int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
BT_DBG("conn %p len %d flags 0x%x", conn, skb->len, flags);
- if (!(flags & ACL_CONT)) {
- struct l2cap_hdr *hdr;
- int len;
-
+ switch (flags) {
+ case ACL_START:
+ case ACL_START_NO_FLUSH:
+ case ACL_COMPLETE:
if (conn->rx_len) {
BT_ERR("Unexpected start frame (len %d)", skb->len);
kfree_skb(conn->rx_skb);
@@ -5633,7 +5635,9 @@ int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
skb_copy_from_linear_data(skb, skb_put(conn->rx_skb, skb->len),
skb->len);
conn->rx_len = len - skb->len;
- } else {
+ break;
+
+ case ACL_CONT:
BT_DBG("Cont: frag len %d (expecting %d)", skb->len, conn->rx_len);
if (!conn->rx_len) {
@@ -5661,6 +5665,7 @@ int l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
l2cap_recv_frame(conn, conn->rx_skb);
conn->rx_skb = NULL;
}
+ break;
}
drop:
--
1.7.9.5
^ permalink raw reply related
* [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field
From: Andrei Emeltchenko @ 2012-10-12 14:09 UTC (permalink / raw)
To: linux-bluetooth
From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
For AMP HCI controller use Logical Link handle in HCI ACL
Handle field.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
net/bluetooth/hci_core.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 2e72c41..32c4dbe 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2162,7 +2162,20 @@ static void hci_queue_acl(struct hci_chan *chan, struct sk_buff_head *queue,
skb->data_len = 0;
bt_cb(skb)->pkt_type = HCI_ACLDATA_PKT;
- hci_add_acl_hdr(skb, conn->handle, flags);
+
+ switch (hdev->dev_type) {
+ case HCI_BREDR:
+ hci_add_acl_hdr(skb, conn->handle, flags);
+ break;
+
+ case HCI_AMP:
+ hci_add_acl_hdr(skb, chan->handle, flags);
+ break;
+
+ default:
+ BT_ERR("%s unknown dev_type %d", hdev->name, hdev->dev_type);
+ return;
+ }
list = skb_shinfo(skb)->frag_list;
if (!list) {
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH] Bluetooth: Rename __l2cap_connect() to l2cap_connect()
From: Andrei Emeltchenko @ 2012-10-12 12:04 UTC (permalink / raw)
To: Gustavo Padovan; +Cc: linux-bluetooth, Gustavo Padovan
In-Reply-To: <1350042040-1908-1-git-send-email-gustavo@padovan.org>
Hi Gustavo,
On Fri, Oct 12, 2012 at 07:40:40PM +0800, Gustavo Padovan wrote:
> From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
>
> Use of "__" usually means we need to call the function with a lock held,
> which is not the case here.
I think it is OK to leave the function as is. We do not have such a strong
convention and we have too many locks anyway.
Best regards
Andrei Emeltchenko
^ permalink raw reply
* [PATCH] Bluetooth: Rename __l2cap_connect() to l2cap_connect()
From: Gustavo Padovan @ 2012-10-12 11:40 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Gustavo Padovan
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Use of "__" usually means we need to call the function with a lock held,
which is not the case here.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
net/bluetooth/l2cap_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 1d773b9..9060eec 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3389,7 +3389,7 @@ static inline int l2cap_command_rej(struct l2cap_conn *conn,
return 0;
}
-static void __l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd,
+static void l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd,
u8 *data, u8 rsp_code, u8 amp_id)
{
struct l2cap_conn_req *req = (struct l2cap_conn_req *) data;
@@ -3508,7 +3508,7 @@ sendresp:
static int l2cap_connect_req(struct l2cap_conn *conn,
struct l2cap_cmd_hdr *cmd, u8 *data)
{
- __l2cap_connect(conn, cmd, data, L2CAP_CONN_RSP, 0);
+ l2cap_connect(conn, cmd, data, L2CAP_CONN_RSP, 0);
return 0;
}
--
1.7.11.4
^ permalink raw reply related
* [PATCH -v3 2/2] Bluetooth: Add chan->ops->defer()
From: Gustavo Padovan @ 2012-10-12 11:35 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Gustavo Padovan
In-Reply-To: <1350041724-29948-1-git-send-email-gustavo@padovan.org>
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
When DEFER_SETUP is set defer() will trigger an authorization
request to the userspace.
l2cap_chan_no_defer() is meant to be used when one does not want to
support DEFER_SETUP (A2MP for example).
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
include/net/bluetooth/l2cap.h | 5 +++++
net/bluetooth/a2mp.c | 1 +
net/bluetooth/l2cap_core.c | 10 +++-------
net/bluetooth/l2cap_sock.c | 10 ++++++++++
4 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index caab98c..6e23afd 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -541,6 +541,7 @@ struct l2cap_ops {
void (*state_change) (struct l2cap_chan *chan,
int state);
void (*ready) (struct l2cap_chan *chan);
+ void (*defer) (struct l2cap_chan *chan);
struct sk_buff *(*alloc_skb) (struct l2cap_chan *chan,
unsigned long len, int nb);
};
@@ -748,6 +749,10 @@ static inline void l2cap_chan_no_ready(struct l2cap_chan *chan)
{
}
+static inline void l2cap_chan_no_defer(struct l2cap_chan *chan)
+{
+}
+
extern bool disable_ertm;
int l2cap_init_sockets(void);
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index 3ff4dc9..7bf9a10 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -699,6 +699,7 @@ static struct l2cap_ops a2mp_chan_ops = {
.new_connection = l2cap_chan_no_new_connection,
.teardown = l2cap_chan_no_teardown,
.ready = l2cap_chan_no_ready,
+ .defer = l2cap_chan_no_defer,
};
static struct l2cap_chan *a2mp_chan_open(struct l2cap_conn *conn, bool locked)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 9d84050..314d955 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -1120,11 +1120,9 @@ static void l2cap_conn_start(struct l2cap_conn *conn)
lock_sock(sk);
if (test_bit(BT_SK_DEFER_SETUP,
&bt_sk(sk)->flags)) {
- struct sock *parent = bt_sk(sk)->parent;
rsp.result = __constant_cpu_to_le16(L2CAP_CR_PEND);
rsp.status = __constant_cpu_to_le16(L2CAP_CS_AUTHOR_PEND);
- if (parent)
- parent->sk_data_ready(parent, 0);
+ chan->ops->defer(chan);
} else {
__l2cap_state_change(chan, BT_CONFIG);
@@ -3460,7 +3458,7 @@ static void __l2cap_connect(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd,
__l2cap_state_change(chan, BT_CONNECT2);
result = L2CAP_CR_PEND;
status = L2CAP_CS_AUTHOR_PEND;
- parent->sk_data_ready(parent, 0);
+ chan->ops->defer(chan);
} else {
__l2cap_state_change(chan, BT_CONFIG);
result = L2CAP_CR_SUCCESS;
@@ -5523,11 +5521,9 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
if (!status) {
if (test_bit(BT_SK_DEFER_SETUP,
&bt_sk(sk)->flags)) {
- struct sock *parent = bt_sk(sk)->parent;
res = L2CAP_CR_PEND;
stat = L2CAP_CS_AUTHOR_PEND;
- if (parent)
- parent->sk_data_ready(parent, 0);
+ chan->ops->defer(chan);
} else {
__l2cap_state_change(chan, BT_CONFIG);
res = L2CAP_CR_SUCCESS;
diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
index d5093b8..5fae2bd 100644
--- a/net/bluetooth/l2cap_sock.c
+++ b/net/bluetooth/l2cap_sock.c
@@ -1081,6 +1081,15 @@ static void l2cap_sock_ready_cb(struct l2cap_chan *chan)
release_sock(sk);
}
+static void l2cap_sock_defer_cb(struct l2cap_chan *chan)
+{
+ struct sock *sk = chan->data;
+ struct sock *parent = bt_sk(sk)->parent;
+
+ if (parent)
+ parent->sk_data_ready(parent, 0);
+}
+
static struct l2cap_ops l2cap_chan_ops = {
.name = "L2CAP Socket Interface",
.new_connection = l2cap_sock_new_connection_cb,
@@ -1089,6 +1098,7 @@ static struct l2cap_ops l2cap_chan_ops = {
.teardown = l2cap_sock_teardown_cb,
.state_change = l2cap_sock_state_change_cb,
.ready = l2cap_sock_ready_cb,
+ .defer = l2cap_sock_defer_cb,
.alloc_skb = l2cap_sock_alloc_skb_cb,
};
--
1.7.11.4
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox