|
From: Anders J. <and...@us...> - 2001-09-28 14:54:16
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
rfcomm.c 1.119 1.120=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Corrected initial credits sent.
* Improved creditcalculation.
The diff of the modified file(s):
--- rfcomm.c 2001/09/18 12:59:47 1.119
+++ rfcomm.c 2001/09/28 14:54:15 1.120
@@ -1284,13 +1284,13 @@
u32 con_id =3D CREATE_RFCOMM_ID(rfcomm->line, tmp_dlci);
=20
if (rfcomm->credit_flow) {
- rfcomm->dlci[tmp_dlci].remote_credits--;
+ --rfcomm->dlci[tmp_dlci].remote_credits;
D_CTRL(FNC": Remote credits: %d\n",rfcomm->dlci[tmp_dlci].remote_credi=
ts);
if (rfcomm->dlci[tmp_dlci].remote_credits < MIN_CREDITS) {
- /* FIXME -- possible race ? */
+ 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;
=20=09=09=09=09=09
- rfcomm_send_credits(rfcomm, tmp_dlci, MAX_CREDITS - rfcomm->dlci[tmp_=
dlci].remote_credits);
- rfcomm->dlci[tmp_dlci].remote_credits =3D MAX_CREDITS;
D_SND(FNC"Remote credits: %d\n",rfcomm->dlci[tmp_dlci].remote_credits=
);
=20=09=09=09=09=09
}
@@ -1374,7 +1374,7 @@
return total;
} else {
if (rfcomm->credit_flow) {
- rfcomm->dlci[dlci].local_credits--;
+ --rfcomm->dlci[dlci].local_credits;
D_SND(FNC"Local credits:%d\n", rfcomm->dlci[dlci].local_credits);
}
=20
@@ -1590,7 +1590,7 @@
rfcomm->dlci[tmp_dlci].remote_credits =3D START_CREDITS;
D_CTRL(FNC"Remote credits: %d\n",rfcomm->dlci[tmp_dlci].remote_credits=
);
send_pn_msg(rfcomm, pn_pkt->prior, frame_size,
- credit ^ 1, MAX_CREDITS,=20
+ credit ^ 1, START_CREDITS,=20
tmp_dlci, MCC_RSP);
} else {
send_pn_msg(rfcomm, pn_pkt->prior, frame_size,
@@ -1827,7 +1827,7 @@
#endif
}
=20
- if (rfcomm->credit_flow &&(rfcomm->dlci[dlci].remote_credits < MAX_CREDIT=
S)) {
+ 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;
}
@@ -1855,10 +1855,10 @@
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 (MAX_CREDITS -
- rfcomm->dlci[dlci].remote_credits);
- rfcomm->dlci[dlci].remote_credits =3D MAX_CREDITS;
+ 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 {
@@ -1888,10 +1888,11 @@
/* 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 (MAX_CREDITS -
- rfcomm->dlci[dlci].remote_credits);
- rfcomm->dlci[dlci].remote_credits =3D MAX_CREDITS;
+ 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 {
|