linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gustavo Padovan <padovan@profusion.mobi>
To: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Cc: linux-bluetooth@vger.kernel.org, ulrik.lauren@stericsson.com,
	henrik.possung@stericsson.com
Subject: Re: [PATCH] Bluetooth: Use miliseconds for L2CAP channel timeouts
Date: Wed, 19 Oct 2011 14:41:06 -0200	[thread overview]
Message-ID: <20111019164106.GA10366@joana> (raw)
In-Reply-To: <1319027936-24525-1-git-send-email-andrzej.kaczmarek@tieto.com>

Hi Andrzej,

* Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com> [2011-10-19 14:38:56 +0200]:

> 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>
> ---
>  include/net/bluetooth/l2cap.h |    8 ++++++--
>  net/bluetooth/l2cap_core.c    |   25 +++++++++++++------------
>  2 files changed, 19 insertions(+), 14 deletions(-)
> 
> diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
> index fddc82a..9576b0a 100644
> --- a/include/net/bluetooth/l2cap.h
> +++ b/include/net/bluetooth/l2cap.h
> @@ -45,8 +45,12 @@
>  #define L2CAP_DEFAULT_SDU_ITIME		0xFFFFFFFF
>  #define L2CAP_DEFAULT_ACC_LAT		0xFFFFFFFF
>  
> -#define L2CAP_CONN_TIMEOUT	(40000) /* 40 seconds */
> -#define L2CAP_INFO_TIMEOUT	(4000)  /*  4 seconds */
> +#define L2CAP_DISC_SEC_TIMEOUT		(100)
> +#define L2CAP_DISC_OWNED_TIMEOUT	(200)

make these two 100 miliseconds and merge them under L2CAP_DISC_TIMEOUT

> +#define L2CAP_DISC_REJ_TIMEOUT		(5000)  /*  5 seconds */
> +#define L2CAP_ENC_TIMEOUT		(5000)  /*  5 seconds */
> +#define L2CAP_CONN_TIMEOUT		(40000) /* 40 seconds */
> +#define L2CAP_INFO_TIMEOUT		(4000)  /*  4 seconds */
>  
>  /* L2CAP socket address */
>  struct sockaddr_l2 {
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index bda6da7..13aa738 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -252,7 +252,7 @@ static void l2cap_chan_timeout(unsigned long arg)
>  
>  	if (sock_owned_by_user(sk)) {
>  		/* sk is owned by user. Try again later */
> -		__set_chan_timer(chan, HZ / 5);
> +		__set_chan_timer(chan, L2CAP_DISC_OWNED_TIMEOUT);
>  		bh_unlock_sock(sk);
>  		chan_put(chan);
>  		return;
> @@ -444,7 +444,8 @@ void l2cap_chan_close(struct l2cap_chan *chan, int reason)
>  		if (chan->chan_type == L2CAP_CHAN_CONN_ORIENTED &&
>  					conn->hcon->type == ACL_LINK) {
>  			__clear_chan_timer(chan);
> -			__set_chan_timer(chan, sk->sk_sndtimeo);
> +			__set_chan_timer(chan,
> +					jiffies_to_msecs(sk->sk_sndtimeo));

sk->sk_sndtimeo is already in miliseconds.

	Gustavo

      reply	other threads:[~2011-10-19 16:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-19 12:38 [PATCH] Bluetooth: Use miliseconds for L2CAP channel timeouts Andrzej Kaczmarek
2011-10-19 16:41 ` Gustavo Padovan [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111019164106.GA10366@joana \
    --to=padovan@profusion.mobi \
    --cc=andrzej.kaczmarek@tieto.com \
    --cc=henrik.possung@stericsson.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=ulrik.lauren@stericsson.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).