diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2007-07-11 03:51:55 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2007-07-11 01:35:32 -0400 |
commit | 5b7f990927fe87ad3bec762a33c0e72bcbf6841e (patch) | |
tree | 1c9356fe04e235e938fa7a1a7a2c7a75bc124de0 /net/bluetooth/hci_conn.c | |
parent | 8de0a15483b357d0f0b821330ec84d1660cadc4e (diff) |
[Bluetooth] Add basics to better support and handle eSCO links
To better support and handle eSCO links in the future a bunch of
constants needs to be added and some basic routines need to be
updated. This is the initial step.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r-- | net/bluetooth/hci_conn.c | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 63980bd6b5f2..5fdfc9a67d39 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c | |||
@@ -123,8 +123,8 @@ void hci_add_sco(struct hci_conn *conn, __u16 handle) | |||
123 | conn->state = BT_CONNECT; | 123 | conn->state = BT_CONNECT; |
124 | conn->out = 1; | 124 | conn->out = 1; |
125 | 125 | ||
126 | cp.pkt_type = cpu_to_le16(hdev->pkt_type & SCO_PTYPE_MASK); | ||
127 | cp.handle = cpu_to_le16(handle); | 126 | cp.handle = cpu_to_le16(handle); |
127 | cp.pkt_type = cpu_to_le16(hdev->pkt_type & SCO_PTYPE_MASK); | ||
128 | 128 | ||
129 | hci_send_cmd(hdev, OGF_LINK_CTL, OCF_ADD_SCO, sizeof(cp), &cp); | 129 | hci_send_cmd(hdev, OGF_LINK_CTL, OCF_ADD_SCO, sizeof(cp), &cp); |
130 | } | 130 | } |
@@ -220,19 +220,19 @@ int hci_conn_del(struct hci_conn *conn) | |||
220 | 220 | ||
221 | del_timer(&conn->disc_timer); | 221 | del_timer(&conn->disc_timer); |
222 | 222 | ||
223 | if (conn->type == SCO_LINK) { | 223 | if (conn->type == ACL_LINK) { |
224 | struct hci_conn *acl = conn->link; | ||
225 | if (acl) { | ||
226 | acl->link = NULL; | ||
227 | hci_conn_put(acl); | ||
228 | } | ||
229 | } else { | ||
230 | struct hci_conn *sco = conn->link; | 224 | struct hci_conn *sco = conn->link; |
231 | if (sco) | 225 | if (sco) |
232 | sco->link = NULL; | 226 | sco->link = NULL; |
233 | 227 | ||
234 | /* Unacked frames */ | 228 | /* Unacked frames */ |
235 | hdev->acl_cnt += conn->sent; | 229 | hdev->acl_cnt += conn->sent; |
230 | } else { | ||
231 | struct hci_conn *acl = conn->link; | ||
232 | if (acl) { | ||
233 | acl->link = NULL; | ||
234 | hci_conn_put(acl); | ||
235 | } | ||
236 | } | 236 | } |
237 | 237 | ||
238 | tasklet_disable(&hdev->tx_task); | 238 | tasklet_disable(&hdev->tx_task); |
@@ -297,9 +297,10 @@ EXPORT_SYMBOL(hci_get_route); | |||
297 | 297 | ||
298 | /* Create SCO or ACL connection. | 298 | /* Create SCO or ACL connection. |
299 | * Device _must_ be locked */ | 299 | * Device _must_ be locked */ |
300 | struct hci_conn * hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst) | 300 | struct hci_conn *hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst) |
301 | { | 301 | { |
302 | struct hci_conn *acl; | 302 | struct hci_conn *acl; |
303 | struct hci_conn *sco; | ||
303 | 304 | ||
304 | BT_DBG("%s dst %s", hdev->name, batostr(dst)); | 305 | BT_DBG("%s dst %s", hdev->name, batostr(dst)); |
305 | 306 | ||
@@ -313,28 +314,26 @@ struct hci_conn * hci_connect(struct hci_dev *hdev, int type, bdaddr_t *dst) | |||
313 | if (acl->state == BT_OPEN || acl->state == BT_CLOSED) | 314 | if (acl->state == BT_OPEN || acl->state == BT_CLOSED) |
314 | hci_acl_connect(acl); | 315 | hci_acl_connect(acl); |
315 | 316 | ||
316 | if (type == SCO_LINK) { | 317 | if (type == ACL_LINK) |
317 | struct hci_conn *sco; | 318 | return acl; |
318 | 319 | ||
319 | if (!(sco = hci_conn_hash_lookup_ba(hdev, SCO_LINK, dst))) { | 320 | if (!(sco = hci_conn_hash_lookup_ba(hdev, type, dst))) { |
320 | if (!(sco = hci_conn_add(hdev, SCO_LINK, dst))) { | 321 | if (!(sco = hci_conn_add(hdev, type, dst))) { |
321 | hci_conn_put(acl); | 322 | hci_conn_put(acl); |
322 | return NULL; | 323 | return NULL; |
323 | } | ||
324 | } | 324 | } |
325 | acl->link = sco; | 325 | } |
326 | sco->link = acl; | ||
327 | 326 | ||
328 | hci_conn_hold(sco); | 327 | acl->link = sco; |
328 | sco->link = acl; | ||
329 | 329 | ||
330 | if (acl->state == BT_CONNECTED && | 330 | hci_conn_hold(sco); |
331 | (sco->state == BT_OPEN || sco->state == BT_CLOSED)) | ||
332 | hci_add_sco(sco, acl->handle); | ||
333 | 331 | ||
334 | return sco; | 332 | if (acl->state == BT_CONNECTED && |
335 | } else { | 333 | (sco->state == BT_OPEN || sco->state == BT_CLOSED)) |
336 | return acl; | 334 | hci_add_sco(sco, acl->handle); |
337 | } | 335 | |
336 | return sco; | ||
338 | } | 337 | } |
339 | EXPORT_SYMBOL(hci_connect); | 338 | EXPORT_SYMBOL(hci_connect); |
340 | 339 | ||