From: Marcel Holtmann <marcel@holtmann.org>
To: Szymon Janc <szymon.janc@tieto.com>
Cc: "linux-bluetooth@vger.kernel.org"
<linux-bluetooth@vger.kernel.org>,
"kanak.gupta@stericsson.com" <kanak.gupta@stericsson.com>
Subject: Re: [PATCH 3/5] Bluetooth: Clear ack_timer when sending ack
Date: Tue, 10 Jan 2012 01:36:04 -0800 [thread overview]
Message-ID: <1326188164.6454.205.camel@aeonflux> (raw)
In-Reply-To: <201201101004.38182.szymon.janc@tieto.com>
Hi Szymon,
> > > ack_timer should be cleared when sending ACK to avoid acking I-frames
> > > twice.
> >
> > explain why you are creating a helper for it. Since that is clearly not
> > obvious to me.
>
> To avoid code duplication - helper is not clearing ack timer and is used by
> both l2cap_send_ack and l2cap_ack_timeout.
> There is no need to clear ack timer in timer funtion.
>
> But if you prefer to not have helper and are fine with clearing ack timer also in
> l2cap_ack_timeout then ack timer can be clear in l2cap_send_ack.
put that in the commit message please.
> > >
> > > Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
> > > ---
> > > net/bluetooth/l2cap_core.c | 10 ++++++++--
> > > 1 files changed, 8 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
> > > index 308d9d7..b9e232e 100644
> > > --- a/net/bluetooth/l2cap_core.c
> > > +++ b/net/bluetooth/l2cap_core.c
> > > @@ -1478,7 +1478,7 @@ static int l2cap_retransmit_frames(struct l2cap_chan *chan)
> > > return ret;
> > > }
> > >
> > > -static void l2cap_send_ack(struct l2cap_chan *chan)
> > > +static void __l2cap_send_ack(struct l2cap_chan *chan)
> > > {
> > > u32 control = 0;
> > >
> > > @@ -1498,6 +1498,12 @@ static void l2cap_send_ack(struct l2cap_chan *chan)
> > > l2cap_send_sframe(chan, control);
> > > }
> > >
> > > +static void l2cap_send_ack(struct l2cap_chan *chan)
> > > +{
> > > + __clear_ack_timer(chan);
> > > + __l2cap_send_ack(chan);
> > > +}
> > > +
> > > static void l2cap_send_srejtail(struct l2cap_chan *chan)
> > > {
> > > struct srej_list *tail;
> > > @@ -1988,7 +1994,7 @@ static void l2cap_ack_timeout(struct work_struct *work)
> > > BT_DBG("chan %p", chan);
> > >
> > > lock_sock(chan->sk);
> >
> > I would have just added
> >
> > __clear_ack_timer(chan):
> >
> > here.
>
> This is a timer function so there is no need to clear timer here.
>
> > > - l2cap_send_ack(chan);
> > > + __l2cap_send_ack(chan);
> > > release_sock(chan->sk);
> > > }
> > >
You are absolutely correct of course. I confused myself here. This also
means that either we add proper comments here or make it simpler to
follow the code. See what makes more sense.
Regards
Marcel
next prev parent reply other threads:[~2012-01-10 9:36 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-09 15:19 [PATCH 0/5] ERTM improvements Szymon Janc
2012-01-09 15:19 ` [PATCH 1/5] Bluetooth: Make l2cap_clear_timer return if timer was running or not Szymon Janc
2012-01-09 19:47 ` Marcel Holtmann
2012-01-10 8:01 ` Szymon Janc
2012-01-10 8:13 ` Marcel Holtmann
2012-01-09 15:19 ` [PATCH 2/5] Bluetooth: Set P-bit for SREJ frame only if there are I-frames to ack Szymon Janc
2012-01-09 19:48 ` Marcel Holtmann
2012-01-09 15:19 ` [PATCH 3/5] Bluetooth: Clear ack_timer when sending ack Szymon Janc
2012-01-09 19:50 ` Marcel Holtmann
2012-01-10 9:04 ` Szymon Janc
2012-01-10 9:36 ` Marcel Holtmann [this message]
2012-01-09 15:19 ` [PATCH 4/5] Bluetooth: Don't send RNR immediately when entering local busy Szymon Janc
2012-01-09 19:52 ` Marcel Holtmann
2012-01-09 15:19 ` [PATCH 5/5] Bluetooth: Drop L2CAP chan reference if ERTM ack_timer fired Szymon Janc
2012-01-09 19:52 ` Marcel Holtmann
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=1326188164.6454.205.camel@aeonflux \
--to=marcel@holtmann.org \
--cc=kanak.gupta@stericsson.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=szymon.janc@tieto.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).