* [PATCH] mkiss
@ 2003-07-05 19:17 Jeroen Vreeken
2003-07-07 0:11 ` Ralf Baechle DO1GRB
0 siblings, 1 reply; 7+ messages in thread
From: Jeroen Vreeken @ 2003-07-05 19:17 UTC (permalink / raw)
To: linux-hams; +Cc: ralf
[-- Attachment #1: Type: text/plain, Size: 432 bytes --]
Hi,
This is a patch to get mkiss working under 2.5.74
It used the driver_data field of the tty structure, this field can be NULL.
Further the whole mkiss magic stuff seems to be unreachable as I can't find
a single piece of code in the kernel that sets the driver_data field with
this structure... Is is something from a long time ago?? Shouldn't it be
removed completly?
This patch also removes the MOD_*_USE_COUNT calls.
Jeroen
[-- Attachment #2: mkiss-2.5.74.rxq.diff --]
[-- Type: application/octet-stream, Size: 2149 bytes --]
diff -ru linux-2.5.74/drivers/net/hamradio/mkiss.c linux-2.5.74.rxq/drivers/net/hamradio/mkiss.c
--- linux-2.5.74/drivers/net/hamradio/mkiss.c 2003-07-02 22:57:13.000000000 +0200
+++ linux-2.5.74.rxq/drivers/net/hamradio/mkiss.c 2003-07-05 19:33:20.000000000 +0200
@@ -22,6 +22,8 @@
* Matthias (DG2FEF) Added support for FlexNet CRC (on special request)
* Fixed bug in ax25_close(): dev_lock_wait() was
* called twice, causing a deadlock.
+ * Jeroen (PE1RXQ) Added NULL check for tty->driver_data and removed
+ * MOD_*_USE_COUNT calls
*/
#include <linux/config.h>
@@ -320,7 +322,7 @@
if (ax->rbuff[0] > 0x0f) {
if (ax->mkiss != NULL) {
mkiss= ax->mkiss->tty->driver_data;
- if (mkiss->magic == MKISS_DRIVER_MAGIC)
+ if (mkiss && mkiss->magic == MKISS_DRIVER_MAGIC)
tmp_ax = ax->mkiss;
} else if (ax->rbuff[0] & 0x20) {
ax->crcmode = CRC_MODE_FLEX;
@@ -376,7 +378,7 @@
p = icp;
- if (mkiss->magic != MKISS_DRIVER_MAGIC) {
+ if (!mkiss || mkiss->magic != MKISS_DRIVER_MAGIC) {
switch (ax->crcmode) {
unsigned short crc;
@@ -430,7 +432,7 @@
if (ax->mkiss != NULL) {
mkiss= ax->mkiss->tty->driver_data;
- if (mkiss->magic == MKISS_DRIVER_MAGIC)
+ if (mkiss && mkiss->magic == MKISS_DRIVER_MAGIC)
ax_unlock(ax->mkiss);
}
@@ -452,7 +454,7 @@
tmp_ax = NULL;
- if (mkiss->magic == MKISS_DRIVER_MAGIC) {
+ if (mkiss && mkiss->magic == MKISS_DRIVER_MAGIC) {
if (skb->data[0] < 0x10)
skb->data[0] = skb->data[0] + 0x10;
tmp_ax = ax->mkiss;
@@ -666,7 +668,7 @@
mkiss = ax->tty->driver_data;
- if (mkiss->magic == MKISS_DRIVER_MAGIC) {
+ if (mkiss && mkiss->magic == MKISS_DRIVER_MAGIC) {
for (cnt = 1; cnt < ax25_maxdev; cnt++) {
if (ax25_ctrls[cnt]) {
if (netif_running(&ax25_ctrls[cnt]->dev)) {
@@ -685,8 +687,6 @@
tmp_ax->mkiss = ax;
}
- MOD_INC_USE_COUNT;
-
/* Done. We have linked the TTY line to a channel. */
return ax->dev->base_addr;
}
@@ -705,7 +705,6 @@
ax->tty = NULL;
ax_free(ax);
- MOD_DEC_USE_COUNT;
}
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mkiss 2003-07-05 19:17 [PATCH] mkiss Jeroen Vreeken @ 2003-07-07 0:11 ` Ralf Baechle DO1GRB 2003-07-07 20:39 ` Jeroen Vreeken 0 siblings, 1 reply; 7+ messages in thread From: Ralf Baechle DO1GRB @ 2003-07-07 0:11 UTC (permalink / raw) To: Jeroen Vreeken; +Cc: linux-hams On Sat, Jul 05, 2003 at 09:17:33PM +0200, Jeroen Vreeken wrote: > This is a patch to get mkiss working under 2.5.74 > It used the driver_data field of the tty structure, this field can be NULL. > Further the whole mkiss magic stuff seems to be unreachable as I can't find > a single piece of code in the kernel that sets the driver_data field with > this structure... Is is something from a long time ago?? Shouldn't it be > removed completly? > This patch also removes the MOD_*_USE_COUNT calls. The code that was setting the magic number - actually large parts of mkiss.c were removed in 2.4.0-prerelease. Alan Cox did remove support for mkiss as a tty driver; the mkiss magic stuff are the last remains of it; they should be removed also. 73 de DO1GRB op Ralf -- Loc. JN47BS / CQ 14 / ITU 28 / DOK A21 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mkiss 2003-07-07 0:11 ` Ralf Baechle DO1GRB @ 2003-07-07 20:39 ` Jeroen Vreeken 2003-07-09 6:35 ` Request change ??? Ronald Jochems 0 siblings, 1 reply; 7+ messages in thread From: Jeroen Vreeken @ 2003-07-07 20:39 UTC (permalink / raw) To: Ralf Baechle DO1GRB; +Cc: linux-hams [-- Attachment #1: Type: text/plain, Size: 407 bytes --] On 2003.07.07 02:11:48 +0200 Ralf Baechle DO1GRB wrote: > The code that was setting the magic number - actually large parts of > mkiss.c were removed in 2.4.0-prerelease. Alan Cox did remove support > for > mkiss as a tty driver; the mkiss magic stuff are the last remains of it; > they should be removed also. This is a redone patch that removes it completly... Ralf, can you pass this upstream? Jeroen [-- Attachment #2: mkiss-2.5.74.rxq.diff --] [-- Type: application/octet-stream, Size: 7466 bytes --] diff -ru linux-2.5.74/drivers/net/hamradio/mkiss.c linux-2.5.74.rxq/drivers/net/hamradio/mkiss.c --- linux-2.5.74/drivers/net/hamradio/mkiss.c 2003-07-06 01:09:04.000000000 +0200 +++ linux-2.5.74.rxq/drivers/net/hamradio/mkiss.c 2003-07-07 21:55:58.000000000 +0200 @@ -22,6 +22,8 @@ * Matthias (DG2FEF) Added support for FlexNet CRC (on special request) * Fixed bug in ax25_close(): dev_lock_wait() was * called twice, causing a deadlock. + * Jeroen (PE1RXQ) Removed old MKISS_MAGIC stuff and calls to + * MOD_*_USE_COUNT */ #include <linux/config.h> @@ -55,15 +57,6 @@ static char banner[] __initdata = KERN_INFO "mkiss: AX.25 Multikiss, Hans Albas PE1AYX\n"; -#define NR_MKISS 4 -#define MKISS_SERIAL_TYPE_NORMAL 1 - -struct mkiss_channel { - int magic; /* magic word */ - int init; /* channel exists? */ - struct tty_struct *tty; /* link to tty control structure */ -}; - typedef struct ax25_ctrl { struct ax_disp ctrl; /* */ struct net_device dev; /* the device */ @@ -310,19 +303,11 @@ /* Send one completely decapsulated AX.25 packet to the AX.25 layer. */ static void ax_bump(struct ax_disp *ax) { - struct ax_disp *tmp_ax; struct sk_buff *skb; - struct mkiss_channel *mkiss; int count; - tmp_ax = ax; - if (ax->rbuff[0] > 0x0f) { - if (ax->mkiss != NULL) { - mkiss= ax->mkiss->tty->driver_data; - if (mkiss->magic == MKISS_DRIVER_MAGIC) - tmp_ax = ax->mkiss; - } else if (ax->rbuff[0] & 0x20) { + if (ax->rbuff[0] & 0x20) { ax->crcmode = CRC_MODE_FLEX; if (check_crc_flex(ax->rbuff, ax->rcount) < 0) { ax->rx_errors++; @@ -346,14 +331,14 @@ return; } - skb->dev = tmp_ax->dev; + skb->dev = ax->dev; memcpy(skb_put(skb,count), ax->rbuff, count); skb->mac.raw = skb->data; skb->protocol = htons(ETH_P_AX25); netif_rx(skb); - tmp_ax->dev->last_rx = jiffies; - tmp_ax->rx_packets++; - tmp_ax->rx_bytes+=count; + ax->dev->last_rx = jiffies; + ax->rx_packets++; + ax->rx_bytes+=count; } /* Encapsulate one AX.25 packet and stuff into a TTY queue. */ @@ -361,7 +346,6 @@ { unsigned char *p; int actual, count; - struct mkiss_channel *mkiss = ax->tty->driver_data; if (ax->mtu != ax->dev->mtu + 73) /* Someone has been ifconfigging */ ax_changedmtu(ax); @@ -376,37 +360,26 @@ p = icp; - if (mkiss->magic != MKISS_DRIVER_MAGIC) { - switch (ax->crcmode) { - unsigned short crc; - - case CRC_MODE_FLEX: - *p |= 0x20; - crc = calc_crc_flex(p, len); - count = kiss_esc_crc(p, (unsigned char *)ax->xbuff, crc, len+2); - break; + switch (ax->crcmode) { + unsigned short crc; - default: - 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++; - ax->tx_bytes+=actual; - ax->dev->trans_start = jiffies; - ax->xleft = count - actual; - ax->xhead = ax->xbuff + actual; - } else { - count = kiss_esc(p, (unsigned char *) ax->mkiss->xbuff, len); - ax->mkiss->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); - actual = ax->mkiss->tty->driver->write(ax->mkiss->tty, 0, ax->mkiss->xbuff, count); - ax->tx_packets++; - ax->tx_bytes+=actual; - ax->mkiss->dev->trans_start = jiffies; - ax->mkiss->xleft = count - actual; - ax->mkiss->xhead = ax->mkiss->xbuff + actual; - } + case CRC_MODE_FLEX: + *p |= 0x20; + crc = calc_crc_flex(p, len); + count = kiss_esc_crc(p, (unsigned char *)ax->xbuff, crc, len+2); + break; + + default: + 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++; + ax->tx_bytes+=actual; + ax->dev->trans_start = jiffies; + ax->xleft = count - actual; + ax->xhead = ax->xbuff + actual; } /* @@ -417,7 +390,6 @@ { int actual; struct ax_disp *ax = (struct ax_disp *) tty->disc_data; - struct mkiss_channel *mkiss; /* First make sure we're connected. */ if (ax == NULL || ax->magic != AX25_MAGIC || !netif_running(ax->dev)) @@ -428,12 +400,6 @@ */ tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); - if (ax->mkiss != NULL) { - mkiss= ax->mkiss->tty->driver_data; - if (mkiss->magic == MKISS_DRIVER_MAGIC) - ax_unlock(ax->mkiss); - } - netif_wake_queue(ax->dev); return; } @@ -447,32 +413,12 @@ static int ax_xmit(struct sk_buff *skb, struct net_device *dev) { struct ax_disp *ax = (struct ax_disp *) dev->priv; - struct mkiss_channel *mkiss = ax->tty->driver_data; - struct ax_disp *tmp_ax; - - tmp_ax = NULL; - - if (mkiss->magic == MKISS_DRIVER_MAGIC) { - if (skb->data[0] < 0x10) - skb->data[0] = skb->data[0] + 0x10; - tmp_ax = ax->mkiss; - } if (!netif_running(dev)) { printk(KERN_ERR "mkiss: %s: xmit call when iface is down\n", dev->name); return 1; } - if (tmp_ax != NULL) - if (netif_queue_stopped(tmp_ax->dev)) - return 1; - - if (tmp_ax != NULL) - if (netif_queue_stopped(dev)) { - printk(KERN_ERR "mkiss: dev busy while serial dev is free\n"); - ax_unlock(ax); - } - if (netif_queue_stopped(dev)) { /* * May be we must check transmitter timeout here ? @@ -495,8 +441,6 @@ /* We were not busy, so we are now... :-) */ if (skb != NULL) { ax_lock(ax); - if (tmp_ax != NULL) - ax_lock(tmp_ax); ax_encaps(ax, skb->data, skb->len); kfree_skb(skb); } @@ -634,9 +578,7 @@ static int ax25_open(struct tty_struct *tty) { struct ax_disp *ax = (struct ax_disp *) tty->disc_data; - struct ax_disp *tmp_ax; - struct mkiss_channel *mkiss; - int err, cnt; + int err; /* First make sure we're not already connected. */ if (ax && ax->magic == AX25_MAGIC) @@ -649,9 +591,6 @@ ax->tty = tty; tty->disc_data = ax; - ax->mkiss = NULL; - tmp_ax = NULL; - if (tty->driver->flush_buffer) tty->driver->flush_buffer(tty); if (tty->ldisc.flush_buffer) @@ -664,29 +603,6 @@ if ((err = ax_open(ax->dev))) return err; - mkiss = ax->tty->driver_data; - - if (mkiss->magic == MKISS_DRIVER_MAGIC) { - for (cnt = 1; cnt < ax25_maxdev; cnt++) { - if (ax25_ctrls[cnt]) { - if (netif_running(&ax25_ctrls[cnt]->dev)) { - if (ax == &ax25_ctrls[cnt]->ctrl) { - cnt--; - tmp_ax = &ax25_ctrls[cnt]->ctrl; - break; - } - } - } - } - } - - if (tmp_ax != NULL) { - ax->mkiss = tmp_ax; - tmp_ax->mkiss = ax; - } - - MOD_INC_USE_COUNT; - /* Done. We have linked the TTY line to a channel. */ return ax->dev->base_addr; } @@ -705,7 +621,6 @@ ax->tty = NULL; ax_free(ax); - MOD_DEC_USE_COUNT; } diff -ru linux-2.5.74/drivers/net/hamradio/mkiss.h linux-2.5.74.rxq/drivers/net/hamradio/mkiss.h --- linux-2.5.74/drivers/net/hamradio/mkiss.h 2003-07-06 01:09:04.000000000 +0200 +++ linux-2.5.74.rxq/drivers/net/hamradio/mkiss.h 2003-07-07 21:50:28.000000000 +0200 @@ -19,7 +19,6 @@ /* Various fields. */ struct tty_struct *tty; /* ptr to TTY structure */ struct net_device *dev; /* easy for intr handling */ - struct ax_disp *mkiss; /* mkiss txport if mkiss channel*/ /* These are pointers to the malloc()ed frame buffers. */ unsigned char *rbuff; /* receiver buffer */ @@ -60,4 +59,3 @@ }; #define AX25_MAGIC 0x5316 -#define MKISS_DRIVER_MAGIC 1215 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Request change ??? 2003-07-07 20:39 ` Jeroen Vreeken @ 2003-07-09 6:35 ` Ronald Jochems 2003-07-09 17:18 ` Arno Verhoeven 0 siblings, 1 reply; 7+ messages in thread From: Ronald Jochems @ 2003-07-09 6:35 UTC (permalink / raw) To: Jeroen Vreeken, Ralf Baechle DO1GRB; +Cc: linux-hams All, I'm not sure if this is the 'right' way/group to ask, but here is my question. It is related to the AX25 kernel i believe. Please see below examples, my question is about the 'statistical' information wich is 'new' in i believe 2.4 kernels. The total ammount of packets is translated in complete bytes transmitted, and received. With the current Z8530 SCC driver these statistics are not calculated. For ethernet cards they are calculated. Is there a way to make this work ? I guess it is a driver issue ??? root@pd1acf:~# ifconfig scc1 scc1 Link encap:AMPR AX.25 HWaddr PD1ACF-2 inet addr:44.137.2.92 Mask:255.255.0.0 UP RUNNING MTU:256 Metric:1 RX packets:1200006 errors:1150494 dropped:0 overruns:0 frame:0 TX packets:509433 errors:2 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:16 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) root@pd1acf:/usr/src/linux# ifconfig eth0 eth0 Link encap:Ethernet HWaddr 00:60:08:E8:00:28 inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8783615 errors:0 dropped:0 overruns:0 frame:0 TX packets:9147315 errors:0 dropped:0 overruns:0 carrier:44 collisions:237625 txqueuelen:100 RX bytes:1045445509 (997.0 Mb) TX bytes:3091956405 (2948.7 Mb) Interrupt:10 Base address:0x6800 root@pd1acf:/usr/src/linux# Best regards, Ron ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Request change ??? 2003-07-09 6:35 ` Request change ??? Ronald Jochems @ 2003-07-09 17:18 ` Arno Verhoeven 2003-07-11 7:32 ` Martijn Hijdra 2003-09-05 8:15 ` Statistics patch for scc.c driver Martijn Hijdra 0 siblings, 2 replies; 7+ messages in thread From: Arno Verhoeven @ 2003-07-09 17:18 UTC (permalink / raw) To: Ronald Jochems; +Cc: Jeroen Vreeken, Ralf Baechle DO1GRB, linux-hams On Wed, 9 Jul 2003, Ronald Jochems wrote: > All, > > I'm not sure if this is the 'right' way/group to ask, but here is my > question. It is related to the AX25 kernel i believe. > > Please see below examples, my question is about the 'statistical' > information wich is 'new' in i believe 2.4 kernels. > The total ammount of packets is translated in complete bytes transmitted, > and received. > With the current Z8530 SCC driver these statistics are not calculated. > For ethernet cards they are calculated. > > Is there a way to make this work ? I guess it is a driver issue ??? > It must be in the driver. I have those statistics displayed for my dmascc ports but not for the scc ports. dmascc0 Link encap:AMPR AX.25 HWaddr PE1ICQ-3 inet addr:44.137.25.18 Mask:255.255.255.255 UP RUNNING MTU:1500 Metric:1 RX packets:65 errors:0 dropped:0 overruns:0 frame:0 TX packets:78598 errors:0 dropped:0 overruns:0 carrier:0 collisions:58762 txqueuelen:64 RX bytes:2835 (2.7 Kb) TX bytes:3615508 (3.4 Mb) Interrupt:7 Base address:0x210 scc0 Link encap:AMPR AX.25 HWaddr PE1ICQ-7 inet addr:44.137.24.162 Mask:255.255.255.255 UP RUNNING MTU:1500 Metric:1 RX packets:3027370 errors:4790988 dropped:0 overruns:0 frame:0 TX packets:630643 errors:5 dropped:0 overruns:5 carrier:0 collisions:0 txqueuelen:16 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) 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] 7+ messages in thread
* Re: Request change ??? 2003-07-09 17:18 ` Arno Verhoeven @ 2003-07-11 7:32 ` Martijn Hijdra 2003-09-05 8:15 ` Statistics patch for scc.c driver Martijn Hijdra 1 sibling, 0 replies; 7+ messages in thread From: Martijn Hijdra @ 2003-07-11 7:32 UTC (permalink / raw) To: Arno Verhoeven Cc: Ronald Jochems, Jeroen Vreeken, Ralf Baechle DO1GRB, linux-hams Hi All, > > > > Is there a way to make this work ? I guess it is a driver issue ??? > > > > It must be in the driver. I have those statistics displayed for my dmascc > ports but not for the scc ports. > The scc statistics are definitly in the scc.c driver. I know for sure because I created a patch a long time ago to fix this problem. I have to take a peek into my archives this weekend to retrieve it. Martijn Hijdra, PE1MNL ^ permalink raw reply [flat|nested] 7+ messages in thread
* Statistics patch for scc.c driver 2003-07-09 17:18 ` Arno Verhoeven 2003-07-11 7:32 ` Martijn Hijdra @ 2003-09-05 8:15 ` Martijn Hijdra 1 sibling, 0 replies; 7+ messages in thread From: Martijn Hijdra @ 2003-09-05 8:15 UTC (permalink / raw) To: linux-hams [-- Attachment #1: Type: text/plain, Size: 503 bytes --] Hi All, I had some spare time and generated a small patch to fill the statistics counters for the scc driver. see output of ifconfig RX bytes and TX bytes. Patch is generated for 2.6.0 kernel but should apply on numerous other (read older) kernels because the driver is not changed in a long time. Please test and if this patch works correctly we can apply this to the standard kernel. btw, a small compile fix is is in scc.h to change datatype. -- Martijn Hijdra <martijn@esrac.ele.tue.nl> [-- Attachment #2: patch --] [-- Type: text/plain, Size: 1198 bytes --] --- drivers/net/hamradio/scc.c.orig 2003-08-23 01:58:57.000000000 +0200 +++ drivers/net/hamradio/scc.c 2003-09-03 08:57:50.000000000 +0200 @@ -1635,6 +1635,7 @@ } scc->dev_stat.rx_packets++; + scc->dev_stat.rx_bytes += skb->len; skb->dev = scc->dev; skb->protocol = htons(ETH_P_AX25); @@ -1661,6 +1662,7 @@ } scc->dev_stat.tx_packets++; + scc->dev_stat.tx_bytes += skb->len; scc->stat.txframes++; kisscmd = *skb->data & 0x1f; --- include/linux/scc.h.orig 2003-09-03 09:13:26.000000000 +0200 +++ include/linux/scc.h 2003-09-03 09:13:55.000000000 +0200 @@ -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] 7+ messages in thread
end of thread, other threads:[~2003-09-05 8:15 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2003-07-05 19:17 [PATCH] mkiss Jeroen Vreeken 2003-07-07 0:11 ` Ralf Baechle DO1GRB 2003-07-07 20:39 ` Jeroen Vreeken 2003-07-09 6:35 ` Request change ??? Ronald Jochems 2003-07-09 17:18 ` Arno Verhoeven 2003-07-11 7:32 ` Martijn Hijdra 2003-09-05 8:15 ` Statistics patch for scc.c driver Martijn Hijdra
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.