aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorAndrzej Kaczmarek <andrzej.kaczmarek@tieto.com>2011-11-07 14:19:04 -0500
committerGustavo F. Padovan <padovan@profusion.mobi>2011-11-07 14:19:04 -0500
commitf3f668b0ef4399b67e60e4c10a30099d630a6206 (patch)
tree16f3547858b3e515e95ab3bc54b1a716bcf20035 /net/bluetooth
parent4dff523a913197e3314c7b0d08734ab037709093 (diff)
Bluetooth: Use miliseconds for L2CAP channel timeouts
Timers set by __set_chan_timer() should use miliseconds instead of jiffies. Commit 942ecc9c4643db5ce071562e0a23f99464d6b461 updated l2cap_set_timer() so it expects timeout to be specified in msecs instead of jiffies. This makes timeouts unreliable when CONFIG_HZ is not set to 1000. Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/l2cap_core.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 8cd12917733..5ea94a1eecf 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -251,7 +251,7 @@ static void l2cap_chan_timeout(unsigned long arg)
251 251
252 if (sock_owned_by_user(sk)) { 252 if (sock_owned_by_user(sk)) {
253 /* sk is owned by user. Try again later */ 253 /* sk is owned by user. Try again later */
254 __set_chan_timer(chan, HZ / 5); 254 __set_chan_timer(chan, L2CAP_DISC_TIMEOUT);
255 bh_unlock_sock(sk); 255 bh_unlock_sock(sk);
256 chan_put(chan); 256 chan_put(chan);
257 return; 257 return;
@@ -2488,7 +2488,7 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd
2488 if (sock_owned_by_user(sk)) { 2488 if (sock_owned_by_user(sk)) {
2489 l2cap_state_change(chan, BT_DISCONN); 2489 l2cap_state_change(chan, BT_DISCONN);
2490 __clear_chan_timer(chan); 2490 __clear_chan_timer(chan);
2491 __set_chan_timer(chan, HZ / 5); 2491 __set_chan_timer(chan, L2CAP_DISC_TIMEOUT);
2492 break; 2492 break;
2493 } 2493 }
2494 2494
@@ -2661,7 +2661,7 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr
2661 2661
2662 default: 2662 default:
2663 sk->sk_err = ECONNRESET; 2663 sk->sk_err = ECONNRESET;
2664 __set_chan_timer(chan, HZ * 5); 2664 __set_chan_timer(chan, L2CAP_DISC_REJ_TIMEOUT);
2665 l2cap_send_disconn_req(conn, chan, ECONNRESET); 2665 l2cap_send_disconn_req(conn, chan, ECONNRESET);
2666 goto done; 2666 goto done;
2667 } 2667 }
@@ -2718,7 +2718,7 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn, struct l2cap_cmd
2718 if (sock_owned_by_user(sk)) { 2718 if (sock_owned_by_user(sk)) {
2719 l2cap_state_change(chan, BT_DISCONN); 2719 l2cap_state_change(chan, BT_DISCONN);
2720 __clear_chan_timer(chan); 2720 __clear_chan_timer(chan);
2721 __set_chan_timer(chan, HZ / 5); 2721 __set_chan_timer(chan, L2CAP_DISC_TIMEOUT);
2722 bh_unlock_sock(sk); 2722 bh_unlock_sock(sk);
2723 return 0; 2723 return 0;
2724 } 2724 }
@@ -2752,7 +2752,7 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, struct l2cap_cmd
2752 if (sock_owned_by_user(sk)) { 2752 if (sock_owned_by_user(sk)) {
2753 l2cap_state_change(chan,BT_DISCONN); 2753 l2cap_state_change(chan,BT_DISCONN);
2754 __clear_chan_timer(chan); 2754 __clear_chan_timer(chan);
2755 __set_chan_timer(chan, HZ / 5); 2755 __set_chan_timer(chan, L2CAP_DISC_TIMEOUT);
2756 bh_unlock_sock(sk); 2756 bh_unlock_sock(sk);
2757 return 0; 2757 return 0;
2758 } 2758 }
@@ -3998,7 +3998,7 @@ static inline void l2cap_check_encryption(struct l2cap_chan *chan, u8 encrypt)
3998 if (encrypt == 0x00) { 3998 if (encrypt == 0x00) {
3999 if (chan->sec_level == BT_SECURITY_MEDIUM) { 3999 if (chan->sec_level == BT_SECURITY_MEDIUM) {
4000 __clear_chan_timer(chan); 4000 __clear_chan_timer(chan);
4001 __set_chan_timer(chan, HZ * 5); 4001 __set_chan_timer(chan, L2CAP_ENC_TIMEOUT);
4002 } else if (chan->sec_level == BT_SECURITY_HIGH) 4002 } else if (chan->sec_level == BT_SECURITY_HIGH)
4003 l2cap_chan_close(chan, ECONNREFUSED); 4003 l2cap_chan_close(chan, ECONNREFUSED);
4004 } else { 4004 } else {
@@ -4066,7 +4066,7 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
4066 L2CAP_CONN_REQ, sizeof(req), &req); 4066 L2CAP_CONN_REQ, sizeof(req), &req);
4067 } else { 4067 } else {
4068 __clear_chan_timer(chan); 4068 __clear_chan_timer(chan);
4069 __set_chan_timer(chan, HZ / 10); 4069 __set_chan_timer(chan, L2CAP_DISC_TIMEOUT);
4070 } 4070 }
4071 } else if (chan->state == BT_CONNECT2) { 4071 } else if (chan->state == BT_CONNECT2) {
4072 struct l2cap_conn_rsp rsp; 4072 struct l2cap_conn_rsp rsp;
@@ -4086,7 +4086,7 @@ static int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt)
4086 } 4086 }
4087 } else { 4087 } else {
4088 l2cap_state_change(chan, BT_DISCONN); 4088 l2cap_state_change(chan, BT_DISCONN);
4089 __set_chan_timer(chan, HZ / 10); 4089 __set_chan_timer(chan, L2CAP_DISC_TIMEOUT);
4090 res = L2CAP_CR_SEC_BLOCK; 4090 res = L2CAP_CR_SEC_BLOCK;
4091 stat = L2CAP_CS_NO_INFO; 4091 stat = L2CAP_CS_NO_INFO;
4092 } 4092 }