Commit c0438174 authored by Ralf Baechle DL5RB's avatar Ralf Baechle DL5RB Committed by Linus Torvalds

[PATCH] 6pack persistence fix

Fix the p-persistence CSMA algorithm which in simplex mode was starting
with a slottime delay before doing anything else as if there was carrier
collision resulting in bad performance on simplex links.
Signed-off-by: default avatarRalf Baechle DL5RB <ralf@linux-mips.org>
Acked-by: default avatarJeff Garzik <jgarzik@pobox.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 48d28fd5
...@@ -130,12 +130,11 @@ struct sixpack { ...@@ -130,12 +130,11 @@ struct sixpack {
#define AX25_6PACK_HEADER_LEN 0 #define AX25_6PACK_HEADER_LEN 0
static void sp_start_tx_timer(struct sixpack *);
static void sixpack_decode(struct sixpack *, unsigned char[], int); static void sixpack_decode(struct sixpack *, unsigned char[], int);
static int encode_sixpack(unsigned char *, unsigned char *, int, unsigned char); static int encode_sixpack(unsigned char *, unsigned char *, int, unsigned char);
/* /*
* perform the persistence/slottime algorithm for CSMA access. If the * Perform the persistence/slottime algorithm for CSMA access. If the
* persistence check was successful, write the data to the serial driver. * persistence check was successful, write the data to the serial driver.
* Note that in case of DAMA operation, the data is not sent here. * Note that in case of DAMA operation, the data is not sent here.
*/ */
...@@ -143,7 +142,7 @@ static int encode_sixpack(unsigned char *, unsigned char *, int, unsigned char); ...@@ -143,7 +142,7 @@ static int encode_sixpack(unsigned char *, unsigned char *, int, unsigned char);
static void sp_xmit_on_air(unsigned long channel) static void sp_xmit_on_air(unsigned long channel)
{ {
struct sixpack *sp = (struct sixpack *) channel; struct sixpack *sp = (struct sixpack *) channel;
int actual; int actual, when = sp->slottime;
static unsigned char random; static unsigned char random;
random = random * 17 + 41; random = random * 17 + 41;
...@@ -159,20 +158,10 @@ static void sp_xmit_on_air(unsigned long channel) ...@@ -159,20 +158,10 @@ static void sp_xmit_on_air(unsigned long channel)
sp->tty->driver->write(sp->tty, &sp->led_state, 1); sp->tty->driver->write(sp->tty, &sp->led_state, 1);
sp->status2 = 0; sp->status2 = 0;
} else } else
sp_start_tx_timer(sp); mod_timer(&sp->tx_t, jiffies + ((when + 1) * HZ) / 100);
} }
/* ----> 6pack timer interrupt handler and friends. <---- */ /* ----> 6pack timer interrupt handler and friends. <---- */
static void sp_start_tx_timer(struct sixpack *sp)
{
int when = sp->slottime;
del_timer(&sp->tx_t);
sp->tx_t.data = (unsigned long) sp;
sp->tx_t.function = sp_xmit_on_air;
sp->tx_t.expires = jiffies + ((when + 1) * HZ) / 100;
add_timer(&sp->tx_t);
}
/* Encapsulate one AX.25 frame and stuff into a TTY queue. */ /* Encapsulate one AX.25 frame and stuff into a TTY queue. */
static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len) static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len)
...@@ -243,8 +232,7 @@ static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len) ...@@ -243,8 +232,7 @@ static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len)
sp->xleft = count; sp->xleft = count;
sp->xhead = sp->xbuff; sp->xhead = sp->xbuff;
sp->status2 = count; sp->status2 = count;
if (sp->duplex == 0) sp_xmit_on_air((unsigned long)sp);
sp_start_tx_timer(sp);
} }
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment