All of lore.kernel.org
 help / color / mirror / Atom feed
From: Max Krasnyansky <maxk@qualcomm.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Daryl Van Vorst <daryl@wideray.com>,
	"'Marcel Holtmann'" <marcel@rvs.uni-bielefeld.de>,
	"'BlueZ Mailing List'" <bluez-devel@lists.sourceforge.net>
Subject: RE: [Bluez-devel] RE: Qualification testing - rfcomm
Date: Tue, 22 Jul 2003 12:43:38 -0700	[thread overview]
Message-ID: <5.1.0.14.2.20030722113308.097cd6a0@unixmail.qualcomm.com> (raw)
In-Reply-To: <1058897607.32360.10.camel@lapdancer.baythorne.internal>

At 11:13 AM 7/22/2003, David Woodhouse wrote:
>On Tue, 2003-07-22 at 13:09, Max Krasnyansky wrote:
>
>> Ok. I know what's the problem is. Basically what happens is that we fill up socket 
>> tx buffer before MSC exchange completes (aclsession script does wait 10) and app goes to 
>> sleep in sendmsg(). Then we receive MSC and send 5 frames from tx buffer (we only 
>> send 5 frames at a time when credit flow ctl is not enabled). App is still sleeping 
>> at this point because sock_def_write_space() will not wakeup the process unless there
>> is a lot of room in the tx buffer. 
>
>I think this is your problem. You should wake the writer as soon as
>there's any space in the buffer for it to write. If you want to throttle
>tx over the wire, do it by other means, not by letting the writers sleep
>indefinitely. 
May be I didn't explain it clearly. The problem is not in the buffering. It's in the TX processing.
Read below.

>> The fix is simple we just need to reschedule DLC when credit based flow control is not enabled. But I'm
>> not sure how often we need to do that. 
>
>Why only when flow control is disabled? Surely we have the same problem
>in the case where flow control is enabled too? You want to keep your
>buffers full (but not too _large_ for latency reasons) or you might as
>well not have them, surely?
Again buffering is not the problem here.
If credit based flow control (CFC) is enabled rfcomm_process_tx() will use all available credits 
(assuming tx buffer has enough stuff to send) and then wait for more credits. As soon as we get more 
credits we send more frames from tx buffer. 
Now when CFC is disabled we send 5 frames and do not send more until app wakes up again. That is
the problem.

Here is an example. RFCOMM app sends 1KB of data and waits for response.
Lets say MTU of this channel is 100 bytes.
CFC case:
        - They grant us 5 credits
        - We send 5 frames. 
        - They grant us 5 credits
        - We send 5 frames.
        <1KB transfer is complete at this point>

Non-CFC case:
        - We send 5 frames.
        <that's it. we're stuck here>
Waking the app here won't help, it already sent what I had to send.

So what should happen instead is
Non-CFC case:
        - We send 5 frames.
        - We reschedule DLC.
        - We send 5 frames.
        - We reschedule DLC
        <1KB transfer is complete at this point>

See. Buffering is not the problem. The problem is that we have to restart tx processing.
I guess we could solve it by making socket send buffer == MTU * 5. In which case the problem 
is kind of related to buffering. But I don't want to change socket buffering just for non CFC
case.

>> If we do it too often we'll essentially restore old behavior, too
>> seldom and performance will suffer. David, any suggestion ?
>
>The old behaviour which I fix wouldn't be restored by waking on dequeue,
>surely? What I did was limit the tx buffers, and that would still have
>the desired effect.
Now you should see what I was talking about. If we reschedule DLC immediately
after sending 5 frames we'll end up sending too fast (ie exactly the same as before).

btw We're talking about RFCOMM sockets here. But it might affect TTYs as well. 

Max

  reply	other threads:[~2003-07-22 19:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-08 18:16 Qualification testing - rfcomm Daryl Van Vorst
2003-07-08 21:47 ` [Bluez-devel] " James Courtier-Dutton
2003-07-08 23:23   ` Daryl Van Vorst
2003-07-18 19:35     ` James Courtier-Dutton
2003-07-11  8:18 ` [Bluez-devel] " Marcel Holtmann
2003-07-22 16:23   ` Max Krasnyansky
2003-07-22 16:46     ` Marcel Holtmann
2003-07-22 17:40       ` Max Krasnyansky
2003-07-22 19:13         ` Marcel Holtmann
2003-07-22 16:48     ` Daryl Van Vorst
2003-07-22 16:53       ` Marcel Holtmann
2003-07-22 17:01         ` Daryl Van Vorst
2003-07-11  8:55 ` Marcel Holtmann
2003-07-11 16:43   ` Daryl Van Vorst
2003-07-11 19:05     ` [Bluez-devel] " Daryl Van Vorst
2003-07-18 18:53       ` Daryl Van Vorst
2003-07-18 18:58         ` Marcel Holtmann
2003-07-18 19:07           ` Daryl Van Vorst
2003-07-18 19:12             ` Marcel Holtmann
2003-07-18 19:19               ` Daryl Van Vorst
2003-07-22 17:09                 ` Max Krasnyansky
2003-07-22 18:13                   ` David Woodhouse
2003-07-22 19:43                     ` Max Krasnyansky [this message]
2003-07-22 16:26     ` Max Krasnyansky
2003-07-18 19:30 ` [Bluez-devel] " James Courtier-Dutton
2003-07-18 20:25   ` Daryl Van Vorst

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=5.1.0.14.2.20030722113308.097cd6a0@unixmail.qualcomm.com \
    --to=maxk@qualcomm.com \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=daryl@wideray.com \
    --cc=dwmw2@infradead.org \
    --cc=marcel@rvs.uni-bielefeld.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.