linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field
@ 2012-10-12 14:09 Andrei Emeltchenko
  2012-10-12 14:10 ` [RFCv1 2/7] Bluetooth: AMP: Handle complete frames in l2cap Andrei Emeltchenko
                   ` (7 more replies)
  0 siblings, 8 replies; 28+ messages in thread
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	[flat|nested] 28+ messages in thread

* [RFCv1 2/7] Bluetooth: AMP: Handle complete frames in l2cap
  2012-10-12 14:09 [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field Andrei Emeltchenko
@ 2012-10-12 14:10 ` Andrei Emeltchenko
  2012-10-12 23:50   ` Marcel Holtmann
  2012-10-12 14:10 ` [RFCv1 3/7] Bluetooth: AMP: Drop packets when no l2cap conn exist Andrei Emeltchenko
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-12 14:10 UTC (permalink / raw)
  To: linux-bluetooth

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	[flat|nested] 28+ messages in thread

* [RFCv1 3/7] Bluetooth: AMP: Drop packets when no l2cap conn exist
  2012-10-12 14:09 [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field Andrei Emeltchenko
  2012-10-12 14:10 ` [RFCv1 2/7] Bluetooth: AMP: Handle complete frames in l2cap Andrei Emeltchenko
@ 2012-10-12 14:10 ` Andrei Emeltchenko
  2012-10-12 23:50   ` Marcel Holtmann
  2012-10-12 14:10 ` [RFCv1 4/7] Bluetooth: Send EFS Conf Rsp only for BR/EDR chan Andrei Emeltchenko
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-12 14:10 UTC (permalink / raw)
  To: linux-bluetooth

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	[flat|nested] 28+ messages in thread

* [RFCv1 4/7] Bluetooth: Send EFS Conf Rsp only for BR/EDR chan
  2012-10-12 14:09 [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field Andrei Emeltchenko
  2012-10-12 14:10 ` [RFCv1 2/7] Bluetooth: AMP: Handle complete frames in l2cap Andrei Emeltchenko
  2012-10-12 14:10 ` [RFCv1 3/7] Bluetooth: AMP: Drop packets when no l2cap conn exist Andrei Emeltchenko
@ 2012-10-12 14:10 ` Andrei Emeltchenko
  2012-10-12 23:51   ` Marcel Holtmann
  2012-10-12 14:10 ` [RFCv1 5/7] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn Andrei Emeltchenko
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-12 14:10 UTC (permalink / raw)
  To: linux-bluetooth

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	[flat|nested] 28+ messages in thread

* [RFCv1 5/7] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn
  2012-10-12 14:09 [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field Andrei Emeltchenko
                   ` (2 preceding siblings ...)
  2012-10-12 14:10 ` [RFCv1 4/7] Bluetooth: Send EFS Conf Rsp only for BR/EDR chan Andrei Emeltchenko
@ 2012-10-12 14:10 ` Andrei Emeltchenko
  2012-10-12 23:53   ` Marcel Holtmann
  2012-10-12 14:10 ` [RFCv1 6/7] Bluetooth: AMP: Zero amp_mgr pointer if removed Andrei Emeltchenko
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-12 14:10 UTC (permalink / raw)
  To: linux-bluetooth

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	[flat|nested] 28+ messages in thread

* [RFCv1 6/7] Bluetooth: AMP: Zero amp_mgr pointer if removed
  2012-10-12 14:09 [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field Andrei Emeltchenko
                   ` (3 preceding siblings ...)
  2012-10-12 14:10 ` [RFCv1 5/7] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn Andrei Emeltchenko
@ 2012-10-12 14:10 ` Andrei Emeltchenko
  2012-10-12 23:54   ` Marcel Holtmann
  2012-10-12 14:10 ` [RFCv1 7/7] Bluetooth: Zero bredr pointer when chan is deleted Andrei Emeltchenko
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-12 14:10 UTC (permalink / raw)
  To: linux-bluetooth

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	[flat|nested] 28+ messages in thread

* [RFCv1 7/7] Bluetooth: Zero bredr pointer when chan is deleted
  2012-10-12 14:09 [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field Andrei Emeltchenko
                   ` (4 preceding siblings ...)
  2012-10-12 14:10 ` [RFCv1 6/7] Bluetooth: AMP: Zero amp_mgr pointer if removed Andrei Emeltchenko
@ 2012-10-12 14:10 ` Andrei Emeltchenko
  2012-10-12 23:54   ` Marcel Holtmann
  2012-10-12 23:49 ` [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field Marcel Holtmann
  2012-10-15  8:58 ` [PATCHv2 0/6] AMP link fixes Andrei Emeltchenko
  7 siblings, 1 reply; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-12 14:10 UTC (permalink / raw)
  To: linux-bluetooth

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	[flat|nested] 28+ messages in thread

* Re: [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field
  2012-10-12 14:09 [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field Andrei Emeltchenko
                   ` (5 preceding siblings ...)
  2012-10-12 14:10 ` [RFCv1 7/7] Bluetooth: Zero bredr pointer when chan is deleted Andrei Emeltchenko
@ 2012-10-12 23:49 ` Marcel Holtmann
  2012-10-15  8:58 ` [PATCHv2 0/6] AMP link fixes Andrei Emeltchenko
  7 siblings, 0 replies; 28+ messages in thread
From: Marcel Holtmann @ 2012-10-12 23:49 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

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	[flat|nested] 28+ messages in thread

* Re: [RFCv1 2/7] Bluetooth: AMP: Handle complete frames in l2cap
  2012-10-12 14:10 ` [RFCv1 2/7] Bluetooth: AMP: Handle complete frames in l2cap Andrei Emeltchenko
@ 2012-10-12 23:50   ` Marcel Holtmann
  0 siblings, 0 replies; 28+ messages in thread
From: Marcel Holtmann @ 2012-10-12 23:50 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

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	[flat|nested] 28+ messages in thread

* Re: [RFCv1 3/7] Bluetooth: AMP: Drop packets when no l2cap conn exist
  2012-10-12 14:10 ` [RFCv1 3/7] Bluetooth: AMP: Drop packets when no l2cap conn exist Andrei Emeltchenko
@ 2012-10-12 23:50   ` Marcel Holtmann
  0 siblings, 0 replies; 28+ messages in thread
From: Marcel Holtmann @ 2012-10-12 23:50 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

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	[flat|nested] 28+ messages in thread

* Re: [RFCv1 4/7] Bluetooth: Send EFS Conf Rsp only for BR/EDR chan
  2012-10-12 14:10 ` [RFCv1 4/7] Bluetooth: Send EFS Conf Rsp only for BR/EDR chan Andrei Emeltchenko
@ 2012-10-12 23:51   ` Marcel Holtmann
  0 siblings, 0 replies; 28+ messages in thread
From: Marcel Holtmann @ 2012-10-12 23:51 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

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	[flat|nested] 28+ messages in thread

* Re: [RFCv1 5/7] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn
  2012-10-12 14:10 ` [RFCv1 5/7] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn Andrei Emeltchenko
@ 2012-10-12 23:53   ` Marcel Holtmann
  2012-10-15  8:31     ` Andrei Emeltchenko
  0 siblings, 1 reply; 28+ messages in thread
From: Marcel Holtmann @ 2012-10-12 23:53 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

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	[flat|nested] 28+ messages in thread

* Re: [RFCv1 6/7] Bluetooth: AMP: Zero amp_mgr pointer if removed
  2012-10-12 14:10 ` [RFCv1 6/7] Bluetooth: AMP: Zero amp_mgr pointer if removed Andrei Emeltchenko
@ 2012-10-12 23:54   ` Marcel Holtmann
  0 siblings, 0 replies; 28+ messages in thread
From: Marcel Holtmann @ 2012-10-12 23:54 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

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	[flat|nested] 28+ messages in thread

* Re: [RFCv1 7/7] Bluetooth: Zero bredr pointer when chan is deleted
  2012-10-12 14:10 ` [RFCv1 7/7] Bluetooth: Zero bredr pointer when chan is deleted Andrei Emeltchenko
@ 2012-10-12 23:54   ` Marcel Holtmann
  0 siblings, 0 replies; 28+ messages in thread
From: Marcel Holtmann @ 2012-10-12 23:54 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

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	[flat|nested] 28+ messages in thread

* Re: [RFCv1 5/7] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn
  2012-10-12 23:53   ` Marcel Holtmann
@ 2012-10-15  8:31     ` Andrei Emeltchenko
  0 siblings, 0 replies; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-15  8:31 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: linux-bluetooth

Hi Marcel,

On Sat, Oct 13, 2012 at 01:53:25AM +0200, Marcel Holtmann wrote:
> 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);

Good idea. I will make it in the following patches.

Best regards 
Andrei Emeltchenko 

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCHv2 0/6] AMP link fixes
  2012-10-12 14:09 [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field Andrei Emeltchenko
                   ` (6 preceding siblings ...)
  2012-10-12 23:49 ` [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field Marcel Holtmann
@ 2012-10-15  8:58 ` Andrei Emeltchenko
  2012-10-15  8:58   ` [PATCHv2 1/6] Bluetooth: AMP: Use Loglink handle in ACL Handle field Andrei Emeltchenko
                     ` (5 more replies)
  7 siblings, 6 replies; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-15  8:58 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

Set of patches handling AMP link fixes

Changelog:
	* v2: Removed patch "AMP: Zero amp_mgr pointer..", taken Marcel's
	comments.

Andrei Emeltchenko (6):
  Bluetooth: AMP: Use Loglink handle in ACL Handle field
  Bluetooth: AMP: Handle complete frames in l2cap
  Bluetooth: AMP: Drop packets when no l2cap conn exist
  Bluetooth: Send EFS Conf Rsp only for BR/EDR chan
  Bluetooth: AMP: Get amp_mgr reference in HS hci_conn
  Bluetooth: Zero bredr pointer when chan is deleted

 include/net/bluetooth/hci.h |    1 +
 net/bluetooth/amp.c         |    4 +++-
 net/bluetooth/hci_core.c    |   13 ++++++++++++-
 net/bluetooth/l2cap_core.c  |   35 ++++++++++++++++++++++++++++-------
 4 files changed, 44 insertions(+), 9 deletions(-)

-- 
1.7.9.5


^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCHv2 1/6] Bluetooth: AMP: Use Loglink handle in ACL Handle field
  2012-10-15  8:58 ` [PATCHv2 0/6] AMP link fixes Andrei Emeltchenko
@ 2012-10-15  8:58   ` Andrei Emeltchenko
  2012-10-15  8:58   ` [PATCHv2 2/6] Bluetooth: AMP: Handle complete frames in l2cap Andrei Emeltchenko
                     ` (4 subsequent siblings)
  5 siblings, 0 replies; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-15  8:58 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>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
---
 net/bluetooth/hci_core.c |   13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 2e72c41..0ec776a 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2162,7 +2162,18 @@ 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	[flat|nested] 28+ messages in thread

* [PATCHv2 2/6] Bluetooth: AMP: Handle complete frames in l2cap
  2012-10-15  8:58 ` [PATCHv2 0/6] AMP link fixes Andrei Emeltchenko
  2012-10-15  8:58   ` [PATCHv2 1/6] Bluetooth: AMP: Use Loglink handle in ACL Handle field Andrei Emeltchenko
@ 2012-10-15  8:58   ` Andrei Emeltchenko
  2012-10-15  8:58   ` [PATCHv2 3/6] Bluetooth: AMP: Drop packets when no l2cap conn exist Andrei Emeltchenko
                     ` (3 subsequent siblings)
  5 siblings, 0 replies; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-15  8:58 UTC (permalink / raw)
  To: linux-bluetooth

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>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
---
 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 2fb37de..5fd236f 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5576,6 +5576,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);
@@ -5585,10 +5587,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);
@@ -5630,7 +5632,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) {
@@ -5658,6 +5662,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	[flat|nested] 28+ messages in thread

* [PATCHv2 3/6] Bluetooth: AMP: Drop packets when no l2cap conn exist
  2012-10-15  8:58 ` [PATCHv2 0/6] AMP link fixes Andrei Emeltchenko
  2012-10-15  8:58   ` [PATCHv2 1/6] Bluetooth: AMP: Use Loglink handle in ACL Handle field Andrei Emeltchenko
  2012-10-15  8:58   ` [PATCHv2 2/6] Bluetooth: AMP: Handle complete frames in l2cap Andrei Emeltchenko
@ 2012-10-15  8:58   ` Andrei Emeltchenko
  2012-10-15  8:58   ` [PATCHv2 4/6] Bluetooth: Send EFS Conf Rsp only for BR/EDR chan Andrei Emeltchenko
                     ` (2 subsequent siblings)
  5 siblings, 0 replies; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-15  8:58 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

High Speed hci_conn should always have l2cap_conn associated with it.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
---
 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 5fd236f..e7bec6c 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -5579,6 +5579,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	[flat|nested] 28+ messages in thread

* [PATCHv2 4/6] Bluetooth: Send EFS Conf Rsp only for BR/EDR chan
  2012-10-15  8:58 ` [PATCHv2 0/6] AMP link fixes Andrei Emeltchenko
                     ` (2 preceding siblings ...)
  2012-10-15  8:58   ` [PATCHv2 3/6] Bluetooth: AMP: Drop packets when no l2cap conn exist Andrei Emeltchenko
@ 2012-10-15  8:58   ` Andrei Emeltchenko
  2012-10-15  8:58   ` [PATCHv2 5/6] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn Andrei Emeltchenko
  2012-10-15  8:58   ` [PATCHv2 6/6] Bluetooth: Zero bredr pointer when chan is deleted Andrei Emeltchenko
  5 siblings, 0 replies; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-15  8:58 UTC (permalink / raw)
  To: linux-bluetooth

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>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
---
 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 e7bec6c..978b203 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -3715,7 +3715,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:
@@ -3764,7 +3768,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	[flat|nested] 28+ messages in thread

* [PATCHv2 5/6] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn
  2012-10-15  8:58 ` [PATCHv2 0/6] AMP link fixes Andrei Emeltchenko
                     ` (3 preceding siblings ...)
  2012-10-15  8:58   ` [PATCHv2 4/6] Bluetooth: Send EFS Conf Rsp only for BR/EDR chan Andrei Emeltchenko
@ 2012-10-15  8:58   ` Andrei Emeltchenko
  2012-10-15 12:49     ` Gustavo Padovan
  2012-10-15  8:58   ` [PATCHv2 6/6] Bluetooth: Zero bredr pointer when chan is deleted Andrei Emeltchenko
  5 siblings, 1 reply; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-15  8:58 UTC (permalink / raw)
  To: linux-bluetooth

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>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
---
 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	[flat|nested] 28+ messages in thread

* [PATCHv2 6/6] Bluetooth: Zero bredr pointer when chan is deleted
  2012-10-15  8:58 ` [PATCHv2 0/6] AMP link fixes Andrei Emeltchenko
                     ` (4 preceding siblings ...)
  2012-10-15  8:58   ` [PATCHv2 5/6] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn Andrei Emeltchenko
@ 2012-10-15  8:58   ` Andrei Emeltchenko
  2012-10-15 12:50     ` Gustavo Padovan
  5 siblings, 1 reply; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-15  8:58 UTC (permalink / raw)
  To: linux-bluetooth

From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

If BREDR L2CAP chan is deleted and this chan is the channel through
which High Speed traffic is routed to AMP then zero pointer to
the chan in amp_mgr to prevent accessing 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 978b203..32b3fae 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;
 	}
 
 	chan->ops->teardown(chan, err);
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCHv2 5/6] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn
  2012-10-15  8:58   ` [PATCHv2 5/6] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn Andrei Emeltchenko
@ 2012-10-15 12:49     ` Gustavo Padovan
  2012-10-15 13:21       ` Andrei Emeltchenko
  0 siblings, 1 reply; 28+ messages in thread
From: Gustavo Padovan @ 2012-10-15 12:49 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-10-15 11:58:43 +0300]:

> 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>
> Acked-by: Marcel Holtmann <marcel@holtmann.org>
> ---
>  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);

You did not take the comments from Marcel in this patch, please make the
change to amp_mgr_get() before sending this patch.

	Gustavo

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHv2 6/6] Bluetooth: Zero bredr pointer when chan is deleted
  2012-10-15  8:58   ` [PATCHv2 6/6] Bluetooth: Zero bredr pointer when chan is deleted Andrei Emeltchenko
@ 2012-10-15 12:50     ` Gustavo Padovan
  0 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2012-10-15 12:50 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-10-15 11:58:44 +0300]:

> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> 
> If BREDR L2CAP chan is deleted and this chan is the channel through
> which High Speed traffic is routed to AMP then zero pointer to
> the chan in amp_mgr to prevent accessing it.
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  net/bluetooth/l2cap_core.c |    4 ++++
>  1 file changed, 4 insertions(+)

All patches but patch 5 were applied to bluetooth-next. Thanks.

	Gustavo

^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHv2 5/6] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn
  2012-10-15 12:49     ` Gustavo Padovan
@ 2012-10-15 13:21       ` Andrei Emeltchenko
  2012-10-15 15:27         ` Gustavo Padovan
  0 siblings, 1 reply; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-15 13:21 UTC (permalink / raw)
  To: Gustavo Padovan, linux-bluetooth

Hi Gustavo,

On Mon, Oct 15, 2012 at 09:49:03AM -0300, Gustavo Padovan wrote:
> Hi Andrei,
> 
> * Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-10-15 11:58:43 +0300]:
> 
> > 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>
> > Acked-by: Marcel Holtmann <marcel@holtmann.org>
> > ---
> >  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);
> 
> You did not take the comments from Marcel in this patch, please make the
> change to amp_mgr_get() before sending this patch.

