aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/rfcomm
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2006-07-03 04:02:51 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-07-03 22:54:07 -0400
commit7c2660b00fae0575dd4ce5c7b6bf30762b632045 (patch)
treede8be4ccdb2d1977be00af5afae65a0a97a7aec9 /net/bluetooth/rfcomm
parent0139418c943c3389cf75afc4f4d2b2fa52bbf7c9 (diff)
[Bluetooth] Allow disabling of credit based flow control
This patch adds the module parameter disable_cfc which can be used to disable the credit based flow control. The credit based flow control was introduced with the Bluetooth 1.1 specification and devices can negotiate its support, but for testing purpose it is helpful to allow disabling of it. Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/rfcomm')
-rw-r--r--net/bluetooth/rfcomm/core.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c
index 6de33fe7bf5b..fe18dc2dd3c1 100644
--- a/net/bluetooth/rfcomm/core.c
+++ b/net/bluetooth/rfcomm/core.c
@@ -52,8 +52,9 @@
52#define BT_DBG(D...) 52#define BT_DBG(D...)
53#endif 53#endif
54 54
55#define VERSION "1.7" 55#define VERSION "1.8"
56 56
57static int disable_cfc = 0;
57static unsigned int l2cap_mtu = RFCOMM_MAX_L2CAP_MTU; 58static unsigned int l2cap_mtu = RFCOMM_MAX_L2CAP_MTU;
58 59
59static struct task_struct *rfcomm_thread; 60static struct task_struct *rfcomm_thread;
@@ -533,7 +534,7 @@ static struct rfcomm_session *rfcomm_session_add(struct socket *sock, int state)
533 s->sock = sock; 534 s->sock = sock;
534 535
535 s->mtu = RFCOMM_DEFAULT_MTU; 536 s->mtu = RFCOMM_DEFAULT_MTU;
536 s->cfc = RFCOMM_CFC_UNKNOWN; 537 s->cfc = disable_cfc ? RFCOMM_CFC_DISABLED : RFCOMM_CFC_UNKNOWN;
537 538
538 /* Do not increment module usage count for listening sessions. 539 /* Do not increment module usage count for listening sessions.
539 * Otherwise we won't be able to unload the module. */ 540 * Otherwise we won't be able to unload the module. */
@@ -1222,14 +1223,18 @@ static int rfcomm_apply_pn(struct rfcomm_dlc *d, int cr, struct rfcomm_pn *pn)
1222 BT_DBG("dlc %p state %ld dlci %d mtu %d fc 0x%x credits %d", 1223 BT_DBG("dlc %p state %ld dlci %d mtu %d fc 0x%x credits %d",
1223 d, d->state, d->dlci, pn->mtu, pn->flow_ctrl, pn->credits); 1224 d, d->state, d->dlci, pn->mtu, pn->flow_ctrl, pn->credits);
1224 1225
1225 if (pn->flow_ctrl == 0xf0 || pn->flow_ctrl == 0xe0) { 1226 if ((pn->flow_ctrl == 0xf0 && s->cfc != RFCOMM_CFC_DISABLED) ||
1226 d->cfc = s->cfc = RFCOMM_CFC_ENABLED; 1227 pn->flow_ctrl == 0xe0) {
1228 d->cfc = RFCOMM_CFC_ENABLED;
1227 d->tx_credits = pn->credits; 1229 d->tx_credits = pn->credits;
1228 } else { 1230 } else {
1229 d->cfc = s->cfc = RFCOMM_CFC_DISABLED; 1231 d->cfc = RFCOMM_CFC_DISABLED;
1230 set_bit(RFCOMM_TX_THROTTLED, &d->flags); 1232 set_bit(RFCOMM_TX_THROTTLED, &d->flags);
1231 } 1233 }
1232 1234
1235 if (s->cfc == RFCOMM_CFC_UNKNOWN)
1236 s->cfc = d->cfc;
1237
1233 d->priority = pn->priority; 1238 d->priority = pn->priority;
1234 1239
1235 d->mtu = s->mtu = btohs(pn->mtu); 1240 d->mtu = s->mtu = btohs(pn->mtu);
@@ -2073,6 +2078,9 @@ static void __exit rfcomm_exit(void)
2073module_init(rfcomm_init); 2078module_init(rfcomm_init);
2074module_exit(rfcomm_exit); 2079module_exit(rfcomm_exit);
2075 2080
2081module_param(disable_cfc, bool, 0644);
2082MODULE_PARM_DESC(disable_cfc, "Disable credit based flow control");
2083
2076module_param(l2cap_mtu, uint, 0644); 2084module_param(l2cap_mtu, uint, 0644);
2077MODULE_PARM_DESC(l2cap_mtu, "Default MTU for the L2CAP connection"); 2085MODULE_PARM_DESC(l2cap_mtu, "Default MTU for the L2CAP connection");
2078 2086