Commit 8483284e authored by Martin Schwidefsky's avatar Martin Schwidefsky Committed by Jeff Garzik

[PATCH] s390 network driver fixes

 - lcs: Don't free net_device in lcs_stop_device.
 - lcs: Reset card after LGW initiaited stoplan.
 - lcs: Fix bug in lcs_tasklet
 - ctc: Get channel structure from private pointer. Remove __NO_VERSION__.
 - lcs,ctc,iucv: Remove MOD_INC_USE_COUNT/MOD_DEC_USE_COUNT. Set dev->owner.
parent c78e8101
...@@ -9,7 +9,7 @@ config LCS ...@@ -9,7 +9,7 @@ config LCS
or zSeries. This device driver supports Token Ring (IEEE 802.5), or zSeries. This device driver supports Token Ring (IEEE 802.5),
FDDI (IEEE 802.7) and Ethernet. FDDI (IEEE 802.7) and Ethernet.
This option is also available as a module which will be This option is also available as a module which will be
called lcs.o . If you do not know what it is, it's safe to say "Y". called lcs.ko. If you do not know what it is, it's safe to say "Y".
config CTC config CTC
tristate "CTC device support" tristate "CTC device support"
...@@ -20,7 +20,7 @@ config CTC ...@@ -20,7 +20,7 @@ config CTC
coupling using ESCON. It also supports virtual CTCs when running coupling using ESCON. It also supports virtual CTCs when running
under VM. It will use the channel device configuration if this is under VM. It will use the channel device configuration if this is
available. This option is also available as a module which will be available. This option is also available as a module which will be
called ctc.o. If you do not know what it is, it's safe to say "Y". called ctc.ko. If you do not know what it is, it's safe to say "Y".
config IUCV config IUCV
tristate "IUCV device support (VM only)" tristate "IUCV device support (VM only)"
...@@ -28,7 +28,7 @@ config IUCV ...@@ -28,7 +28,7 @@ config IUCV
help help
Select this option if you want to use inter-user communication Select this option if you want to use inter-user communication
vehicle networking under VM or VIF. This option is also available vehicle networking under VM or VIF. This option is also available
as a module which will be called iucv.o. If unsure, say "Y". as a module which will be called iucv.ko. If unsure, say "Y".
config CCWGROUP config CCWGROUP
tristate tristate
......
/* /*
* $Id: ctcmain.c,v 1.36 2003/02/18 09:15:14 mschwide Exp $ * $Id: ctcmain.c,v 1.40 2003/04/08 16:00:17 mschwide Exp $
* *
* CTC / ESCON network driver * CTC / ESCON network driver
* *
...@@ -36,13 +36,12 @@ ...@@ -36,13 +36,12 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* RELEASE-TAG: CTC/ESCON network driver $Revision: 1.36 $ * RELEASE-TAG: CTC/ESCON network driver $Revision: 1.40 $
* *
*/ */
#undef DEBUG #undef DEBUG
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/kernel.h> #include <linux/kernel.h>
...@@ -273,7 +272,7 @@ static void ...@@ -273,7 +272,7 @@ static void
print_banner(void) print_banner(void)
{ {
static int printed = 0; static int printed = 0;
char vbuf[] = "$Revision: 1.36 $"; char vbuf[] = "$Revision: 1.40 $";
char *version = vbuf; char *version = vbuf;
if (printed) if (printed)
...@@ -1962,11 +1961,7 @@ ctc_irq_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) ...@@ -1962,11 +1961,7 @@ ctc_irq_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
} }
priv = cdev->dev.driver_data; priv = cdev->dev.driver_data;
ch = (struct channel *) intparm;
if ((ch != priv->channel[READ]) && (ch != priv->channel[WRITE]))
ch = NULL;
if (!ch) {
/* Try to extract channel from driver data. */ /* Try to extract channel from driver data. */
if (priv->channel[READ]->cdev == cdev) if (priv->channel[READ]->cdev == cdev)
ch = priv->channel[READ]; ch = priv->channel[READ];
...@@ -1978,7 +1973,6 @@ ctc_irq_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) ...@@ -1978,7 +1973,6 @@ ctc_irq_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
"device %s\n", cdev->dev.bus_id); "device %s\n", cdev->dev.bus_id);
return; return;
} }
}
dev = (struct net_device *) (ch->netdev); dev = (struct net_device *) (ch->netdev);
if (dev == NULL) { if (dev == NULL) {
...@@ -2392,7 +2386,6 @@ transmit_skb(struct channel *ch, struct sk_buff *skb) ...@@ -2392,7 +2386,6 @@ transmit_skb(struct channel *ch, struct sk_buff *skb)
static int static int
ctc_open(struct net_device * dev) ctc_open(struct net_device * dev)
{ {
MOD_INC_USE_COUNT;
fsm_event(((struct ctc_priv *) dev->priv)->fsm, DEV_EVENT_START, dev); fsm_event(((struct ctc_priv *) dev->priv)->fsm, DEV_EVENT_START, dev);
return 0; return 0;
} }
...@@ -2409,7 +2402,6 @@ static int ...@@ -2409,7 +2402,6 @@ static int
ctc_close(struct net_device * dev) ctc_close(struct net_device * dev)
{ {
fsm_event(((struct ctc_priv *) dev->priv)->fsm, DEV_EVENT_STOP, dev); fsm_event(((struct ctc_priv *) dev->priv)->fsm, DEV_EVENT_STOP, dev);
MOD_DEC_USE_COUNT;
return 0; return 0;
} }
...@@ -2761,6 +2753,7 @@ ctc_init_netdevice(struct net_device * dev, int alloc_device, ...@@ -2761,6 +2753,7 @@ ctc_init_netdevice(struct net_device * dev, int alloc_device,
dev->addr_len = 0; dev->addr_len = 0;
dev->type = ARPHRD_SLIP; dev->type = ARPHRD_SLIP;
dev->tx_queue_len = 100; dev->tx_queue_len = 100;
dev->owner = THIS_MODULE;
dev->flags = IFF_POINTOPOINT | IFF_NOARP; dev->flags = IFF_POINTOPOINT | IFF_NOARP;
return dev; return dev;
} }
......
/* /*
* $Id: ctctty.c,v 1.9 2002/12/02 15:25:13 aberg Exp $ * $Id: ctctty.c,v 1.10 2003/03/21 18:47:31 aberg Exp $
* *
* CTC / ESCON network driver, tty interface. * CTC / ESCON network driver, tty interface.
* *
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
* *
*/ */
#define __NO_VERSION__
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/tty.h> #include <linux/tty.h>
......
/** /**
* $Id: fsm.c,v 1.3 2002/10/08 16:53:45 mschwide Exp $ * $Id: fsm.c,v 1.4 2003/03/28 08:54:40 mschwide Exp $
* *
* A generic FSM based on fsm used in isdn4linux * A generic FSM based on fsm used in isdn4linux
* *
*/ */
#include "fsm.h" #include "fsm.h"
#include <linux/version.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/timer.h> #include <linux/timer.h>
......
/* /*
* $Id: iucv.c,v 1.9 2002/11/06 13:37:25 cohuck Exp $ * $Id: iucv.c,v 1.10 2003/03/28 08:54:40 mschwide Exp $
* *
* IUCV network driver * IUCV network driver
* *
...@@ -29,14 +29,13 @@ ...@@ -29,14 +29,13 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* RELEASE-TAG: IUCV lowlevel driver $Revision: 1.9 $ * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.10 $
* *
*/ */
#include <linux/module.h> #include <linux/module.h>
#include <linux/config.h> #include <linux/config.h>
#include <linux/version.h>
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -333,7 +332,7 @@ do { \ ...@@ -333,7 +332,7 @@ do { \
static void static void
iucv_banner(void) iucv_banner(void)
{ {
char vbuf[] = "$Revision: 1.9 $"; char vbuf[] = "$Revision: 1.10 $";
char *version = vbuf; char *version = vbuf;
if ((version = strchr(version, ':'))) { if ((version = strchr(version, ':'))) {
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
* Frank Pavlic (pavlic@de.ibm.com) and * Frank Pavlic (pavlic@de.ibm.com) and
* Martin Schwidefsky <schwidefsky@de.ibm.com> * Martin Schwidefsky <schwidefsky@de.ibm.com>
* *
* $Revision: 1.44 $ $Date: 2003/02/18 19:49:02 $ * $Revision: 1.51 $ $Date: 2003/03/28 08:54:40 $
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/version.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/if.h> #include <linux/if.h>
#include <linux/netdevice.h> #include <linux/netdevice.h>
...@@ -59,7 +58,7 @@ ...@@ -59,7 +58,7 @@
/** /**
* initialization string for output * initialization string for output
*/ */
#define VERSION_LCS_C "$Revision: 1.44 $" #define VERSION_LCS_C "$Revision: 1.51 $"
static char version[] __initdata = "LCS driver ("VERSION_LCS_C "/" VERSION_LCS_H ")"; static char version[] __initdata = "LCS driver ("VERSION_LCS_C "/" VERSION_LCS_H ")";
...@@ -335,7 +334,9 @@ lcs_setup_card(struct lcs_card *card) ...@@ -335,7 +334,9 @@ lcs_setup_card(struct lcs_card *card)
(void *)lcs_start_kernel_thread,card); (void *)lcs_start_kernel_thread,card);
card->thread_mask = 0; card->thread_mask = 0;
spin_lock_init(&card->lock); spin_lock_init(&card->lock);
#ifdef CONFIG_IP_MULTICAST
INIT_LIST_HEAD(&card->ipm_list); INIT_LIST_HEAD(&card->ipm_list);
#endif
INIT_LIST_HEAD(&card->lancmd_waiters); INIT_LIST_HEAD(&card->lancmd_waiters);
return 0; return 0;
} }
...@@ -358,6 +359,7 @@ lcs_cleanup_card(struct lcs_card *card) ...@@ -358,6 +359,7 @@ lcs_cleanup_card(struct lcs_card *card)
kfree(ipm_list); kfree(ipm_list);
} }
#endif #endif
kfree(card->dev);
/* Cleanup channels. */ /* Cleanup channels. */
lcs_cleanup_channel(&card->write); lcs_cleanup_channel(&card->write);
lcs_cleanup_channel(&card->read); lcs_cleanup_channel(&card->read);
...@@ -556,13 +558,12 @@ lcs_ready_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer) ...@@ -556,13 +558,12 @@ lcs_ready_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer)
static int static int
__lcs_processed_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer) __lcs_processed_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer)
{ {
int index, prevprev, prev, next; int index, prev, next;
if (buffer->state != BUF_STATE_READY) if (buffer->state != BUF_STATE_READY)
BUG(); BUG();
buffer->state = BUF_STATE_PROCESSED; buffer->state = BUF_STATE_PROCESSED;
index = buffer - channel->iob; index = buffer - channel->iob;
prevprev = (index - 1) & (LCS_NUM_BUFFS - 1);
prev = (index - 1) & (LCS_NUM_BUFFS - 1); prev = (index - 1) & (LCS_NUM_BUFFS - 1);
next = (index + 1) & (LCS_NUM_BUFFS - 1); next = (index + 1) & (LCS_NUM_BUFFS - 1);
/* Set the suspend bit and clear the PCI bit of this buffer. */ /* Set the suspend bit and clear the PCI bit of this buffer. */
...@@ -1082,7 +1083,7 @@ lcs_tasklet(unsigned long data) ...@@ -1082,7 +1083,7 @@ lcs_tasklet(unsigned long data)
unsigned long flags; unsigned long flags;
struct lcs_channel *channel; struct lcs_channel *channel;
struct lcs_buffer *iob; struct lcs_buffer *iob;
int buf_idx, io_idx; int buf_idx;
int rc; int rc;
channel = (struct lcs_channel *) data; channel = (struct lcs_channel *) data;
...@@ -1092,9 +1093,7 @@ lcs_tasklet(unsigned long data) ...@@ -1092,9 +1093,7 @@ lcs_tasklet(unsigned long data)
/* Check for processed buffers. */ /* Check for processed buffers. */
iob = channel->iob; iob = channel->iob;
buf_idx = channel->buf_idx; buf_idx = channel->buf_idx;
io_idx = channel->io_idx; while (iob[buf_idx].state == BUF_STATE_PROCESSED) {
while (buf_idx != io_idx &&
iob[buf_idx].state == BUF_STATE_PROCESSED) {
/* Do the callback thing. */ /* Do the callback thing. */
if (iob[buf_idx].callback != NULL) if (iob[buf_idx].callback != NULL)
iob[buf_idx].callback(channel, iob + buf_idx); iob[buf_idx].callback(channel, iob + buf_idx);
...@@ -1434,6 +1433,7 @@ static int ...@@ -1434,6 +1433,7 @@ static int
lcs_lgw_stoplan_thread(void *data) lcs_lgw_stoplan_thread(void *data)
{ {
struct lcs_card *card; struct lcs_card *card;
int rc;
card = (struct lcs_card *) data; card = (struct lcs_card *) data;
daemonize("lgwstop"); daemonize("lgwstop");
...@@ -1446,7 +1446,11 @@ lcs_lgw_stoplan_thread(void *data) ...@@ -1446,7 +1446,11 @@ lcs_lgw_stoplan_thread(void *data)
else else
PRINT_ERR("Stoplan %s initiated by LGW failed!\n", PRINT_ERR("Stoplan %s initiated by LGW failed!\n",
card->dev->name); card->dev->name);
return 0; /*Try to reset the card, stop it on failure */
rc = lcs_resetcard(card);
if (rc != 0)
rc = lcs_stopcard(card);
return rc;
} }
/** /**
...@@ -1462,8 +1466,10 @@ lcs_start_kernel_thread(struct lcs_card *card) ...@@ -1462,8 +1466,10 @@ lcs_start_kernel_thread(struct lcs_card *card)
kernel_thread(lcs_lgw_startlan_thread, (void *) card, SIGCHLD); kernel_thread(lcs_lgw_startlan_thread, (void *) card, SIGCHLD);
if (test_and_clear_bit(2, &card->thread_mask)) if (test_and_clear_bit(2, &card->thread_mask))
kernel_thread(lcs_lgw_stoplan_thread, (void *) card, SIGCHLD); kernel_thread(lcs_lgw_stoplan_thread, (void *) card, SIGCHLD);
#ifdef CONFIG_IP_MULTICAST
if (test_and_clear_bit(3, &card->thread_mask)) if (test_and_clear_bit(3, &card->thread_mask))
kernel_thread(lcs_fix_multicast_list, (void *) card, SIGCHLD); kernel_thread(lcs_fix_multicast_list, (void *) card, SIGCHLD);
#endif
} }
/** /**
...@@ -1599,12 +1605,9 @@ lcs_stop_device(struct net_device *dev) ...@@ -1599,12 +1605,9 @@ lcs_stop_device(struct net_device *dev)
LCS_DBF_TEXT(2, trace, "stopdev"); LCS_DBF_TEXT(2, trace, "stopdev");
card = (struct lcs_card *) dev->priv; card = (struct lcs_card *) dev->priv;
netif_stop_queue(dev); netif_stop_queue(dev);
// FIXME: really free the net_device here ?!?
kfree(card->dev);
rc = lcs_stopcard(card); rc = lcs_stopcard(card);
if (rc) if (rc)
PRINT_ERR("Try it again!\n "); PRINT_ERR("Try it again!\n ");
MOD_DEC_USE_COUNT;
return rc; return rc;
} }
...@@ -1626,7 +1629,6 @@ lcs_open_device(struct net_device *dev) ...@@ -1626,7 +1629,6 @@ lcs_open_device(struct net_device *dev)
PRINT_ERR("LCS:Error in opening device!\n"); PRINT_ERR("LCS:Error in opening device!\n");
} else { } else {
MOD_INC_USE_COUNT;
netif_wake_queue(dev); netif_wake_queue(dev);
card->state = DEV_STATE_UP; card->state = DEV_STATE_UP;
} }
...@@ -1784,6 +1786,7 @@ lcs_new_device(struct ccwgroup_device *ccwgdev) ...@@ -1784,6 +1786,7 @@ lcs_new_device(struct ccwgroup_device *ccwgdev)
dev->set_multicast_list = lcs_set_multicast_list; dev->set_multicast_list = lcs_set_multicast_list;
#endif #endif
dev->get_stats = lcs_getstats; dev->get_stats = lcs_getstats;
dev->owner = THIS_MODULE;
netif_stop_queue(dev); netif_stop_queue(dev);
lcs_stopcard(card); lcs_stopcard(card);
return 0; return 0;
......
/* /*
* $Id: netiucv.c,v 1.16 2003/02/18 09:15:14 mschwide Exp $ * $Id: netiucv.c,v 1.19 2003/04/08 16:00:17 mschwide Exp $
* *
* IUCV network driver * IUCV network driver
* *
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *
* RELEASE-TAG: IUCV network driver $Revision: 1.16 $ * RELEASE-TAG: IUCV network driver $Revision: 1.19 $
* *
*/ */
...@@ -1140,7 +1140,6 @@ netiucv_transmit_skb(struct iucv_connection *conn, struct sk_buff *skb) { ...@@ -1140,7 +1140,6 @@ netiucv_transmit_skb(struct iucv_connection *conn, struct sk_buff *skb) {
*/ */
static int static int
netiucv_open(struct net_device *dev) { netiucv_open(struct net_device *dev) {
MOD_INC_USE_COUNT;
SET_DEVICE_START(dev, 1); SET_DEVICE_START(dev, 1);
fsm_event(((struct netiucv_priv *)dev->priv)->fsm, DEV_EVENT_START, dev); fsm_event(((struct netiucv_priv *)dev->priv)->fsm, DEV_EVENT_START, dev);
return 0; return 0;
...@@ -1158,7 +1157,6 @@ static int ...@@ -1158,7 +1157,6 @@ static int
netiucv_close(struct net_device *dev) { netiucv_close(struct net_device *dev) {
SET_DEVICE_START(dev, 0); SET_DEVICE_START(dev, 0);
fsm_event(((struct netiucv_priv *)dev->priv)->fsm, DEV_EVENT_STOP, dev); fsm_event(((struct netiucv_priv *)dev->priv)->fsm, DEV_EVENT_STOP, dev);
MOD_DEC_USE_COUNT;
return 0; return 0;
} }
...@@ -1517,12 +1515,14 @@ netiucv_new_connection(struct net_device *dev, char *username) ...@@ -1517,12 +1515,14 @@ netiucv_new_connection(struct net_device *dev, char *username)
conn->max_buffsize = NETIUCV_BUFSIZE_DEFAULT; conn->max_buffsize = NETIUCV_BUFSIZE_DEFAULT;
conn->netdev = dev; conn->netdev = dev;
conn->rx_buff = alloc_skb(NETIUCV_BUFSIZE_DEFAULT, GFP_DMA); conn->rx_buff = alloc_skb(NETIUCV_BUFSIZE_DEFAULT,
GFP_KERNEL | GFP_DMA);
if (!conn->rx_buff) { if (!conn->rx_buff) {
kfree(conn); kfree(conn);
return NULL; return NULL;
} }
conn->tx_buff = alloc_skb(NETIUCV_BUFSIZE_DEFAULT, GFP_DMA); conn->tx_buff = alloc_skb(NETIUCV_BUFSIZE_DEFAULT,
GFP_KERNEL | GFP_DMA);
if (!conn->tx_buff) { if (!conn->tx_buff) {
kfree_skb(conn->rx_buff); kfree_skb(conn->rx_buff);
kfree(conn); kfree(conn);
...@@ -1630,6 +1630,7 @@ netiucv_init_netdevice(int ifno, char *username) ...@@ -1630,6 +1630,7 @@ netiucv_init_netdevice(int ifno, char *username)
dev->addr_len = 0; dev->addr_len = 0;
dev->type = ARPHRD_SLIP; dev->type = ARPHRD_SLIP;
dev->tx_queue_len = NETIUCV_QUEUELEN_DEFAULT; dev->tx_queue_len = NETIUCV_QUEUELEN_DEFAULT;
dev->owner = THIS_MODULE;
dev->flags = IFF_POINTOPOINT | IFF_NOARP; dev->flags = IFF_POINTOPOINT | IFF_NOARP;
return dev; return dev;
} }
...@@ -1716,7 +1717,7 @@ static struct device_driver netiucv_driver = { ...@@ -1716,7 +1717,7 @@ static struct device_driver netiucv_driver = {
static void static void
netiucv_banner(void) netiucv_banner(void)
{ {
char vbuf[] = "$Revision: 1.16 $"; char vbuf[] = "$Revision: 1.19 $";
char *version = vbuf; char *version = vbuf;
if ((version = strchr(version, ':'))) { if ((version = strchr(version, ':'))) {
......
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