* [PATCH] hamradio driver fixes
@ 2004-01-19 21:32 Jeroen Vreeken
2004-01-19 22:51 ` Ruben Navarro Huedo
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Jeroen Vreeken @ 2004-01-19 21:32 UTC (permalink / raw)
To: linux-hams, jgarzik; +Cc: ralf
[-- Attachment #1: Type: text/plain, Size: 522 bytes --]
Hi,
This is a patch that fixes some problems in the hamradio drivers in 2.6.1
Part is a resent that was probably lost during the holiday season.
The fixes include:
+ scc.c usage of rtnl lock and register_netdev.
+ scc.c properly initialize timers.
+ remove cli() call in 6pack.c (The line of code that was 'protected'
couldn't have needed it anyway)
+ fix init of reused devices and remove cli()
The only thing remaining is a call to cli() in the dmascc driver, I don't
know what exactly it aims to protect....
Jeroen
[-- Attachment #2: hamradio.2.6.1.rxq.diff --]
[-- Type: application/octet-stream, Size: 5751 bytes --]
diff -ruN linux-2.6.1/drivers/net/hamradio/6pack.c linux-2.6.1-rxq/drivers/net/hamradio/6pack.c
--- linux-2.6.1/drivers/net/hamradio/6pack.c 2004-01-09 07:59:10.000000000 +0100
+++ linux-2.6.1-rxq/drivers/net/hamradio/6pack.c 2004-01-19 22:01:19.000000000 +0100
@@ -516,7 +516,6 @@
static void sixpack_receive_buf(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
{
unsigned char buf[512];
- unsigned long flags;
int count1;
struct sixpack *sp = (struct sixpack *) tty->disc_data;
@@ -525,10 +524,7 @@
!netif_running(sp->dev) || !count)
return;
- save_flags(flags);
- cli();
memcpy(buf, cp, count<sizeof(buf)? count:sizeof(buf));
- restore_flags(flags);
/* Read the characters out of the buffer */
diff -ruN linux-2.6.1/drivers/net/hamradio/mkiss.c linux-2.6.1-rxq/drivers/net/hamradio/mkiss.c
--- linux-2.6.1/drivers/net/hamradio/mkiss.c 2004-01-09 08:00:04.000000000 +0100
+++ linux-2.6.1-rxq/drivers/net/hamradio/mkiss.c 2004-01-18 17:47:52.000000000 +0100
@@ -24,6 +24,7 @@
* called twice, causing a deadlock.
* Jeroen (PE1RXQ) Removed old MKISS_MAGIC stuff and calls to
* MOD_*_USE_COUNT
+ * Remove cli() and fix rtnl lock usage.
*/
#include <linux/config.h>
@@ -167,17 +168,17 @@
/* If no channels are available, allocate one */
if (axp == NULL && (ax25_ctrls[i] = kmalloc(sizeof(ax25_ctrl_t), GFP_KERNEL)) != NULL) {
axp = ax25_ctrls[i];
- memset(axp, 0, sizeof(ax25_ctrl_t));
-
- /* Initialize channel control data */
- set_bit(AXF_INUSE, &axp->ctrl.flags);
- sprintf(axp->dev.name, "ax%d", i++);
- axp->ctrl.tty = NULL;
- axp->dev.base_addr = i;
- axp->dev.priv = (void *)&axp->ctrl;
- axp->dev.next = NULL;
- axp->dev.init = ax25_init;
}
+ memset(axp, 0, sizeof(ax25_ctrl_t));
+
+ /* Initialize channel control data */
+ set_bit(AXF_INUSE, &axp->ctrl.flags);
+ sprintf(axp->dev.name, "ax%d", i++);
+ axp->ctrl.tty = NULL;
+ axp->dev.base_addr = i;
+ axp->dev.priv = (void *)&axp->ctrl;
+ axp->dev.next = NULL;
+ axp->dev.init = ax25_init;
if (axp != NULL) {
/*
@@ -220,7 +221,6 @@
struct net_device *dev = ax->dev;
unsigned char *xbuff, *rbuff, *oxbuff, *orbuff;
int len;
- unsigned long flags;
len = dev->mtu * 2;
@@ -246,8 +246,7 @@
return;
}
- save_flags(flags);
- cli();
+ spin_lock_bh(ax->buflock);
oxbuff = ax->xbuff;
ax->xbuff = xbuff;
@@ -278,7 +277,7 @@
ax->mtu = dev->mtu + 73;
ax->buffsize = len;
- restore_flags(flags);
+ spin_unlock_bh(ax->buflock);
if (oxbuff != NULL)
kfree(oxbuff);
@@ -306,6 +305,7 @@
struct sk_buff *skb;
int count;
+ spin_lock_bh(ax->buflock);
if (ax->rbuff[0] > 0x0f) {
if (ax->rbuff[0] & 0x20) {
ax->crcmode = CRC_MODE_FLEX;
@@ -322,6 +322,7 @@
*ax->rbuff &= ~0x20;
}
}
+ spin_unlock_bh(ax->buflock);
count = ax->rcount;
@@ -332,7 +333,9 @@
}
skb->dev = ax->dev;
+ spin_lock_bh(ax->buflock);
memcpy(skb_put(skb,count), ax->rbuff, count);
+ spin_unlock_bh(ax->buflock);
skb->mac.raw = skb->data;
skb->protocol = htons(ETH_P_AX25);
netif_rx(skb);
@@ -360,6 +363,7 @@
p = icp;
+ spin_lock_bh(ax->buflock);
switch (ax->crcmode) {
unsigned short crc;
@@ -373,6 +377,7 @@
count = kiss_esc(p, (unsigned char *)ax->xbuff, len);
break;
}
+
ax->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP);
actual = ax->tty->driver->write(ax->tty, 0, ax->xbuff, count);
ax->tx_packets++;
@@ -380,6 +385,8 @@
ax->dev->trans_start = jiffies;
ax->xleft = count - actual;
ax->xhead = ax->xbuff + actual;
+
+ spin_unlock_bh(ax->buflock);
}
/*
@@ -511,6 +518,8 @@
ax->flags &= (1 << AXF_INUSE); /* Clear ESCAPE & ERROR flags */
+ ax->buflock = SPIN_LOCK_UNLOCKED;
+
netif_start_queue(dev);
return 0;
@@ -750,15 +759,18 @@
break;
}
+ spin_lock_bh(ax->buflock);
if (!test_bit(AXF_ERROR, &ax->flags)) {
if (ax->rcount < ax->buffsize) {
ax->rbuff[ax->rcount++] = s;
+ spin_unlock_bh(ax->buflock);
return;
}
ax->rx_over_errors++;
set_bit(AXF_ERROR, &ax->flags);
}
+ spin_unlock_bh(ax->buflock);
}
diff -ruN linux-2.6.1/drivers/net/hamradio/mkiss.h linux-2.6.1-rxq/drivers/net/hamradio/mkiss.h
--- linux-2.6.1/drivers/net/hamradio/mkiss.h 2004-01-09 07:59:09.000000000 +0100
+++ linux-2.6.1-rxq/drivers/net/hamradio/mkiss.h 2004-01-11 19:16:02.000000000 +0100
@@ -56,6 +56,7 @@
#define CRC_MODE_NONE 0
#define CRC_MODE_FLEX 1
#define CRC_MODE_SMACK 2
+ spinlock_t buflock; /* lock for rbuf and xbuf */
};
#define AX25_MAGIC 0x5316
diff -ruN linux-2.6.1/drivers/net/hamradio/scc.c linux-2.6.1-rxq/drivers/net/hamradio/scc.c
--- linux-2.6.1/drivers/net/hamradio/scc.c 2004-01-09 07:59:56.000000000 +0100
+++ linux-2.6.1-rxq/drivers/net/hamradio/scc.c 2004-01-11 22:31:59.000000000 +0100
@@ -163,6 +163,7 @@
#include <linux/delay.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
+#include <linux/rtnetlink.h>
#include <linux/if_ether.h>
#include <linux/if_arp.h>
#include <linux/socket.h>
@@ -1520,8 +1521,10 @@
dev->priv = scc;
scc->dev = dev;
spin_lock_init(&scc->lock);
+ init_timer(&scc->tx_t);
+ init_timer(&scc->tx_wdog);
- err = register_netdev(dev);
+ err = register_netdevice(dev);
if (err) {
printk(KERN_ERR "%s: can't register network device (%d)\n",
name, err);
@@ -2114,10 +2117,13 @@
sprintf(devname,"%s0", SCC_DriverName);
+ rtnl_lock();
if (scc_net_alloc(devname, SCC_Info)) {
+ rtnl_unlock();
printk(KERN_ERR "z8530drv: cannot initialize module\n");
return -EIO;
}
+ rtnl_unlock();
proc_net_fops_create("z8530drv", 0, &scc_net_seq_fops);
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] hamradio driver fixes
2004-01-19 21:32 [PATCH] hamradio driver fixes Jeroen Vreeken
@ 2004-01-19 22:51 ` Ruben Navarro Huedo
2004-01-19 23:25 ` Jeroen Vreeken
2004-01-19 23:33 ` Bernard Pidoux
2004-01-20 19:11 ` Lars E. Pettersson
2 siblings, 1 reply; 8+ messages in thread
From: Ruben Navarro Huedo @ 2004-01-19 22:51 UTC (permalink / raw)
To: linux-hams
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
will be this patch in 2.6.2?
Thank's.
El Lunes, 19 de Enero de 2004 22:32, Jeroen Vreeken escribió:
> Hi,
>
> This is a patch that fixes some problems in the hamradio drivers in 2.6.1
> Part is a resent that was probably lost during the holiday season.
> The fixes include:
>
> + scc.c usage of rtnl lock and register_netdev.
> + scc.c properly initialize timers.
> + remove cli() call in 6pack.c (The line of code that was 'protected'
> couldn't have needed it anyway)
> + fix init of reused devices and remove cli()
>
> The only thing remaining is a call to cli() in the dmascc driver, I don't
> know what exactly it aims to protect....
>
> Jeroen
- --
(Del lat. anus).
1. m. Orificio en que remata el conducto digestivo y por el cual se
expele el excremento.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQFADF9l0S5G8AO3zN8RAurkAKCGflZE5SiOjHCQ3Qq3GVS7FKDPCgCfetwd
Zwf6TP6MmI8vNSLCfsKun84=
=ibm9
-----END PGP SIGNATURE-----
-
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] hamradio driver fixes
2004-01-19 23:33 ` Bernard Pidoux
@ 2004-01-19 23:06 ` Jeroen Vreeken
0 siblings, 0 replies; 8+ messages in thread
From: Jeroen Vreeken @ 2004-01-19 23:06 UTC (permalink / raw)
To: Bernard Pidoux; +Cc: Jeroen Vreeken, linux-hams, jgarzik, ralf
On 2004.01.20 00:33:25 +0100 Bernard Pidoux wrote:
> Hi,
>
> Thanks and congratuations Jeroen.
> I applied the patch and it cured the problems of kernel panic when
> removing mkiss module driver after performing a kissattach.
>
> Just for your information, there was two warnings during scc.c
> compilation :
> line 1201 and 1279 warning comparison is always true due to limited
> range of data type.
Are you sure about the line numbers and the file? I can't find anything
like that in scc.c in either 2.6.0, 2.6.1 or 2.6.1 with my patch.
I also don't get that warning.
> I am using ax25, mkiss, rose and netrom drivers.
>
> There is still a similar problem left when removing rose module driver
> after and only after attaching a rose port with rsattach.
>
> I give the Call Trace :
> free_module + 0x44/0x90
> sys_delete_module + 0x133/0x1a0
> do_munmap + 0xfs/0x150
> sys_munmap + 0x34/0x60
> syscall_call °0x7/0xb
I am not a Rose user myself so my knowledge of it is very limited...
I will take a look at it and see if I see something wrong.
Jeroen
-
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] hamradio driver fixes
2004-01-19 22:51 ` Ruben Navarro Huedo
@ 2004-01-19 23:25 ` Jeroen Vreeken
0 siblings, 0 replies; 8+ messages in thread
From: Jeroen Vreeken @ 2004-01-19 23:25 UTC (permalink / raw)
To: Ruben Navarro Huedo; +Cc: linux-hams
On 2004.01.19 23:51:17 +0100 Ruben Navarro Huedo wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> will be this patch in 2.6.2?
I hope so, but its not my call to make....
Jeroen
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] hamradio driver fixes
2004-01-19 21:32 [PATCH] hamradio driver fixes Jeroen Vreeken
2004-01-19 22:51 ` Ruben Navarro Huedo
@ 2004-01-19 23:33 ` Bernard Pidoux
2004-01-19 23:06 ` Jeroen Vreeken
2004-01-20 19:11 ` Lars E. Pettersson
2 siblings, 1 reply; 8+ messages in thread
From: Bernard Pidoux @ 2004-01-19 23:33 UTC (permalink / raw)
To: Jeroen Vreeken; +Cc: linux-hams, jgarzik, ralf
Hi,
Thanks and congratuations Jeroen.
I applied the patch and it cured the problems of kernel panic when
removing mkiss module driver after performing a kissattach.
Just for your information, there was two warnings during scc.c
compilation :
line 1201 and 1279 warning comparison is always true due to limited
range of data type.
I am using ax25, mkiss, rose and netrom drivers.
There is still a similar problem left when removing rose module driver
after and only after attaching a rose port with rsattach.
I give the Call Trace :
free_module + 0x44/0x90
sys_delete_module + 0x133/0x1a0
do_munmap + 0xfs/0x150
sys_munmap + 0x34/0x60
syscall_call °0x7/0xb
Hope this will help.
73 de Bernard, F6BVP
-------------------
Jeroen Vreeken wrote:
> Hi,
>
> This is a patch that fixes some problems in the hamradio drivers in 2.6.1
> Part is a resent that was probably lost during the holiday season.
> The fixes include:
>
> + scc.c usage of rtnl lock and register_netdev.
> + scc.c properly initialize timers.
> + remove cli() call in 6pack.c (The line of code that was 'protected'
> couldn't have needed it anyway)
> + fix init of reused devices and remove cli()
>
> The only thing remaining is a call to cli() in the dmascc driver, I don't
> know what exactly it aims to protect....
>
> Jeroen
-
To unsubscribe from this list: send the line "unsubscribe linux-hams" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] hamradio driver fixes
2004-01-19 21:32 [PATCH] hamradio driver fixes Jeroen Vreeken
2004-01-19 22:51 ` Ruben Navarro Huedo
2004-01-19 23:33 ` Bernard Pidoux
@ 2004-01-20 19:11 ` Lars E. Pettersson
2004-01-21 17:48 ` Arno Verhoeven
2 siblings, 1 reply; 8+ messages in thread
From: Lars E. Pettersson @ 2004-01-20 19:11 UTC (permalink / raw)
To: linux-hams
[-- Attachment #1: Type: text/plain, Size: 481 bytes --]
Hi!
On Mon, 2004-01-19 at 22:32, Jeroen Vreeken wrote:
> This is a patch that fixes some problems in the hamradio drivers in 2.6.1
A patch for scc.c to count the number of bytes sent and received was
sent to this mailing list a while ago (do not remember from who.) I can
not find this patch in the 2.6.1-kernel.
Attached is a quick diff I did for the 2.6.1 kernel.
73 de Lars, sm6rpz
--
Lars E. Pettersson, SM6RPZ | Gothenburg, SWEDEN
sm6rpz@home.se | http://www.sm6rpz.se/
[-- Attachment #2: Type: text/x-patch, Size: 483 bytes --]
--- linux-2.6.1/drivers/net/hamradio/scc.c.orig 2004-01-09 07:59:56.000000000 +0100
+++ linux-2.6.1/drivers/net/hamradio/scc.c 2004-01-20 20:01:22.000000000 +0100
@@ -1625,6 +1625,7 @@
}
scc->dev_stat.rx_packets++;
+ scc->dev_stat.rx_bytes += skb->len;
skb->dev = scc->dev;
skb->protocol = htons(ETH_P_AX25);
@@ -1651,6 +1652,7 @@
}
scc->dev_stat.tx_packets++;
+ scc->dev_stat.tx_bytes += skb->len;
scc->stat.txframes++;
kisscmd = *skb->data & 0x1f;
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] hamradio driver fixes
2004-01-20 19:11 ` Lars E. Pettersson
@ 2004-01-21 17:48 ` Arno Verhoeven
0 siblings, 0 replies; 8+ messages in thread
From: Arno Verhoeven @ 2004-01-21 17:48 UTC (permalink / raw)
To: linux-hams
Lars E. Pettersson wrote:
>Hi!
>
>On Mon, 2004-01-19 at 22:32, Jeroen Vreeken wrote:
>
>
>>This is a patch that fixes some problems in the hamradio drivers in 2.6.1
>>
>>
>
>A patch for scc.c to count the number of bytes sent and received was
>sent to this mailing list a while ago (do not remember from who.) I can
>not find this patch in the 2.6.1-kernel.
>
>
I had forgotten about that patch :-). Martijn Hijdra, PE1MNL, had made
the patch some time ago. IIRC it was against a 2.4 kernel.
I applied the patch and have been using it since then. It works beautifully.
Jeroen, can you work this in with your series of patches for 2.6 ?
--
73, PE1ICQ Arno Verhoeven
--------------------------------
AX.25 pe1icq@pi8zaa.#nbo.nld.eu
smtp pe1icq@pi8zaa.ampr.org
inet pe1icq@amsat.org
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH] hamradio driver fixes
@ 2004-01-21 20:52 Jeroen Vreeken
0 siblings, 0 replies; 8+ messages in thread
From: Jeroen Vreeken @ 2004-01-21 20:52 UTC (permalink / raw)
To: linux-hams, jgarzik; +Cc: ralf
[-- Attachment #1: Type: text/plain, Size: 412 bytes --]
Hi,
This is the same patch as a few days back with an very old one added:
correctly updating statistics.
Jeff, can you apply this?
Thanks,
Jeroen
details:
+ scc.c usage of rtnl lock and register_netdev.
+ scc.c properly initialize timers.
+ remove cli() call in 6pack.c (The line of code that was 'protected'
couldn't have needed it anyway)
+ fix init of reused devices and remove cli()
+ scc.c statistics
[-- Attachment #2: hamradio.2.6.1.rxq2.diff --]
[-- Type: application/octet-stream, Size: 6956 bytes --]
diff -ru linux-2.6.1.org/drivers/net/hamradio/6pack.c linux-2.6.1-rxq2/drivers/net/hamradio/6pack.c
--- linux-2.6.1.org/drivers/net/hamradio/6pack.c 2004-01-09 07:59:10.000000000 +0100
+++ linux-2.6.1-rxq2/drivers/net/hamradio/6pack.c 2004-01-21 20:47:09.000000000 +0100
@@ -516,7 +516,6 @@
static void sixpack_receive_buf(struct tty_struct *tty, const unsigned char *cp, char *fp, int count)
{
unsigned char buf[512];
- unsigned long flags;
int count1;
struct sixpack *sp = (struct sixpack *) tty->disc_data;
@@ -525,10 +524,7 @@
!netif_running(sp->dev) || !count)
return;
- save_flags(flags);
- cli();
memcpy(buf, cp, count<sizeof(buf)? count:sizeof(buf));
- restore_flags(flags);
/* Read the characters out of the buffer */
diff -ru linux-2.6.1.org/drivers/net/hamradio/mkiss.c linux-2.6.1-rxq2/drivers/net/hamradio/mkiss.c
--- linux-2.6.1.org/drivers/net/hamradio/mkiss.c 2004-01-09 08:00:04.000000000 +0100
+++ linux-2.6.1-rxq2/drivers/net/hamradio/mkiss.c 2004-01-21 20:47:09.000000000 +0100
@@ -24,6 +24,7 @@
* called twice, causing a deadlock.
* Jeroen (PE1RXQ) Removed old MKISS_MAGIC stuff and calls to
* MOD_*_USE_COUNT
+ * Remove cli() and fix rtnl lock usage.
*/
#include <linux/config.h>
@@ -167,17 +168,17 @@
/* If no channels are available, allocate one */
if (axp == NULL && (ax25_ctrls[i] = kmalloc(sizeof(ax25_ctrl_t), GFP_KERNEL)) != NULL) {
axp = ax25_ctrls[i];
- memset(axp, 0, sizeof(ax25_ctrl_t));
-
- /* Initialize channel control data */
- set_bit(AXF_INUSE, &axp->ctrl.flags);
- sprintf(axp->dev.name, "ax%d", i++);
- axp->ctrl.tty = NULL;
- axp->dev.base_addr = i;
- axp->dev.priv = (void *)&axp->ctrl;
- axp->dev.next = NULL;
- axp->dev.init = ax25_init;
}
+ memset(axp, 0, sizeof(ax25_ctrl_t));
+
+ /* Initialize channel control data */
+ set_bit(AXF_INUSE, &axp->ctrl.flags);
+ sprintf(axp->dev.name, "ax%d", i++);
+ axp->ctrl.tty = NULL;
+ axp->dev.base_addr = i;
+ axp->dev.priv = (void *)&axp->ctrl;
+ axp->dev.next = NULL;
+ axp->dev.init = ax25_init;
if (axp != NULL) {
/*
@@ -220,7 +221,6 @@
struct net_device *dev = ax->dev;
unsigned char *xbuff, *rbuff, *oxbuff, *orbuff;
int len;
- unsigned long flags;
len = dev->mtu * 2;
@@ -246,8 +246,7 @@
return;
}
- save_flags(flags);
- cli();
+ spin_lock_bh(ax->buflock);
oxbuff = ax->xbuff;
ax->xbuff = xbuff;
@@ -278,7 +277,7 @@
ax->mtu = dev->mtu + 73;
ax->buffsize = len;
- restore_flags(flags);
+ spin_unlock_bh(ax->buflock);
if (oxbuff != NULL)
kfree(oxbuff);
@@ -306,6 +305,7 @@
struct sk_buff *skb;
int count;
+ spin_lock_bh(ax->buflock);
if (ax->rbuff[0] > 0x0f) {
if (ax->rbuff[0] & 0x20) {
ax->crcmode = CRC_MODE_FLEX;
@@ -322,6 +322,7 @@
*ax->rbuff &= ~0x20;
}
}
+ spin_unlock_bh(ax->buflock);
count = ax->rcount;
@@ -332,7 +333,9 @@
}
skb->dev = ax->dev;
+ spin_lock_bh(ax->buflock);
memcpy(skb_put(skb,count), ax->rbuff, count);
+ spin_unlock_bh(ax->buflock);
skb->mac.raw = skb->data;
skb->protocol = htons(ETH_P_AX25);
netif_rx(skb);
@@ -360,6 +363,7 @@
p = icp;
+ spin_lock_bh(ax->buflock);
switch (ax->crcmode) {
unsigned short crc;
@@ -373,6 +377,7 @@
count = kiss_esc(p, (unsigned char *)ax->xbuff, len);
break;
}
+
ax->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP);
actual = ax->tty->driver->write(ax->tty, 0, ax->xbuff, count);
ax->tx_packets++;
@@ -380,6 +385,8 @@
ax->dev->trans_start = jiffies;
ax->xleft = count - actual;
ax->xhead = ax->xbuff + actual;
+
+ spin_unlock_bh(ax->buflock);
}
/*
@@ -511,6 +518,8 @@
ax->flags &= (1 << AXF_INUSE); /* Clear ESCAPE & ERROR flags */
+ ax->buflock = SPIN_LOCK_UNLOCKED;
+
netif_start_queue(dev);
return 0;
@@ -750,15 +759,18 @@
break;
}
+ spin_lock_bh(ax->buflock);
if (!test_bit(AXF_ERROR, &ax->flags)) {
if (ax->rcount < ax->buffsize) {
ax->rbuff[ax->rcount++] = s;
+ spin_unlock_bh(ax->buflock);
return;
}
ax->rx_over_errors++;
set_bit(AXF_ERROR, &ax->flags);
}
+ spin_unlock_bh(ax->buflock);
}
diff -ru linux-2.6.1.org/drivers/net/hamradio/mkiss.h linux-2.6.1-rxq2/drivers/net/hamradio/mkiss.h
--- linux-2.6.1.org/drivers/net/hamradio/mkiss.h 2004-01-09 07:59:09.000000000 +0100
+++ linux-2.6.1-rxq2/drivers/net/hamradio/mkiss.h 2004-01-21 20:47:09.000000000 +0100
@@ -56,6 +56,7 @@
#define CRC_MODE_NONE 0
#define CRC_MODE_FLEX 1
#define CRC_MODE_SMACK 2
+ spinlock_t buflock; /* lock for rbuf and xbuf */
};
#define AX25_MAGIC 0x5316
diff -ru linux-2.6.1.org/drivers/net/hamradio/scc.c linux-2.6.1-rxq2/drivers/net/hamradio/scc.c
--- linux-2.6.1.org/drivers/net/hamradio/scc.c 2004-01-09 07:59:56.000000000 +0100
+++ linux-2.6.1-rxq2/drivers/net/hamradio/scc.c 2004-01-21 21:12:39.000000000 +0100
@@ -163,6 +163,7 @@
#include <linux/delay.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
+#include <linux/rtnetlink.h>
#include <linux/if_ether.h>
#include <linux/if_arp.h>
#include <linux/socket.h>
@@ -1520,8 +1521,10 @@
dev->priv = scc;
scc->dev = dev;
spin_lock_init(&scc->lock);
+ init_timer(&scc->tx_t);
+ init_timer(&scc->tx_wdog);
- err = register_netdev(dev);
+ err = register_netdevice(dev);
if (err) {
printk(KERN_ERR "%s: can't register network device (%d)\n",
name, err);
@@ -1625,6 +1628,7 @@
}
scc->dev_stat.rx_packets++;
+ scc->dev_stat.rx_bytes += skb->len;
skb->dev = scc->dev;
skb->protocol = htons(ETH_P_AX25);
@@ -1651,6 +1655,7 @@
}
scc->dev_stat.tx_packets++;
+ scc->dev_stat.tx_bytes += skb->len;
scc->stat.txframes++;
kisscmd = *skb->data & 0x1f;
@@ -2114,10 +2119,13 @@
sprintf(devname,"%s0", SCC_DriverName);
+ rtnl_lock();
if (scc_net_alloc(devname, SCC_Info)) {
+ rtnl_unlock();
printk(KERN_ERR "z8530drv: cannot initialize module\n");
return -EIO;
}
+ rtnl_unlock();
proc_net_fops_create("z8530drv", 0, &scc_net_seq_fops);
diff -ru linux-2.6.1.org/include/linux/scc.h linux-2.6.1-rxq2/include/linux/scc.h
--- linux-2.6.1.org/include/linux/scc.h 2004-01-09 07:59:46.000000000 +0100
+++ linux-2.6.1-rxq2/include/linux/scc.h 2004-01-21 20:50:05.000000000 +0100
@@ -200,7 +200,7 @@
unsigned char fulldup; /* Full Duplex mode 0=CSMA 1=DUP 2=ALWAYS KEYED */
unsigned char waittime; /* Waittime before any transmit attempt */
unsigned int maxkeyup; /* Maximum time to transmit (seconds) */
- unsigned char mintime; /* Minimal offtime after MAXKEYUP timeout (seconds) */
+ unsigned int mintime; /* Minimal offtime after MAXKEYUP timeout (seconds) */
unsigned int idletime; /* Maximum idle time in ALWAYS KEYED mode (seconds) */
unsigned int maxdefer; /* Timer for CSMA channel busy limit */
unsigned char tx_inhibit; /* Transmit is not allowed when set */
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-01-21 20:52 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-19 21:32 [PATCH] hamradio driver fixes Jeroen Vreeken
2004-01-19 22:51 ` Ruben Navarro Huedo
2004-01-19 23:25 ` Jeroen Vreeken
2004-01-19 23:33 ` Bernard Pidoux
2004-01-19 23:06 ` Jeroen Vreeken
2004-01-20 19:11 ` Lars E. Pettersson
2004-01-21 17:48 ` Arno Verhoeven
2004-01-21 20:52 Jeroen Vreeken
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.