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
or zSeries. This device driver supports Token Ring (IEEE 802.5),
FDDI (IEEE 802.7) and Ethernet.
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
tristate "CTC device support"
......@@ -20,7 +20,7 @@ config CTC
coupling using ESCON. It also supports virtual CTCs when running
under VM. It will use the channel device configuration if this is
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
tristate "IUCV device support (VM only)"
......@@ -28,7 +28,7 @@ config IUCV
help
Select this option if you want to use inter-user communication
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
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
*
......@@ -36,13 +36,12 @@
* along with this program; if not, write to the Free Software
* 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
#include <linux/version.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/kernel.h>
......@@ -273,7 +272,7 @@ static void
print_banner(void)
{
static int printed = 0;
char vbuf[] = "$Revision: 1.36 $";
char vbuf[] = "$Revision: 1.40 $";
char *version = vbuf;
if (printed)
......@@ -1962,22 +1961,17 @@ ctc_irq_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
}
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. */
if (priv->channel[READ]->cdev == cdev)
ch = priv->channel[READ];
else if (priv->channel[WRITE]->cdev == cdev)
ch = priv->channel[READ];
else {
printk(KERN_ERR
"ctc: Can't determine channel for interrupt, "
"device %s\n", cdev->dev.bus_id);
return;
}
/* Try to extract channel from driver data. */
if (priv->channel[READ]->cdev == cdev)
ch = priv->channel[READ];
else if (priv->channel[WRITE]->cdev == cdev)
ch = priv->channel[READ];
else {
printk(KERN_ERR
"ctc: Can't determine channel for interrupt, "
"device %s\n", cdev->dev.bus_id);
return;
}
dev = (struct net_device *) (ch->netdev);
......@@ -2392,7 +2386,6 @@ transmit_skb(struct channel *ch, struct sk_buff *skb)
static int
ctc_open(struct net_device * dev)
{
MOD_INC_USE_COUNT;
fsm_event(((struct ctc_priv *) dev->priv)->fsm, DEV_EVENT_START, dev);
return 0;
}
......@@ -2409,7 +2402,6 @@ static int
ctc_close(struct net_device * dev)
{
fsm_event(((struct ctc_priv *) dev->priv)->fsm, DEV_EVENT_STOP, dev);
MOD_DEC_USE_COUNT;
return 0;
}
......@@ -2761,6 +2753,7 @@ ctc_init_netdevice(struct net_device * dev, int alloc_device,
dev->addr_len = 0;
dev->type = ARPHRD_SLIP;
dev->tx_queue_len = 100;
dev->owner = THIS_MODULE;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
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.
*
......@@ -22,7 +22,6 @@
*
*/
#define __NO_VERSION__
#include <linux/config.h>
#include <linux/module.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
*
*/
#include "fsm.h"
#include <linux/version.h>
#include <linux/config.h>
#include <linux/module.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
*
......@@ -29,14 +29,13 @@
* along with this program; if not, write to the Free Software
* 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/config.h>
#include <linux/version.h>
#include <linux/spinlock.h>
#include <linux/kernel.h>
#include <linux/slab.h>
......@@ -333,7 +332,7 @@ do { \
static void
iucv_banner(void)
{
char vbuf[] = "$Revision: 1.9 $";
char vbuf[] = "$Revision: 1.10 $";
char *version = vbuf;
if ((version = strchr(version, ':'))) {
......
......@@ -11,7 +11,7 @@
* Frank Pavlic (pavlic@de.ibm.com) and
* 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
* it under the terms of the GNU General Public License as published by
......@@ -28,7 +28,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <linux/version.h>
#include <linux/module.h>
#include <linux/if.h>
#include <linux/netdevice.h>
......@@ -59,7 +58,7 @@
/**
* 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 ")";
......@@ -335,7 +334,9 @@ lcs_setup_card(struct lcs_card *card)
(void *)lcs_start_kernel_thread,card);
card->thread_mask = 0;
spin_lock_init(&card->lock);
#ifdef CONFIG_IP_MULTICAST
INIT_LIST_HEAD(&card->ipm_list);
#endif
INIT_LIST_HEAD(&card->lancmd_waiters);
return 0;
}
......@@ -358,6 +359,7 @@ lcs_cleanup_card(struct lcs_card *card)
kfree(ipm_list);
}
#endif
kfree(card->dev);
/* Cleanup channels. */
lcs_cleanup_channel(&card->write);
lcs_cleanup_channel(&card->read);
......@@ -556,13 +558,12 @@ lcs_ready_buffer(struct lcs_channel *channel, struct lcs_buffer *buffer)
static int
__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)
BUG();
buffer->state = BUF_STATE_PROCESSED;
index = buffer - channel->iob;
prevprev = (index - 1) & (LCS_NUM_BUFFS - 1);
prev = (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. */
......@@ -1082,7 +1083,7 @@ lcs_tasklet(unsigned long data)
unsigned long flags;
struct lcs_channel *channel;
struct lcs_buffer *iob;
int buf_idx, io_idx;
int buf_idx;
int rc;
channel = (struct lcs_channel *) data;
......@@ -1092,9 +1093,7 @@ lcs_tasklet(unsigned long data)
/* Check for processed buffers. */
iob = channel->iob;
buf_idx = channel->buf_idx;
io_idx = channel->io_idx;
while (buf_idx != io_idx &&
iob[buf_idx].state == BUF_STATE_PROCESSED) {
while (iob[buf_idx].state == BUF_STATE_PROCESSED) {
/* Do the callback thing. */
if (iob[buf_idx].callback != NULL)
iob[buf_idx].callback(channel, iob + buf_idx);
......@@ -1434,6 +1433,7 @@ static int
lcs_lgw_stoplan_thread(void *data)
{
struct lcs_card *card;
int rc;
card = (struct lcs_card *) data;
daemonize("lgwstop");
......@@ -1446,7 +1446,11 @@ lcs_lgw_stoplan_thread(void *data)
else
PRINT_ERR("Stoplan %s initiated by LGW failed!\n",
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)
kernel_thread(lcs_lgw_startlan_thread, (void *) card, SIGCHLD);
if (test_and_clear_bit(2, &card->thread_mask))
kernel_thread(lcs_lgw_stoplan_thread, (void *) card, SIGCHLD);
#ifdef CONFIG_IP_MULTICAST
if (test_and_clear_bit(3, &card->thread_mask))
kernel_thread(lcs_fix_multicast_list, (void *) card, SIGCHLD);
#endif
}
/**
......@@ -1599,12 +1605,9 @@ lcs_stop_device(struct net_device *dev)
LCS_DBF_TEXT(2, trace, "stopdev");
card = (struct lcs_card *) dev->priv;
netif_stop_queue(dev);
// FIXME: really free the net_device here ?!?
kfree(card->dev);
rc = lcs_stopcard(card);
if (rc)
PRINT_ERR("Try it again!\n ");
MOD_DEC_USE_COUNT;
return rc;
}
......@@ -1626,7 +1629,6 @@ lcs_open_device(struct net_device *dev)
PRINT_ERR("LCS:Error in opening device!\n");
} else {
MOD_INC_USE_COUNT;
netif_wake_queue(dev);
card->state = DEV_STATE_UP;
}
......@@ -1784,6 +1786,7 @@ lcs_new_device(struct ccwgroup_device *ccwgdev)
dev->set_multicast_list = lcs_set_multicast_list;
#endif
dev->get_stats = lcs_getstats;
dev->owner = THIS_MODULE;
netif_stop_queue(dev);
lcs_stopcard(card);
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
*
......@@ -30,7 +30,7 @@
* along with this program; if not, write to the Free Software
* 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) {
*/
static int
netiucv_open(struct net_device *dev) {
MOD_INC_USE_COUNT;
SET_DEVICE_START(dev, 1);
fsm_event(((struct netiucv_priv *)dev->priv)->fsm, DEV_EVENT_START, dev);
return 0;
......@@ -1158,7 +1157,6 @@ static int
netiucv_close(struct net_device *dev) {
SET_DEVICE_START(dev, 0);
fsm_event(((struct netiucv_priv *)dev->priv)->fsm, DEV_EVENT_STOP, dev);
MOD_DEC_USE_COUNT;
return 0;
}
......@@ -1517,12 +1515,14 @@ netiucv_new_connection(struct net_device *dev, char *username)
conn->max_buffsize = NETIUCV_BUFSIZE_DEFAULT;
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) {
kfree(conn);
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) {
kfree_skb(conn->rx_buff);
kfree(conn);
......@@ -1630,6 +1630,7 @@ netiucv_init_netdevice(int ifno, char *username)
dev->addr_len = 0;
dev->type = ARPHRD_SLIP;
dev->tx_queue_len = NETIUCV_QUEUELEN_DEFAULT;
dev->owner = THIS_MODULE;
dev->flags = IFF_POINTOPOINT | IFF_NOARP;
return dev;
}
......@@ -1716,7 +1717,7 @@ static struct device_driver netiucv_driver = {
static void
netiucv_banner(void)
{
char vbuf[] = "$Revision: 1.16 $";
char vbuf[] = "$Revision: 1.19 $";
char *version = vbuf;
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