From: Mat Martineau <mathewm@codeaurora.org>
To: Andrei Emeltchenko <Andrei.Emeltchenko.news@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [RFCv1 05/11] Bluetooth: AMP: Add Logical Link Create function
Date: Fri, 26 Oct 2012 10:01:01 -0700 (PDT) [thread overview]
Message-ID: <alpine.DEB.2.02.1210260958240.2459@mathewm-linux> (raw)
In-Reply-To: <1351167652-12346-6-git-send-email-Andrei.Emeltchenko.news@gmail.com>
Hi Andrei -
On Thu, 25 Oct 2012, Andrei Emeltchenko wrote:
> From: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
>
> After physical link is created logical link needs to be created.
> The process starts after L2CAP channel is created and L2CAP
> Configuration Response with result PENDING is received.
>
> Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
> Acked-by: Marcel Holtmann <marcel@holtmann.org>
> ---
> include/net/bluetooth/amp.h | 1 +
> net/bluetooth/amp.c | 49 +++++++++++++++++++++++++++++++++++++++++++
> net/bluetooth/hci_event.c | 9 ++++++++
> net/bluetooth/l2cap_core.c | 17 +++++++++++----
> 4 files changed, 72 insertions(+), 4 deletions(-)
>
> diff --git a/include/net/bluetooth/amp.h b/include/net/bluetooth/amp.h
> index 2e7c79e..70d5c15 100644
> --- a/include/net/bluetooth/amp.h
> +++ b/include/net/bluetooth/amp.h
> @@ -46,5 +46,6 @@ void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
> struct hci_conn *hcon);
> void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle);
> void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle);
> +void amp_create_logical_link(struct l2cap_chan *chan);
>
> #endif /* __AMP_H */
> diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
> index 231d7ef..fbb6360 100644
> --- a/net/bluetooth/amp.c
> +++ b/net/bluetooth/amp.c
> @@ -372,3 +372,52 @@ void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
>
> hci_send_cmd(hdev, HCI_OP_ACCEPT_PHY_LINK, sizeof(cp), &cp);
> }
> +
> +void amp_create_logical_link(struct l2cap_chan *chan)
> +{
> + struct hci_cp_create_accept_logical_link cp;
> + struct hci_conn *hcon;
> + struct hci_dev *hdev;
> +
> + BT_DBG("chan %p", chan);
> +
> + if (!chan->hs_hcon)
> + return;
> +
> + hdev = hci_dev_hold(chan->hs_hcon->hdev);
> + if (!hdev)
> + return;
> +
> + BT_DBG("chan %p ctrl_id %d dst %pMR", chan, chan->ctrl_id,
> + chan->conn->dst);
> +
> + hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK, chan->conn->dst);
> + if (!hcon)
> + goto done;
> +
> + cp.phy_handle = hcon->handle;
> +
> + cp.tx_flow_spec.id = chan->local_id;
> + cp.tx_flow_spec.stype = chan->local_stype;
> + cp.tx_flow_spec.msdu = cpu_to_le16(chan->local_msdu);
> + cp.tx_flow_spec.sdu_itime = cpu_to_le32(chan->local_sdu_itime);
> + cp.tx_flow_spec.acc_lat = cpu_to_le32(chan->local_acc_lat);
> + cp.tx_flow_spec.flush_to = cpu_to_le32(chan->local_flush_to);
> +
> + cp.rx_flow_spec.id = chan->remote_id;
> + cp.rx_flow_spec.stype = chan->remote_stype;
> + cp.rx_flow_spec.msdu = cpu_to_le16(chan->remote_msdu);
> + cp.rx_flow_spec.sdu_itime = cpu_to_le32(chan->remote_sdu_itime);
> + cp.rx_flow_spec.acc_lat = cpu_to_le32(chan->remote_acc_lat);
> + cp.rx_flow_spec.flush_to = cpu_to_le32(chan->remote_flush_to);
> +
> + if (hcon->out)
> + hci_send_cmd(hdev, HCI_OP_CREATE_LOGICAL_LINK, sizeof(cp),
> + &cp);
> + else
> + hci_send_cmd(hdev, HCI_OP_ACCEPT_LOGICAL_LINK, sizeof(cp),
> + &cp);
> +
> +done:
> + hci_dev_put(hdev);
> +}
> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
> index 00021cb..2c562a7 100644
> --- a/net/bluetooth/hci_event.c
> +++ b/net/bluetooth/hci_event.c
> @@ -1829,6 +1829,11 @@ static void hci_cs_accept_phylink(struct hci_dev *hdev, u8 status)
> amp_write_remote_assoc(hdev, cp->phy_handle);
> }
>
> +static void hci_cs_create_logical_link(struct hci_dev *hdev, u8 status)
> +{
> + BT_DBG("%s status 0x%2.2x", hdev->name, status);
> +}
> +
> static void hci_inquiry_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
> {
> __u8 status = *((__u8 *) skb->data);
> @@ -2663,6 +2668,10 @@ static void hci_cmd_status_evt(struct hci_dev *hdev, struct sk_buff *skb)
> hci_cs_accept_phylink(hdev, ev->status);
> break;
>
> + case HCI_OP_CREATE_LOGICAL_LINK:
> + hci_cs_create_logical_link(hdev, ev->status);
> + break;
> +
> default:
> BT_DBG("%s opcode 0x%4.4x", hdev->name, opcode);
> break;
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index d1728af..8e1525f 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -38,6 +38,7 @@
> #include <net/bluetooth/l2cap.h>
> #include <net/bluetooth/smp.h>
> #include <net/bluetooth/a2mp.h>
> +#include <net/bluetooth/amp.h>
>
> bool disable_ertm;
>
> @@ -1013,6 +1014,12 @@ static bool __amp_capable(struct l2cap_chan *chan)
> return false;
> }
>
> +static bool l2cap_check_efs(struct l2cap_chan *chan)
> +{
> + /* Check EFS parameters */
> + return true;
> +}
> +
> void l2cap_send_conn_req(struct l2cap_chan *chan)
> {
> struct l2cap_conn *conn = chan->conn;
> @@ -3948,13 +3955,15 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn,
> goto done;
> }
>
> - /* check compatibility */
> -
> if (!chan->ctrl_id)
> l2cap_send_efs_conf_rsp(chan, buf, cmd->ident,
> 0);
> - else
> - chan->ident = cmd->ident;
> + else {
> + if (l2cap_check_efs(chan)) {
> + amp_create_logical_link(chan);
> + chan->ident = cmd->ident;
> + }
> + }
Minor style issue - if one block of an if/else needs braces, then they
all get braces.
> }
> goto done;
>
> --
> 1.7.9.5
--
Mat Martineau
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
next prev parent reply other threads:[~2012-10-26 17:01 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 [this message]
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
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=alpine.DEB.2.02.1210260958240.2459@mathewm-linux \
--to=mathewm@codeaurora.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