From: Andrei Emeltchenko <andrei.emeltchenko.news@gmail.com>
To: Ulisses Furquim <ulisses@profusion.mobi>
Cc: Mat Martineau <mathewm@codeaurora.org>,
linux-bluetooth@vger.kernel.org, padovan@profusion.mobi,
pkrystad@codeaurora.org, marcel@holtmann.org,
luiz.dentz@gmail.com
Subject: Re: [RFC 2/2] Bluetooth: L2CAP ERTM state machine replacement
Date: Mon, 27 Feb 2012 11:15:35 +0200 [thread overview]
Message-ID: <20120227091528.GB13267@aemeltch-MOBL1> (raw)
In-Reply-To: <CAA37ikbYkfwsCTWGt+dPmEU6CVXfMkfyphfUBxUBJphnd7uB4Q@mail.gmail.com>
Hi all,
On Sat, Feb 25, 2012 at 12:52:04PM -0300, Ulisses Furquim wrote:
> >> <snip>
> >>
> >> - if (bt_cb(skb)->retries == 1) {
> >> - chan->unacked_frames++;
> >> + l2cap_chan_hold(chan);
> >> + sock_hold(chan->sk);
> >> + tx_skb->sk = chan->sk;
> >>
> >> Do we really need these? Do we always have chan->sk? (We have that in
> >> l2cap_ertm_send() and l2cap_ertm_resend()).
> >
> > The upstream ERTM code still relies on having chan->sk, so I didn't try to
> > finish splitting channels & sockets within this patch. skb destructors
> > expect to have an sk pointer, so it is critical to modify these reference
> > counts so the socket and chan are around when the skb leaves the hci tx
> > queue.
>
> If I'm not mistaken the skb destructor relies on sk only to be able to
> access chan, right? It'd be good if we could not rely on sk here.
> Andrei, what do you think?
I believe that ERTM should not use sk. The places where we still use sk
shall be corrected IMO.
> >> - int ret;
> >> + struct l2cap_chan *chan =
> >> + container_of(work, struct l2cap_chan, tx_work);
> >>
> >> - if (!skb_queue_empty(&chan->tx_q))
> >> - chan->tx_send_head = chan->tx_q.next;
> >> + BT_DBG("%p", chan);
> >>
> >> - chan->next_tx_seq = chan->expected_ack_seq;
> >> - ret = l2cap_ertm_send(chan);
> >> - return ret;
> >> + lock_sock(chan->sk);
> >> + l2cap_ertm_send(chan);
> >> + release_sock(chan->sk);
> >>
> >> Can't we just use l2cap_chan_lock()/l2cap_chan_unlock() here? (I'm
> >> assuming you saw the patches creating a lock in l2cap_chan to protect
> >> it) Do we always have sk?
> >
> > l2cap_chan_lock() is pretty new! Yes, I should use that to guard the ERTM
> > state.
> >
> > Right now, we do still always have sk, but that is changing (as it should).
>
> Ok. If we could not rely on sk here as well would be good.
Good that we agree here.
Best regards
Andrei Emeltchenko
next prev parent reply other threads:[~2012-02-27 9:15 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-23 20:37 [RFC 0/2] New L2CAP ERTM state machine Mat Martineau
2012-02-23 20:37 ` [RFC 1/2] Bluetooth: Header changes for ERTM state machine replacement Mat Martineau
2012-02-24 9:48 ` Andrei Emeltchenko
2012-02-24 17:42 ` Ulisses Furquim
2012-02-25 0:21 ` Mat Martineau
2012-02-25 15:37 ` Ulisses Furquim
2012-02-27 9:28 ` Andrei Emeltchenko
2012-02-24 17:39 ` Ulisses Furquim
2012-02-25 0:32 ` Mat Martineau
2012-02-25 15:32 ` Ulisses Furquim
2012-02-28 23:33 ` Gustavo Padovan
2012-03-03 0:19 ` Mat Martineau
2012-02-23 20:37 ` [RFC 2/2] Bluetooth: L2CAP " Mat Martineau
2012-02-24 20:13 ` Ulisses Furquim
2012-02-25 1:08 ` Mat Martineau
2012-02-25 15:52 ` Ulisses Furquim
2012-02-27 9:15 ` Andrei Emeltchenko [this message]
2012-02-28 23:49 ` Gustavo Padovan
2012-03-03 0:30 ` Mat Martineau
2012-03-03 0:40 ` Marcel Holtmann
2012-03-06 23:09 ` Mat Martineau
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=20120227091528.GB13267@aemeltch-MOBL1 \
--to=andrei.emeltchenko.news@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=luiz.dentz@gmail.com \
--cc=marcel@holtmann.org \
--cc=mathewm@codeaurora.org \
--cc=padovan@profusion.mobi \
--cc=pkrystad@codeaurora.org \
--cc=ulisses@profusion.mobi \
/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