Linux bluetooth development
 help / color / mirror / Atom feed
From: Mat Martineau <mathewm@codeaurora.org>
To: "Gustavo F. Padovan" <padovan@profusion.mobi>
Cc: linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 3/4] Bluetooth: Limit depth of the HCI TX queue with ERTM mode
Date: Thu, 9 Jun 2011 16:36:29 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.02.1106091610040.18748@mathewm-linux> (raw)
In-Reply-To: <20110609021648.GA2776@joana>


Gustavo,

On Wed, 8 Jun 2011, Gustavo F. Padovan wrote:

> Hi Mat,
>
> * Mat Martineau <mathewm@codeaurora.org> [2011-06-03 16:21:09 -0700]:
>
>> In order to provide timely responses to REJ, SREJ, and poll input from
>> the remote device, it helps to reduce the number of ERTM data frames
>> in the HCI TX queue at one time. If a full TX window of data is in the
>> HCI TX queue, any responses to REJ, SREJ, or polls must wait in line
>> behind all previously queued data. This latency leads to disconnects,
>> and will be more severe with extended window sizes.
>
> I prefer if we go with a hci_send_acl_prio() implementation. It will have much
> less overhead using a workqueue. As it will be filled only by S-frames with a
> few bytes each I don't think we will have problems. So lets go with this
> approach and see what we can get.

I considered that approach too, but it breaks some major assumptions 
and I don't think it complies with the ERTM spec.  I-frames contain 
reqseq fields and a final bit, so if S-frames and I-frames are 
delivered out-of-sequence, you can easily end up with a confusing 
series of reqseq values at the receiver.

Suppose the HCI tx queue is full of I-frames, and the oldest I-frame 
has reqseq set to 1.  Since that I-frame has been queued, other 
incoming I-frames have been processed, so the last recieved I-frame 
had txseq 20.  The remote device sends a poll, and we reply with an RR 
(reqseq 21) using the priority queue.  HCI sends that RR first, then 
an I-frame from the normal queue with reqseq 1.  Now the remote side 
thinks it missed all of the frames from 21 to 1 (having wrapped 
around).  The remote side then has to send REJ or SREJ frames, even 
though nothing is actually missing.


So, I think we have two options:

  * Use the skb_destructor mechanism to pull data for ERTM (which is 
what my patch does), and leave queuing for other modes alone
  * Rearchitect HCI & L2CAP so that data is pulled from the L2CAP layer 
as num_comp_pkts events are received


I realize there is increased overhead to make the callbacks to get 
data out of the ERTM tx queue, but the skb destructor is very 
lightweight (since it uses an atomic_t counter).  The overhead is 
tunable using L2CAP_MAX_ERTM_QUEUED and L2CAP_MIN_ERTM_QUEUED to 
control how often the callback to l2cap_ertm_send() is actually made. 
With the current queuing behavior, things get unmanageable on AMP with 
extra latency from larger tx windows and much shorter timeouts.


Regards,

--
Mat Martineau
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum

  reply	other threads:[~2011-06-09 23:36 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-03 23:21 [PATCH 1/4] Bluetooth: Restore accidentally-deleted line Mat Martineau
2011-06-03 23:21 ` [PATCH 2/4] Bluetooth: Rename _busy_wq to _l2cap_wq Mat Martineau
2011-06-06 17:31   ` Gustavo F. Padovan
2011-06-08 23:24     ` Mat Martineau
2011-06-09 18:47       ` Gustavo F. Padovan
2011-06-09 23:09         ` Mat Martineau
2011-06-15  0:04           ` Gustavo F. Padovan
2011-06-16 21:48             ` Mat Martineau
2011-06-20 19:23               ` Gustavo F. Padovan
2011-06-24 22:31                 ` Gustavo F. Padovan
2011-06-03 23:21 ` [PATCH 3/4] Bluetooth: Limit depth of the HCI TX queue with ERTM mode Mat Martineau
2011-06-09  2:16   ` Gustavo F. Padovan
2011-06-09 23:36     ` Mat Martineau [this message]
2011-06-14 23:31       ` Mat Martineau
2011-06-14 23:53       ` Gustavo F. Padovan
2011-06-16 22:38         ` Mat Martineau
2011-06-03 23:21 ` [PATCH 4/4] Bluetooth: Fix check for the ERTM local busy state Mat Martineau
2011-06-06 17:38   ` Gustavo F. Padovan
2011-06-06 17:37 ` [PATCH 1/4] Bluetooth: Restore accidentally-deleted line Gustavo F. 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=alpine.DEB.2.02.1106091610040.18748@mathewm-linux \
    --to=mathewm@codeaurora.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=padovan@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