|
From: Mats F. <ma...@us...> - 2001-05-18 07:05:04
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_sequence.c 1.3 1.4=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Rewrote the resend procedures
The diff of the modified file(s):
--- bcsp_sequence.c 2001/05/17 15:55:00 1.3
+++ bcsp_sequence.c 2001/05/18 07:05:03 1.4
@@ -47,6 +47,7 @@
#include <linux/bluetooth/bcsp.h>
#include <linux/interrupt.h>
#include <linux/bluetooth/sysdep-2.1.h>
+#include <linux/bluetooth/bcsp_debug.h>
=20
/****************** CONSTANT AND MACRO SECTION ***************************=
***/
=20
@@ -56,6 +57,9 @@
#define D(fmt...)
#endif
=20
+#define WINSIZE 7
+#define SEQUENCE_TIMEOUT HZ
+
/****************** TYPE DEFINITION SECTION ******************************=
***/
=20
typedef struct resend_buf {
@@ -68,20 +72,31 @@
/****************** LOCAL FUNCTION DECLARATION SECTION *******************=
***/
=20
static void sequence_resend(void);
+static void send_ack(void);
=20
+static void start_resend_timer(void);
+static void release_resend_timer(void);
+
/****************** GLOBAL VARIABLE DECLARATION SECTION ******************=
***/
=20
/****************** LOCAL VARIABLE DECLARATION SECTION *******************=
***/
=20
static struct tq_struct resend_data_task;
+static struct tq_struct send_ack_task;
=20
-static u8 seq_nbr =3D 0;
-static u8 ack_nbr =3D 0;
+static u8 txseq =3D 0;
+static u8 txack =3D 0;
+static u8 rxack =3D 0;
+static u8 expected_rxseq =3D 0;
=20
-static u8 remote_ack_nbr =3D 0;
+static u8 winspace =3D WINSIZE;
=20
static u32 got_packet =3D FALSE;
=20
+static struct timer_list resend_timer;
+
+static u8 resend_timer_active =3D FALSE;
+
static struct resend_buf resend_buffer[8];
=20
/****************** FUNCTION DEFINITION SECTION **************************=
***/
@@ -90,6 +105,9 @@
{
resend_data_task.routine =3D (void*)sequence_resend;
resend_data_task.data =3D NULL;
+
+ send_ack_task.routine =3D (void*)send_ack;
+ send_ack_task.data =3D NULL;
}
=20
s32
@@ -100,12 +118,28 @@
bcsp_syncronized();
}
=20=09
- ack_nbr =3D BCSP_GET_SEQ(bcsp) + 1;
- /* Do we realy need to do this ? */
- //remote_ack_nbr =3D BCSP_GET_ACK(bcsp);
- send_txack(ack_nbr);
+ if (expected_rxseq =3D=3D BCSP_GET_SEQ(bcsp)) {
=20
+ cli();
+ txack =3D (BCSP_GET_SEQ(bcsp) + 1) % 8;
+ expected_rxseq =3D (expected_rxseq + 1) % 8;
+ sti();
+
bcsp_receive_top(bcsp->payload, bcsp->payload_length, bcsp->identifier);
+=09=09
+ }
+
+/* FIXME: Do we need a task_queue for sending the ack packets ? */
+#if 0
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
+ queue_task(&send_ack_task, &tq_immediate);
+#else
+ queue_task(&send_ack_task, &tq_immediate);
+ mark_bh(IMMEDIATE_BH);
+#endif
+#endif=09=09
+ send_ack();
+=09
return 0;
}
=20
@@ -115,73 +149,128 @@
{
struct bcsp bcsp;
=20=09
+ if (winspace > 0) {
init_bcsp_packet(&bcsp);
=20=09
bcsp.identifier =3D chn;
=20
BCSP_SET_PROTOCOL_TYPE(&bcsp, BCSP_RELIABLE);
=20=09
- BCSP_SET_SEQ(&bcsp, seq_nbr);
+ BCSP_SET_SEQ(&bcsp, txseq);
=20
- BCSP_SET_ACK(&bcsp, ack_nbr);
+ BCSP_SET_ACK(&bcsp, txack);
=20=09
bcsp.payload =3D data;
bcsp.payload_length =3D len;
=20
- memcpy(resend_buffer[seq_nbr].data, data, len);
- resend_buffer[seq_nbr].len =3D len;
- resend_buffer[seq_nbr].chn =3D chn;
+ memcpy(resend_buffer[txseq].data, data, len);
+ resend_buffer[txseq].len =3D len;
+ resend_buffer[txseq].chn =3D chn;
=20
- seq_nbr =3D (seq_nbr + 1) % 8;
+ txseq =3D (txseq + 1) % 8;
+ winspace--;
+
+ D(__FUNCTION__": winspace:%d, txreq:%d\n", winspace, txseq);
+=09=09
+ if (resend_timer_active) {
+ release_resend_timer();
+ }
+ start_resend_timer();
+ } else {
+ printk(__FUNCTION__": winspace =3D 0\n");
+ return 0;
+ }
=20=09=09
return mux_send(&bcsp);
}
=20
void
-signal_rxack(u8 ack)
+signal_rxack(u8 new_ack)
{
- static u8 last_ack =3D 0;
=20
- remote_ack_nbr =3D ack;
+ D(__FUNCTION__": Got rxack:%d\n", new_ack);
=20=09
- if (last_ack =3D=3D ack) {
- printk(__FUNCTION__ ": Got incorrect ack:%d, seq_nbr:%d\n", ack, seq_nbr=
);
+ if ((rxack =3D=3D new_ack) && !(rxack =3D=3D txseq)) {
+ printk(__FUNCTION__": Got incorrect new_ack:%d, seq_nbr:%d\n", new_ack,=
txseq);
+=09=09
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
queue_task(&resend_data_task, &tq_scheduler);
#else
queue_task(&resend_data_task, &tq_immediate);
mark_bh(IMMEDIATE_BH);
#endif
+ } else if (rxack < new_ack) {
+ D(__FUNCTION__": winspace before:%d\n", winspace);
+ winspace +=3D new_ack - rxack;
+ D(__FUNCTION__": winspace after:%d\n", winspace);
} else {
- D(__FUNCTION__ ": Got rx ack:%d\n", ack);
+ D(__FUNCTION__": winspace before:%d\n", winspace);
+ winspace +=3D (WINSIZE - rxack) + new_ack + 1;
+ D(__FUNCTION__": winspace after:%d\n", winspace);
}
- last_ack =3D ack;
+
+=09
+ rxack =3D new_ack;
+
+ if (winspace =3D=3D WINSIZE) {
+ release_resend_timer();
}
+}
=20
-void sequence_resend(void)
+void
+sequence_resend(void)
{
struct bcsp bcsp;
+ u8 resend_cnt =3D rxack;
=20
- while (remote_ack_nbr !=3D seq_nbr) {
+ while (resend_cnt !=3D txseq) {
=20=09
- printk(__FUNCTION__ ": Resending seq_nbr:%d, last sent was %d\n", remote=
_ack_nbr, seq_nbr);
+ printk(__FUNCTION__": Resending with seq_nbr:%d, last ack was %d, cur se=
q_nbr:%d\n", resend_cnt, rxack, txseq);
=20=09=09
init_bcsp_packet(&bcsp);
=20=09=09
- bcsp.identifier =3D resend_buffer[remote_ack_nbr].chn;
+ bcsp.identifier =3D resend_buffer[resend_cnt].chn;
=20=09=09
BCSP_SET_PROTOCOL_TYPE(&bcsp, BCSP_RELIABLE);
=20=09=09
- BCSP_SET_SEQ(&bcsp, remote_ack_nbr);
+ BCSP_SET_SEQ(&bcsp, resend_cnt);
=20=09=09
- BCSP_SET_ACK(&bcsp, ack_nbr);
+ BCSP_SET_ACK(&bcsp, txack);
=20=09=09
- bcsp.payload =3D resend_buffer[remote_ack_nbr].data;
- bcsp.payload_length =3D resend_buffer[remote_ack_nbr].len;
+ bcsp.payload =3D resend_buffer[resend_cnt].data;
+ bcsp.payload_length =3D resend_buffer[resend_cnt].len;
=20=09=09
mux_send(&bcsp);
- remote_ack_nbr =3D (remote_ack_nbr + 1) % 8;
+ resend_cnt =3D (resend_cnt + 1) % 8;
+ }
+
+ start_resend_timer();
+}
+
+void
+send_ack(void)
+{
+ send_txack(txack);
+}
+
+void
+start_resend_timer(void)
+{
+ init_timer(&resend_timer);
+ resend_timer.function =3D (void*)sequence_resend;
+ resend_timer.data =3D 0;
+ resend_timer.expires =3D jiffies + SEQUENCE_TIMEOUT;
+
+ resend_timer_active =3D TRUE;
+=09
+ add_timer(&resend_timer);
}
+
+void
+release_resend_timer(void)
+{
+ resend_timer_active =3D FALSE;
+ del_timer(&resend_timer);
}
=20
/****************** END OF FILE sequence.c *******************************=
***/
|
|
From: Mats F. <ma...@us...> - 2001-05-18 13:58:18
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_sequence.c 1.6 1.7=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Added case for handling of multiple acknowledgment packets
The diff of the modified file(s):
--- bcsp_sequence.c 2001/05/18 13:48:46 1.6
+++ bcsp_sequence.c 2001/05/18 13:58:17 1.7
@@ -46,6 +46,7 @@
#include <linux/types.h>
#include <linux/bluetooth/bcsp.h>
#include <linux/interrupt.h>
+#include <linux/timer.h>
#include <linux/bluetooth/sysdep-2.1.h>
#include <linux/bluetooth/bcsp_debug.h>
=20
@@ -195,7 +196,8 @@
=20
D(__FUNCTION__": Got rxack:%d\n", new_ack);
=20=09
- if ((rxack =3D=3D new_ack) && !(rxack =3D=3D txseq)) {
+ if (rxack =3D=3D new_ack) {
+ if (!(rxack =3D=3D txseq)) {
printk(__FUNCTION__": Got incorrect new_ack:%d, seq_nbr:%d\n", new_ack, =
txseq);
=20=09=09
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
@@ -204,6 +206,9 @@
queue_task(&resend_data_task, &tq_immediate);
mark_bh(IMMEDIATE_BH);
#endif
+ } else {
+ printk(__FUNCTION__": Got repeted ack%d\n", new_ack);
+ }
} else if (rxack < new_ack) {
D(__FUNCTION__": winspace before:%d\n", winspace);
winspace +=3D new_ack - rxack;
@@ -218,6 +223,10 @@
=20
if (winspace =3D=3D WINSIZE) {
release_resend_timer();
+ } else if (winspace > WINSIZE) {
+ printk(__FUNCTION__": Somthing has gone wrong winspace > WINSIZE\n");
+ release_resend_timer();
+ winspace =3D WINSIZE;
}
}
=20
|
|
From: Mats F. <ma...@us...> - 2001-05-25 14:12:51
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_sequence.c 1.8 1.9=20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Rewrote resending procedures
The diff of the modified file(s):
--- bcsp_sequence.c 2001/05/18 16:03:51 1.8
+++ bcsp_sequence.c 2001/05/25 14:12:50 1.9
@@ -58,7 +58,7 @@
#define D(fmt...)
#endif
=20
-#define WINSIZE 7
+#define WINSIZE 4
#define SEQUENCE_TIMEOUT HZ
=20
/****************** TYPE DEFINITION SECTION ******************************=
***/
@@ -126,25 +126,32 @@
bcsp_syncronized();
}
=20=09
+ printk(__FUNCTION__": txack:%d, expected_rxseq:%d, BCSP_GET_SEQ(bcsp):%d\=
n", txack, expected_rxseq, BCSP_GET_SEQ(bcsp));
+=09
if (expected_rxseq =3D=3D BCSP_GET_SEQ(bcsp)) {
cli();
txack =3D (BCSP_GET_SEQ(bcsp) + 1) % 8;
expected_rxseq =3D (expected_rxseq + 1) % 8;
sti();
=20
- bcsp_receive_top(bcsp->payload, bcsp->payload_length, bcsp->identifier);
+ if ((winspace > 0) && (hci_trig_send())) {
+ printk("*\n");
+ } else {
+ printk(" -\n");
+ send_ack();
}
=20
-/* FIXME: Do we need a task_queue for sending the ack packets ? */
-#if 0
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
- queue_task(&send_ack_task, &tq_immediate);
-#else
- queue_task(&send_ack_task, &tq_immediate);
- mark_bh(IMMEDIATE_BH);
-#endif
-#endif=09=09
+ bcsp_receive_top(bcsp->payload, bcsp->payload_length,
+ bcsp->identifier);
+ } else { /* out of order rx seq nbr */=20
+ if ((winspace > 0) && (hci_trig_send())) {
+ print_data(__FUNCTION__, bcsp->payload, bcsp->payload_length);
+ printk("**\n");
+ } else {
+ printk(" --\n");
send_ack();
+ }
+ }
=20=09
return 0;
}
@@ -154,6 +161,8 @@
{
struct bcsp bcsp;
=20=09
+ //printk(__FUNCTION__": rxack:%d, txack:%d, txseq:%d, winspace:%d\n", rxa=
ck, txack, txseq, winspace);
+=09
if (winspace > 0) {
bcsp_init_packet(&bcsp);
=20
@@ -161,8 +170,8 @@
=20
BCSP_SET_PROTOCOL_TYPE(&bcsp, BCSP_RELIABLE);
=20
+ cli();
BCSP_SET_SEQ(&bcsp, txseq);
-
BCSP_SET_ACK(&bcsp, txack);
=20
bcsp.payload =3D data;
@@ -174,12 +183,11 @@
=20
txseq =3D (txseq + 1) % 8;
winspace--;
+ sti();
=20
D(__FUNCTION__": winspace:%d, txreq:%d\n", winspace, txseq);
=20
- if (resend_timer_active) {
- release_resend_timer();
- }
+ /* restart timer */
start_resend_timer();
} else {
printk(__FUNCTION__": winspace =3D 0\n");
@@ -192,40 +200,42 @@
void
bcsp_signal_rxack(u8 new_ack)
{
- D(__FUNCTION__": Got rxack:%d\n", new_ack);
+ s32 trig_send =3D FALSE;
+ printk(__FUNCTION__": Got new ack:%d, rxack is:%d, txseq:%d, winspace:%d\=
n", new_ack, rxack, txseq, winspace);
=20=09
- if (rxack =3D=3D new_ack) {
- if (!(rxack =3D=3D txseq)) {
- printk(__FUNCTION__": Got incorrect new_ack:%d, seq_nbr:%d\n", new_ack=
, txseq);
=20=09=09
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0)
- queue_task(&resend_data_task, &tq_scheduler);
-#else
- queue_task(&resend_data_task, &tq_immediate);
- mark_bh(IMMEDIATE_BH);
-#endif
- } else {
- printk(__FUNCTION__": Got repeted ack%d\n", new_ack);
+ if (rxack =3D=3D new_ack) { /* Same ack again... */
+ return;
}
- } else if (rxack < new_ack) {
+
+ cli();
+ if (winspace =3D=3D 0) {
+ trig_send =3D TRUE;
+ }
+
D(__FUNCTION__": winspace before:%d\n", winspace);
- winspace +=3D new_ack - rxack;
- D(__FUNCTION__": winspace after:%d\n", winspace);
+ if (new_ack > rxack) {
+ winspace +=3D (new_ack - rxack);
} else {
- D(__FUNCTION__": winspace before:%d\n", winspace);
- winspace +=3D (WINSIZE - rxack) + new_ack + 1;
- D(__FUNCTION__": winspace after:%d\n", winspace);
+ winspace +=3D (WINSIZE - (rxack - new_ack) + 1);
}
+ D(__FUNCTION__": winspace after:%d\n", winspace);
=20
rxack =3D new_ack;
+ sti();
=20
if (winspace =3D=3D WINSIZE) {
release_resend_timer();
} else if (winspace > WINSIZE) {
- printk(__FUNCTION__": Somthing has gone wrong winspace > WINSIZE\n");
+ printk(__FUNCTION__": Something has gone wrong winspace > WINSIZE\n");
release_resend_timer();
winspace =3D WINSIZE;
}
+=09
+ if (trig_send) {
+ printk(__FUNCTION__": Trying to trig send\n");
+ hci_trig_send();
+ }
}
=20
void
@@ -233,8 +243,9 @@
{
struct bcsp bcsp;
u8 resend_cnt =3D rxack;
-=09
+ cli();
while (resend_cnt !=3D txseq) {
+ sti();
printk(__FUNCTION__": Resending with seq_nbr:%d, last ack was %d, cur se=
q_nbr:%d\n", resend_cnt, rxack, txseq);
=20
bcsp_init_packet(&bcsp);
@@ -244,28 +255,36 @@
BCSP_SET_PROTOCOL_TYPE(&bcsp, BCSP_RELIABLE);
=20
BCSP_SET_SEQ(&bcsp, resend_cnt);
-
+ cli();
BCSP_SET_ACK(&bcsp, txack);
-
+ sti();
bcsp.payload =3D resend_buffer[resend_cnt].data;
bcsp.payload_length =3D resend_buffer[resend_cnt].len;
=20
bcsp_mux_send(&bcsp);
resend_cnt =3D (resend_cnt + 1) % 8;
}
-
+ sti();
start_resend_timer();
}
=20
void
send_ack(void)
{
- bcsp_send_txack(txack);
+ u8 tmp;
+ cli();
+ tmp =3D txack;
+ sti();
+ bcsp_send_txack(tmp);
}
=20
void
start_resend_timer(void)
{
+ if (resend_timer_active) {
+ release_resend_timer();
+ }
+=09
init_timer(&resend_timer);
resend_timer.function =3D (void*)sequence_resend;
resend_timer.data =3D 0;
@@ -279,8 +298,10 @@
void
release_resend_timer(void)
{
+ if (resend_timer_active) {
resend_timer_active =3D FALSE;
del_timer(&resend_timer);
+ }
}
=20
/****************** END OF FILE sequence.c *******************************=
***/
|
|
From: Mattias A. <mat...@us...> - 2001-06-06 14:55:19
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_sequence.c 1.10 1.11=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Fixed bug when calculating winspace=20
* Don't use static variables if BCSP_PARSELOWER is defined
* Set rtx timeout to default (250 ms)
* Always reset variables in bcsp_sequence_init()
* Choke all received data until we are syncronized
* Added debug macros aroung some printouts
* Don't turn off interrupts more than necessary
* Added max number of retransmits (default 20)
The diff of the modified file(s):
--- bcsp_sequence.c 2001/05/30 09:47:00 1.10
+++ bcsp_sequence.c 2001/06/06 14:55:18 1.11
@@ -62,7 +62,7 @@
#endif
=20
#define WINSIZE 4
-#define SEQUENCE_TIMEOUT HZ
+#define SEQUENCE_TIMEOUT (HZ/4) /* default 250 ms */
=20
/****************** TYPE DEFINITION SECTION ******************************=
***/
=20
@@ -88,12 +88,20 @@
static struct tq_struct resend_data_task;
static struct tq_struct send_ack_task;
=20
-static u8 txseq =3D 0;
-static u8 txack =3D 0;
-static u8 rxack =3D 0;
-static u8 expected_rxseq =3D 0;
+#if BCSP_PARSELOWER
+u8 txseq;
+u8 txack;
+u8 rxack;
+u8 expected_rxseq;
+u8 winspace;
+#else
+static u8 txseq;
+static u8 txack;
+static u8 rxack;
+static u8 expected_rxseq;
+static u8 winspace;
+#endif
=20
-static u8 winspace =3D WINSIZE;
=20
static u32 got_packet =3D FALSE;
=20
@@ -113,6 +121,12 @@
=20
send_ack_task.routine =3D (void*)send_ack;
send_ack_task.data =3D NULL;
+
+ txseq =3D 0;
+ txack =3D 0;
+ rxack =3D 0;
+ expected_rxseq =3D 0;
+ winspace =3D WINSIZE;
}
=20
void
@@ -124,12 +138,12 @@
s32
bcsp_sequence_receive(struct bcsp *bcsp)
{
- if (!got_packet) {
- got_packet =3D TRUE;
- bcsp_syncronized();
+ if (!bcsp_issyncronized()){=09
+ D(printk("Still not synced\n"));
+ return 0;
}
=20
- printk(__FUNCTION__": txack:%d, expected_rxseq:%d, BCSP_GET_SEQ(bcsp):%d\=
n", txack, expected_rxseq, BCSP_GET_SEQ(bcsp));
+ D(__FUNCTION__": txack:%d, expected_rxseq:%d, BCSP_GET_SEQ(bcsp):%d\n", t=
xack, expected_rxseq, BCSP_GET_SEQ(bcsp));
=20=09
if (expected_rxseq =3D=3D BCSP_GET_SEQ(bcsp)) {
cli();
@@ -137,10 +151,11 @@
expected_rxseq =3D (expected_rxseq + 1) % 8;
sti();
=20
- if ((winspace > 0) && (hci_trig_send())) {
- printk("*\n");
+ if ((winspace > 0) && (buf_count())) {
+ /* ack is piggybacked in next tx data packet */
+ D("<-data ack\n");
} else {
- printk(" -\n");
+ D("<-ack\n");
send_ack();
}
=20=09=09
@@ -148,10 +163,13 @@
bcsp->identifier);
} else { /* out of order rx seq nbr */=20
if ((winspace > 0) && (hci_trig_send())) {
- print_data(__FUNCTION__, bcsp->payload, bcsp->payload_length);
- printk("**\n");
+ print_data(__FUNCTION__, bcsp->payload,=20
+ bcsp->payload_length);
+ printk("seq out-of-order [exp:%d, got:%d]\n",=20
+ expected_rxseq, BCSP_GET_SEQ(bcsp));
} else {
- printk(" --\n");
+ printk("seq out-of-order [exp:%d, got:%d], send ack\n",
+ expected_rxseq, BCSP_GET_SEQ(bcsp));
send_ack();
}
}
@@ -164,7 +182,7 @@
{
struct bcsp bcsp;
=20
- //printk(__FUNCTION__": rxack:%d, txack:%d, txseq:%d, winspace:%d\n", rxa=
ck, txack, txseq, winspace);
+ D(__FUNCTION__": rxack:%d, txack:%d, txseq:%d, winspace:%d\n", rxack, txa=
ck, txseq, winspace);
=20=09
if (winspace > 0) {
bcsp_init_packet(&bcsp);
@@ -176,14 +194,15 @@
cli();
BCSP_SET_SEQ(&bcsp, txseq);
BCSP_SET_ACK(&bcsp, txack);
-=09=09
bcsp.payload =3D data;
bcsp.payload_length =3D len;
+ sti();
=20
memcpy(resend_buffer[txseq].data, data, len);
resend_buffer[txseq].len =3D len;
resend_buffer[txseq].chn =3D chn;
=20=09=09
+ cli();
txseq =3D (txseq + 1) % 8;
winspace--;
sti();
@@ -193,7 +212,9 @@
/* restart timer */
start_resend_timer();
} else {
- printk(__FUNCTION__": winspace =3D 0\n");
+#ifdef DBG_BCSPHEADER
+ printk(__FUNCTION__": win=3D0\n");
+#endif
return 0;
}
=20
@@ -204,8 +225,7 @@
bcsp_signal_rxack(u8 new_ack)
{
s32 trig_send =3D FALSE;
- printk(__FUNCTION__": Got new ack:%d, rxack is:%d, txseq:%d, winspace:%d\=
n", new_ack, rxack, txseq, winspace);
-
+ D(__FUNCTION__": Got new ack:%d, rxack is:%d, txseq:%d, winspace:%d\n", n=
ew_ack, rxack, txseq, winspace);
=20
if (rxack =3D=3D new_ack) { /* Same ack again... */
return;
@@ -216,40 +236,45 @@
trig_send =3D TRUE;
}
=20
- D(__FUNCTION__": winspace before:%d\n", winspace);
+ D(__FUNCTION__": winspace before:%d [%d, %d]\n",=20
+ winspace, rxack, new_ack);
if (new_ack > rxack) {
winspace +=3D (new_ack - rxack);
} else {
- winspace +=3D (WINSIZE - (rxack - new_ack) + 1);
+ winspace +=3D (8 - (rxack - new_ack));
}
- D(__FUNCTION__": winspace after:%d\n", winspace);
=20=09
+ D(__FUNCTION__" win_up:%d\n", winspace);
+
rxack =3D new_ack;
+
sti();
=20=09
if (winspace =3D=3D WINSIZE) {
release_resend_timer();
} else if (winspace > WINSIZE) {
- printk(__FUNCTION__": Something has gone wrong winspace > WINSIZE\n");
+ printk(__FUNCTION__": ERROR winspace > WINSIZE [%d]\n",=20
+ winspace);
release_resend_timer();
- winspace =3D WINSIZE;
}
=20=09
if (trig_send) {
- printk(__FUNCTION__": Trying to trig send\n");
hci_trig_send();
}
}
=20
+#define BCSP_RTX_MAX 20
void
sequence_resend(void)
{
struct bcsp bcsp;
u8 resend_cnt =3D rxack;
+ u8 rtx_count =3D BCSP_RTX_MAX;
+=09
cli();
- while (resend_cnt !=3D txseq) {
+ while ((resend_cnt !=3D txseq) && (rtx_count--)) {
sti();
- printk(__FUNCTION__": Resending with seq_nbr:%d, last ack was %d, cur se=
q_nbr:%d\n", resend_cnt, rxack, txseq);
+ printk(__FUNCTION__" : seq_nbr:%d, last_ack:%d, cur_seq:%d\n\n", resend_=
cnt, rxack, txseq);
=20
bcsp_init_packet(&bcsp);
=20
@@ -268,8 +293,16 @@
resend_cnt =3D (resend_cnt + 1) % 8;
}
sti();
+=09
+ if (rtx_count =3D=3D 0)
+ {
+ printk("ERROR : giving up on rtx !\n");
+ /* fixme -- signal link down etc. */
+ }
+ else
start_resend_timer();
}
+
=20
void
send_ack(void)
|
|
From: Mats F. <ma...@us...> - 2001-06-07 09:11:51
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_sequence.c 1.11 1.12=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Corrected debug
* Added comments
The diff of the modified file(s):
--- bcsp_sequence.c 2001/06/06 14:55:18 1.11
+++ bcsp_sequence.c 2001/06/07 09:11:48 1.12
@@ -139,7 +139,7 @@
bcsp_sequence_receive(struct bcsp *bcsp)
{
if (!bcsp_issyncronized()){=09
- D(printk("Still not synced\n"));
+ D(__FUNCTION__": Still not synced\n");
return 0;
}
=20=09
@@ -151,6 +151,7 @@
expected_rxseq =3D (expected_rxseq + 1) % 8;
sti();
=20
+ /* FIXME: Do we need to schedule when winsize > 0 ? */
if ((winspace > 0) && (buf_count())) {
/* ack is piggybacked in next tx data packet */
D("<-data ack\n");
@@ -163,8 +164,7 @@
bcsp->identifier);
} else { /* out of order rx seq nbr */=20
if ((winspace > 0) && (hci_trig_send())) {
- print_data(__FUNCTION__, bcsp->payload,=20
- bcsp->payload_length);
+ /* ack is piggybacked in next tx data packet */
printk("seq out-of-order [exp:%d, got:%d]\n",=20
expected_rxseq, BCSP_GET_SEQ(bcsp));
} else {
|
|
From: Mats F. <ma...@us...> - 2001-06-08 12:46:50
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_sequence.c 1.12 1.13=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
If winspace becomes greater than WINSIZE, set winspace to WINSIZE
The diff of the modified file(s):
--- bcsp_sequence.c 2001/06/07 09:11:48 1.12
+++ bcsp_sequence.c 2001/06/08 12:46:49 1.13
@@ -255,6 +255,7 @@
} else if (winspace > WINSIZE) {
printk(__FUNCTION__": ERROR winspace > WINSIZE [%d]\n",=20
winspace);
+ winspace =3D WINSIZE;
release_resend_timer();
}=20
=20=09
|
|
From: Mats F. <ma...@us...> - 2001-07-06 07:00:08
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_sequence.c 1.13 1.14=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
* Corrected the RTX timeout
* Some minor changes
The diff of the modified file(s):
--- bcsp_sequence.c 2001/06/08 12:46:49 1.13
+++ bcsp_sequence.c 2001/07/06 07:00:07 1.14
@@ -64,6 +64,8 @@
#define WINSIZE 4
#define SEQUENCE_TIMEOUT (HZ/4) /* default 250 ms */
=20
+#define BCSP_RTX_MAX 20
+
/****************** TYPE DEFINITION SECTION ******************************=
***/
=20
typedef struct resend_buf {
@@ -102,6 +104,8 @@
static u8 winspace;
#endif
=20
+static u8 rtx_count =3D BCSP_RTX_MAX;
+
=20
static u32 got_packet =3D FALSE;
=20
@@ -152,7 +156,7 @@
sti();
=20
/* FIXME: Do we need to schedule when winsize > 0 ? */
- if ((winspace > 0) && (buf_count())) {
+ if ((winspace > 0) && buf_count() && (hci_acl_num_cnt() > 0)) {
/* ack is piggybacked in next tx data packet */
D("<-data ack\n");
} else {
@@ -167,7 +171,9 @@
/* ack is piggybacked in next tx data packet */
printk("seq out-of-order [exp:%d, got:%d]\n",=20
expected_rxseq, BCSP_GET_SEQ(bcsp));
+
} else {
+ s32 i;
printk("seq out-of-order [exp:%d, got:%d], send ack\n",
expected_rxseq, BCSP_GET_SEQ(bcsp));
send_ack();
@@ -247,6 +253,7 @@
D(__FUNCTION__" win_up:%d\n", winspace);
=20
rxack =3D new_ack;
+ rtx_count =3D BCSP_RTX_MAX;
=20
sti();
=20=09
@@ -264,16 +271,14 @@
}
}
=20
-#define BCSP_RTX_MAX 20
void
sequence_resend(void)
{
struct bcsp bcsp;
u8 resend_cnt =3D rxack;
- u8 rtx_count =3D BCSP_RTX_MAX;
=20=09
cli();
- while ((resend_cnt !=3D txseq) && (rtx_count--)) {
+ while (rtx_count && (resend_cnt !=3D txseq)) {
sti();
printk(__FUNCTION__" : seq_nbr:%d, last_ack:%d, cur_seq:%d\n\n", resend_=
cnt, rxack, txseq);
=20=09=09
@@ -295,13 +300,14 @@
}=20=20=20=20=20=20=20
sti();
=20=09
- if (rtx_count =3D=3D 0)
- {
+ rtx_count--;
+=09
+ if (rtx_count =3D=3D 0) {
printk("ERROR : giving up on rtx !\n");
/* fixme -- signal link down etc. */
- }
- else
+ } else {
start_resend_timer();
+ }
}
=20
=20
|
|
From: Mats F. <ma...@us...> - 2001-07-20 06:43:17
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_sequence.c 1.14 1.15=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
If the sequence nbr is correct, signal rxack
The diff of the modified file(s):
--- bcsp_sequence.c 2001/07/06 07:00:07 1.14
+++ bcsp_sequence.c 2001/07/20 06:43:16 1.15
@@ -106,7 +106,6 @@
=20
static u8 rtx_count =3D BCSP_RTX_MAX;
=20
-
static u32 got_packet =3D FALSE;
=20
static struct timer_list resend_timer;
@@ -150,10 +149,13 @@
D(__FUNCTION__": txack:%d, expected_rxseq:%d, BCSP_GET_SEQ(bcsp):%d\n", t=
xack, expected_rxseq, BCSP_GET_SEQ(bcsp));
=20
if (expected_rxseq =3D=3D BCSP_GET_SEQ(bcsp)) {
+
cli();
txack =3D (BCSP_GET_SEQ(bcsp) + 1) % 8;
expected_rxseq =3D (expected_rxseq + 1) % 8;
sti();
+
+ bcsp_signal_rxack(BCSP_GET_ACK(bcsp));
=20=09=09
/* FIXME: Do we need to schedule when winsize > 0 ? */
if ((winspace > 0) && buf_count() && (hci_acl_num_cnt() > 0)) {
|
|
From: Peter K. <pk...@us...> - 2001-07-31 17:59:27
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_sequence.c 1.15 1.16=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Fixed a couple of compiler warnings.
The diff of the modified file(s):
--- bcsp_sequence.c 2001/07/20 06:43:16 1.15
+++ bcsp_sequence.c 2001/07/31 17:59:25 1.16
@@ -50,6 +50,8 @@
#include <linux/timer.h>
=20
#include <linux/bluetooth/sysdep-2.1.h>
+#include <linux/bluetooth/btmem.h>
+#include <linux/bluetooth/hci.h>
#include <linux/bluetooth/bcsp.h>
#include <linux/bluetooth/bcsp_debug.h>
=20
@@ -106,8 +108,6 @@
=20
static u8 rtx_count =3D BCSP_RTX_MAX;
=20
-static u32 got_packet =3D FALSE;
-
static struct timer_list resend_timer;
=20
static u8 resend_timer_active =3D FALSE;
@@ -175,7 +175,6 @@
expected_rxseq, BCSP_GET_SEQ(bcsp));
=20
} else {
- s32 i;
printk("seq out-of-order [exp:%d, got:%d], send ack\n",
expected_rxseq, BCSP_GET_SEQ(bcsp));
send_ack();
|
|
From: Peter K. <pk...@us...> - 2001-09-18 12:20:17
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_sequence.c 1.17 1.18=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Fixed a compiler warning.
The diff of the modified file(s):
--- bcsp_sequence.c 2001/08/16 13:01:22 1.17
+++ bcsp_sequence.c 2001/09/18 12:20:17 1.18
@@ -184,11 +184,11 @@
} else { /* out of order rx seq nbr */=20
if ((winspace > 0) && (hci_trig_send())) {
/* ack is piggybacked in next tx data packet */
- printk("seq out-of-order [exp:%d, got:%d]\n",=20
+ printk("seq out-of-order [exp:%d, got:%ld]\n",=20
expected_rxseq, BCSP_GET_SEQ(bcsp));
=20
} else {
- printk("seq out-of-order [exp:%d, got:%d], send ack\n",
+ printk("seq out-of-order [exp:%d, got:%ld], send ack\n",
expected_rxseq, BCSP_GET_SEQ(bcsp));
send_ack();
}
|
|
From: Peter K. <pk...@us...> - 2001-09-20 17:02:04
|
The following file was modified in linux/drivers/char/bluetooth:
Name Old version New version Comment
---- ----------- ----------- -------
bcsp_sequence.c 1.19 1.20=20=20=20=20=20=20=20=20=20=20=20=20
The accompanying log:
Fixed a debug message.
The diff of the modified file(s):
--- bcsp_sequence.c 2001/09/18 13:04:27 1.19
+++ bcsp_sequence.c 2001/09/20 17:02:03 1.20
@@ -294,7 +294,8 @@
cli();
while (rtx_count && (resend_cnt !=3D txseq)) {
sti();
- printk(__FUNCTION__" : seq_nbr:%d, last_ack:%d, cur_seq:%d\n\n", resend_=
cnt, rxack, txseq);
+ D(__FUNCTION__ ": seq_nbr:%d, last_ack:%d, cur_seq:%d\n",
+ resend_cnt, rxack, txseq);
=20=09=09
bcsp_init_packet(&bcsp);
=20=09=09
|
|
From: Willy S. <sag...@us...> - 2002-04-11 08:35:22
|
The following file was modified in linux/drivers/char/bluetooth: Name Old version New version Tag Comment ---- ----------- ----------- --- ------- bcsp_sequence.c 1.20 1.21=20=20=20=20=20=20=20=20=20=20=20=20=20= =20 The accompanying log: Added linux version ifdef for malloc.h/slab.h The diff of the modified file(s): --- bcsp_sequence.c 20 Sep 2001 17:02:03 -0000 1.20 +++ bcsp_sequence.c 11 Apr 2002 08:35:22 -0000 1.21 @@ -45,7 +45,11 @@ #define __NO_VERSION__ /* don't define kernel_version in module.h */ =20 #ifdef __KERNEL__ +#if LINUX_VERSION_CODE >=3D 0x20200 +#include <linux/slab.h> +#else #include <linux/malloc.h> +#endif #include <linux/types.h> #include <linux/interrupt.h> #include <linux/timer.h> |