I was thinking of making separate patch since this might be used in
several places so I would change it once instead of splitting this change
to several patches.

Best regards 
Andrei Emeltchenko 


^ permalink raw reply	[flat|nested] 28+ messages in thread

* Re: [PATCHv2 5/6] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn
  2012-10-15 13:21       ` Andrei Emeltchenko
@ 2012-10-15 15:27         ` Gustavo Padovan
  2012-10-18 10:16           ` [PATCHv2] " Andrei Emeltchenko
  0 siblings, 1 reply; 28+ messages in thread
From: Gustavo Padovan @ 2012-10-15 15:27 UTC (permalink / raw)
  To: Andrei Emeltchenko, linux-bluetooth

Hi Andrei,

* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-10-15 16:21:21 +0300]:

> Hi Gustavo,
> 
> On Mon, Oct 15, 2012 at 09:49:03AM -0300, Gustavo Padovan wrote:
> > Hi Andrei,
> > 
> > * Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-10-15 11:58:43 +0300]:
> > 
> > > 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>
> > > Acked-by: Marcel Holtmann <marcel@holtmann.org>
> > > ---
> > >  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);
> > 
> > You did not take the comments from Marcel in this patch, please make the
> > change to amp_mgr_get() before sending this patch.
> 
> I was thinking of making separate patch since this might be used in
> several places so I would change it once instead of splitting this change
> to several patches.

Sure, but just send that patch before this one.

	Gustavo

^ permalink raw reply	[flat|nested] 28+ messages in thread

* [PATCHv2] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn
  2012-10-15 15:27         ` Gustavo Padovan
@ 2012-10-18 10:16           ` Andrei Emeltchenko
  2012-10-18 10:28             ` Gustavo Padovan
  0 siblings, 1 reply; 28+ messages in thread
From: Andrei Emeltchenko @ 2012-10-18 10:16 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: gustavo

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 conn types
AMP_LINK and ACL_LINK associated with amp_mgr.

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
---
 include/net/bluetooth/a2mp.h |    2 +-
 net/bluetooth/a2mp.c         |    4 +++-
 net/bluetooth/amp.c          |    2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/net/bluetooth/a2mp.h b/include/net/bluetooth/a2mp.h
index e776ab2..42f2176 100644
--- a/include/net/bluetooth/a2mp.h
+++ b/include/net/bluetooth/a2mp.h
@@ -133,7 +133,7 @@ struct a2mp_physlink_rsp {
 extern struct list_head amp_mgr_list;
 extern struct mutex amp_mgr_list_lock;
 
-void amp_mgr_get(struct amp_mgr *mgr);
+struct amp_mgr *amp_mgr_get(struct amp_mgr *mgr);
 int amp_mgr_put(struct amp_mgr *mgr);
 u8 __next_ident(struct amp_mgr *mgr);
 struct l2cap_chan *a2mp_channel_create(struct l2cap_conn *conn,
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index 7bf9a10..d5136cf 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -751,11 +751,13 @@ static struct l2cap_chan *a2mp_chan_open(struct l2cap_conn *conn, bool locked)
 }
 
 /* AMP Manager functions */
-void amp_mgr_get(struct amp_mgr *mgr)
+struct amp_mgr *amp_mgr_get(struct amp_mgr *mgr)
 {
 	BT_DBG("mgr %p orig refcnt %d", mgr, atomic_read(&mgr->kref.refcount));
 
 	kref_get(&mgr->kref);
+
+	return mgr;
 }
 
 static void amp_mgr_destroy(struct kref *kref)
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 59da0f1..231d7ef 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -123,7 +123,7 @@ 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->amp_mgr = amp_mgr_get(mgr);
 	hcon->out = out;
 
 	return hcon;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 28+ messages in thread

* Re: [PATCHv2] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn
  2012-10-18 10:16           ` [PATCHv2] " Andrei Emeltchenko
@ 2012-10-18 10:28             ` Gustavo Padovan
  0 siblings, 0 replies; 28+ messages in thread
From: Gustavo Padovan @ 2012-10-18 10:28 UTC (permalink / raw)
  To: Andrei Emeltchenko; +Cc: linux-bluetooth

Hi Andrei,

* Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com> [2012-10-18 13:16:19 +0300]:

> 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 conn types
> AMP_LINK and ACL_LINK associated with amp_mgr.
> 
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
>  include/net/bluetooth/a2mp.h |    2 +-
>  net/bluetooth/a2mp.c         |    4 +++-
>  net/bluetooth/amp.c          |    2 +-
>  3 files changed, 5 insertions(+), 3 deletions(-)

Patch has been applied to bluetooth-next. Thanks.

	Gustavo

^ permalink raw reply	[flat|nested] 28+ messages in thread

end of thread, other threads:[~2012-10-18 10:28 UTC | newest]

Thread overview: 28+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-12 14:09 [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field Andrei Emeltchenko
2012-10-12 14:10 ` [RFCv1 2/7] Bluetooth: AMP: Handle complete frames in l2cap Andrei Emeltchenko
2012-10-12 23:50   ` Marcel Holtmann
2012-10-12 14:10 ` [RFCv1 3/7] Bluetooth: AMP: Drop packets when no l2cap conn exist Andrei Emeltchenko
2012-10-12 23:50   ` Marcel Holtmann
2012-10-12 14:10 ` [RFCv1 4/7] Bluetooth: Send EFS Conf Rsp only for BR/EDR chan Andrei Emeltchenko
2012-10-12 23:51   ` Marcel Holtmann
2012-10-12 14:10 ` [RFCv1 5/7] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn Andrei Emeltchenko
2012-10-12 23:53   ` Marcel Holtmann
2012-10-15  8:31     ` Andrei Emeltchenko
2012-10-12 14:10 ` [RFCv1 6/7] Bluetooth: AMP: Zero amp_mgr pointer if removed Andrei Emeltchenko
2012-10-12 23:54   ` Marcel Holtmann
2012-10-12 14:10 ` [RFCv1 7/7] Bluetooth: Zero bredr pointer when chan is deleted Andrei Emeltchenko
2012-10-12 23:54   ` Marcel Holtmann
2012-10-12 23:49 ` [RFCv1 1/7] Bluetooth: AMP: Use Loglink handle in ACL Handle field Marcel Holtmann
2012-10-15  8:58 ` [PATCHv2 0/6] AMP link fixes Andrei Emeltchenko
2012-10-15  8:58   ` [PATCHv2 1/6] Bluetooth: AMP: Use Loglink handle in ACL Handle field Andrei Emeltchenko
2012-10-15  8:58   ` [PATCHv2 2/6] Bluetooth: AMP: Handle complete frames in l2cap Andrei Emeltchenko
2012-10-15  8:58   ` [PATCHv2 3/6] Bluetooth: AMP: Drop packets when no l2cap conn exist Andrei Emeltchenko
2012-10-15  8:58   ` [PATCHv2 4/6] Bluetooth: Send EFS Conf Rsp only for BR/EDR chan Andrei Emeltchenko
2012-10-15  8:58   ` [PATCHv2 5/6] Bluetooth: AMP: Get amp_mgr reference in HS hci_conn Andrei Emeltchenko
2012-10-15 12:49     ` Gustavo Padovan
2012-10-15 13:21       ` Andrei Emeltchenko
2012-10-15 15:27         ` Gustavo Padovan
2012-10-18 10:16           ` [PATCHv2] " Andrei Emeltchenko
2012-10-18 10:28             ` Gustavo Padovan
2012-10-15  8:58   ` [PATCHv2 6/6] Bluetooth: Zero bredr pointer when chan is deleted Andrei Emeltchenko
2012-10-15 12:50     ` 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).