From: Marcel Holtmann <marcel@holtmann.org>
To: Gustavo Padovan <gustavo@padovan.org>
Cc: linux-bluetooth@vger.kernel.org,
Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Subject: Re: [PATCH 02/16] Bluetooth: Remove sk_sndtimeo from l2cap_core.c
Date: Wed, 20 Feb 2013 22:14:04 +0100 [thread overview]
Message-ID: <1361394844.1583.78.camel@aeonflux> (raw)
In-Reply-To: <1361391103-30738-3-git-send-email-gustavo@padovan.org>
Hi Gustavo,
> We now have a new struct member in l2cap_chan to store this value for
> access inside l2cap_core.c
more commit message explaining what is happening in this patch and why.
>
> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
> ---
> include/net/bluetooth/l2cap.h | 1 +
> net/bluetooth/l2cap_core.c | 7 +++----
> net/bluetooth/l2cap_sock.c | 1 +
> 3 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
> index 6040743..cf94e68 100644
> --- a/include/net/bluetooth/l2cap.h
> +++ b/include/net/bluetooth/l2cap.h
> @@ -480,6 +480,7 @@ struct l2cap_chan {
> __u8 tx_state;
> __u8 rx_state;
>
> + unsigned long sndtimeo;
The socket one is long, why is this one unsigned long?
> unsigned long conf_state;
> unsigned long conn_state;
> unsigned long flags;
> diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> index 4a88fa1..a306cc8 100644
> --- a/net/bluetooth/l2cap_core.c
> +++ b/net/bluetooth/l2cap_core.c
> @@ -630,7 +630,7 @@ void l2cap_chan_close(struct l2cap_chan *chan, int reason)
> case BT_CONFIG:
> if (chan->chan_type == L2CAP_CHAN_CONN_ORIENTED &&
> conn->hcon->type == ACL_LINK) {
> - __set_chan_timer(chan, sk->sk_sndtimeo);
> + __set_chan_timer(chan, chan->sndtimeo);
> l2cap_send_disconn_req(chan, reason);
> } else
> l2cap_chan_del(chan, reason);
> @@ -1602,7 +1602,6 @@ static struct l2cap_chan *l2cap_global_chan_by_psm(int state, __le16 psm,
> int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
> bdaddr_t *dst, u8 dst_type)
> {
> - struct sock *sk = chan->sk;
> bdaddr_t *src = &chan->src;
> struct l2cap_conn *conn;
> struct hci_conn *hcon;
> @@ -1716,7 +1715,7 @@ int l2cap_chan_connect(struct l2cap_chan *chan, __le16 psm, u16 cid,
> l2cap_chan_lock(chan);
>
> l2cap_state_change(chan, BT_CONNECT);
> - __set_chan_timer(chan, sk->sk_sndtimeo);
> + __set_chan_timer(chan, chan->sndtimeo);
>
> if (hcon->state == BT_CONNECTED) {
> if (chan->chan_type != L2CAP_CHAN_CONN_ORIENTED) {
> @@ -3641,7 +3640,7 @@ static struct l2cap_chan *l2cap_connect(struct l2cap_conn *conn,
>
> dcid = chan->scid;
>
> - __set_chan_timer(chan, sk->sk_sndtimeo);
> + __set_chan_timer(chan, chan->sndtimeo);
>
> chan->ident = cmd->ident;
>
> diff --git a/net/bluetooth/l2cap_sock.c b/net/bluetooth/l2cap_sock.c
> index 0977966..221aef9 100644
> --- a/net/bluetooth/l2cap_sock.c
> +++ b/net/bluetooth/l2cap_sock.c
> @@ -1178,6 +1178,7 @@ static void l2cap_sock_init(struct sock *sk, struct sock *parent)
>
> /* Default config options */
> chan->flush_to = L2CAP_DEFAULT_FLUSH_TO;
> + chan->sndtimeo = sk->sk_sndtimeo;
Explain to me how this actually works. Have you thought about
SO_SNDTIMEO socket option?
Regards
Marcel
next prev parent reply other threads:[~2013-02-20 21:14 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-20 20:11 [PATCH 00/16] Completely remove socket dependency from l2cap_core.c Gustavo Padovan
2013-02-20 20:11 ` [PATCH 01/16] Bluetooth: Add src and dst info to struct l2cap_chan Gustavo Padovan
2013-02-20 21:12 ` Marcel Holtmann
2013-02-20 20:11 ` [PATCH 02/16] Bluetooth: Remove sk_sndtimeo from l2cap_core.c Gustavo Padovan
2013-02-20 21:14 ` Marcel Holtmann [this message]
2013-02-20 20:11 ` [PATCH 03/16] Bluetooth: extend state_change() call to report errors too Gustavo Padovan
2013-02-20 21:16 ` Marcel Holtmann
2013-02-20 20:11 ` [PATCH 04/16] Bluetooth: add l2cap_state_change_and_error() Gustavo Padovan
2013-02-20 21:17 ` Marcel Holtmann
2013-02-20 20:11 ` [PATCH 05/16] Bluetooth: Add missing braces to an "else if" Gustavo Padovan
2013-02-20 21:18 ` Marcel Holtmann
2013-02-20 20:11 ` [PATCH 06/16] Bluetooth: use l2cap_chan_ready() instead of duplicate code Gustavo Padovan
2013-02-20 21:20 ` Marcel Holtmann
2013-02-20 20:11 ` [PATCH 07/16] Bluetooth: duplicate DEFER_SETUP flag on l2cap_chan Gustavo Padovan
2013-02-20 21:22 ` Marcel Holtmann
2013-02-20 20:11 ` [PATCH 08/16] Bluetooth: Improving locking in l2cap_conn_start() Gustavo Padovan
2013-02-20 21:23 ` Marcel Holtmann
2013-02-20 20:11 ` [PATCH 09/16] Bluetooth: lock socket in defer_cb call Gustavo Padovan
2013-02-20 20:11 ` [PATCH 10/16] Bluetooth: Remove socket lock from state_change() in l2cap_core Gustavo Padovan
2013-02-20 21:26 ` Marcel Holtmann
2013-02-20 20:11 ` [PATCH 11/16] Bluetooth: remove parent socket usage from l2cap_core.c Gustavo Padovan
2013-02-20 21:28 ` Marcel Holtmann
2013-02-20 20:11 ` [PATCH 12/16] Bluetooth: Use abstract chan->data in comparison Gustavo Padovan
2013-02-20 20:11 ` [PATCH 13/16] Bluetooth: Move l2cap_wait_ack() to l2cap_sock.c Gustavo Padovan
2013-02-20 20:11 ` [PATCH 14/16] Bluetooth: Create l2cap->ops->resume() Gustavo Padovan
2013-02-20 20:11 ` [PATCH 15/16] Bluetooth: Create l2cap->ops->set_shutdown() Gustavo Padovan
2013-02-20 20:11 ` [PATCH 16/16] Bluetooth: Remove sk member from struct l2cap_chan Gustavo Padovan
-- strict thread matches above, loose matches on Subject: below --
2013-01-10 7:47 [PATCH 00/16] Completely remove socket dependency from l2cap_core.c Gustavo Padovan
2013-01-10 7:47 ` [PATCH 02/16] Bluetooth: Remove sk_sndtimeo " Gustavo Padovan
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=1361394844.1583.78.camel@aeonflux \
--to=marcel@holtmann.org \
--cc=gustavo.padovan@collabora.co.uk \
--cc=gustavo@padovan.org \
--cc=linux-bluetooth@vger.kernel.org \
/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