diff options
author | Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com> | 2012-01-04 06:10:42 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-15 06:09:25 -0500 |
commit | 6e1da683f79a22fafaada62d547138daaa9e3456 (patch) | |
tree | d3502a1dd0a2df2d13e9d53a70042f68381e0ee3 /net | |
parent | a63752552b95624a9f1dfa3d763870f72f964ad0 (diff) |
Bluetooth: l2cap_set_timer needs jiffies as timeout value
After moving L2CAP timers to workqueues l2cap_set_timer expects timeout
value to be specified in jiffies but constants defined in miliseconds
are used. This makes timeouts unreliable when CONFIG_HZ is not set to
1000.
__set_chan_timer macro still uses jiffies as input to avoid multiple
conversions from/to jiffies for sk_sndtimeo value which is already
specified in jiffies.
Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Ackec-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/l2cap_core.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 980abdb30671..dcccae04ae08 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -2970,7 +2970,8 @@ static inline int l2cap_config_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr | |||
2970 | 2970 | ||
2971 | default: | 2971 | default: |
2972 | sk->sk_err = ECONNRESET; | 2972 | sk->sk_err = ECONNRESET; |
2973 | __set_chan_timer(chan, L2CAP_DISC_REJ_TIMEOUT); | 2973 | __set_chan_timer(chan, |
2974 | msecs_to_jiffies(L2CAP_DISC_REJ_TIMEOUT)); | ||
2974 | l2cap_send_disconn_req(conn, chan, ECONNRESET); | 2975 | l2cap_send_disconn_req(conn, chan, ECONNRESET); |
2975 | goto done; | 2976 | goto done; |
2976 | } | 2977 | } |
@@ -4478,7 +4479,8 @@ static inline void l2cap_check_encryption(struct l2cap_chan *chan, u8 encrypt) | |||
4478 | if (encrypt == 0x00) { | 4479 | if (encrypt == 0x00) { |
4479 | if (chan->sec_level == BT_SECURITY_MEDIUM) { | 4480 | if (chan->sec_level == BT_SECURITY_MEDIUM) { |
4480 | __clear_chan_timer(chan); | 4481 | __clear_chan_timer(chan); |
4481 | __set_chan_timer(chan, L2CAP_ENC_TIMEOUT); | 4482 | __set_chan_timer(chan, |
4483 | msecs_to_jiffies(L2CAP_ENC_TIMEOUT)); | ||
4482 | } else if (chan->sec_level == BT_SECURITY_HIGH) | 4484 | } else if (chan->sec_level == BT_SECURITY_HIGH) |
4483 | l2cap_chan_close(chan, ECONNREFUSED); | 4485 | l2cap_chan_close(chan, ECONNREFUSED); |
4484 | } else { | 4486 | } else { |
@@ -4546,7 +4548,8 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) | |||
4546 | L2CAP_CONN_REQ, sizeof(req), &req); | 4548 | L2CAP_CONN_REQ, sizeof(req), &req); |
4547 | } else { | 4549 | } else { |
4548 | __clear_chan_timer(chan); | 4550 | __clear_chan_timer(chan); |
4549 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); | 4551 | __set_chan_timer(chan, |
4552 | msecs_to_jiffies(L2CAP_DISC_TIMEOUT)); | ||
4550 | } | 4553 | } |
4551 | } else if (chan->state == BT_CONNECT2) { | 4554 | } else if (chan->state == BT_CONNECT2) { |
4552 | struct l2cap_conn_rsp rsp; | 4555 | struct l2cap_conn_rsp rsp; |
@@ -4566,7 +4569,8 @@ int l2cap_security_cfm(struct hci_conn *hcon, u8 status, u8 encrypt) | |||
4566 | } | 4569 | } |
4567 | } else { | 4570 | } else { |
4568 | l2cap_state_change(chan, BT_DISCONN); | 4571 | l2cap_state_change(chan, BT_DISCONN); |
4569 | __set_chan_timer(chan, L2CAP_DISC_TIMEOUT); | 4572 | __set_chan_timer(chan, |
4573 | msecs_to_jiffies(L2CAP_DISC_TIMEOUT)); | ||
4570 | res = L2CAP_CR_SEC_BLOCK; | 4574 | res = L2CAP_CR_SEC_BLOCK; |
4571 | stat = L2CAP_CS_NO_INFO; | 4575 | stat = L2CAP_CS_NO_INFO; |
4572 | } | 4576 | } |