aboutsummaryrefslogtreecommitdiffstats
path: root/include/net
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-09-26 03:43:48 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-28 21:01:33 -0400
commit6ac59344ef25d5f0ebadb5663cf700d25d2a3886 (patch)
treeb4dbdf1589e0a7b6d3ed04d38fb7615a54f0d7af /include/net
parent1143e5a6d4d69cd36d44e0184769aa2b17041a10 (diff)
[Bluetooth] Support create connection cancel command
In case of non-blocking connects it is possible that the last user of an ACL link quits before the connection has been fully established. This will lead to a race condition where the internal state of a connection is closed, but the actual link has been established and is active. In case of Bluetooth 1.2 and later devices it is possible to call create connection cancel to abort the connect. For older devices the disconnect timer will be used to trigger the needed disconnect. Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'include/net')
-rw-r--r--include/net/bluetooth/hci.h6
-rw-r--r--include/net/bluetooth/hci_core.h9
2 files changed, 12 insertions, 3 deletions
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 5f04181b8109..10a3eec191fd 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -297,6 +297,7 @@ struct hci_cp_host_buffer_size {
297 297
298/* Link Control */ 298/* Link Control */
299#define OGF_LINK_CTL 0x01 299#define OGF_LINK_CTL 0x01
300
300#define OCF_CREATE_CONN 0x0005 301#define OCF_CREATE_CONN 0x0005
301struct hci_cp_create_conn { 302struct hci_cp_create_conn {
302 bdaddr_t bdaddr; 303 bdaddr_t bdaddr;
@@ -307,6 +308,11 @@ struct hci_cp_create_conn {
307 __u8 role_switch; 308 __u8 role_switch;
308} __attribute__ ((packed)); 309} __attribute__ ((packed));
309 310
311#define OCF_CREATE_CONN_CANCEL 0x0008
312struct hci_cp_create_conn_cancel {
313 bdaddr_t bdaddr;
314} __attribute__ ((packed));
315
310#define OCF_ACCEPT_CONN_REQ 0x0009 316#define OCF_ACCEPT_CONN_REQ 0x0009
311struct hci_cp_accept_conn_req { 317struct hci_cp_accept_conn_req {
312 bdaddr_t bdaddr; 318 bdaddr_t bdaddr;
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index 7451a9c92d9d..df22efcfcc0b 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -316,10 +316,13 @@ static inline void hci_conn_put(struct hci_conn *conn)
316 if (atomic_dec_and_test(&conn->refcnt)) { 316 if (atomic_dec_and_test(&conn->refcnt)) {
317 unsigned long timeo; 317 unsigned long timeo;
318 if (conn->type == ACL_LINK) { 318 if (conn->type == ACL_LINK) {
319 timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT);
320 if (!conn->out)
321 timeo *= 2;
322 del_timer(&conn->idle_timer); 319 del_timer(&conn->idle_timer);
320 if (conn->state == BT_CONNECTED) {
321 timeo = msecs_to_jiffies(HCI_DISCONN_TIMEOUT);
322 if (!conn->out)
323 timeo *= 2;
324 } else
325 timeo = msecs_to_jiffies(10);
323 } else 326 } else
324 timeo = msecs_to_jiffies(10); 327 timeo = msecs_to_jiffies(10);
325 mod_timer(&conn->disc_timer, jiffies + timeo); 328 mod_timer(&conn->disc_timer, jiffies + timeo);