|
From: Anders J. <and...@us...> - 2001-10-23 10:10:28
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
rfcomm.c 1.127 1.128=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Minimum limit when sending credits set to 6.
* Only send credits in an empty packet if we run out of them, otherwise=20
always try to send them together with any outgoing data.
The diff of the modified file(s):
--- rfcomm.c 2001/10/18 15:49:25 1.127
+++ rfcomm.c 2001/10/23 10:10:28 1.128
@@ -136,7 +136,7 @@
=20
#define MAX_CREDITS 30
#define START_CREDITS 7
-#define MIN_CREDITS 15
+#define MIN_CREDITS 6
=20
#define DEF_RFCOMM_MTU 127
=20
@@ -1302,13 +1302,18 @@
u32 con_id =3D CREATE_RFCOMM_ID(rfcomm->line, tmp_dlci);
=20
if (rfcomm->credit_flow) {
+ if(rfcomm->dlci[tmp_dlci].remote_credits) {
--rfcomm->dlci[tmp_dlci].remote_credits;
+ }
+=09=09=09=09
D_CTRL(FNC": Remote credits: %d\n",rfcomm->dlci[tmp_dlci].remote_credi=
ts);
- if (rfcomm->dlci[tmp_dlci].remote_credits < MIN_CREDITS) {
+ /* Send new credits in packet only if we totally run out of them. When=
we send
+ data to the other side we usually send credits needed together with=
the data
+ (piggy-backed) */
+ if (rfcomm->dlci[tmp_dlci].remote_credits =3D=3D 0) {
u8 newcredits =3D MAX_CREDITS - rfcomm->dlci[tmp_dlci].remote_credits;
- rfcomm_send_credits(rfcomm, tmp_dlci, newcredits);
rfcomm->dlci[tmp_dlci].remote_credits +=3D newcredits;
-=09=09=09=09=09
+ rfcomm_send_credits(rfcomm, tmp_dlci, newcredits);
D_SND(FNC"Remote credits: %d\n",rfcomm->dlci[tmp_dlci].remote_credits=
);
=20=09=09=09=09=09
}
@@ -1831,6 +1836,7 @@
u32 rfcomm_frame_size;
u8 send_credit =3D 0;
s32 retval =3D 0;
+ u8 newcredits =3D 0;
=20=09=09
D_CTRL(FNC"Creating UIH packet with %d bytes data to DLCI %d\n",
len, dlci);
@@ -1847,6 +1853,8 @@
if (rfcomm->credit_flow &&(rfcomm->dlci[dlci].remote_credits < MIN_CREDIT=
S)) {
D_SND(FNC"Sending more credits to remote port\n");
send_credit =3D 1;
+ newcredits =3D MAX_CREDITS - rfcomm->dlci[dlci].remote_credits;
+ rfcomm->dlci[dlci].remote_credits +=3D newcredits;
}
=20=09
if (len > SHORT_PAYLOAD_SIZE) {
@@ -1872,10 +1880,8 @@
l_pkt =3D (long_frame*) (tx_buf->data + sizeof(rfcomm_tx_buf));
set_uih_hdr((void*) l_pkt, dlci, len, rfcomm->initiator);
if (send_credit) {
- u8 newcredits =3D MAX_CREDITS - rfcomm->dlci[dlci].remote_credits;
l_pkt->h.control =3D SET_PF(UIH);
l_pkt->data[0] =3D (newcredits);
- rfcomm->dlci[dlci].remote_credits +=3D newcredits;
D_SND(FNC": Remote credits: %d\n",rfcomm->dlci[dlci].remote_credits);
memcpy(l_pkt->data + 1, data, len);
} else {
@@ -1905,11 +1911,8 @@
/* Always one */
set_uih_hdr((void*) s_pkt, dlci, len, rfcomm->initiator);
if (send_credit) {
- u8 newcredits =3D MAX_CREDITS - rfcomm->dlci[dlci].remote_credits;
-=09=09=09
s_pkt->h.control =3D SET_PF(UIH);
s_pkt->data[0] =3D (newcredits);
- rfcomm->dlci[dlci].remote_credits +=3D newcredits;
D_SND(FNC": Remote credits: %d\n",rfcomm->dlci[dlci].remote_credits);
memcpy(s_pkt->data + 1, data, len);
} else {
@@ -2538,6 +2541,13 @@
rfcomm_con_list[i].line,=20
rfcomm_con_list[i].dlci[j].mtu);
=20=09=09=09=09
+ if(j) {
+ len +=3Dsprintf(buf+len, " lc[%d] rc[%d] ",
+ rfcomm_con_list[i].dlci[j].local_credits,
+ rfcomm_con_list[i].dlci[j].remote_credits);
+ }
+=09=09=09=09
+
len+=3Dsprintf(buf+len, "dlci#%d state[%s]\n",=20
j, state2name(rfcomm_con_list[i].dlci[j].state));
}
|