aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/amp.c
diff options
context:
space:
mode:
authorAndrei Emeltchenko <andrei.emeltchenko@intel.com>2012-10-31 09:46:30 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-11-01 18:27:07 -0400
commit5ce66b59d787478f57a6f3368ff23d75a06e76e2 (patch)
tree553619827622111c9d5679947d85ae92377fc7aa /net/bluetooth/amp.c
parent770bfefa2cbe8f5911860fef1a68ea873a9bbdbe (diff)
Bluetooth: AMP: Add Logical Link Create function
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> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth/amp.c')
-rw-r--r--net/bluetooth/amp.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/net/bluetooth/amp.c b/net/bluetooth/amp.c
index 231d7ef53ecb..fbb63605a27e 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,
372 372
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
376void amp_create_logical_link(struct l2cap_chan *chan)
377{
378 struct hci_cp_create_accept_logical_link cp;
379 struct hci_conn *hcon;
380 struct hci_dev *hdev;
381
382 BT_DBG("chan %p", chan);
383
384 if (!chan->hs_hcon)
385 return;
386
387 hdev = hci_dev_hold(chan->hs_hcon->hdev);
388 if (!hdev)
389 return;
390
391 BT_DBG("chan %p ctrl_id %d dst %pMR", chan, chan->ctrl_id,
392 chan->conn->dst);
393
394 hcon = hci_conn_hash_lookup_ba(hdev, AMP_LINK, chan->conn->dst);
395 if (!hcon)
396 goto done;
397
398 cp.phy_handle = hcon->handle;
399
400 cp.tx_flow_spec.id = chan->local_id;
401 cp.tx_flow_spec.stype = chan->local_stype;
402 cp.tx_flow_spec.msdu = cpu_to_le16(chan->local_msdu);
403 cp.tx_flow_spec.sdu_itime = cpu_to_le32(chan->local_sdu_itime);
404 cp.tx_flow_spec.acc_lat = cpu_to_le32(chan->local_acc_lat);
405 cp.tx_flow_spec.flush_to = cpu_to_le32(chan->local_flush_to);
406
407 cp.rx_flow_spec.id = chan->remote_id;
408 cp.rx_flow_spec.stype = chan->remote_stype;
409 cp.rx_flow_spec.msdu = cpu_to_le16(chan->remote_msdu);
410 cp.rx_flow_spec.sdu_itime = cpu_to_le32(chan->remote_sdu_itime);
411 cp.rx_flow_spec.acc_lat = cpu_to_le32(chan->remote_acc_lat);
412 cp.rx_flow_spec.flush_to = cpu_to_le32(chan->remote_flush_to);
413
414 if (hcon->out)
415 hci_send_cmd(hdev, HCI_OP_CREATE_LOGICAL_LINK, sizeof(cp),
416 &cp);
417 else
418 hci_send_cmd(hdev, HCI_OP_ACCEPT_LOGICAL_LINK, sizeof(cp),
419 &cp);
420
421done:
422 hci_dev_put(hdev);
423}