Linux bluetooth development
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@rvs.uni-bielefeld.de>
To: Max Krasnyansky <maxk@qualcomm.com>
Cc: Daryl Van Vorst <daryl@wideray.com>,
	BlueZ Mailing List <bluez-devel@lists.sourceforge.net>
Subject: Re: [Bluez-devel] RE: Rfcomm qualification
Date: 31 Jul 2003 02:48:46 +0200	[thread overview]
Message-ID: <1059612533.1832.48.camel@pegasus> (raw)
In-Reply-To: <5.1.0.14.2.20030730162942.053ff898@unixmail.qualcomm.com>

[-- Attachment #1: Type: text/plain, Size: 1151 bytes --]

Hi Max,

> >The session wide credits value is useless 
> No, it's not. 1.1 spec only mandates send PN for the _first_ DLC
> on that session. Which means that values negotiated in PN request are supposed 
> to be applied to the subsequent DLCs.  So we still need session wide settings.
> We just need to update them when we get PN req/rsp, which don't do.
> 
> Check this out:
> "
> 6.5.1 Initial DLC Negotiation
> The use of credit based flow control is a session characteristic. Thus, it has to
> be negotiated with the PN multiplexor control command (see Section 5.5.3)
> before the first DLC is established.
> After the first successful negotiation and DLC establishment, all DLCs will be
> flow controlled with this scheme. PN negotiation at subsequent DLC establish-ments
> is optional, but recommended, since it also establishes initial credit
> count values on both sides for both sides.
> "

memory malfunction ;) I thought it was a per dlc value.

The attached patch sets the default values for session and dlc credits
to zero and put in RFCOMM_MAX_CREDITS only if we receive a PN with 1.1
flow control.

What do you think?

Regards

Marcel


[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 1558 bytes --]

diff -Nru a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
--- a/net/bluetooth/rfcomm/core.c	Thu Jul 31 02:41:29 2003
+++ b/net/bluetooth/rfcomm/core.c	Thu Jul 31 02:41:29 2003
@@ -202,7 +202,7 @@
 	d->mtu        = RFCOMM_DEFAULT_MTU;
 	d->v24_sig    = RFCOMM_V24_RTC | RFCOMM_V24_RTR | RFCOMM_V24_DV;
 
-	d->credits    = RFCOMM_MAX_CREDITS;
+	d->credits    = 0;
 	d->rx_credits = RFCOMM_DEFAULT_CREDITS;
 }
 
@@ -475,7 +475,7 @@
 	s->sock  = sock;
 
 	s->mtu     = RFCOMM_DEFAULT_MTU;
-	s->credits = RFCOMM_MAX_CREDITS;
+	s->credits = 0;
 	
 	list_add(&s->list, &session_list);
 
@@ -746,7 +746,7 @@
 	pn->ack_timer   = 0;
 	pn->max_retrans = 0;
 
-	if (d->credits) {
+	if (cr || d->credits) {
 		pn->flow_ctrl = cr ? 0xf0 : 0xe0;
 		pn->credits = RFCOMM_DEFAULT_CREDITS;
 	} else {
@@ -1135,11 +1135,15 @@
 
 static int rfcomm_apply_pn(struct rfcomm_dlc *d, int cr, struct rfcomm_pn *pn)
 {
+	struct rfcomm_session *s = d->session;
+
 	BT_DBG("dlc %p state %ld dlci %d mtu %d fc 0x%x credits %d", 
 			d, d->state, d->dlci, pn->mtu, pn->flow_ctrl, pn->credits);
 
 	if (cr) {
 		if (pn->flow_ctrl == 0xf0) {
+			s->credits = RFCOMM_MAX_CREDITS;
+			d->credits = s->credits;
 			d->tx_credits = pn->credits;
 		} else {
 			set_bit(RFCOMM_TX_THROTTLED, &d->flags);
@@ -1147,6 +1151,8 @@
 		}
 	} else {
 		if (pn->flow_ctrl == 0xe0) {
+			s->credits = RFCOMM_MAX_CREDITS;
+			d->credits = s->credits;
 			d->tx_credits = pn->credits;
 		} else {
 			set_bit(RFCOMM_TX_THROTTLED, &d->flags);

  reply	other threads:[~2003-07-31  0:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-29 20:58 Rfcomm qualification Daryl Van Vorst
2003-07-29 23:03 ` [Bluez-devel] " Marcel Holtmann
2003-07-30 16:25   ` Daryl Van Vorst
2003-07-30 17:22     ` [Bluez-devel] " Marcel Holtmann
2003-07-30 21:43     ` Marcel Holtmann
2003-07-31  0:01       ` Max Krasnyansky
2003-07-31  0:48         ` Marcel Holtmann [this message]
2003-08-05 17:10           ` Max Krasnyansky
2003-08-05 22:04             ` Marcel Holtmann
2003-08-11 16:43               ` Daryl Van Vorst
2003-08-11 19:03                 ` Marcel Holtmann
2003-08-14 17:39           ` Daryl Van Vorst
2003-08-14 17:48             ` 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=1059612533.1832.48.camel@pegasus \
    --to=marcel@rvs.uni-bielefeld.de \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=daryl@wideray.com \
    --cc=maxk@qualcomm.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