diff options
author | Andrei Emeltchenko <andrei.emeltchenko@intel.com> | 2012-12-07 07:59:05 -0500 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2013-01-09 14:05:05 -0500 |
commit | 8e05e3ba88adcf7ac644e6ef26676ea7c048a08c (patch) | |
tree | 9116603c2b9ca6b10b3cbb00001a4f1ee04ef62c /net/bluetooth | |
parent | 7952861f4a8d67b6624b2e6c92cd63bd11a332ce (diff) |
Bluetooth: AMP: Send A2MP Create Phylink Rsp after Assoc write
Postpone sending A2MP Create Phylink Response until we got successful
HCI Command Complete after HCI Write Remote AMP Assoc.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/a2mp.c | 38 | ||||
-rw-r--r-- | net/bluetooth/amp.c | 4 |
2 files changed, 39 insertions, 3 deletions
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c index 2f67d5ecc907..a200edf63117 100644 --- a/net/bluetooth/a2mp.c +++ b/net/bluetooth/a2mp.c | |||
@@ -499,8 +499,16 @@ send_rsp: | |||
499 | if (hdev) | 499 | if (hdev) |
500 | hci_dev_put(hdev); | 500 | hci_dev_put(hdev); |
501 | 501 | ||
502 | a2mp_send(mgr, A2MP_CREATEPHYSLINK_RSP, hdr->ident, sizeof(rsp), | 502 | /* Reply error now and success after HCI Write Remote AMP Assoc |
503 | &rsp); | 503 | command complete with success status |
504 | */ | ||
505 | if (rsp.status != A2MP_STATUS_SUCCESS) { | ||
506 | a2mp_send(mgr, A2MP_CREATEPHYSLINK_RSP, hdr->ident, | ||
507 | sizeof(rsp), &rsp); | ||
508 | } else { | ||
509 | mgr->state = WRITE_REMOTE_AMP_ASSOC; | ||
510 | mgr->ident = hdr->ident; | ||
511 | } | ||
504 | 512 | ||
505 | skb_pull(skb, le16_to_cpu(hdr->len)); | 513 | skb_pull(skb, le16_to_cpu(hdr->len)); |
506 | return 0; | 514 | return 0; |
@@ -949,6 +957,32 @@ clean: | |||
949 | kfree(req); | 957 | kfree(req); |
950 | } | 958 | } |
951 | 959 | ||
960 | void a2mp_send_create_phy_link_rsp(struct hci_dev *hdev, u8 status) | ||
961 | { | ||
962 | struct amp_mgr *mgr; | ||
963 | struct a2mp_physlink_rsp rsp; | ||
964 | struct hci_conn *hs_hcon; | ||
965 | |||
966 | mgr = amp_mgr_lookup_by_state(WRITE_REMOTE_AMP_ASSOC); | ||
967 | if (!mgr) | ||
968 | return; | ||
969 | |||
970 | hs_hcon = hci_conn_hash_lookup_state(hdev, AMP_LINK, BT_CONNECT); | ||
971 | if (!hs_hcon) { | ||
972 | rsp.status = A2MP_STATUS_UNABLE_START_LINK_CREATION; | ||
973 | } else { | ||
974 | rsp.remote_id = hs_hcon->remote_id; | ||
975 | rsp.status = A2MP_STATUS_SUCCESS; | ||
976 | } | ||
977 | |||
978 | BT_DBG("%s mgr %p hs_hcon %p status %u", hdev->name, mgr, hs_hcon, | ||
979 | status); | ||
980 | |||
981 | rsp.local_id = hdev->id; | ||
982 | a2mp_send(mgr, A2MP_CREATEPHYSLINK_RSP, mgr->ident, sizeof(rsp), &rsp); | ||
983 | amp_mgr_put(mgr); | ||
984 | } | ||
985 | |||
952 | void a2mp_discover_amp(struct l2cap_chan *chan) | 986 | void a2mp_discover_amp(struct l2cap_chan *chan) |
953 | { | 987 | { |
954 | struct l2cap_conn *conn = chan->conn; | 988 | struct l2cap_conn *conn = chan->conn; |
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c index 1b0d92c0643a..522865776ec6 100644 --- a/net/bluetooth/amp.c +++ b/net/bluetooth/amp.c | |||
@@ -317,7 +317,9 @@ void amp_write_rem_assoc_continue(struct hci_dev *hdev, u8 handle) | |||
317 | if (!hcon) | 317 | if (!hcon) |
318 | return; | 318 | return; |
319 | 319 | ||
320 | amp_write_rem_assoc_frag(hdev, hcon); | 320 | /* Send A2MP create phylink rsp when all fragments are written */ |
321 | if (amp_write_rem_assoc_frag(hdev, hcon)) | ||
322 | a2mp_send_create_phy_link_rsp(hdev, 0); | ||
321 | } | 323 | } |
322 | 324 | ||
323 | void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle) | 325 | void amp_write_remote_assoc(struct hci_dev *hdev, u8 handle) |