aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/hamradio/6pack.c
diff options
context:
space:
mode:
authorRalf Baechle DL5RB <ralf@linux-mips.org>2005-08-10 13:03:20 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-10 14:03:02 -0400
commitc0438174e8272d23fe43a5d3f23d777f5b412e87 (patch)
tree5c7ef2706004c7ebf620f5f347b914e57f3b093d /drivers/net/hamradio/6pack.c
parent48d28fd55e7fd349fb16a50244379b4da3a4943c (diff)
[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: Ralf Baechle DL5RB <ralf@linux-mips.org> Acked-by: Jeff Garzik <jgarzik@pobox.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/net/hamradio/6pack.c')
-rw-r--r--drivers/net/hamradio/6pack.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
index e44f8e9055ef..f9e3be96963c 100644
--- a/drivers/net/hamradio/6pack.c
+++ b/drivers/net/hamradio/6pack.c
@@ -130,12 +130,11 @@ struct sixpack {
130 130
131#define AX25_6PACK_HEADER_LEN 0 131#define AX25_6PACK_HEADER_LEN 0
132 132
133static void sp_start_tx_timer(struct sixpack *);
134static void sixpack_decode(struct sixpack *, unsigned char[], int); 133static void sixpack_decode(struct sixpack *, unsigned char[], int);
135static int encode_sixpack(unsigned char *, unsigned char *, int, unsigned char); 134static int encode_sixpack(unsigned char *, unsigned char *, int, unsigned char);
136 135
137/* 136/*
138 * perform the persistence/slottime algorithm for CSMA access. If the 137 * Perform the persistence/slottime algorithm for CSMA access. If the
139 * persistence check was successful, write the data to the serial driver. 138 * persistence check was successful, write the data to the serial driver.
140 * Note that in case of DAMA operation, the data is not sent here. 139 * Note that in case of DAMA operation, the data is not sent here.
141 */ 140 */
@@ -143,7 +142,7 @@ static int encode_sixpack(unsigned char *, unsigned char *, int, unsigned char);
143static void sp_xmit_on_air(unsigned long channel) 142static void sp_xmit_on_air(unsigned long channel)
144{ 143{
145 struct sixpack *sp = (struct sixpack *) channel; 144 struct sixpack *sp = (struct sixpack *) channel;
146 int actual; 145 int actual, when = sp->slottime;
147 static unsigned char random; 146 static unsigned char random;
148 147
149 random = random * 17 + 41; 148 random = random * 17 + 41;
@@ -159,20 +158,10 @@ static void sp_xmit_on_air(unsigned long channel)
159 sp->tty->driver->write(sp->tty, &sp->led_state, 1); 158 sp->tty->driver->write(sp->tty, &sp->led_state, 1);
160 sp->status2 = 0; 159 sp->status2 = 0;
161 } else 160 } else
162 sp_start_tx_timer(sp); 161 mod_timer(&sp->tx_t, jiffies + ((when + 1) * HZ) / 100);
163} 162}
164 163
165/* ----> 6pack timer interrupt handler and friends. <---- */ 164/* ----> 6pack timer interrupt handler and friends. <---- */
166static void sp_start_tx_timer(struct sixpack *sp)
167{
168 int when = sp->slottime;
169
170 del_timer(&sp->tx_t);
171 sp->tx_t.data = (unsigned long) sp;
172 sp->tx_t.function = sp_xmit_on_air;
173 sp->tx_t.expires = jiffies + ((when + 1) * HZ) / 100;
174 add_timer(&sp->tx_t);
175}
176 165
177/* Encapsulate one AX.25 frame and stuff into a TTY queue. */ 166/* Encapsulate one AX.25 frame and stuff into a TTY queue. */
178static void sp_encaps(struct sixpack *sp, unsigned char *icp, int len) 167static 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 sp->xleft = count; 232 sp->xleft = count;
244 sp->xhead = sp->xbuff; 233 sp->xhead = sp->xbuff;
245 sp->status2 = count; 234 sp->status2 = count;
246 if (sp->duplex == 0) 235 sp_xmit_on_air((unsigned long)sp);
247 sp_start_tx_timer(sp);
248 } 236 }
249 237
250 return; 238 return;