From: Marcel Holtmann <marcel@holtmann.org>
To: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [RFCv2 12/12] Bluetooth: Process Create Chan Request
Date: Tue, 30 Oct 2012 09:53:22 -0700 [thread overview]
Message-ID: <1351616002.1828.9.camel@aeonflux> (raw)
In-Reply-To: <1351612384-12392-13-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei,
> Add processing L2CAP Create Chan Request. When channel is created
> save associated high speed link hs_hcon.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> ---
> net/bluetooth/l2cap_core.c | 31 ++++++++++++++++++++++---------
> 1 file changed, 22 insertions(+), 9 deletions(-)
>
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index bdffc4c..0e14a1a 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -4238,6 +4238,7 @@ static int l2cap_create_channel_req(struct l2cap_conn *conn,
> {
> struct l2cap_create_chan_req *req = data;
> struct l2cap_chan *chan;
> + struct hci_dev *hdev = NULL;
> u16 psm, scid;
>
> if (cmd_len != sizeof(*req))
> @@ -4252,8 +4253,6 @@ static int l2cap_create_channel_req(struct l2cap_conn *conn,
> BT_DBG("psm 0x%2.2x, scid 0x%4.4x, amp_id %d", psm, scid, req->amp_id);
>
> if (req->amp_id) {
> - struct hci_dev *hdev;
> -
> /* Validate AMP controller id */
> hdev = hci_dev_get(req->amp_id);
> if (!hdev || hdev->dev_type != HCI_AMP ||
> @@ -4267,19 +4266,33 @@ static int l2cap_create_channel_req(struct l2cap_conn *conn,
>
> l2cap_send_cmd(conn, cmd->ident, L2CAP_CREATE_CHAN_RSP,
> sizeof(rsp), &rsp);
> -
> - if (hdev)
> - hci_dev_put(hdev);
> -
> - return 0;
> + goto done;
> }
> -
> - hci_dev_put(hdev);
> }
>
> chan = l2cap_connect(conn, cmd, data, L2CAP_CREATE_CHAN_RSP,
> req->amp_id);
>
> + if (chan && hdev) {
> + struct amp_mgr *mgr = conn->hcon->amp_mgr;
> + struct hci_conn *hs_hcon;
> +
> + hs_hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK, conn->dst);
> + if (!hs_hcon)
> + goto done;
> +
> + BT_DBG("mgr %p bredr_chan %p hs_hcon %p", mgr, chan, hs_hcon);
> +
> + chan->local_amp_id = req->amp_id;
> + mgr->bredr_chan = chan;
> + chan->hs_hcon = hs_hcon;
> + conn->mtu = hdev->block_mtu;
> + }
> +
> +done:
> + if (hdev)
> + hci_dev_put(hdev);
> +
same comment that I gave Mat, I do not like these unbalanced locking or
in your case reference counting. That is just hacking it together.
Regards
Marcel
next prev parent reply other threads:[~2012-10-30 16:53 UTC|newest]
Thread overview: 85+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-16 15:01 [RFCv0 0/8] Handling physical and logical link Andrei Emeltchenko
2012-10-16 15:01 ` [RFCv0 1/8] Bluetooth: AMP: Process Physical Link Complete evt Andrei Emeltchenko
2012-10-16 15:01 ` [RFCv0 2/8] Bluetooth: AMP: Process Logical Link complete evt Andrei Emeltchenko
2012-10-16 15:01 ` [RFCv0 3/8] Bluetooth: Add logical link create function Andrei Emeltchenko
2012-10-16 15:01 ` [RFCv0 4/8] Bluetooth: AMP: Process Disc Logical Link Andrei Emeltchenko
2012-10-16 15:01 ` [RFCv0 5/8] Bluetooth: AMP: Process Disc Physical Link complete evt Andrei Emeltchenko
2012-10-16 15:01 ` [RFCv0 6/8] Bluetooth: AMP: Remove hci_conn receiving error command status Andrei Emeltchenko
2012-10-16 15:01 ` [RFCv0 7/8] Bluetooth: Disconnect logical link when deleteing chan Andrei Emeltchenko
2012-10-16 15:01 ` [RFCv0 8/8] Bluetooth: Add put(hcon) when deleting hchan Andrei Emeltchenko
2012-10-17 17:07 ` [RFCv0 0/8] Handling physical and logical link Marcel Holtmann
2012-10-18 10:44 ` Andrei Emeltchenko
2012-10-25 12:20 ` [RFCv1 00/11] " Andrei Emeltchenko
2012-10-25 12:20 ` [RFCv1 01/11] Bluetooth: trivial: Remove unneeded assignment Andrei Emeltchenko
2012-10-25 13:06 ` Marcel Holtmann
2012-10-25 12:20 ` [RFCv1 02/11] Bluetooth: Use helper function sending EFS conf rsp Andrei Emeltchenko
2012-10-25 13:07 ` Marcel Holtmann
2012-10-25 12:20 ` [RFCv1 03/11] Bluetooth: AMP: Process Physical Link Complete evt Andrei Emeltchenko
2012-10-26 17:16 ` Mat Martineau
2012-10-29 9:22 ` Andrei Emeltchenko
2012-10-25 12:20 ` [RFCv1 04/11] Bluetooth: AMP: Process Logical Link complete evt Andrei Emeltchenko
2012-10-25 13:08 ` Marcel Holtmann
2012-10-25 12:20 ` [RFCv1 05/11] Bluetooth: AMP: Add Logical Link Create function Andrei Emeltchenko
2012-10-26 17:01 ` Mat Martineau
2012-10-29 9:24 ` Andrei Emeltchenko
2012-10-25 12:20 ` [RFCv1 06/11] Bluetooth: AMP: Process Disc Logical Link Andrei Emeltchenko
2012-10-25 12:20 ` [RFCv1 07/11] Bluetooth: AMP: Process Disc Physical Link Complete evt Andrei Emeltchenko
2012-10-25 12:20 ` [RFCv1 08/11] Bluetooth: AMP: Remove hci_conn receiving error command status Andrei Emeltchenko
2012-10-25 12:20 ` [RFCv1 09/11] Bluetooth: Disconnect logical link when deleteing chan Andrei Emeltchenko
2012-10-25 12:20 ` [RFCv1 10/11] Bluetooth: Add put(hcon) when deleting hchan Andrei Emeltchenko
2012-10-25 13:09 ` Marcel Holtmann
2012-10-25 15:22 ` Gustavo Padovan
2012-10-25 12:20 ` [RFCv1 11/11] Bluetooth: AMP: Check for hs_hcon instead of ctrl_id Andrei Emeltchenko
2012-10-25 13:09 ` Marcel Holtmann
2012-10-25 13:11 ` [RFCv1 00/11] Handling physical and logical link Marcel Holtmann
2012-10-25 13:35 ` Andrei Emeltchenko
2012-10-26 17:27 ` Mat Martineau
2012-10-30 15:52 ` [RFCv2 00/12] " Andrei Emeltchenko
2012-10-30 15:52 ` [RFCv2 01/12] Bluetooth: trivial: Fix braces style and remove empty line Andrei Emeltchenko
2012-10-30 16:45 ` Marcel Holtmann
2012-10-30 15:52 ` [RFCv2 02/12] Bluetooth: Save hs_hchan instead of hs_hcon in loglink complete Andrei Emeltchenko
2012-10-30 16:46 ` Marcel Holtmann
2012-10-30 15:52 ` [RFCv2 03/12] Bluetooth: Return correct L2CAP response type Andrei Emeltchenko
2012-10-30 16:49 ` Marcel Holtmann
2012-10-30 17:16 ` Andrei Emeltchenko
2012-10-30 17:48 ` Marcel Holtmann
2012-10-30 15:52 ` [RFCv2 04/12] Bluetooth: Derive remote and local amp id from chan struct Andrei Emeltchenko
2012-10-30 16:49 ` Marcel Holtmann
2012-10-30 15:52 ` [RFCv2 05/12] Bluetooth: AMP: Add Logical Link Create function Andrei Emeltchenko
2012-10-30 15:52 ` [RFCv2 06/12] Bluetooth: AMP: Process Disc Logical Link Andrei Emeltchenko
2012-10-30 15:52 ` [RFCv2 07/12] Bluetooth: AMP: Process Disc Physical Link Complete evt Andrei Emeltchenko
2012-10-30 15:53 ` [RFCv2 08/12] Bluetooth: AMP: Remove hci_conn receiving error command status Andrei Emeltchenko
2012-10-30 15:53 ` [RFCv2 09/12] Bluetooth: Disconnect logical link when deleteing chan Andrei Emeltchenko
2012-10-30 15:53 ` [RFCv2 10/12] Bluetooth: AMP: Check for hs_hcon instead of ctrl_id Andrei Emeltchenko
2012-10-30 16:50 ` Marcel Holtmann
2012-10-30 15:53 ` [RFCv2 11/12] Bluetooth: AMP: Use l2cap_physical_cfm in phylink complete evt Andrei Emeltchenko
2012-10-30 16:51 ` Marcel Holtmann
2012-10-30 15:53 ` [RFCv2 12/12] Bluetooth: Process Create Chan Request Andrei Emeltchenko
2012-10-30 16:53 ` Marcel Holtmann [this message]
2012-10-31 13:46 ` [PATCHv1 00/12] Handling physical and logical link fixes Andrei Emeltchenko
2012-10-31 13:46 ` [PATCHv1 01/12] Bluetooth: trivial: Fix braces style and remove empty line Andrei Emeltchenko
2012-10-31 13:46 ` [PATCHv1 02/12] Bluetooth: Save hs_hchan instead of hs_hcon in loglink complete Andrei Emeltchenko
2012-10-31 13:46 ` [PATCHv1 03/12] Bluetooth: Return correct L2CAP response type Andrei Emeltchenko
2012-10-31 13:46 ` [PATCHv1 04/12] Bluetooth: Derive remote and local amp id from chan struct Andrei Emeltchenko
2012-10-31 13:46 ` [PATCHv1 05/12] Bluetooth: AMP: Add Logical Link Create function Andrei Emeltchenko
2012-10-31 13:46 ` [PATCHv1 06/12] Bluetooth: AMP: Process Disc Logical Link Andrei Emeltchenko
2012-10-31 13:46 ` [PATCHv1 07/12] Bluetooth: AMP: Process Disc Physical Link Complete evt Andrei Emeltchenko
2012-10-31 13:46 ` [PATCHv1 08/12] Bluetooth: AMP: Remove hci_conn receiving error command status Andrei Emeltchenko
2012-10-31 13:46 ` [PATCHv1 09/12] Bluetooth: Disconnect logical link when deleteing chan Andrei Emeltchenko
2012-10-31 13:46 ` [PATCHv1 10/12] Bluetooth: AMP: Check for hs_hcon instead of ctrl_id Andrei Emeltchenko
2012-10-31 13:46 ` [PATCHv1 11/12] Bluetooth: AMP: Use l2cap_physical_cfm in phylink complete evt Andrei Emeltchenko
2012-10-31 18:51 ` Gustavo Padovan
2012-11-01 17:51 ` Mat Martineau
2012-11-02 7:48 ` Andrei Emeltchenko
2012-11-02 15:39 ` Mat Martineau
2012-11-12 9:26 ` Andrei Emeltchenko
2012-11-13 17:29 ` Mat Martineau
2012-11-13 22:49 ` Marcel Holtmann
2012-11-14 12:19 ` Andrei Emeltchenko
2012-10-31 13:46 ` [PATCHv1 12/12] Bluetooth: Process Create Chan Request Andrei Emeltchenko
2012-10-31 16:24 ` Marcel Holtmann
2012-11-01 8:55 ` Andrei Emeltchenko
2012-11-01 13:37 ` [PATCH 1/2] " Andrei Emeltchenko
2012-11-01 13:37 ` [PATCH 2/2] Bluetooth: Rename ctrl_id to remote_amp_id Andrei Emeltchenko
2012-11-02 0:31 ` Marcel Holtmann
2012-11-02 0:30 ` [PATCH 1/2] Bluetooth: Process Create Chan Request Marcel Holtmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1351616002.1828.9.camel@aeonflux \
--to=marcel@holtmann.org \
--cc=Andrei.Emeltchenko.news@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).