aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-10-31 09:46:36 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-11-01 18:27:10 -0400
commitcf70ff220a918b25d383510f913de52308d04bb2 (patch)
tree61bfa3a91d7e09480c08e4b3431adf88db36875f
parentf351bc72676e2666543511558215fe3c95d4336f (diff)
Bluetooth: AMP: Use l2cap_physical_cfm in phylink complete evt
When receiving HCI Phylink Complete event run amp_physical_cfm which initialize BR/EDR L2CAP channel associated with High Speed link and run l2cap_physical_cfm which shall send L2CAP Create Chan Request. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
-rw-r--r--include/net/bluetooth/amp.h1
-rw-r--r--include/net/bluetooth/l2cap.h1
-rw-r--r--net/bluetooth/amp.c24
-rw-r--r--net/bluetooth/hci_event.c15
4 files changed, 28 insertions, 13 deletions
diff --git a/include/net/bluetooth/amp.h b/include/net/bluetooth/amp.h
index f1c0017f69e7..7ea3db77ba89 100644
--- a/include/net/bluetooth/amp.h
+++ b/include/net/bluetooth/amp.h
@@ -46,6 +46,7 @@ void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
46 struct hci_conn *hcon); 46 struct hci_conn *hcon);
47void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle); 47void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle);
48void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle); 48void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle);
49void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon);
49void amp_create_logical_link(struct l2cap_chan *chan); 50void amp_create_logical_link(struct l2cap_chan *chan);
50void amp_disconnect_logical_link(struct hci_chan *hchan); 51void amp_disconnect_logical_link(struct hci_chan *hchan);
51void amp_destroy_logical_link(struct hci_chan *hchan, u8 reason); 52void amp_destroy_logical_link(struct hci_chan *hchan, u8 reason);
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 24c61ef933b5..18149c8b4d1d 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -812,5 +812,6 @@ void l2cap_send_conn_req(struct l2cap_chan *chan);
812void l2cap_move_start(struct l2cap_chan *chan); 812void l2cap_move_start(struct l2cap_chan *chan);
813void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan, 813void l2cap_logical_cfm(struct l2cap_chan *chan, struct hci_chan *hchan,
814 u8 status); 814 u8 status);
815void l2cap_physical_cfm(struct l2cap_chan *chan, int result);
815 816
816#endif /* __L2CAP_H */ 817#endif /* __L2CAP_H */
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 917e034b9aa5..650bb8df04fd 100644
--- a/net/bluetooth/amp.c
+++ b/net/bluetooth/amp.c
@@ -373,6 +373,30 @@ void amp_accept_phylink(struct hci_dev *hdev, struct amp_mgr *mgr,
373 hci_send_cmd(hdev, HCI_OP_ACCEPT_PHY_LINK, sizeof(cp), &cp); 373 hci_send_cmd(hdev, HCI_OP_ACCEPT_PHY_LINK, sizeof(cp), &cp);
374} 374}
375 375
376void amp_physical_cfm(struct hci_conn *bredr_hcon, struct hci_conn *hs_hcon)
377{
378 struct hci_dev *bredr_hdev = hci_dev_hold(bredr_hcon->hdev);
379 struct amp_mgr *mgr = hs_hcon->amp_mgr;
380 struct l2cap_chan *bredr_chan;
381
382 BT_DBG("bredr_hcon %p hs_hcon %p mgr %p", bredr_hcon, hs_hcon, mgr);
383
384 if (!bredr_hdev || !mgr || !mgr->bredr_chan)
385 return;
386
387 bredr_chan = mgr->bredr_chan;
388
389 set_bit(FLAG_EFS_ENABLE, &bredr_chan->flags);
390 bredr_chan->ctrl_id = hs_hcon->remote_id;
391 bredr_chan->hs_hcon = hs_hcon;
392 bredr_chan->conn->mtu = hs_hcon->hdev->block_mtu;
393 bredr_chan->fcs = L2CAP_FCS_NONE;
394
395 l2cap_physical_cfm(bredr_chan, 0);
396
397 hci_dev_put(bredr_hdev);
398}
399
376void amp_create_logical_link(struct l2cap_chan *chan) 400void amp_create_logical_link(struct l2cap_chan *chan)
377{ 401{
378 struct hci_cp_create_accept_logical_link cp; 402 struct hci_cp_create_accept_logical_link cp;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 0572f051c693..c08ac7c03711 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3696,20 +3696,9 @@ static void hci_phy_link_complete_evt(struct hci_dev *hdev,
3696 hci_conn_hold_device(hcon); 3696 hci_conn_hold_device(hcon);
3697 hci_conn_add_sysfs(hcon); 3697 hci_conn_add_sysfs(hcon);
3698 3698
3699 hci_dev_unlock(hdev); 3699 amp_physical_cfm(bredr_hcon, hcon);
3700
3701 if (hcon->out) {
3702 struct hci_dev *bredr_hdev = hci_dev_hold(bredr_hcon->hdev);
3703
3704 if (!bredr_hdev)
3705 return;
3706 3700
3707 /* Placeholder - create chan req 3701 hci_dev_unlock(hdev);
3708 l2cap_chan_create_cfm(bredr_hcon, hcon->remote_id);
3709 */
3710
3711 hci_dev_put(bredr_hdev);
3712 }
3713} 3702}
3714 3703
3715static void hci_loglink_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) 3704static void hci_loglink_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)