Netdev List
 help / color / mirror / Atom feed
* [patch 4/4] ctc: removal of the old ctc driver
From: Ursula Braun @ 2008-02-06 18:27 UTC (permalink / raw)
  To: jgarzik, netdev, linux-s390; +Cc: Peter Tiedemann
In-Reply-To: <20080206182723.103842000@linux.vnet.ibm.com>

[-- Attachment #1: 703-ctc_removal.diff --]
[-- Type: TEXT/PLAIN, Size: 103820 bytes --]

From: Peter Tiedemann <ptiedem@de.ibm.com>

ctc driver is replaced by a new ctcm driver.
The ctcm driver supports the channel-to-channel connections of the
old ctc driver plus an additional MPC protocol to provide SNA
connectivity.
This patch removes the functions of the old ctc driver.

Signed-off-by: Peter Tiedemann <ptiedem@de.ibm.com>
Signed-off-by: Ursula Braun <braunu@de.ibm.com>

---
 drivers/s390/net/ctcdbug.c |   80 -
 drivers/s390/net/ctcdbug.h |  125 -
 drivers/s390/net/ctcmain.c | 3054 ---------------------------------------------
 drivers/s390/net/ctcmain.h |  270 ---
 4 files changed, 3529 deletions(-)

Index: linux-2.6-uschi/drivers/s390/net/ctcdbug.c
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/ctcdbug.c
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *
- * linux/drivers/s390/net/ctcdbug.c
- *
- * CTC / ESCON network driver - s390 dbf exploit.
- *
- * Copyright 2000,2003 IBM Corporation
- *
- *    Author(s): Original Code written by
- *			  Peter Tiedemann (ptiedem@de.ibm.com)
- *
- * 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
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "ctcdbug.h"
-
-/**
- * Debug Facility Stuff
- */
-debug_info_t *ctc_dbf_setup = NULL;
-debug_info_t *ctc_dbf_data = NULL;
-debug_info_t *ctc_dbf_trace = NULL;
-
-DEFINE_PER_CPU(char[256], ctc_dbf_txt_buf);
-
-void
-ctc_unregister_dbf_views(void)
-{
-	if (ctc_dbf_setup)
-		debug_unregister(ctc_dbf_setup);
-	if (ctc_dbf_data)
-		debug_unregister(ctc_dbf_data);
-	if (ctc_dbf_trace)
-		debug_unregister(ctc_dbf_trace);
-}
-int
-ctc_register_dbf_views(void)
-{
-	ctc_dbf_setup = debug_register(CTC_DBF_SETUP_NAME,
-					CTC_DBF_SETUP_PAGES,
-					CTC_DBF_SETUP_NR_AREAS,
-					CTC_DBF_SETUP_LEN);
-	ctc_dbf_data = debug_register(CTC_DBF_DATA_NAME,
-				       CTC_DBF_DATA_PAGES,
-				       CTC_DBF_DATA_NR_AREAS,
-				       CTC_DBF_DATA_LEN);
-	ctc_dbf_trace = debug_register(CTC_DBF_TRACE_NAME,
-					CTC_DBF_TRACE_PAGES,
-					CTC_DBF_TRACE_NR_AREAS,
-					CTC_DBF_TRACE_LEN);
-
-	if ((ctc_dbf_setup == NULL) || (ctc_dbf_data == NULL) ||
-	    (ctc_dbf_trace == NULL)) {
-		ctc_unregister_dbf_views();
-		return -ENOMEM;
-	}
-	debug_register_view(ctc_dbf_setup, &debug_hex_ascii_view);
-	debug_set_level(ctc_dbf_setup, CTC_DBF_SETUP_LEVEL);
-
-	debug_register_view(ctc_dbf_data, &debug_hex_ascii_view);
-	debug_set_level(ctc_dbf_data, CTC_DBF_DATA_LEVEL);
-
-	debug_register_view(ctc_dbf_trace, &debug_hex_ascii_view);
-	debug_set_level(ctc_dbf_trace, CTC_DBF_TRACE_LEVEL);
-
-	return 0;
-}
-
Index: linux-2.6-uschi/drivers/s390/net/ctcdbug.h
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/ctcdbug.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/*
- *
- * linux/drivers/s390/net/ctcdbug.h
- *
- * CTC / ESCON network driver - s390 dbf exploit.
- *
- * Copyright 2000,2003 IBM Corporation
- *
- *    Author(s): Original Code written by
- *			  Peter Tiedemann (ptiedem@de.ibm.com)
- *
- * 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
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.	 See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#ifndef _CTCDBUG_H_
-#define _CTCDBUG_H_
-
-#include <asm/debug.h>
-#include "ctcmain.h"
-/**
- * Debug Facility stuff
- */
-#define CTC_DBF_SETUP_NAME "ctc_setup"
-#define CTC_DBF_SETUP_LEN 16
-#define CTC_DBF_SETUP_PAGES 8
-#define CTC_DBF_SETUP_NR_AREAS 1
-#define CTC_DBF_SETUP_LEVEL 3
-
-#define CTC_DBF_DATA_NAME "ctc_data"
-#define CTC_DBF_DATA_LEN 128
-#define CTC_DBF_DATA_PAGES 8
-#define CTC_DBF_DATA_NR_AREAS 1
-#define CTC_DBF_DATA_LEVEL 3
-
-#define CTC_DBF_TRACE_NAME "ctc_trace"
-#define CTC_DBF_TRACE_LEN 16
-#define CTC_DBF_TRACE_PAGES 4
-#define CTC_DBF_TRACE_NR_AREAS 2
-#define CTC_DBF_TRACE_LEVEL 3
-
-#define DBF_TEXT(name,level,text) \
-	do { \
-		debug_text_event(ctc_dbf_##name,level,text); \
-	} while (0)
-
-#define DBF_HEX(name,level,addr,len) \
-	do { \
-		debug_event(ctc_dbf_##name,level,(void*)(addr),len); \
-	} while (0)
-
-DECLARE_PER_CPU(char[256], ctc_dbf_txt_buf);
-extern debug_info_t *ctc_dbf_setup;
-extern debug_info_t *ctc_dbf_data;
-extern debug_info_t *ctc_dbf_trace;
-
-
-#define DBF_TEXT_(name,level,text...)				\
-	do {								\
-		char* ctc_dbf_txt_buf = get_cpu_var(ctc_dbf_txt_buf);	\
-		sprintf(ctc_dbf_txt_buf, text);			  	\
-		debug_text_event(ctc_dbf_##name,level,ctc_dbf_txt_buf);	\
-		put_cpu_var(ctc_dbf_txt_buf);				\
-	} while (0)
-
-#define DBF_SPRINTF(name,level,text...) \
-	do { \
-		debug_sprintf_event(ctc_dbf_trace, level, ##text ); \
-		debug_sprintf_event(ctc_dbf_trace, level, text ); \
-	} while (0)
-
-
-int ctc_register_dbf_views(void);
-
-void ctc_unregister_dbf_views(void);
-
-/**
- * some more debug stuff
- */
-
-#define HEXDUMP16(importance,header,ptr) \
-PRINT_##importance(header "%02x %02x %02x %02x  %02x %02x %02x %02x  " \
-		   "%02x %02x %02x %02x  %02x %02x %02x %02x\n", \
-		   *(((char*)ptr)),*(((char*)ptr)+1),*(((char*)ptr)+2), \
-		   *(((char*)ptr)+3),*(((char*)ptr)+4),*(((char*)ptr)+5), \
-		   *(((char*)ptr)+6),*(((char*)ptr)+7),*(((char*)ptr)+8), \
-		   *(((char*)ptr)+9),*(((char*)ptr)+10),*(((char*)ptr)+11), \
-		   *(((char*)ptr)+12),*(((char*)ptr)+13), \
-		   *(((char*)ptr)+14),*(((char*)ptr)+15)); \
-PRINT_##importance(header "%02x %02x %02x %02x  %02x %02x %02x %02x  " \
-		   "%02x %02x %02x %02x  %02x %02x %02x %02x\n", \
-		   *(((char*)ptr)+16),*(((char*)ptr)+17), \
-		   *(((char*)ptr)+18),*(((char*)ptr)+19), \
-		   *(((char*)ptr)+20),*(((char*)ptr)+21), \
-		   *(((char*)ptr)+22),*(((char*)ptr)+23), \
-		   *(((char*)ptr)+24),*(((char*)ptr)+25), \
-		   *(((char*)ptr)+26),*(((char*)ptr)+27), \
-		   *(((char*)ptr)+28),*(((char*)ptr)+29), \
-		   *(((char*)ptr)+30),*(((char*)ptr)+31));
-
-static inline void
-hex_dump(unsigned char *buf, size_t len)
-{
-	size_t i;
-
-	for (i = 0; i < len; i++) {
-		if (i && !(i % 16))
-			printk("\n");
-		printk("%02x ", *(buf + i));
-	}
-	printk("\n");
-}
-
-
-#endif
Index: linux-2.6-uschi/drivers/s390/net/ctcmain.c
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/ctcmain.c
+++ /dev/null
@@ -1,3054 +0,0 @@
-/*
- * CTC / ESCON network driver
- *
- * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation
- * Author(s): Fritz Elfert (elfert@de.ibm.com, felfert@millenux.com)
- * Fixes by : Jochen Röhrig (roehrig@de.ibm.com)
- *            Arnaldo Carvalho de Melo <acme@conectiva.com.br>
-	      Peter Tiedemann (ptiedem@de.ibm.com)
- * Driver Model stuff by : Cornelia Huck <cornelia.huck@de.ibm.com>
- *
- * Documentation used:
- *  - Principles of Operation (IBM doc#: SA22-7201-06)
- *  - Common IO/-Device Commands and Self Description (IBM doc#: SA22-7204-02)
- *  - Common IO/-Device Commands and Self Description (IBM doc#: SN22-5535)
- *  - ESCON Channel-to-Channel Adapter (IBM doc#: SA22-7203-00)
- *  - ESCON I/O Interface (IBM doc#: SA22-7202-029
- *
- * and the source of the original CTC driver by:
- *  Dieter Wellerdiek (wel@de.ibm.com)
- *  Martin Schwidefsky (schwidefsky@de.ibm.com)
- *  Denis Joseph Barrow (djbarrow@de.ibm.com,barrow_dj@yahoo.com)
- *  Jochen Röhrig (roehrig@de.ibm.com)
- *
- * 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
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-#undef DEBUG
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/errno.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/timer.h>
-#include <linux/bitops.h>
-
-#include <linux/signal.h>
-#include <linux/string.h>
-
-#include <linux/ip.h>
-#include <linux/if_arp.h>
-#include <linux/tcp.h>
-#include <linux/skbuff.h>
-#include <linux/ctype.h>
-#include <net/dst.h>
-
-#include <asm/io.h>
-#include <asm/ccwdev.h>
-#include <asm/ccwgroup.h>
-#include <asm/uaccess.h>
-
-#include <asm/idals.h>
-
-#include "fsm.h"
-#include "cu3088.h"
-
-#include "ctcdbug.h"
-#include "ctcmain.h"
-
-MODULE_AUTHOR("(C) 2000 IBM Corp. by Fritz Elfert (felfert@millenux.com)");
-MODULE_DESCRIPTION("Linux for S/390 CTC/Escon Driver");
-MODULE_LICENSE("GPL");
-/**
- * States of the interface statemachine.
- */
-enum dev_states {
-	DEV_STATE_STOPPED,
-	DEV_STATE_STARTWAIT_RXTX,
-	DEV_STATE_STARTWAIT_RX,
-	DEV_STATE_STARTWAIT_TX,
-	DEV_STATE_STOPWAIT_RXTX,
-	DEV_STATE_STOPWAIT_RX,
-	DEV_STATE_STOPWAIT_TX,
-	DEV_STATE_RUNNING,
-	/**
-	 * MUST be always the last element!!
-	 */
-	CTC_NR_DEV_STATES
-};
-
-static const char *dev_state_names[] = {
-	"Stopped",
-	"StartWait RXTX",
-	"StartWait RX",
-	"StartWait TX",
-	"StopWait RXTX",
-	"StopWait RX",
-	"StopWait TX",
-	"Running",
-};
-
-/**
- * Events of the interface statemachine.
- */
-enum dev_events {
-	DEV_EVENT_START,
-	DEV_EVENT_STOP,
-	DEV_EVENT_RXUP,
-	DEV_EVENT_TXUP,
-	DEV_EVENT_RXDOWN,
-	DEV_EVENT_TXDOWN,
-	DEV_EVENT_RESTART,
-	/**
-	 * MUST be always the last element!!
-	 */
-	CTC_NR_DEV_EVENTS
-};
-
-static const char *dev_event_names[] = {
-	"Start",
-	"Stop",
-	"RX up",
-	"TX up",
-	"RX down",
-	"TX down",
-	"Restart",
-};
-
-/**
- * Events of the channel statemachine
- */
-enum ch_events {
-	/**
-	 * Events, representing return code of
-	 * I/O operations (ccw_device_start, ccw_device_halt et al.)
-	 */
-	CH_EVENT_IO_SUCCESS,
-	CH_EVENT_IO_EBUSY,
-	CH_EVENT_IO_ENODEV,
-	CH_EVENT_IO_EIO,
-	CH_EVENT_IO_UNKNOWN,
-
-	CH_EVENT_ATTNBUSY,
-	CH_EVENT_ATTN,
-	CH_EVENT_BUSY,
-
-	/**
-	 * Events, representing unit-check
-	 */
-	CH_EVENT_UC_RCRESET,
-	CH_EVENT_UC_RSRESET,
-	CH_EVENT_UC_TXTIMEOUT,
-	CH_EVENT_UC_TXPARITY,
-	CH_EVENT_UC_HWFAIL,
-	CH_EVENT_UC_RXPARITY,
-	CH_EVENT_UC_ZERO,
-	CH_EVENT_UC_UNKNOWN,
-
-	/**
-	 * Events, representing subchannel-check
-	 */
-	CH_EVENT_SC_UNKNOWN,
-
-	/**
-	 * Events, representing machine checks
-	 */
-	CH_EVENT_MC_FAIL,
-	CH_EVENT_MC_GOOD,
-
-	/**
-	 * Event, representing normal IRQ
-	 */
-	CH_EVENT_IRQ,
-	CH_EVENT_FINSTAT,
-
-	/**
-	 * Event, representing timer expiry.
-	 */
-	CH_EVENT_TIMER,
-
-	/**
-	 * Events, representing commands from upper levels.
-	 */
-	CH_EVENT_START,
-	CH_EVENT_STOP,
-
-	/**
-	 * MUST be always the last element!!
-	 */
-	NR_CH_EVENTS,
-};
-
-/**
- * States of the channel statemachine.
- */
-enum ch_states {
-	/**
-	 * Channel not assigned to any device,
-	 * initial state, direction invalid
-	 */
-	CH_STATE_IDLE,
-
-	/**
-	 * Channel assigned but not operating
-	 */
-	CH_STATE_STOPPED,
-	CH_STATE_STARTWAIT,
-	CH_STATE_STARTRETRY,
-	CH_STATE_SETUPWAIT,
-	CH_STATE_RXINIT,
-	CH_STATE_TXINIT,
-	CH_STATE_RX,
-	CH_STATE_TX,
-	CH_STATE_RXIDLE,
-	CH_STATE_TXIDLE,
-	CH_STATE_RXERR,
-	CH_STATE_TXERR,
-	CH_STATE_TERM,
-	CH_STATE_DTERM,
-	CH_STATE_NOTOP,
-
-	/**
-	 * MUST be always the last element!!
-	 */
-	NR_CH_STATES,
-};
-
-static int loglevel = CTC_LOGLEVEL_DEFAULT;
-
-/**
- * Linked list of all detected channels.
- */
-static struct channel *channels = NULL;
-
-/**
- * Print Banner.
- */
-static void
-print_banner(void)
-{
-	static int printed = 0;
-
-	if (printed)
-		return;
-
-	printk(KERN_INFO "CTC driver initialized\n");
-	printed = 1;
-}
-
-/**
- * Return type of a detected device.
- */
-static enum channel_types
-get_channel_type(struct ccw_device_id *id)
-{
-	enum channel_types type = (enum channel_types) id->driver_info;
-
-	if (type == channel_type_ficon)
-		type = channel_type_escon;
-
-	return type;
-}
-
-static const char *ch_event_names[] = {
-	"ccw_device success",
-	"ccw_device busy",
-	"ccw_device enodev",
-	"ccw_device ioerr",
-	"ccw_device unknown",
-
-	"Status ATTN & BUSY",
-	"Status ATTN",
-	"Status BUSY",
-
-	"Unit check remote reset",
-	"Unit check remote system reset",
-	"Unit check TX timeout",
-	"Unit check TX parity",
-	"Unit check Hardware failure",
-	"Unit check RX parity",
-	"Unit check ZERO",
-	"Unit check Unknown",
-
-	"SubChannel check Unknown",
-
-	"Machine check failure",
-	"Machine check operational",
-
-	"IRQ normal",
-	"IRQ final",
-
-	"Timer",
-
-	"Start",
-	"Stop",
-};
-
-static const char *ch_state_names[] = {
-	"Idle",
-	"Stopped",
-	"StartWait",
-	"StartRetry",
-	"SetupWait",
-	"RX init",
-	"TX init",
-	"RX",
-	"TX",
-	"RX idle",
-	"TX idle",
-	"RX error",
-	"TX error",
-	"Terminating",
-	"Restarting",
-	"Not operational",
-};
-
-#ifdef DEBUG
-/**
- * Dump header and first 16 bytes of an sk_buff for debugging purposes.
- *
- * @param skb    The sk_buff to dump.
- * @param offset Offset relative to skb-data, where to start the dump.
- */
-static void
-ctc_dump_skb(struct sk_buff *skb, int offset)
-{
-	unsigned char *p = skb->data;
-	__u16 bl;
-	struct ll_header *header;
-	int i;
-
-	if (!(loglevel & CTC_LOGLEVEL_DEBUG))
-		return;
-	p += offset;
-	bl = *((__u16 *) p);
-	p += 2;
-	header = (struct ll_header *) p;
-	p -= 2;
-
-	printk(KERN_DEBUG "dump:\n");
-	printk(KERN_DEBUG "blocklen=%d %04x\n", bl, bl);
-
-	printk(KERN_DEBUG "h->length=%d %04x\n", header->length,
-	       header->length);
-	printk(KERN_DEBUG "h->type=%04x\n", header->type);
-	printk(KERN_DEBUG "h->unused=%04x\n", header->unused);
-	if (bl > 16)
-		bl = 16;
-	printk(KERN_DEBUG "data: ");
-	for (i = 0; i < bl; i++)
-		printk("%02x%s", *p++, (i % 16) ? " " : "\n<7>");
-	printk("\n");
-}
-#else
-static inline void
-ctc_dump_skb(struct sk_buff *skb, int offset)
-{
-}
-#endif
-
-/**
- * Unpack a just received skb and hand it over to
- * upper layers.
- *
- * @param ch The channel where this skb has been received.
- * @param pskb The received skb.
- */
-static void
-ctc_unpack_skb(struct channel *ch, struct sk_buff *pskb)
-{
-	struct net_device *dev = ch->netdev;
-	struct ctc_priv *privptr = (struct ctc_priv *) dev->priv;
-	__u16 len = *((__u16 *) pskb->data);
-
-	DBF_TEXT(trace, 4, __FUNCTION__);
-	skb_put(pskb, 2 + LL_HEADER_LENGTH);
-	skb_pull(pskb, 2);
-	pskb->dev = dev;
-	pskb->ip_summed = CHECKSUM_UNNECESSARY;
-	while (len > 0) {
-		struct sk_buff *skb;
-		struct ll_header *header = (struct ll_header *) pskb->data;
-
-		skb_pull(pskb, LL_HEADER_LENGTH);
-		if ((ch->protocol == CTC_PROTO_S390) &&
-		    (header->type != ETH_P_IP)) {
-
-#ifndef DEBUG
-		        if (!(ch->logflags & LOG_FLAG_ILLEGALPKT)) {
-#endif
-				/**
-				 * Check packet type only if we stick strictly
-				 * to S/390's protocol of OS390. This only
-				 * supports IP. Otherwise allow any packet
-				 * type.
-				 */
-				ctc_pr_warn(
-					"%s Illegal packet type 0x%04x received, dropping\n",
-					dev->name, header->type);
-				ch->logflags |= LOG_FLAG_ILLEGALPKT;
-#ifndef DEBUG
-			}
-#endif
-#ifdef DEBUG
-			ctc_dump_skb(pskb, -6);
-#endif
-			privptr->stats.rx_dropped++;
-			privptr->stats.rx_frame_errors++;
-			return;
-		}
-		pskb->protocol = ntohs(header->type);
-		if (header->length <= LL_HEADER_LENGTH) {
-#ifndef DEBUG
-		        if (!(ch->logflags & LOG_FLAG_ILLEGALSIZE)) {
-#endif
-				ctc_pr_warn(
-				       "%s Illegal packet size %d "
-				       "received (MTU=%d blocklen=%d), "
-				       "dropping\n", dev->name, header->length,
-				       dev->mtu, len);
-				ch->logflags |= LOG_FLAG_ILLEGALSIZE;
-#ifndef DEBUG
-			}
-#endif
-#ifdef DEBUG
-			ctc_dump_skb(pskb, -6);
-#endif
-			privptr->stats.rx_dropped++;
-			privptr->stats.rx_length_errors++;
-			return;
-		}
-		header->length -= LL_HEADER_LENGTH;
-		len -= LL_HEADER_LENGTH;
-		if ((header->length > skb_tailroom(pskb)) ||
-		    (header->length > len)) {
-#ifndef DEBUG
-		        if (!(ch->logflags & LOG_FLAG_OVERRUN)) {
-#endif
-				ctc_pr_warn(
-					"%s Illegal packet size %d "
-					"(beyond the end of received data), "
-					"dropping\n", dev->name, header->length);
-				ch->logflags |= LOG_FLAG_OVERRUN;
-#ifndef DEBUG
-			}
-#endif
-#ifdef DEBUG
-			ctc_dump_skb(pskb, -6);
-#endif
-			privptr->stats.rx_dropped++;
-			privptr->stats.rx_length_errors++;
-			return;
-		}
-		skb_put(pskb, header->length);
-		skb_reset_mac_header(pskb);
-		len -= header->length;
-		skb = dev_alloc_skb(pskb->len);
-		if (!skb) {
-#ifndef DEBUG
-		        if (!(ch->logflags & LOG_FLAG_NOMEM)) {
-#endif
-				ctc_pr_warn(
-					"%s Out of memory in ctc_unpack_skb\n",
-					dev->name);
-				ch->logflags |= LOG_FLAG_NOMEM;
-#ifndef DEBUG
-			}
-#endif
-			privptr->stats.rx_dropped++;
-			return;
-		}
-		skb_copy_from_linear_data(pskb, skb_put(skb, pskb->len),
-					  pskb->len);
-		skb_reset_mac_header(skb);
-		skb->dev = pskb->dev;
-		skb->protocol = pskb->protocol;
-		pskb->ip_summed = CHECKSUM_UNNECESSARY;
-		/**
-		 * reset logflags
-		 */
-		ch->logflags = 0;
-		privptr->stats.rx_packets++;
-		privptr->stats.rx_bytes += skb->len;
-		netif_rx_ni(skb);
-		dev->last_rx = jiffies;
-		if (len > 0) {
-			skb_pull(pskb, header->length);
-			if (skb_tailroom(pskb) < LL_HEADER_LENGTH) {
-#ifndef DEBUG
-				if (!(ch->logflags & LOG_FLAG_OVERRUN)) {
-#endif
-					ctc_pr_warn(
-						"%s Overrun in ctc_unpack_skb\n",
-						dev->name);
-					ch->logflags |= LOG_FLAG_OVERRUN;
-#ifndef DEBUG
-				}
-#endif
-				return;
-			}
-			skb_put(pskb, LL_HEADER_LENGTH);
-		}
-	}
-}
-
-/**
- * Check return code of a preceeding ccw_device call, halt_IO etc...
- *
- * @param ch          The channel, the error belongs to.
- * @param return_code The error code to inspect.
- */
-static void
-ccw_check_return_code(struct channel *ch, int return_code, char *msg)
-{
-	DBF_TEXT(trace, 5, __FUNCTION__);
-	switch (return_code) {
-		case 0:
-			fsm_event(ch->fsm, CH_EVENT_IO_SUCCESS, ch);
-			break;
-		case -EBUSY:
-			ctc_pr_warn("%s (%s): Busy !\n", ch->id, msg);
-			fsm_event(ch->fsm, CH_EVENT_IO_EBUSY, ch);
-			break;
-		case -ENODEV:
-			ctc_pr_emerg("%s (%s): Invalid device called for IO\n",
-				     ch->id, msg);
-			fsm_event(ch->fsm, CH_EVENT_IO_ENODEV, ch);
-			break;
-		case -EIO:
-			ctc_pr_emerg("%s (%s): Status pending... \n",
-				     ch->id, msg);
-			fsm_event(ch->fsm, CH_EVENT_IO_EIO, ch);
-			break;
-		default:
-			ctc_pr_emerg("%s (%s): Unknown error in do_IO %04x\n",
-				     ch->id, msg, return_code);
-			fsm_event(ch->fsm, CH_EVENT_IO_UNKNOWN, ch);
-	}
-}
-
-/**
- * Check sense of a unit check.
- *
- * @param ch    The channel, the sense code belongs to.
- * @param sense The sense code to inspect.
- */
-static void
-ccw_unit_check(struct channel *ch, unsigned char sense)
-{
-	DBF_TEXT(trace, 5, __FUNCTION__);
-	if (sense & SNS0_INTERVENTION_REQ) {
-		if (sense & 0x01) {
-			ctc_pr_debug("%s: Interface disc. or Sel. reset "
-					"(remote)\n", ch->id);
-			fsm_event(ch->fsm, CH_EVENT_UC_RCRESET, ch);
-		} else {
-			ctc_pr_debug("%s: System reset (remote)\n", ch->id);
-			fsm_event(ch->fsm, CH_EVENT_UC_RSRESET, ch);
-		}
-	} else if (sense & SNS0_EQUIPMENT_CHECK) {
-		if (sense & SNS0_BUS_OUT_CHECK) {
-			ctc_pr_warn("%s: Hardware malfunction (remote)\n",
-				    ch->id);
-			fsm_event(ch->fsm, CH_EVENT_UC_HWFAIL, ch);
-		} else {
-			ctc_pr_warn("%s: Read-data parity error (remote)\n",
-				    ch->id);
-			fsm_event(ch->fsm, CH_EVENT_UC_RXPARITY, ch);
-		}
-	} else if (sense & SNS0_BUS_OUT_CHECK) {
-		if (sense & 0x04) {
-			ctc_pr_warn("%s: Data-streaming timeout)\n", ch->id);
-			fsm_event(ch->fsm, CH_EVENT_UC_TXTIMEOUT, ch);
-		} else {
-			ctc_pr_warn("%s: Data-transfer parity error\n", ch->id);
-			fsm_event(ch->fsm, CH_EVENT_UC_TXPARITY, ch);
-		}
-	} else if (sense & SNS0_CMD_REJECT) {
-		ctc_pr_warn("%s: Command reject\n", ch->id);
-	} else if (sense == 0) {
-		ctc_pr_debug("%s: Unit check ZERO\n", ch->id);
-		fsm_event(ch->fsm, CH_EVENT_UC_ZERO, ch);
-	} else {
-		ctc_pr_warn("%s: Unit Check with sense code: %02x\n",
-			    ch->id, sense);
-		fsm_event(ch->fsm, CH_EVENT_UC_UNKNOWN, ch);
-	}
-}
-
-static void
-ctc_purge_skb_queue(struct sk_buff_head *q)
-{
-	struct sk_buff *skb;
-
-	DBF_TEXT(trace, 5, __FUNCTION__);
-
-	while ((skb = skb_dequeue(q))) {
-		atomic_dec(&skb->users);
-		dev_kfree_skb_irq(skb);
-	}
-}
-
-static int
-ctc_checkalloc_buffer(struct channel *ch, int warn)
-{
-	DBF_TEXT(trace, 5, __FUNCTION__);
-	if ((ch->trans_skb == NULL) ||
-	    (ch->flags & CHANNEL_FLAGS_BUFSIZE_CHANGED)) {
-		if (ch->trans_skb != NULL)
-			dev_kfree_skb(ch->trans_skb);
-		clear_normalized_cda(&ch->ccw[1]);
-		ch->trans_skb = __dev_alloc_skb(ch->max_bufsize,
-						GFP_ATOMIC | GFP_DMA);
-		if (ch->trans_skb == NULL) {
-			if (warn)
-				ctc_pr_warn(
-					"%s: Couldn't alloc %s trans_skb\n",
-					ch->id,
-					(CHANNEL_DIRECTION(ch->flags) == READ) ?
-					"RX" : "TX");
-			return -ENOMEM;
-		}
-		ch->ccw[1].count = ch->max_bufsize;
-		if (set_normalized_cda(&ch->ccw[1], ch->trans_skb->data)) {
-			dev_kfree_skb(ch->trans_skb);
-			ch->trans_skb = NULL;
-			if (warn)
-				ctc_pr_warn(
-					"%s: set_normalized_cda for %s "
-					"trans_skb failed, dropping packets\n",
-					ch->id,
-					(CHANNEL_DIRECTION(ch->flags) == READ) ?
-					"RX" : "TX");
-			return -ENOMEM;
-		}
-		ch->ccw[1].count = 0;
-		ch->trans_skb_data = ch->trans_skb->data;
-		ch->flags &= ~CHANNEL_FLAGS_BUFSIZE_CHANGED;
-	}
-	return 0;
-}
-
-/**
- * Actions for channel - statemachines.
- *****************************************************************************/
-
-/**
- * Normal data has been send. Free the corresponding
- * skb (it's in io_queue), reset dev->tbusy and
- * revert to idle state.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_txdone(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	struct net_device *dev = ch->netdev;
-	struct ctc_priv *privptr = dev->priv;
-	struct sk_buff *skb;
-	int first = 1;
-	int i;
-	unsigned long duration;
-	struct timespec done_stamp = current_kernel_time();
-
-	DBF_TEXT(trace, 4, __FUNCTION__);
-
-	duration =
-	    (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 +
-	    (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000;
-	if (duration > ch->prof.tx_time)
-		ch->prof.tx_time = duration;
-
-	if (ch->irb->scsw.count != 0)
-		ctc_pr_debug("%s: TX not complete, remaining %d bytes\n",
-			     dev->name, ch->irb->scsw.count);
-	fsm_deltimer(&ch->timer);
-	while ((skb = skb_dequeue(&ch->io_queue))) {
-		privptr->stats.tx_packets++;
-		privptr->stats.tx_bytes += skb->len - LL_HEADER_LENGTH;
-		if (first) {
-			privptr->stats.tx_bytes += 2;
-			first = 0;
-		}
-		atomic_dec(&skb->users);
-		dev_kfree_skb_irq(skb);
-	}
-	spin_lock(&ch->collect_lock);
-	clear_normalized_cda(&ch->ccw[4]);
-	if (ch->collect_len > 0) {
-		int rc;
-
-		if (ctc_checkalloc_buffer(ch, 1)) {
-			spin_unlock(&ch->collect_lock);
-			return;
-		}
-		ch->trans_skb->data = ch->trans_skb_data;
-		skb_reset_tail_pointer(ch->trans_skb);
-		ch->trans_skb->len = 0;
-		if (ch->prof.maxmulti < (ch->collect_len + 2))
-			ch->prof.maxmulti = ch->collect_len + 2;
-		if (ch->prof.maxcqueue < skb_queue_len(&ch->collect_queue))
-			ch->prof.maxcqueue = skb_queue_len(&ch->collect_queue);
-		*((__u16 *) skb_put(ch->trans_skb, 2)) = ch->collect_len + 2;
-		i = 0;
-		while ((skb = skb_dequeue(&ch->collect_queue))) {
-			skb_copy_from_linear_data(skb, skb_put(ch->trans_skb,
-							       skb->len),
-						  skb->len);
-			privptr->stats.tx_packets++;
-			privptr->stats.tx_bytes += skb->len - LL_HEADER_LENGTH;
-			atomic_dec(&skb->users);
-			dev_kfree_skb_irq(skb);
-			i++;
-		}
-		ch->collect_len = 0;
-		spin_unlock(&ch->collect_lock);
-		ch->ccw[1].count = ch->trans_skb->len;
-		fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch);
-		ch->prof.send_stamp = current_kernel_time();
-		rc = ccw_device_start(ch->cdev, &ch->ccw[0],
-				      (unsigned long) ch, 0xff, 0);
-		ch->prof.doios_multi++;
-		if (rc != 0) {
-			privptr->stats.tx_dropped += i;
-			privptr->stats.tx_errors += i;
-			fsm_deltimer(&ch->timer);
-			ccw_check_return_code(ch, rc, "chained TX");
-		}
-	} else {
-		spin_unlock(&ch->collect_lock);
-		fsm_newstate(fi, CH_STATE_TXIDLE);
-	}
-	ctc_clear_busy(dev);
-}
-
-/**
- * Initial data is sent.
- * Notify device statemachine that we are up and
- * running.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_txidle(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-
-	DBF_TEXT(trace, 4, __FUNCTION__);
-	fsm_deltimer(&ch->timer);
-	fsm_newstate(fi, CH_STATE_TXIDLE);
-	fsm_event(((struct ctc_priv *) ch->netdev->priv)->fsm, DEV_EVENT_TXUP,
-		  ch->netdev);
-}
-
-/**
- * Got normal data, check for sanity, queue it up, allocate new buffer
- * trigger bottom half, and initiate next read.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_rx(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	struct net_device *dev = ch->netdev;
-	struct ctc_priv *privptr = dev->priv;
-	int len = ch->max_bufsize - ch->irb->scsw.count;
-	struct sk_buff *skb = ch->trans_skb;
-	__u16 block_len = *((__u16 *) skb->data);
-	int check_len;
-	int rc;
-
-	DBF_TEXT(trace, 4, __FUNCTION__);
-	fsm_deltimer(&ch->timer);
-	if (len < 8) {
-		ctc_pr_debug("%s: got packet with length %d < 8\n",
-			     dev->name, len);
-		privptr->stats.rx_dropped++;
-		privptr->stats.rx_length_errors++;
-		goto again;
-	}
-	if (len > ch->max_bufsize) {
-		ctc_pr_debug("%s: got packet with length %d > %d\n",
-			     dev->name, len, ch->max_bufsize);
-		privptr->stats.rx_dropped++;
-		privptr->stats.rx_length_errors++;
-		goto again;
-	}
-
-	/**
-	 * VM TCP seems to have a bug sending 2 trailing bytes of garbage.
-	 */
-	switch (ch->protocol) {
-		case CTC_PROTO_S390:
-		case CTC_PROTO_OS390:
-			check_len = block_len + 2;
-			break;
-		default:
-			check_len = block_len;
-			break;
-	}
-	if ((len < block_len) || (len > check_len)) {
-		ctc_pr_debug("%s: got block length %d != rx length %d\n",
-			     dev->name, block_len, len);
-#ifdef DEBUG
-		ctc_dump_skb(skb, 0);
-#endif
-		*((__u16 *) skb->data) = len;
-		privptr->stats.rx_dropped++;
-		privptr->stats.rx_length_errors++;
-		goto again;
-	}
-	block_len -= 2;
-	if (block_len > 0) {
-		*((__u16 *) skb->data) = block_len;
-		ctc_unpack_skb(ch, skb);
-	}
- again:
-	skb->data = ch->trans_skb_data;
-	skb_reset_tail_pointer(skb);
-	skb->len = 0;
-	if (ctc_checkalloc_buffer(ch, 1))
-		return;
-	ch->ccw[1].count = ch->max_bufsize;
-	rc = ccw_device_start(ch->cdev, &ch->ccw[0], (unsigned long) ch, 0xff, 0);
-	if (rc != 0)
-		ccw_check_return_code(ch, rc, "normal RX");
-}
-
-static void ch_action_rxidle(fsm_instance * fi, int event, void *arg);
-
-/**
- * Initialize connection by sending a __u16 of value 0.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_firstio(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	int rc;
-
-	DBF_TEXT(trace, 4, __FUNCTION__);
-
-	if (fsm_getstate(fi) == CH_STATE_TXIDLE)
-		ctc_pr_debug("%s: remote side issued READ?, init ...\n", ch->id);
-	fsm_deltimer(&ch->timer);
-	if (ctc_checkalloc_buffer(ch, 1))
-		return;
-	if ((fsm_getstate(fi) == CH_STATE_SETUPWAIT) &&
-	    (ch->protocol == CTC_PROTO_OS390)) {
-		/* OS/390 resp. z/OS */
-		if (CHANNEL_DIRECTION(ch->flags) == READ) {
-			*((__u16 *) ch->trans_skb->data) = CTC_INITIAL_BLOCKLEN;
-			fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC,
-				     CH_EVENT_TIMER, ch);
-			ch_action_rxidle(fi, event, arg);
-		} else {
-			struct net_device *dev = ch->netdev;
-			fsm_newstate(fi, CH_STATE_TXIDLE);
-			fsm_event(((struct ctc_priv *) dev->priv)->fsm,
-				  DEV_EVENT_TXUP, dev);
-		}
-		return;
-	}
-
-	/**
-	 * Don't setup a timer for receiving the initial RX frame
-	 * if in compatibility mode, since VM TCP delays the initial
-	 * frame until it has some data to send.
-	 */
-	if ((CHANNEL_DIRECTION(ch->flags) == WRITE) ||
-	    (ch->protocol != CTC_PROTO_S390))
-		fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch);
-
-	*((__u16 *) ch->trans_skb->data) = CTC_INITIAL_BLOCKLEN;
-	ch->ccw[1].count = 2;	/* Transfer only length */
-
-	fsm_newstate(fi, (CHANNEL_DIRECTION(ch->flags) == READ)
-		     ? CH_STATE_RXINIT : CH_STATE_TXINIT);
-	rc = ccw_device_start(ch->cdev, &ch->ccw[0], (unsigned long) ch, 0xff, 0);
-	if (rc != 0) {
-		fsm_deltimer(&ch->timer);
-		fsm_newstate(fi, CH_STATE_SETUPWAIT);
-		ccw_check_return_code(ch, rc, "init IO");
-	}
-	/**
-	 * If in compatibility mode since we don't setup a timer, we
-	 * also signal RX channel up immediately. This enables us
-	 * to send packets early which in turn usually triggers some
-	 * reply from VM TCP which brings up the RX channel to it's
-	 * final state.
-	 */
-	if ((CHANNEL_DIRECTION(ch->flags) == READ) &&
-	    (ch->protocol == CTC_PROTO_S390)) {
-		struct net_device *dev = ch->netdev;
-		fsm_event(((struct ctc_priv *) dev->priv)->fsm, DEV_EVENT_RXUP,
-			  dev);
-	}
-}
-
-/**
- * Got initial data, check it. If OK,
- * notify device statemachine that we are up and
- * running.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_rxidle(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	struct net_device *dev = ch->netdev;
-	__u16 buflen;
-	int rc;
-
-	DBF_TEXT(trace, 4, __FUNCTION__);
-	fsm_deltimer(&ch->timer);
-	buflen = *((__u16 *) ch->trans_skb->data);
-#ifdef DEBUG
-	ctc_pr_debug("%s: Initial RX count %d\n", dev->name, buflen);
-#endif
-	if (buflen >= CTC_INITIAL_BLOCKLEN) {
-		if (ctc_checkalloc_buffer(ch, 1))
-			return;
-		ch->ccw[1].count = ch->max_bufsize;
-		fsm_newstate(fi, CH_STATE_RXIDLE);
-		rc = ccw_device_start(ch->cdev, &ch->ccw[0],
-				      (unsigned long) ch, 0xff, 0);
-		if (rc != 0) {
-			fsm_newstate(fi, CH_STATE_RXINIT);
-			ccw_check_return_code(ch, rc, "initial RX");
-		} else
-			fsm_event(((struct ctc_priv *) dev->priv)->fsm,
-				  DEV_EVENT_RXUP, dev);
-	} else {
-		ctc_pr_debug("%s: Initial RX count %d not %d\n",
-			     dev->name, buflen, CTC_INITIAL_BLOCKLEN);
-		ch_action_firstio(fi, event, arg);
-	}
-}
-
-/**
- * Set channel into extended mode.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_setmode(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	int rc;
-	unsigned long saveflags;
-
-	DBF_TEXT(trace, 4, __FUNCTION__);
-	fsm_deltimer(&ch->timer);
-	fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch);
-	fsm_newstate(fi, CH_STATE_SETUPWAIT);
-	saveflags = 0;	/* avoids compiler warning with
-			   spin_unlock_irqrestore */
-	if (event == CH_EVENT_TIMER)	// only for timer not yet locked
-		spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
-	rc = ccw_device_start(ch->cdev, &ch->ccw[6], (unsigned long) ch, 0xff, 0);
-	if (event == CH_EVENT_TIMER)
-		spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags);
-	if (rc != 0) {
-		fsm_deltimer(&ch->timer);
-		fsm_newstate(fi, CH_STATE_STARTWAIT);
-		ccw_check_return_code(ch, rc, "set Mode");
-	} else
-		ch->retry = 0;
-}
-
-/**
- * Setup channel.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_start(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	unsigned long saveflags;
-	int rc;
-	struct net_device *dev;
-
-	DBF_TEXT(trace, 4, __FUNCTION__);
-	if (ch == NULL) {
-		ctc_pr_warn("ch_action_start ch=NULL\n");
-		return;
-	}
-	if (ch->netdev == NULL) {
-		ctc_pr_warn("ch_action_start dev=NULL, id=%s\n", ch->id);
-		return;
-	}
-	dev = ch->netdev;
-
-#ifdef DEBUG
-	ctc_pr_debug("%s: %s channel start\n", dev->name,
-		     (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX");
-#endif
-
-	if (ch->trans_skb != NULL) {
-		clear_normalized_cda(&ch->ccw[1]);
-		dev_kfree_skb(ch->trans_skb);
-		ch->trans_skb = NULL;
-	}
-	if (CHANNEL_DIRECTION(ch->flags) == READ) {
-		ch->ccw[1].cmd_code = CCW_CMD_READ;
-		ch->ccw[1].flags = CCW_FLAG_SLI;
-		ch->ccw[1].count = 0;
-	} else {
-		ch->ccw[1].cmd_code = CCW_CMD_WRITE;
-		ch->ccw[1].flags = CCW_FLAG_SLI | CCW_FLAG_CC;
-		ch->ccw[1].count = 0;
-	}
-	if (ctc_checkalloc_buffer(ch, 0)) {
-		ctc_pr_notice(
-			"%s: Could not allocate %s trans_skb, delaying "
-			"allocation until first transfer\n",
-			dev->name,
-			(CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX");
-	}
-
-	ch->ccw[0].cmd_code = CCW_CMD_PREPARE;
-	ch->ccw[0].flags = CCW_FLAG_SLI | CCW_FLAG_CC;
-	ch->ccw[0].count = 0;
-	ch->ccw[0].cda = 0;
-	ch->ccw[2].cmd_code = CCW_CMD_NOOP;	/* jointed CE + DE */
-	ch->ccw[2].flags = CCW_FLAG_SLI;
-	ch->ccw[2].count = 0;
-	ch->ccw[2].cda = 0;
-	memcpy(&ch->ccw[3], &ch->ccw[0], sizeof (struct ccw1) * 3);
-	ch->ccw[4].cda = 0;
-	ch->ccw[4].flags &= ~CCW_FLAG_IDA;
-
-	fsm_newstate(fi, CH_STATE_STARTWAIT);
-	fsm_addtimer(&ch->timer, 1000, CH_EVENT_TIMER, ch);
-	spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
-	rc = ccw_device_halt(ch->cdev, (unsigned long) ch);
-	spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags);
-	if (rc != 0) {
-		if (rc != -EBUSY)
-		    fsm_deltimer(&ch->timer);
-		ccw_check_return_code(ch, rc, "initial HaltIO");
-	}
-#ifdef DEBUG
-	ctc_pr_debug("ctc: %s(): leaving\n", __func__);
-#endif
-}
-
-/**
- * Shutdown a channel.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_haltio(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	unsigned long saveflags;
-	int rc;
-	int oldstate;
-
-	DBF_TEXT(trace, 3, __FUNCTION__);
-	fsm_deltimer(&ch->timer);
-	fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch);
-	saveflags = 0;	/* avoids comp warning with
-			   spin_unlock_irqrestore */
-	if (event == CH_EVENT_STOP)	// only for STOP not yet locked
-		spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
-	oldstate = fsm_getstate(fi);
-	fsm_newstate(fi, CH_STATE_TERM);
-	rc = ccw_device_halt(ch->cdev, (unsigned long) ch);
-	if (event == CH_EVENT_STOP)
-		spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags);
-	if (rc != 0) {
-		if (rc != -EBUSY) {
-		    fsm_deltimer(&ch->timer);
-		    fsm_newstate(fi, oldstate);
-		}
-		ccw_check_return_code(ch, rc, "HaltIO in ch_action_haltio");
-	}
-}
-
-/**
- * A channel has successfully been halted.
- * Cleanup it's queue and notify interface statemachine.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_stopped(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	struct net_device *dev = ch->netdev;
-
-	DBF_TEXT(trace, 3, __FUNCTION__);
-	fsm_deltimer(&ch->timer);
-	fsm_newstate(fi, CH_STATE_STOPPED);
-	if (ch->trans_skb != NULL) {
-		clear_normalized_cda(&ch->ccw[1]);
-		dev_kfree_skb(ch->trans_skb);
-		ch->trans_skb = NULL;
-	}
-	if (CHANNEL_DIRECTION(ch->flags) == READ) {
-		skb_queue_purge(&ch->io_queue);
-		fsm_event(((struct ctc_priv *) dev->priv)->fsm,
-			  DEV_EVENT_RXDOWN, dev);
-	} else {
-		ctc_purge_skb_queue(&ch->io_queue);
-		spin_lock(&ch->collect_lock);
-		ctc_purge_skb_queue(&ch->collect_queue);
-		ch->collect_len = 0;
-		spin_unlock(&ch->collect_lock);
-		fsm_event(((struct ctc_priv *) dev->priv)->fsm,
-			  DEV_EVENT_TXDOWN, dev);
-	}
-}
-
-/**
- * A stop command from device statemachine arrived and we are in
- * not operational mode. Set state to stopped.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_stop(fsm_instance * fi, int event, void *arg)
-{
-	fsm_newstate(fi, CH_STATE_STOPPED);
-}
-
-/**
- * A machine check for no path, not operational status or gone device has
- * happened.
- * Cleanup queue and notify interface statemachine.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_fail(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	struct net_device *dev = ch->netdev;
-
-	DBF_TEXT(trace, 3, __FUNCTION__);
-	fsm_deltimer(&ch->timer);
-	fsm_newstate(fi, CH_STATE_NOTOP);
-	if (CHANNEL_DIRECTION(ch->flags) == READ) {
-		skb_queue_purge(&ch->io_queue);
-		fsm_event(((struct ctc_priv *) dev->priv)->fsm,
-			  DEV_EVENT_RXDOWN, dev);
-	} else {
-		ctc_purge_skb_queue(&ch->io_queue);
-		spin_lock(&ch->collect_lock);
-		ctc_purge_skb_queue(&ch->collect_queue);
-		ch->collect_len = 0;
-		spin_unlock(&ch->collect_lock);
-		fsm_event(((struct ctc_priv *) dev->priv)->fsm,
-			  DEV_EVENT_TXDOWN, dev);
-	}
-}
-
-/**
- * Handle error during setup of channel.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_setuperr(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	struct net_device *dev = ch->netdev;
-
-	DBF_TEXT(setup, 3, __FUNCTION__);
-	/**
-	 * Special case: Got UC_RCRESET on setmode.
-	 * This means that remote side isn't setup. In this case
-	 * simply retry after some 10 secs...
-	 */
-	if ((fsm_getstate(fi) == CH_STATE_SETUPWAIT) &&
-	    ((event == CH_EVENT_UC_RCRESET) ||
-	     (event == CH_EVENT_UC_RSRESET))) {
-		fsm_newstate(fi, CH_STATE_STARTRETRY);
-		fsm_deltimer(&ch->timer);
-		fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch);
-		if (CHANNEL_DIRECTION(ch->flags) == READ) {
-			int rc = ccw_device_halt(ch->cdev, (unsigned long) ch);
-			if (rc != 0)
-				ccw_check_return_code(
-					ch, rc, "HaltIO in ch_action_setuperr");
-		}
-		return;
-	}
-
-	ctc_pr_debug("%s: Error %s during %s channel setup state=%s\n",
-		     dev->name, ch_event_names[event],
-		     (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX",
-		     fsm_getstate_str(fi));
-	if (CHANNEL_DIRECTION(ch->flags) == READ) {
-		fsm_newstate(fi, CH_STATE_RXERR);
-		fsm_event(((struct ctc_priv *) dev->priv)->fsm,
-			  DEV_EVENT_RXDOWN, dev);
-	} else {
-		fsm_newstate(fi, CH_STATE_TXERR);
-		fsm_event(((struct ctc_priv *) dev->priv)->fsm,
-			  DEV_EVENT_TXDOWN, dev);
-	}
-}
-
-/**
- * Restart a channel after an error.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_restart(fsm_instance * fi, int event, void *arg)
-{
-	unsigned long saveflags;
-	int oldstate;
-	int rc;
-
-	struct channel *ch = (struct channel *) arg;
-	struct net_device *dev = ch->netdev;
-
-	DBF_TEXT(trace, 3, __FUNCTION__);
-	fsm_deltimer(&ch->timer);
-	ctc_pr_debug("%s: %s channel restart\n", dev->name,
-		     (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX");
-	fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch);
-	oldstate = fsm_getstate(fi);
-	fsm_newstate(fi, CH_STATE_STARTWAIT);
-	saveflags = 0;	/* avoids compiler warning with
-			   spin_unlock_irqrestore */
-	if (event == CH_EVENT_TIMER)	// only for timer not yet locked
-		spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
-	rc = ccw_device_halt(ch->cdev, (unsigned long) ch);
-	if (event == CH_EVENT_TIMER)
-		spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags);
-	if (rc != 0) {
-		if (rc != -EBUSY) {
-		    fsm_deltimer(&ch->timer);
-		    fsm_newstate(fi, oldstate);
-		}
-		ccw_check_return_code(ch, rc, "HaltIO in ch_action_restart");
-	}
-}
-
-/**
- * Handle error during RX initial handshake (exchange of
- * 0-length block header)
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_rxiniterr(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	struct net_device *dev = ch->netdev;
-
-	DBF_TEXT(setup, 3, __FUNCTION__);
-	if (event == CH_EVENT_TIMER) {
-		fsm_deltimer(&ch->timer);
-		ctc_pr_debug("%s: Timeout during RX init handshake\n", dev->name);
-		if (ch->retry++ < 3)
-			ch_action_restart(fi, event, arg);
-		else {
-			fsm_newstate(fi, CH_STATE_RXERR);
-			fsm_event(((struct ctc_priv *) dev->priv)->fsm,
-				  DEV_EVENT_RXDOWN, dev);
-		}
-	} else
-		ctc_pr_warn("%s: Error during RX init handshake\n", dev->name);
-}
-
-/**
- * Notify device statemachine if we gave up initialization
- * of RX channel.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_rxinitfail(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	struct net_device *dev = ch->netdev;
-
-	DBF_TEXT(setup, 3, __FUNCTION__);
-	fsm_newstate(fi, CH_STATE_RXERR);
-	ctc_pr_warn("%s: RX initialization failed\n", dev->name);
-	ctc_pr_warn("%s: RX <-> RX connection detected\n", dev->name);
-	fsm_event(((struct ctc_priv *) dev->priv)->fsm, DEV_EVENT_RXDOWN, dev);
-}
-
-/**
- * Handle RX Unit check remote reset (remote disconnected)
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_rxdisc(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	struct channel *ch2;
-	struct net_device *dev = ch->netdev;
-
-	DBF_TEXT(trace, 3, __FUNCTION__);
-	fsm_deltimer(&ch->timer);
-	ctc_pr_debug("%s: Got remote disconnect, re-initializing ...\n",
-		     dev->name);
-
-	/**
-	 * Notify device statemachine
-	 */
-	fsm_event(((struct ctc_priv *) dev->priv)->fsm, DEV_EVENT_RXDOWN, dev);
-	fsm_event(((struct ctc_priv *) dev->priv)->fsm, DEV_EVENT_TXDOWN, dev);
-
-	fsm_newstate(fi, CH_STATE_DTERM);
-	ch2 = ((struct ctc_priv *) dev->priv)->channel[WRITE];
-	fsm_newstate(ch2->fsm, CH_STATE_DTERM);
-
-	ccw_device_halt(ch->cdev, (unsigned long) ch);
-	ccw_device_halt(ch2->cdev, (unsigned long) ch2);
-}
-
-/**
- * Handle error during TX channel initialization.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_txiniterr(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	struct net_device *dev = ch->netdev;
-
-	DBF_TEXT(setup, 2, __FUNCTION__);
-	if (event == CH_EVENT_TIMER) {
-		fsm_deltimer(&ch->timer);
-		ctc_pr_debug("%s: Timeout during TX init handshake\n", dev->name);
-		if (ch->retry++ < 3)
-			ch_action_restart(fi, event, arg);
-		else {
-			fsm_newstate(fi, CH_STATE_TXERR);
-			fsm_event(((struct ctc_priv *) dev->priv)->fsm,
-				  DEV_EVENT_TXDOWN, dev);
-		}
-	} else
-		ctc_pr_warn("%s: Error during TX init handshake\n", dev->name);
-}
-
-/**
- * Handle TX timeout by retrying operation.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_txretry(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	struct net_device *dev = ch->netdev;
-	unsigned long saveflags;
-
-	DBF_TEXT(trace, 4, __FUNCTION__);
-	fsm_deltimer(&ch->timer);
-	if (ch->retry++ > 3) {
-		ctc_pr_debug("%s: TX retry failed, restarting channel\n",
-			     dev->name);
-		fsm_event(((struct ctc_priv *) dev->priv)->fsm,
-			  DEV_EVENT_TXDOWN, dev);
-		ch_action_restart(fi, event, arg);
-	} else {
-		struct sk_buff *skb;
-
-		ctc_pr_debug("%s: TX retry %d\n", dev->name, ch->retry);
-		if ((skb = skb_peek(&ch->io_queue))) {
-			int rc = 0;
-
-			clear_normalized_cda(&ch->ccw[4]);
-			ch->ccw[4].count = skb->len;
-			if (set_normalized_cda(&ch->ccw[4], skb->data)) {
-				ctc_pr_debug(
-					"%s: IDAL alloc failed, chan restart\n",
-					dev->name);
-				fsm_event(((struct ctc_priv *) dev->priv)->fsm,
-					  DEV_EVENT_TXDOWN, dev);
-				ch_action_restart(fi, event, arg);
-				return;
-			}
-			fsm_addtimer(&ch->timer, 1000, CH_EVENT_TIMER, ch);
-			saveflags = 0;	/* avoids compiler warning with
-					   spin_unlock_irqrestore */
-			if (event == CH_EVENT_TIMER) // only for TIMER not yet locked
-				spin_lock_irqsave(get_ccwdev_lock(ch->cdev),
-						  saveflags);
-			rc = ccw_device_start(ch->cdev, &ch->ccw[3],
-					      (unsigned long) ch, 0xff, 0);
-			if (event == CH_EVENT_TIMER)
-				spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev),
-						       saveflags);
-			if (rc != 0) {
-				fsm_deltimer(&ch->timer);
-				ccw_check_return_code(ch, rc, "TX in ch_action_txretry");
-				ctc_purge_skb_queue(&ch->io_queue);
-			}
-		}
-	}
-
-}
-
-/**
- * Handle fatal errors during an I/O command.
- *
- * @param fi    An instance of a channel statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from channel * upon call.
- */
-static void
-ch_action_iofatal(fsm_instance * fi, int event, void *arg)
-{
-	struct channel *ch = (struct channel *) arg;
-	struct net_device *dev = ch->netdev;
-
-	DBF_TEXT(trace, 3, __FUNCTION__);
-	fsm_deltimer(&ch->timer);
-	if (CHANNEL_DIRECTION(ch->flags) == READ) {
-		ctc_pr_debug("%s: RX I/O error\n", dev->name);
-		fsm_newstate(fi, CH_STATE_RXERR);
-		fsm_event(((struct ctc_priv *) dev->priv)->fsm,
-			  DEV_EVENT_RXDOWN, dev);
-	} else {
-		ctc_pr_debug("%s: TX I/O error\n", dev->name);
-		fsm_newstate(fi, CH_STATE_TXERR);
-		fsm_event(((struct ctc_priv *) dev->priv)->fsm,
-			  DEV_EVENT_TXDOWN, dev);
-	}
-}
-
-static void
-ch_action_reinit(fsm_instance *fi, int event, void *arg)
-{
- 	struct channel *ch = (struct channel *)arg;
- 	struct net_device *dev = ch->netdev;
- 	struct ctc_priv *privptr = dev->priv;
-
-	DBF_TEXT(trace, 4, __FUNCTION__);
- 	ch_action_iofatal(fi, event, arg);
- 	fsm_addtimer(&privptr->restart_timer, 1000, DEV_EVENT_RESTART, dev);
-}
-
-/**
- * The statemachine for a channel.
- */
-static const fsm_node ch_fsm[] = {
-	{CH_STATE_STOPPED,    CH_EVENT_STOP,       fsm_action_nop       },
-	{CH_STATE_STOPPED,    CH_EVENT_START,      ch_action_start      },
-	{CH_STATE_STOPPED,    CH_EVENT_FINSTAT,    fsm_action_nop       },
-	{CH_STATE_STOPPED,    CH_EVENT_MC_FAIL,    fsm_action_nop       },
-
-	{CH_STATE_NOTOP,      CH_EVENT_STOP,       ch_action_stop       },
-	{CH_STATE_NOTOP,      CH_EVENT_START,      fsm_action_nop       },
-	{CH_STATE_NOTOP,      CH_EVENT_FINSTAT,    fsm_action_nop       },
-	{CH_STATE_NOTOP,      CH_EVENT_MC_FAIL,    fsm_action_nop       },
-	{CH_STATE_NOTOP,      CH_EVENT_MC_GOOD,    ch_action_start      },
-
-	{CH_STATE_STARTWAIT,  CH_EVENT_STOP,       ch_action_haltio     },
-	{CH_STATE_STARTWAIT,  CH_EVENT_START,      fsm_action_nop       },
-	{CH_STATE_STARTWAIT,  CH_EVENT_FINSTAT,    ch_action_setmode    },
-	{CH_STATE_STARTWAIT,  CH_EVENT_TIMER,      ch_action_setuperr   },
-	{CH_STATE_STARTWAIT,  CH_EVENT_IO_ENODEV,  ch_action_iofatal    },
-	{CH_STATE_STARTWAIT,  CH_EVENT_IO_EIO,     ch_action_reinit     },
-	{CH_STATE_STARTWAIT,  CH_EVENT_MC_FAIL,    ch_action_fail       },
-
-	{CH_STATE_STARTRETRY, CH_EVENT_STOP,       ch_action_haltio     },
-	{CH_STATE_STARTRETRY, CH_EVENT_TIMER,      ch_action_setmode    },
-	{CH_STATE_STARTRETRY, CH_EVENT_FINSTAT,    fsm_action_nop       },
-	{CH_STATE_STARTRETRY, CH_EVENT_MC_FAIL,    ch_action_fail       },
-
-	{CH_STATE_SETUPWAIT,  CH_EVENT_STOP,       ch_action_haltio     },
-	{CH_STATE_SETUPWAIT,  CH_EVENT_START,      fsm_action_nop       },
-	{CH_STATE_SETUPWAIT,  CH_EVENT_FINSTAT,    ch_action_firstio    },
-	{CH_STATE_SETUPWAIT,  CH_EVENT_UC_RCRESET, ch_action_setuperr   },
-	{CH_STATE_SETUPWAIT,  CH_EVENT_UC_RSRESET, ch_action_setuperr   },
-	{CH_STATE_SETUPWAIT,  CH_EVENT_TIMER,      ch_action_setmode    },
-	{CH_STATE_SETUPWAIT,  CH_EVENT_IO_ENODEV,  ch_action_iofatal    },
-	{CH_STATE_SETUPWAIT,  CH_EVENT_IO_EIO,     ch_action_reinit     },
-	{CH_STATE_SETUPWAIT,  CH_EVENT_MC_FAIL,    ch_action_fail       },
-
-	{CH_STATE_RXINIT,     CH_EVENT_STOP,       ch_action_haltio     },
-	{CH_STATE_RXINIT,     CH_EVENT_START,      fsm_action_nop       },
-	{CH_STATE_RXINIT,     CH_EVENT_FINSTAT,    ch_action_rxidle     },
-	{CH_STATE_RXINIT,     CH_EVENT_UC_RCRESET, ch_action_rxiniterr  },
-	{CH_STATE_RXINIT,     CH_EVENT_UC_RSRESET, ch_action_rxiniterr  },
-	{CH_STATE_RXINIT,     CH_EVENT_TIMER,      ch_action_rxiniterr  },
-	{CH_STATE_RXINIT,     CH_EVENT_ATTNBUSY,   ch_action_rxinitfail },
-	{CH_STATE_RXINIT,     CH_EVENT_IO_ENODEV,  ch_action_iofatal    },
-	{CH_STATE_RXINIT,     CH_EVENT_IO_EIO,     ch_action_reinit     },
-	{CH_STATE_RXINIT,     CH_EVENT_UC_ZERO,    ch_action_firstio    },
-	{CH_STATE_RXINIT,     CH_EVENT_MC_FAIL,    ch_action_fail       },
-
-	{CH_STATE_RXIDLE,     CH_EVENT_STOP,       ch_action_haltio     },
-	{CH_STATE_RXIDLE,     CH_EVENT_START,      fsm_action_nop       },
-	{CH_STATE_RXIDLE,     CH_EVENT_FINSTAT,    ch_action_rx         },
-	{CH_STATE_RXIDLE,     CH_EVENT_UC_RCRESET, ch_action_rxdisc     },
-//      {CH_STATE_RXIDLE,     CH_EVENT_UC_RSRESET, ch_action_rxretry    },
-	{CH_STATE_RXIDLE,     CH_EVENT_IO_ENODEV,  ch_action_iofatal    },
-	{CH_STATE_RXIDLE,     CH_EVENT_IO_EIO,     ch_action_reinit     },
-	{CH_STATE_RXIDLE,     CH_EVENT_MC_FAIL,    ch_action_fail       },
-	{CH_STATE_RXIDLE,     CH_EVENT_UC_ZERO,    ch_action_rx         },
-
-	{CH_STATE_TXINIT,     CH_EVENT_STOP,       ch_action_haltio     },
-	{CH_STATE_TXINIT,     CH_EVENT_START,      fsm_action_nop       },
-	{CH_STATE_TXINIT,     CH_EVENT_FINSTAT,    ch_action_txidle     },
-	{CH_STATE_TXINIT,     CH_EVENT_UC_RCRESET, ch_action_txiniterr  },
-	{CH_STATE_TXINIT,     CH_EVENT_UC_RSRESET, ch_action_txiniterr  },
-	{CH_STATE_TXINIT,     CH_EVENT_TIMER,      ch_action_txiniterr  },
-	{CH_STATE_TXINIT,     CH_EVENT_IO_ENODEV,  ch_action_iofatal    },
-	{CH_STATE_TXINIT,     CH_EVENT_IO_EIO,     ch_action_reinit     },
-	{CH_STATE_TXINIT,     CH_EVENT_MC_FAIL,    ch_action_fail       },
-
-	{CH_STATE_TXIDLE,     CH_EVENT_STOP,       ch_action_haltio     },
-	{CH_STATE_TXIDLE,     CH_EVENT_START,      fsm_action_nop       },
-	{CH_STATE_TXIDLE,     CH_EVENT_FINSTAT,    ch_action_firstio    },
-	{CH_STATE_TXIDLE,     CH_EVENT_UC_RCRESET, fsm_action_nop       },
-	{CH_STATE_TXIDLE,     CH_EVENT_UC_RSRESET, fsm_action_nop       },
-	{CH_STATE_TXIDLE,     CH_EVENT_IO_ENODEV,  ch_action_iofatal    },
-	{CH_STATE_TXIDLE,     CH_EVENT_IO_EIO,     ch_action_reinit     },
-	{CH_STATE_TXIDLE,     CH_EVENT_MC_FAIL,    ch_action_fail       },
-
-	{CH_STATE_TERM,       CH_EVENT_STOP,       fsm_action_nop       },
-	{CH_STATE_TERM,       CH_EVENT_START,      ch_action_restart    },
-	{CH_STATE_TERM,       CH_EVENT_FINSTAT,    ch_action_stopped    },
-	{CH_STATE_TERM,       CH_EVENT_UC_RCRESET, fsm_action_nop       },
-	{CH_STATE_TERM,       CH_EVENT_UC_RSRESET, fsm_action_nop       },
-	{CH_STATE_TERM,       CH_EVENT_MC_FAIL,    ch_action_fail       },
-
-	{CH_STATE_DTERM,      CH_EVENT_STOP,       ch_action_haltio     },
-	{CH_STATE_DTERM,      CH_EVENT_START,      ch_action_restart    },
-	{CH_STATE_DTERM,      CH_EVENT_FINSTAT,    ch_action_setmode    },
-	{CH_STATE_DTERM,      CH_EVENT_UC_RCRESET, fsm_action_nop       },
-	{CH_STATE_DTERM,      CH_EVENT_UC_RSRESET, fsm_action_nop       },
-	{CH_STATE_DTERM,      CH_EVENT_MC_FAIL,    ch_action_fail       },
-
-	{CH_STATE_TX,         CH_EVENT_STOP,       ch_action_haltio     },
-	{CH_STATE_TX,         CH_EVENT_START,      fsm_action_nop       },
-	{CH_STATE_TX,         CH_EVENT_FINSTAT,    ch_action_txdone     },
-	{CH_STATE_TX,         CH_EVENT_UC_RCRESET, ch_action_txretry    },
-	{CH_STATE_TX,         CH_EVENT_UC_RSRESET, ch_action_txretry    },
-	{CH_STATE_TX,         CH_EVENT_TIMER,      ch_action_txretry    },
-	{CH_STATE_TX,         CH_EVENT_IO_ENODEV,  ch_action_iofatal    },
-	{CH_STATE_TX,         CH_EVENT_IO_EIO,     ch_action_reinit     },
-	{CH_STATE_TX,         CH_EVENT_MC_FAIL,    ch_action_fail       },
-
-	{CH_STATE_RXERR,      CH_EVENT_STOP,       ch_action_haltio     },
-	{CH_STATE_TXERR,      CH_EVENT_STOP,       ch_action_haltio     },
-	{CH_STATE_TXERR,      CH_EVENT_MC_FAIL,    ch_action_fail       },
-	{CH_STATE_RXERR,      CH_EVENT_MC_FAIL,    ch_action_fail       },
-};
-
-static const int CH_FSM_LEN = sizeof (ch_fsm) / sizeof (fsm_node);
-
-/**
- * Functions related to setup and device detection.
- *****************************************************************************/
-
-static inline int
-less_than(char *id1, char *id2)
-{
-	int dev1, dev2, i;
-
-	for (i = 0; i < 5; i++) {
-		id1++;
-		id2++;
-	}
-	dev1 = simple_strtoul(id1, &id1, 16);
-	dev2 = simple_strtoul(id2, &id2, 16);
-
-	return (dev1 < dev2);
-}
-
-/**
- * Add a new channel to the list of channels.
- * Keeps the channel list sorted.
- *
- * @param cdev  The ccw_device to be added.
- * @param type  The type class of the new channel.
- *
- * @return 0 on success, !0 on error.
- */
-static int
-add_channel(struct ccw_device *cdev, enum channel_types type)
-{
-	struct channel **c = &channels;
-	struct channel *ch;
-
-	DBF_TEXT(trace, 2, __FUNCTION__);
-	ch = kzalloc(sizeof(struct channel), GFP_KERNEL);
-	if (!ch) {
-		ctc_pr_warn("ctc: Out of memory in add_channel\n");
-		return -1;
-	}
-	/* assure all flags and counters are reset */
-	ch->ccw = kzalloc(8 * sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
-	if (!ch->ccw) {
-		kfree(ch);
-		ctc_pr_warn("ctc: Out of memory in add_channel\n");
-		return -1;
-	}
-
-
-	/**
-	 * "static" ccws are used in the following way:
-	 *
-	 * ccw[0..2] (Channel program for generic I/O):
-	 *           0: prepare
-	 *           1: read or write (depending on direction) with fixed
-	 *              buffer (idal allocated once when buffer is allocated)
-	 *           2: nop
-	 * ccw[3..5] (Channel program for direct write of packets)
-	 *           3: prepare
-	 *           4: write (idal allocated on every write).
-	 *           5: nop
-	 * ccw[6..7] (Channel program for initial channel setup):
-	 *           6: set extended mode
-	 *           7: nop
-	 *
-	 * ch->ccw[0..5] are initialized in ch_action_start because
-	 * the channel's direction is yet unknown here.
-	 */
-	ch->ccw[6].cmd_code = CCW_CMD_SET_EXTENDED;
-	ch->ccw[6].flags = CCW_FLAG_SLI;
-
-	ch->ccw[7].cmd_code = CCW_CMD_NOOP;
-	ch->ccw[7].flags = CCW_FLAG_SLI;
-
-	ch->cdev = cdev;
-	snprintf(ch->id, CTC_ID_SIZE, "ch-%s", cdev->dev.bus_id);
-	ch->type = type;
-	ch->fsm = init_fsm(ch->id, ch_state_names,
-			   ch_event_names, NR_CH_STATES, NR_CH_EVENTS,
-			   ch_fsm, CH_FSM_LEN, GFP_KERNEL);
-	if (ch->fsm == NULL) {
-		ctc_pr_warn("ctc: Could not create FSM in add_channel\n");
-		kfree(ch->ccw);
-		kfree(ch);
-		return -1;
-	}
-	fsm_newstate(ch->fsm, CH_STATE_IDLE);
-	ch->irb = kzalloc(sizeof(struct irb), GFP_KERNEL);
-	if (!ch->irb) {
-		ctc_pr_warn("ctc: Out of memory in add_channel\n");
-		kfree_fsm(ch->fsm);
-		kfree(ch->ccw);
-		kfree(ch);
-		return -1;
-	}
-	while (*c && less_than((*c)->id, ch->id))
-		c = &(*c)->next;
-	if (*c && (!strncmp((*c)->id, ch->id, CTC_ID_SIZE))) {
-		ctc_pr_debug(
-			"ctc: add_channel: device %s already in list, "
-			"using old entry\n", (*c)->id);
-		kfree(ch->irb);
-		kfree_fsm(ch->fsm);
-		kfree(ch->ccw);
-		kfree(ch);
-		return 0;
-	}
-
-	spin_lock_init(&ch->collect_lock);
-
-	fsm_settimer(ch->fsm, &ch->timer);
-	skb_queue_head_init(&ch->io_queue);
-	skb_queue_head_init(&ch->collect_queue);
-	ch->next = *c;
-	*c = ch;
-	return 0;
-}
-
-/**
- * Release a specific channel in the channel list.
- *
- * @param ch Pointer to channel struct to be released.
- */
-static void
-channel_free(struct channel *ch)
-{
-	ch->flags &= ~CHANNEL_FLAGS_INUSE;
-	fsm_newstate(ch->fsm, CH_STATE_IDLE);
-}
-
-/**
- * Remove a specific channel in the channel list.
- *
- * @param ch Pointer to channel struct to be released.
- */
-static void
-channel_remove(struct channel *ch)
-{
-	struct channel **c = &channels;
-
-	DBF_TEXT(trace, 2, __FUNCTION__);
-	if (ch == NULL)
-		return;
-
-	channel_free(ch);
-	while (*c) {
-		if (*c == ch) {
-			*c = ch->next;
-			fsm_deltimer(&ch->timer);
-			kfree_fsm(ch->fsm);
-			clear_normalized_cda(&ch->ccw[4]);
-			if (ch->trans_skb != NULL) {
-				clear_normalized_cda(&ch->ccw[1]);
-				dev_kfree_skb(ch->trans_skb);
-			}
-			kfree(ch->ccw);
-			kfree(ch->irb);
-			kfree(ch);
-			return;
-		}
-		c = &((*c)->next);
-	}
-}
-
-/**
- * Get a specific channel from the channel list.
- *
- * @param type Type of channel we are interested in.
- * @param id Id of channel we are interested in.
- * @param direction Direction we want to use this channel for.
- *
- * @return Pointer to a channel or NULL if no matching channel available.
- */
-static struct channel
-*
-channel_get(enum channel_types type, char *id, int direction)
-{
-	struct channel *ch = channels;
-
-	DBF_TEXT(trace, 3, __FUNCTION__);
-#ifdef DEBUG
-	ctc_pr_debug("ctc: %s(): searching for ch with id %s and type %d\n",
-		     __func__, id, type);
-#endif
-
-	while (ch && ((strncmp(ch->id, id, CTC_ID_SIZE)) || (ch->type != type))) {
-#ifdef DEBUG
-		ctc_pr_debug("ctc: %s(): ch=0x%p (id=%s, type=%d\n",
-			     __func__, ch, ch->id, ch->type);
-#endif
-		ch = ch->next;
-	}
-#ifdef DEBUG
-	ctc_pr_debug("ctc: %s(): ch=0x%pq (id=%s, type=%d\n",
-		     __func__, ch, ch->id, ch->type);
-#endif
-	if (!ch) {
-		ctc_pr_warn("ctc: %s(): channel with id %s "
-			    "and type %d not found in channel list\n",
-			    __func__, id, type);
-	} else {
-		if (ch->flags & CHANNEL_FLAGS_INUSE)
-			ch = NULL;
-		else {
-			ch->flags |= CHANNEL_FLAGS_INUSE;
-			ch->flags &= ~CHANNEL_FLAGS_RWMASK;
-			ch->flags |= (direction == WRITE)
-			    ? CHANNEL_FLAGS_WRITE : CHANNEL_FLAGS_READ;
-			fsm_newstate(ch->fsm, CH_STATE_STOPPED);
-		}
-	}
-	return ch;
-}
-
-/**
- * Return the channel type by name.
- *
- * @param name Name of network interface.
- *
- * @return Type class of channel to be used for that interface.
- */
-static enum channel_types inline
-extract_channel_media(char *name)
-{
-	enum channel_types ret = channel_type_unknown;
-
-	if (name != NULL) {
-		if (strncmp(name, "ctc", 3) == 0)
-			ret = channel_type_parallel;
-		if (strncmp(name, "escon", 5) == 0)
-			ret = channel_type_escon;
-	}
-	return ret;
-}
-
-static long
-__ctc_check_irb_error(struct ccw_device *cdev, struct irb *irb)
-{
-	if (!IS_ERR(irb))
-		return 0;
-
-	switch (PTR_ERR(irb)) {
-	case -EIO:
-		ctc_pr_warn("i/o-error on device %s\n", cdev->dev.bus_id);
-//		CTC_DBF_TEXT(trace, 2, "ckirberr");
-//		CTC_DBF_TEXT_(trace, 2, "  rc%d", -EIO);
-		break;
-	case -ETIMEDOUT:
-		ctc_pr_warn("timeout on device %s\n", cdev->dev.bus_id);
-//		CTC_DBF_TEXT(trace, 2, "ckirberr");
-//		CTC_DBF_TEXT_(trace, 2, "  rc%d", -ETIMEDOUT);
-		break;
-	default:
-		ctc_pr_warn("unknown error %ld on device %s\n", PTR_ERR(irb),
-			   cdev->dev.bus_id);
-//		CTC_DBF_TEXT(trace, 2, "ckirberr");
-//		CTC_DBF_TEXT(trace, 2, "  rc???");
-	}
-	return PTR_ERR(irb);
-}
-
-/**
- * Main IRQ handler.
- *
- * @param cdev    The ccw_device the interrupt is for.
- * @param intparm interruption parameter.
- * @param irb     interruption response block.
- */
-static void
-ctc_irq_handler(struct ccw_device *cdev, unsigned long intparm, struct irb *irb)
-{
-	struct channel *ch;
-	struct net_device *dev;
-	struct ctc_priv *priv;
-
-	DBF_TEXT(trace, 5, __FUNCTION__);
-	if (__ctc_check_irb_error(cdev, irb))
-		return;
-
-	/* Check for unsolicited interrupts. */
-	if (!cdev->dev.driver_data) {
-		ctc_pr_warn("ctc: Got unsolicited irq: %s c-%02x d-%02x\n",
-			    cdev->dev.bus_id, irb->scsw.cstat,
-			    irb->scsw.dstat);
-		return;
-	}
-
-	priv = ((struct ccwgroup_device *)cdev->dev.driver_data)
-		->dev.driver_data;
-
-	/* 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[WRITE];
-	else {
-		ctc_pr_err("ctc: Can't determine channel for interrupt, "
-			   "device %s\n", cdev->dev.bus_id);
-		return;
-	}
-
-	dev = (struct net_device *) (ch->netdev);
-	if (dev == NULL) {
-		ctc_pr_crit("ctc: ctc_irq_handler dev=NULL bus_id=%s, ch=0x%p\n",
-			    cdev->dev.bus_id, ch);
-		return;
-	}
-
-#ifdef DEBUG
-	ctc_pr_debug("%s: interrupt for device: %s received c-%02x d-%02x\n",
-		     dev->name, ch->id, irb->scsw.cstat, irb->scsw.dstat);
-#endif
-
-	/* Copy interruption response block. */
-	memcpy(ch->irb, irb, sizeof(struct irb));
-
-	/* Check for good subchannel return code, otherwise error message */
-	if (ch->irb->scsw.cstat) {
-		fsm_event(ch->fsm, CH_EVENT_SC_UNKNOWN, ch);
-		ctc_pr_warn("%s: subchannel check for device: %s - %02x %02x\n",
-			    dev->name, ch->id, ch->irb->scsw.cstat,
-			    ch->irb->scsw.dstat);
-		return;
-	}
-
-	/* Check the reason-code of a unit check */
-	if (ch->irb->scsw.dstat & DEV_STAT_UNIT_CHECK) {
-		ccw_unit_check(ch, ch->irb->ecw[0]);
-		return;
-	}
-	if (ch->irb->scsw.dstat & DEV_STAT_BUSY) {
-		if (ch->irb->scsw.dstat & DEV_STAT_ATTENTION)
-			fsm_event(ch->fsm, CH_EVENT_ATTNBUSY, ch);
-		else
-			fsm_event(ch->fsm, CH_EVENT_BUSY, ch);
-		return;
-	}
-	if (ch->irb->scsw.dstat & DEV_STAT_ATTENTION) {
-		fsm_event(ch->fsm, CH_EVENT_ATTN, ch);
-		return;
-	}
-	if ((ch->irb->scsw.stctl & SCSW_STCTL_SEC_STATUS) ||
-	    (ch->irb->scsw.stctl == SCSW_STCTL_STATUS_PEND) ||
-	    (ch->irb->scsw.stctl ==
-	     (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND)))
-		fsm_event(ch->fsm, CH_EVENT_FINSTAT, ch);
-	else
-		fsm_event(ch->fsm, CH_EVENT_IRQ, ch);
-
-}
-
-/**
- * Actions for interface - statemachine.
- *****************************************************************************/
-
-/**
- * Startup channels by sending CH_EVENT_START to each channel.
- *
- * @param fi    An instance of an interface statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from struct net_device * upon call.
- */
-static void
-dev_action_start(fsm_instance * fi, int event, void *arg)
-{
-	struct net_device *dev = (struct net_device *) arg;
-	struct ctc_priv *privptr = dev->priv;
-	int direction;
-
-	DBF_TEXT(setup, 3, __FUNCTION__);
-	fsm_deltimer(&privptr->restart_timer);
-	fsm_newstate(fi, DEV_STATE_STARTWAIT_RXTX);
-	for (direction = READ; direction <= WRITE; direction++) {
-		struct channel *ch = privptr->channel[direction];
-		fsm_event(ch->fsm, CH_EVENT_START, ch);
-	}
-}
-
-/**
- * Shutdown channels by sending CH_EVENT_STOP to each channel.
- *
- * @param fi    An instance of an interface statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from struct net_device * upon call.
- */
-static void
-dev_action_stop(fsm_instance * fi, int event, void *arg)
-{
-	struct net_device *dev = (struct net_device *) arg;
-	struct ctc_priv *privptr = dev->priv;
-	int direction;
-
-	DBF_TEXT(trace, 3, __FUNCTION__);
-	fsm_newstate(fi, DEV_STATE_STOPWAIT_RXTX);
-	for (direction = READ; direction <= WRITE; direction++) {
-		struct channel *ch = privptr->channel[direction];
-		fsm_event(ch->fsm, CH_EVENT_STOP, ch);
-	}
-}
-static void
-dev_action_restart(fsm_instance *fi, int event, void *arg)
-{
-	struct net_device *dev = (struct net_device *)arg;
-	struct ctc_priv *privptr = dev->priv;
-
-	DBF_TEXT(trace, 3, __FUNCTION__);
-	ctc_pr_debug("%s: Restarting\n", dev->name);
-	dev_action_stop(fi, event, arg);
-	fsm_event(privptr->fsm, DEV_EVENT_STOP, dev);
-	fsm_addtimer(&privptr->restart_timer, CTC_TIMEOUT_5SEC,
-		     DEV_EVENT_START, dev);
-}
-
-/**
- * Called from channel statemachine
- * when a channel is up and running.
- *
- * @param fi    An instance of an interface statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from struct net_device * upon call.
- */
-static void
-dev_action_chup(fsm_instance * fi, int event, void *arg)
-{
-	struct net_device *dev = (struct net_device *) arg;
-
-	DBF_TEXT(trace, 3, __FUNCTION__);
-	switch (fsm_getstate(fi)) {
-		case DEV_STATE_STARTWAIT_RXTX:
-			if (event == DEV_EVENT_RXUP)
-				fsm_newstate(fi, DEV_STATE_STARTWAIT_TX);
-			else
-				fsm_newstate(fi, DEV_STATE_STARTWAIT_RX);
-			break;
-		case DEV_STATE_STARTWAIT_RX:
-			if (event == DEV_EVENT_RXUP) {
-				fsm_newstate(fi, DEV_STATE_RUNNING);
-				ctc_pr_info("%s: connected with remote side\n",
-					    dev->name);
-				ctc_clear_busy(dev);
-			}
-			break;
-		case DEV_STATE_STARTWAIT_TX:
-			if (event == DEV_EVENT_TXUP) {
-				fsm_newstate(fi, DEV_STATE_RUNNING);
-				ctc_pr_info("%s: connected with remote side\n",
-					    dev->name);
-				ctc_clear_busy(dev);
-			}
-			break;
-		case DEV_STATE_STOPWAIT_TX:
-			if (event == DEV_EVENT_RXUP)
-				fsm_newstate(fi, DEV_STATE_STOPWAIT_RXTX);
-			break;
-		case DEV_STATE_STOPWAIT_RX:
-			if (event == DEV_EVENT_TXUP)
-				fsm_newstate(fi, DEV_STATE_STOPWAIT_RXTX);
-			break;
-	}
-}
-
-/**
- * Called from channel statemachine
- * when a channel has been shutdown.
- *
- * @param fi    An instance of an interface statemachine.
- * @param event The event, just happened.
- * @param arg   Generic pointer, casted from struct net_device * upon call.
- */
-static void
-dev_action_chdown(fsm_instance * fi, int event, void *arg)
-{
-
-	DBF_TEXT(trace, 3, __FUNCTION__);
-	switch (fsm_getstate(fi)) {
-		case DEV_STATE_RUNNING:
-			if (event == DEV_EVENT_TXDOWN)
-				fsm_newstate(fi, DEV_STATE_STARTWAIT_TX);
-			else
-				fsm_newstate(fi, DEV_STATE_STARTWAIT_RX);
-			break;
-		case DEV_STATE_STARTWAIT_RX:
-			if (event == DEV_EVENT_TXDOWN)
-				fsm_newstate(fi, DEV_STATE_STARTWAIT_RXTX);
-			break;
-		case DEV_STATE_STARTWAIT_TX:
-			if (event == DEV_EVENT_RXDOWN)
-				fsm_newstate(fi, DEV_STATE_STARTWAIT_RXTX);
-			break;
-		case DEV_STATE_STOPWAIT_RXTX:
-			if (event == DEV_EVENT_TXDOWN)
-				fsm_newstate(fi, DEV_STATE_STOPWAIT_RX);
-			else
-				fsm_newstate(fi, DEV_STATE_STOPWAIT_TX);
-			break;
-		case DEV_STATE_STOPWAIT_RX:
-			if (event == DEV_EVENT_RXDOWN)
-				fsm_newstate(fi, DEV_STATE_STOPPED);
-			break;
-		case DEV_STATE_STOPWAIT_TX:
-			if (event == DEV_EVENT_TXDOWN)
-				fsm_newstate(fi, DEV_STATE_STOPPED);
-			break;
-	}
-}
-
-static const fsm_node dev_fsm[] = {
-	{DEV_STATE_STOPPED, DEV_EVENT_START, dev_action_start},
-
-	{DEV_STATE_STOPWAIT_RXTX,  DEV_EVENT_START,   dev_action_start   },
-	{DEV_STATE_STOPWAIT_RXTX,  DEV_EVENT_RXDOWN,  dev_action_chdown  },
-	{DEV_STATE_STOPWAIT_RXTX,  DEV_EVENT_TXDOWN,  dev_action_chdown  },
- 	{DEV_STATE_STOPWAIT_RXTX,  DEV_EVENT_RESTART, dev_action_restart },
-
-	{DEV_STATE_STOPWAIT_RX,    DEV_EVENT_START,   dev_action_start   },
-	{DEV_STATE_STOPWAIT_RX,    DEV_EVENT_RXUP,    dev_action_chup    },
-	{DEV_STATE_STOPWAIT_RX,    DEV_EVENT_TXUP,    dev_action_chup    },
-	{DEV_STATE_STOPWAIT_RX,    DEV_EVENT_RXDOWN,  dev_action_chdown  },
- 	{DEV_STATE_STOPWAIT_RX,    DEV_EVENT_RESTART, dev_action_restart },
-
-	{DEV_STATE_STOPWAIT_TX,    DEV_EVENT_START,   dev_action_start   },
-	{DEV_STATE_STOPWAIT_TX,    DEV_EVENT_RXUP,    dev_action_chup    },
-	{DEV_STATE_STOPWAIT_TX,    DEV_EVENT_TXUP,    dev_action_chup    },
-	{DEV_STATE_STOPWAIT_TX,    DEV_EVENT_TXDOWN,  dev_action_chdown  },
- 	{DEV_STATE_STOPWAIT_TX,    DEV_EVENT_RESTART, dev_action_restart },
-
-	{DEV_STATE_STARTWAIT_RXTX, DEV_EVENT_STOP,    dev_action_stop    },
-	{DEV_STATE_STARTWAIT_RXTX, DEV_EVENT_RXUP,    dev_action_chup    },
-	{DEV_STATE_STARTWAIT_RXTX, DEV_EVENT_TXUP,    dev_action_chup    },
-	{DEV_STATE_STARTWAIT_RXTX, DEV_EVENT_RXDOWN,  dev_action_chdown  },
-	{DEV_STATE_STARTWAIT_RXTX, DEV_EVENT_TXDOWN,  dev_action_chdown  },
- 	{DEV_STATE_STARTWAIT_RXTX, DEV_EVENT_RESTART, dev_action_restart },
-
-	{DEV_STATE_STARTWAIT_TX,   DEV_EVENT_STOP,    dev_action_stop    },
-	{DEV_STATE_STARTWAIT_TX,   DEV_EVENT_RXUP,    dev_action_chup    },
-	{DEV_STATE_STARTWAIT_TX,   DEV_EVENT_TXUP,    dev_action_chup    },
-	{DEV_STATE_STARTWAIT_TX,   DEV_EVENT_RXDOWN,  dev_action_chdown  },
- 	{DEV_STATE_STARTWAIT_TX,   DEV_EVENT_RESTART, dev_action_restart },
-
-	{DEV_STATE_STARTWAIT_RX,   DEV_EVENT_STOP,    dev_action_stop    },
-	{DEV_STATE_STARTWAIT_RX,   DEV_EVENT_RXUP,    dev_action_chup    },
-	{DEV_STATE_STARTWAIT_RX,   DEV_EVENT_TXUP,    dev_action_chup    },
-	{DEV_STATE_STARTWAIT_RX,   DEV_EVENT_TXDOWN,  dev_action_chdown  },
- 	{DEV_STATE_STARTWAIT_RX,   DEV_EVENT_RESTART, dev_action_restart },
-
-	{DEV_STATE_RUNNING,        DEV_EVENT_STOP,    dev_action_stop    },
-	{DEV_STATE_RUNNING,        DEV_EVENT_RXDOWN,  dev_action_chdown  },
-	{DEV_STATE_RUNNING,        DEV_EVENT_TXDOWN,  dev_action_chdown  },
-	{DEV_STATE_RUNNING,        DEV_EVENT_TXUP,    fsm_action_nop     },
-	{DEV_STATE_RUNNING,        DEV_EVENT_RXUP,    fsm_action_nop     },
- 	{DEV_STATE_RUNNING,        DEV_EVENT_RESTART, dev_action_restart },
-};
-
-static const int DEV_FSM_LEN = sizeof (dev_fsm) / sizeof (fsm_node);
-
-/**
- * Transmit a packet.
- * This is a helper function for ctc_tx().
- *
- * @param ch Channel to be used for sending.
- * @param skb Pointer to struct sk_buff of packet to send.
- *            The linklevel header has already been set up
- *            by ctc_tx().
- *
- * @return 0 on success, -ERRNO on failure. (Never fails.)
- */
-static int
-transmit_skb(struct channel *ch, struct sk_buff *skb)
-{
-	unsigned long saveflags;
-	struct ll_header header;
-	int rc = 0;
-
-	DBF_TEXT(trace, 5, __FUNCTION__);
-	/* we need to acquire the lock for testing the state
-	 * otherwise we can have an IRQ changing the state to
-	 * TXIDLE after the test but before acquiring the lock.
-	 */
-	spin_lock_irqsave(&ch->collect_lock, saveflags);
-	if (fsm_getstate(ch->fsm) != CH_STATE_TXIDLE) {
-		int l = skb->len + LL_HEADER_LENGTH;
-
-		if (ch->collect_len + l > ch->max_bufsize - 2) {
-			spin_unlock_irqrestore(&ch->collect_lock, saveflags);
-			return -EBUSY;
-		} else {
-			atomic_inc(&skb->users);
-			header.length = l;
-			header.type = skb->protocol;
-			header.unused = 0;
-			memcpy(skb_push(skb, LL_HEADER_LENGTH), &header,
-			       LL_HEADER_LENGTH);
-			skb_queue_tail(&ch->collect_queue, skb);
-			ch->collect_len += l;
-		}
-		spin_unlock_irqrestore(&ch->collect_lock, saveflags);
-	} else {
-		__u16 block_len;
-		int ccw_idx;
-		struct sk_buff *nskb;
-		unsigned long hi;
-		spin_unlock_irqrestore(&ch->collect_lock, saveflags);
-		/**
-		 * Protect skb against beeing free'd by upper
-		 * layers.
-		 */
-		atomic_inc(&skb->users);
-		ch->prof.txlen += skb->len;
-		header.length = skb->len + LL_HEADER_LENGTH;
-		header.type = skb->protocol;
-		header.unused = 0;
-		memcpy(skb_push(skb, LL_HEADER_LENGTH), &header,
-		       LL_HEADER_LENGTH);
-		block_len = skb->len + 2;
-		*((__u16 *) skb_push(skb, 2)) = block_len;
-
-		/**
-		 * IDAL support in CTC is broken, so we have to
-		 * care about skb's above 2G ourselves.
-		 */
-		hi = ((unsigned long)skb_tail_pointer(skb) +
-		      LL_HEADER_LENGTH) >> 31;
-		if (hi) {
-			nskb = alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA);
-			if (!nskb) {
-				atomic_dec(&skb->users);
-				skb_pull(skb, LL_HEADER_LENGTH + 2);
-				ctc_clear_busy(ch->netdev);
-				return -ENOMEM;
-			} else {
-				memcpy(skb_put(nskb, skb->len),
-				       skb->data, skb->len);
-				atomic_inc(&nskb->users);
-				atomic_dec(&skb->users);
-				dev_kfree_skb_irq(skb);
-				skb = nskb;
-			}
-		}
-
-		ch->ccw[4].count = block_len;
-		if (set_normalized_cda(&ch->ccw[4], skb->data)) {
-			/**
-			 * idal allocation failed, try via copying to
-			 * trans_skb. trans_skb usually has a pre-allocated
-			 * idal.
-			 */
-			if (ctc_checkalloc_buffer(ch, 1)) {
-				/**
-				 * Remove our header. It gets added
-				 * again on retransmit.
-				 */
-				atomic_dec(&skb->users);
-				skb_pull(skb, LL_HEADER_LENGTH + 2);
-				ctc_clear_busy(ch->netdev);
-				return -EBUSY;
-			}
-
-			skb_reset_tail_pointer(ch->trans_skb);
-			ch->trans_skb->len = 0;
-			ch->ccw[1].count = skb->len;
-			skb_copy_from_linear_data(skb, skb_put(ch->trans_skb,
-							       skb->len),
-						  skb->len);
-			atomic_dec(&skb->users);
-			dev_kfree_skb_irq(skb);
-			ccw_idx = 0;
-		} else {
-			skb_queue_tail(&ch->io_queue, skb);
-			ccw_idx = 3;
-		}
-		ch->retry = 0;
-		fsm_newstate(ch->fsm, CH_STATE_TX);
-		fsm_addtimer(&ch->timer, CTC_TIMEOUT_5SEC, CH_EVENT_TIMER, ch);
-		spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags);
-		ch->prof.send_stamp = current_kernel_time();
-		rc = ccw_device_start(ch->cdev, &ch->ccw[ccw_idx],
-				      (unsigned long) ch, 0xff, 0);
-		spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags);
-		if (ccw_idx == 3)
-			ch->prof.doios_single++;
-		if (rc != 0) {
-			fsm_deltimer(&ch->timer);
-			ccw_check_return_code(ch, rc, "single skb TX");
-			if (ccw_idx == 3)
-				skb_dequeue_tail(&ch->io_queue);
-			/**
-			 * Remove our header. It gets added
-			 * again on retransmit.
-			 */
-			skb_pull(skb, LL_HEADER_LENGTH + 2);
-		} else {
-			if (ccw_idx == 0) {
-				struct net_device *dev = ch->netdev;
-				struct ctc_priv *privptr = dev->priv;
-				privptr->stats.tx_packets++;
-				privptr->stats.tx_bytes +=
-				    skb->len - LL_HEADER_LENGTH;
-			}
-		}
-	}
-
-	ctc_clear_busy(ch->netdev);
-	return rc;
-}
-
-/**
- * Interface API for upper network layers
- *****************************************************************************/
-
-/**
- * Open an interface.
- * Called from generic network layer when ifconfig up is run.
- *
- * @param dev Pointer to interface struct.
- *
- * @return 0 on success, -ERRNO on failure. (Never fails.)
- */
-static int
-ctc_open(struct net_device * dev)
-{
-	DBF_TEXT(trace, 5, __FUNCTION__);
-	fsm_event(((struct ctc_priv *) dev->priv)->fsm, DEV_EVENT_START, dev);
-	return 0;
-}
-
-/**
- * Close an interface.
- * Called from generic network layer when ifconfig down is run.
- *
- * @param dev Pointer to interface struct.
- *
- * @return 0 on success, -ERRNO on failure. (Never fails.)
- */
-static int
-ctc_close(struct net_device * dev)
-{
-	DBF_TEXT(trace, 5, __FUNCTION__);
-	fsm_event(((struct ctc_priv *) dev->priv)->fsm, DEV_EVENT_STOP, dev);
-	return 0;
-}
-
-/**
- * Start transmission of a packet.
- * Called from generic network device layer.
- *
- * @param skb Pointer to buffer containing the packet.
- * @param dev Pointer to interface struct.
- *
- * @return 0 if packet consumed, !0 if packet rejected.
- *         Note: If we return !0, then the packet is free'd by
- *               the generic network layer.
- */
-static int
-ctc_tx(struct sk_buff *skb, struct net_device * dev)
-{
-	int rc = 0;
-	struct ctc_priv *privptr = (struct ctc_priv *) dev->priv;
-
-	DBF_TEXT(trace, 5, __FUNCTION__);
-	/**
-	 * Some sanity checks ...
-	 */
-	if (skb == NULL) {
-		ctc_pr_warn("%s: NULL sk_buff passed\n", dev->name);
-		privptr->stats.tx_dropped++;
-		return 0;
-	}
-	if (skb_headroom(skb) < (LL_HEADER_LENGTH + 2)) {
-		ctc_pr_warn("%s: Got sk_buff with head room < %ld bytes\n",
-			    dev->name, LL_HEADER_LENGTH + 2);
-		dev_kfree_skb(skb);
-		privptr->stats.tx_dropped++;
-		return 0;
-	}
-
-	/**
-	 * If channels are not running, try to restart them
-	 * and throw away packet.
-	 */
-	if (fsm_getstate(privptr->fsm) != DEV_STATE_RUNNING) {
-		fsm_event(privptr->fsm, DEV_EVENT_START, dev);
-		dev_kfree_skb(skb);
-		privptr->stats.tx_dropped++;
-		privptr->stats.tx_errors++;
-		privptr->stats.tx_carrier_errors++;
-		return 0;
-	}
-
-	if (ctc_test_and_set_busy(dev))
-		return -EBUSY;
-
-	dev->trans_start = jiffies;
-	if (transmit_skb(privptr->channel[WRITE], skb) != 0)
-		rc = 1;
-	return rc;
-}
-
-/**
- * Sets MTU of an interface.
- *
- * @param dev     Pointer to interface struct.
- * @param new_mtu The new MTU to use for this interface.
- *
- * @return 0 on success, -EINVAL if MTU is out of valid range.
- *         (valid range is 576 .. 65527). If VM is on the
- *         remote side, maximum MTU is 32760, however this is
- *         <em>not</em> checked here.
- */
-static int
-ctc_change_mtu(struct net_device * dev, int new_mtu)
-{
-	struct ctc_priv *privptr = (struct ctc_priv *) dev->priv;
-
-	DBF_TEXT(trace, 3, __FUNCTION__);
-	if ((new_mtu < 576) || (new_mtu > 65527) ||
-	    (new_mtu > (privptr->channel[READ]->max_bufsize -
-			LL_HEADER_LENGTH - 2)))
-		return -EINVAL;
-	dev->mtu = new_mtu;
-	dev->hard_header_len = LL_HEADER_LENGTH + 2;
-	return 0;
-}
-
-/**
- * Returns interface statistics of a device.
- *
- * @param dev Pointer to interface struct.
- *
- * @return Pointer to stats struct of this interface.
- */
-static struct net_device_stats *
-ctc_stats(struct net_device * dev)
-{
-	return &((struct ctc_priv *) dev->priv)->stats;
-}
-
-/*
- * sysfs attributes
- */
-
-static ssize_t
-buffer_show(struct device *dev, struct device_attribute *attr, char *buf)
-{
-	struct ctc_priv *priv;
-
-	priv = dev->driver_data;
-	if (!priv)
-		return -ENODEV;
-	return sprintf(buf, "%d\n",
-			priv->buffer_size);
-}
-
-static ssize_t
-buffer_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
-{
-	struct ctc_priv *priv;
-	struct net_device *ndev;
-	int bs1;
-	char buffer[16];
-
-	DBF_TEXT(trace, 3, __FUNCTION__);
-	DBF_TEXT(trace, 3, buf);
-	priv = dev->driver_data;
-	if (!priv) {
-		DBF_TEXT(trace, 3, "bfnopriv");
-		return -ENODEV;
-	}
-
-	sscanf(buf, "%u", &bs1);
-	if (bs1 > CTC_BUFSIZE_LIMIT)
-		goto einval;
-	if (bs1 < (576 + LL_HEADER_LENGTH + 2))
-		goto einval;
-	priv->buffer_size = bs1;	// just to overwrite the default
-
-	ndev = priv->channel[READ]->netdev;
-	if (!ndev) {
-		DBF_TEXT(trace, 3, "bfnondev");
-		return -ENODEV;
-	}
-
-	if ((ndev->flags & IFF_RUNNING) &&
-	    (bs1 < (ndev->mtu + LL_HEADER_LENGTH + 2)))
-		goto einval;
-
-	priv->channel[READ]->max_bufsize = bs1;
-	priv->channel[WRITE]->max_bufsize = bs1;
-	if (!(ndev->flags & IFF_RUNNING))
-		ndev->mtu = bs1 - LL_HEADER_LENGTH - 2;
-	priv->channel[READ]->flags |= CHANNEL_FLAGS_BUFSIZE_CHANGED;
-	priv->channel[WRITE]->flags |= CHANNEL_FLAGS_BUFSIZE_CHANGED;
-
-	sprintf(buffer, "%d",priv->buffer_size);
-	DBF_TEXT(trace, 3, buffer);
-	return count;
-
-einval:
-	DBF_TEXT(trace, 3, "buff_err");
-	return -EINVAL;
-}
-
-static ssize_t
-loglevel_show(struct device *dev, struct device_attribute *attr, char *buf)
-{
-	return sprintf(buf, "%d\n", loglevel);
-}
-
-static ssize_t
-loglevel_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
-{
-	int ll1;
-
-	DBF_TEXT(trace, 5, __FUNCTION__);
-	sscanf(buf, "%i", &ll1);
-
-	if ((ll1 > CTC_LOGLEVEL_MAX) || (ll1 < 0))
-		return -EINVAL;
-	loglevel = ll1;
-	return count;
-}
-
-static void
-ctc_print_statistics(struct ctc_priv *priv)
-{
-	char *sbuf;
-	char *p;
-
-	DBF_TEXT(trace, 4, __FUNCTION__);
-	if (!priv)
-		return;
-	sbuf = kmalloc(2048, GFP_KERNEL);
-	if (sbuf == NULL)
-		return;
-	p = sbuf;
-
-	p += sprintf(p, "  Device FSM state: %s\n",
-		     fsm_getstate_str(priv->fsm));
-	p += sprintf(p, "  RX channel FSM state: %s\n",
-		     fsm_getstate_str(priv->channel[READ]->fsm));
-	p += sprintf(p, "  TX channel FSM state: %s\n",
-		     fsm_getstate_str(priv->channel[WRITE]->fsm));
-	p += sprintf(p, "  Max. TX buffer used: %ld\n",
-		     priv->channel[WRITE]->prof.maxmulti);
-	p += sprintf(p, "  Max. chained SKBs: %ld\n",
-		     priv->channel[WRITE]->prof.maxcqueue);
-	p += sprintf(p, "  TX single write ops: %ld\n",
-		     priv->channel[WRITE]->prof.doios_single);
-	p += sprintf(p, "  TX multi write ops: %ld\n",
-		     priv->channel[WRITE]->prof.doios_multi);
-	p += sprintf(p, "  Netto bytes written: %ld\n",
-		     priv->channel[WRITE]->prof.txlen);
-	p += sprintf(p, "  Max. TX IO-time: %ld\n",
-		     priv->channel[WRITE]->prof.tx_time);
-
-	ctc_pr_debug("Statistics for %s:\n%s",
-		     priv->channel[WRITE]->netdev->name, sbuf);
-	kfree(sbuf);
-	return;
-}
-
-static ssize_t
-stats_show(struct device *dev, struct device_attribute *attr, char *buf)
-{
-	struct ctc_priv *priv = dev->driver_data;
-	if (!priv)
-		return -ENODEV;
-	ctc_print_statistics(priv);
-	return sprintf(buf, "0\n");
-}
-
-static ssize_t
-stats_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
-{
-	struct ctc_priv *priv = dev->driver_data;
-	if (!priv)
-		return -ENODEV;
-	/* Reset statistics */
-	memset(&priv->channel[WRITE]->prof, 0,
-			sizeof(priv->channel[WRITE]->prof));
-	return count;
-}
-
-static void
-ctc_netdev_unregister(struct net_device * dev)
-{
-	struct ctc_priv *privptr;
-
-	if (!dev)
-		return;
-	privptr = (struct ctc_priv *) dev->priv;
-	unregister_netdev(dev);
-}
-
-static int
-ctc_netdev_register(struct net_device * dev)
-{
-	return register_netdev(dev);
-}
-
-static void
-ctc_free_netdevice(struct net_device * dev, int free_dev)
-{
-	struct ctc_priv *privptr;
-	if (!dev)
-		return;
-	privptr = dev->priv;
-	if (privptr) {
-		if (privptr->fsm)
-			kfree_fsm(privptr->fsm);
-		kfree(privptr);
-	}
-#ifdef MODULE
-	if (free_dev)
-		free_netdev(dev);
-#endif
-}
-
-static ssize_t
-ctc_proto_show(struct device *dev, struct device_attribute *attr, char *buf)
-{
-	struct ctc_priv *priv;
-
-	priv = dev->driver_data;
-	if (!priv)
-		return -ENODEV;
-
-	return sprintf(buf, "%d\n", priv->protocol);
-}
-
-static ssize_t
-ctc_proto_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
-{
-	struct ctc_priv *priv;
-	int value;
-
-	DBF_TEXT(trace, 3, __FUNCTION__);
-	pr_debug("%s() called\n", __FUNCTION__);
-
-	priv = dev->driver_data;
-	if (!priv)
-		return -ENODEV;
-	sscanf(buf, "%u", &value);
-	if (!((value == CTC_PROTO_S390)  ||
-	      (value == CTC_PROTO_LINUX) ||
-	      (value == CTC_PROTO_OS390)))
-		return -EINVAL;
-	priv->protocol = value;
-
-	return count;
-}
-
-static ssize_t
-ctc_type_show(struct device *dev, struct device_attribute *attr, char *buf)
-{
-	struct ccwgroup_device *cgdev;
-
-	cgdev = to_ccwgroupdev(dev);
-	if (!cgdev)
-		return -ENODEV;
-
-	return sprintf(buf, "%s\n", cu3088_type[cgdev->cdev[0]->id.driver_info]);
-}
-
-static DEVICE_ATTR(buffer, 0644, buffer_show, buffer_write);
-static DEVICE_ATTR(protocol, 0644, ctc_proto_show, ctc_proto_store);
-static DEVICE_ATTR(type, 0444, ctc_type_show, NULL);
-
-static DEVICE_ATTR(loglevel, 0644, loglevel_show, loglevel_write);
-static DEVICE_ATTR(stats, 0644, stats_show, stats_write);
-
-static struct attribute *ctc_attr[] = {
-	&dev_attr_protocol.attr,
-	&dev_attr_type.attr,
-	&dev_attr_buffer.attr,
-	NULL,
-};
-
-static struct attribute_group ctc_attr_group = {
-	.attrs = ctc_attr,
-};
-
-static int
-ctc_add_attributes(struct device *dev)
-{
-	int rc;
-
-	rc = device_create_file(dev, &dev_attr_loglevel);
-	if (rc)
-		goto out;
-	rc = device_create_file(dev, &dev_attr_stats);
-	if (!rc)
-		goto out;
-	device_remove_file(dev, &dev_attr_loglevel);
-out:
-	return rc;
-}
-
-static void
-ctc_remove_attributes(struct device *dev)
-{
-	device_remove_file(dev, &dev_attr_stats);
-	device_remove_file(dev, &dev_attr_loglevel);
-}
-
-static int
-ctc_add_files(struct device *dev)
-{
-	pr_debug("%s() called\n", __FUNCTION__);
-
-	return sysfs_create_group(&dev->kobj, &ctc_attr_group);
-}
-
-static void
-ctc_remove_files(struct device *dev)
-{
-	pr_debug("%s() called\n", __FUNCTION__);
-
-	sysfs_remove_group(&dev->kobj, &ctc_attr_group);
-}
-
-/**
- * Add ctc specific attributes.
- * Add ctc private data.
- *
- * @param cgdev pointer to ccwgroup_device just added
- *
- * @returns 0 on success, !0 on failure.
- */
-static int
-ctc_probe_device(struct ccwgroup_device *cgdev)
-{
-	struct ctc_priv *priv;
-	int rc;
-	char buffer[16];
-
-	pr_debug("%s() called\n", __FUNCTION__);
-	DBF_TEXT(setup, 3, __FUNCTION__);
-
-	if (!get_device(&cgdev->dev))
-		return -ENODEV;
-
-	priv = kzalloc(sizeof(struct ctc_priv), GFP_KERNEL);
-	if (!priv) {
-		ctc_pr_err("%s: Out of memory\n", __func__);
-		put_device(&cgdev->dev);
-		return -ENOMEM;
-	}
-
-	rc = ctc_add_files(&cgdev->dev);
-	if (rc) {
-		kfree(priv);
-		put_device(&cgdev->dev);
-		return rc;
-	}
-	priv->buffer_size = CTC_BUFSIZE_DEFAULT;
-	cgdev->cdev[0]->handler = ctc_irq_handler;
-	cgdev->cdev[1]->handler = ctc_irq_handler;
-	cgdev->dev.driver_data = priv;
-
-	sprintf(buffer, "%p", priv);
-	DBF_TEXT(data, 3, buffer);
-
-	sprintf(buffer, "%u", (unsigned int)sizeof(struct ctc_priv));
-	DBF_TEXT(data, 3, buffer);
-
-	sprintf(buffer, "%p", &channels);
-	DBF_TEXT(data, 3, buffer);
-
-	sprintf(buffer, "%u", (unsigned int)sizeof(struct channel));
-	DBF_TEXT(data, 3, buffer);
-
-	return 0;
-}
-
-/**
- * Device setup function called by alloc_netdev().
- *
- * @param dev  Device to be setup.
- */
-void ctc_init_netdevice(struct net_device * dev)
-{
-	DBF_TEXT(setup, 3, __FUNCTION__);
-
-	if (dev->mtu == 0)
-		dev->mtu = CTC_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2;
-	dev->hard_start_xmit = ctc_tx;
-	dev->open = ctc_open;
-	dev->stop = ctc_close;
-	dev->get_stats = ctc_stats;
-	dev->change_mtu = ctc_change_mtu;
-	dev->hard_header_len = LL_HEADER_LENGTH + 2;
-	dev->addr_len = 0;
-	dev->type = ARPHRD_SLIP;
-	dev->tx_queue_len = 100;
-	dev->flags = IFF_POINTOPOINT | IFF_NOARP;
-}
-
-
-/**
- *
- * Setup an interface.
- *
- * @param cgdev  Device to be setup.
- *
- * @returns 0 on success, !0 on failure.
- */
-static int
-ctc_new_device(struct ccwgroup_device *cgdev)
-{
-	char read_id[CTC_ID_SIZE];
-	char write_id[CTC_ID_SIZE];
-	int direction;
-	enum channel_types type;
-	struct ctc_priv *privptr;
-	struct net_device *dev;
-	int ret;
-	char buffer[16];
-
-	pr_debug("%s() called\n", __FUNCTION__);
-	DBF_TEXT(setup, 3, __FUNCTION__);
-
-	privptr = cgdev->dev.driver_data;
-	if (!privptr)
-		return -ENODEV;
-
-	sprintf(buffer, "%d", privptr->buffer_size);
-	DBF_TEXT(setup, 3, buffer);
-
-	type = get_channel_type(&cgdev->cdev[0]->id);
-
-	snprintf(read_id, CTC_ID_SIZE, "ch-%s", cgdev->cdev[0]->dev.bus_id);
-	snprintf(write_id, CTC_ID_SIZE, "ch-%s", cgdev->cdev[1]->dev.bus_id);
-
-	if (add_channel(cgdev->cdev[0], type))
-		return -ENOMEM;
-	if (add_channel(cgdev->cdev[1], type))
-		return -ENOMEM;
-
-	ret = ccw_device_set_online(cgdev->cdev[0]);
-	if (ret != 0) {
-			printk(KERN_WARNING
-		 	"ccw_device_set_online (cdev[0]) failed with ret = %d\n", ret);
-	}
-
-	ret = ccw_device_set_online(cgdev->cdev[1]);
-	if (ret != 0) {
-			printk(KERN_WARNING
-		 	"ccw_device_set_online (cdev[1]) failed with ret = %d\n", ret);
-	}
-
-	dev = alloc_netdev(0, "ctc%d", ctc_init_netdevice);
-	if (!dev) {
-		ctc_pr_warn("ctc_init_netdevice failed\n");
-		goto out;
-	}
-	dev->priv = privptr;
-
-	privptr->fsm = init_fsm("ctcdev", dev_state_names,
-			dev_event_names, CTC_NR_DEV_STATES, CTC_NR_DEV_EVENTS,
-			dev_fsm, DEV_FSM_LEN, GFP_KERNEL);
-	if (privptr->fsm == NULL) {
-		free_netdev(dev);
-		goto out;
-	}
-	fsm_newstate(privptr->fsm, DEV_STATE_STOPPED);
-	fsm_settimer(privptr->fsm, &privptr->restart_timer);
-
-	for (direction = READ; direction <= WRITE; direction++) {
-		privptr->channel[direction] =
-		    channel_get(type, direction == READ ? read_id : write_id,
-				direction);
-		if (privptr->channel[direction] == NULL) {
-			if (direction == WRITE)
-				channel_free(privptr->channel[READ]);
-
-			ctc_free_netdevice(dev, 1);
-			goto out;
-		}
-		privptr->channel[direction]->netdev = dev;
-		privptr->channel[direction]->protocol = privptr->protocol;
-		privptr->channel[direction]->max_bufsize = privptr->buffer_size;
-	}
-	/* sysfs magic */
-	SET_NETDEV_DEV(dev, &cgdev->dev);
-
-	if (ctc_netdev_register(dev) != 0) {
-		ctc_free_netdevice(dev, 1);
-		goto out;
-	}
-
-	if (ctc_add_attributes(&cgdev->dev)) {
-		ctc_netdev_unregister(dev);
-		dev->priv = NULL;
-		ctc_free_netdevice(dev, 1);
-		goto out;
-	}
-
-	strlcpy(privptr->fsm->name, dev->name, sizeof (privptr->fsm->name));
-
-	print_banner();
-
-	ctc_pr_info("%s: read: %s, write: %s, proto: %d\n",
-		    dev->name, privptr->channel[READ]->id,
-		    privptr->channel[WRITE]->id, privptr->protocol);
-
-	return 0;
-out:
-	ccw_device_set_offline(cgdev->cdev[1]);
-	ccw_device_set_offline(cgdev->cdev[0]);
-
-	return -ENODEV;
-}
-
-/**
- * Shutdown an interface.
- *
- * @param cgdev  Device to be shut down.
- *
- * @returns 0 on success, !0 on failure.
- */
-static int
-ctc_shutdown_device(struct ccwgroup_device *cgdev)
-{
-	struct ctc_priv *priv;
-	struct net_device *ndev;
-
-	DBF_TEXT(setup, 3, __FUNCTION__);
-	pr_debug("%s() called\n", __FUNCTION__);
-
-
-	priv = cgdev->dev.driver_data;
-	ndev = NULL;
-	if (!priv)
-		return -ENODEV;
-
-	if (priv->channel[READ]) {
-		ndev = priv->channel[READ]->netdev;
-
-		/* Close the device */
-		ctc_close(ndev);
-		ndev->flags &=~IFF_RUNNING;
-
-		ctc_remove_attributes(&cgdev->dev);
-
-		channel_free(priv->channel[READ]);
-	}
-	if (priv->channel[WRITE])
-		channel_free(priv->channel[WRITE]);
-
-	if (ndev) {
-		ctc_netdev_unregister(ndev);
-		ndev->priv = NULL;
-		ctc_free_netdevice(ndev, 1);
-	}
-
-	if (priv->fsm)
-		kfree_fsm(priv->fsm);
-
-	ccw_device_set_offline(cgdev->cdev[1]);
-	ccw_device_set_offline(cgdev->cdev[0]);
-
-	if (priv->channel[READ])
-		channel_remove(priv->channel[READ]);
-	if (priv->channel[WRITE])
-		channel_remove(priv->channel[WRITE]);
-	priv->channel[READ] = priv->channel[WRITE] = NULL;
-
-	return 0;
-
-}
-
-static void
-ctc_remove_device(struct ccwgroup_device *cgdev)
-{
-	struct ctc_priv *priv;
-
-	pr_debug("%s() called\n", __FUNCTION__);
-	DBF_TEXT(setup, 3, __FUNCTION__);
-
-	priv = cgdev->dev.driver_data;
-	if (!priv)
-		return;
-	if (cgdev->state == CCWGROUP_ONLINE)
-		ctc_shutdown_device(cgdev);
-	ctc_remove_files(&cgdev->dev);
-	cgdev->dev.driver_data = NULL;
-	kfree(priv);
-	put_device(&cgdev->dev);
-}
-
-static struct ccwgroup_driver ctc_group_driver = {
-	.owner       = THIS_MODULE,
-	.name        = "ctc",
-	.max_slaves  = 2,
-	.driver_id   = 0xC3E3C3,
-	.probe       = ctc_probe_device,
-	.remove      = ctc_remove_device,
-	.set_online  = ctc_new_device,
-	.set_offline = ctc_shutdown_device,
-};
-
-/**
- * Module related routines
- *****************************************************************************/
-
-/**
- * Prepare to be unloaded. Free IRQ's and release all resources.
- * This is called just before this module is unloaded. It is
- * <em>not</em> called, if the usage count is !0, so we don't need to check
- * for that.
- */
-static void __exit
-ctc_exit(void)
-{
-	DBF_TEXT(setup, 3, __FUNCTION__);
-	unregister_cu3088_discipline(&ctc_group_driver);
-	ctc_unregister_dbf_views();
-	ctc_pr_info("CTC driver unloaded\n");
-}
-
-/**
- * Initialize module.
- * This is called just after the module is loaded.
- *
- * @return 0 on success, !0 on error.
- */
-static int __init
-ctc_init(void)
-{
-	int ret = 0;
-
-	loglevel = CTC_LOGLEVEL_DEFAULT;
-
-	DBF_TEXT(setup, 3, __FUNCTION__);
-
-	print_banner();
-
-	ret = ctc_register_dbf_views();
-	if (ret){
-		ctc_pr_crit("ctc_init failed with ctc_register_dbf_views rc = %d\n", ret);
-		return ret;
-	}
-	ret = register_cu3088_discipline(&ctc_group_driver);
-	if (ret) {
-		ctc_unregister_dbf_views();
-	}
-	return ret;
-}
-
-module_init(ctc_init);
-module_exit(ctc_exit);
-
-/* --- This is the END my friend --- */
Index: linux-2.6-uschi/drivers/s390/net/ctcmain.h
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/ctcmain.h
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * CTC / ESCON network driver
- *
- * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation
- * Author(s): Fritz Elfert (elfert@de.ibm.com, felfert@millenux.com)
-	      Peter Tiedemann (ptiedem@de.ibm.com)
- *
- *
- * Documentation used:
- *  - Principles of Operation (IBM doc#: SA22-7201-06)
- *  - Common IO/-Device Commands and Self Description (IBM doc#: SA22-7204-02)
- *  - Common IO/-Device Commands and Self Description (IBM doc#: SN22-5535)
- *  - ESCON Channel-to-Channel Adapter (IBM doc#: SA22-7203-00)
- *  - ESCON I/O Interface (IBM doc#: SA22-7202-029
- *
- * 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
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#ifndef _CTCMAIN_H_
-#define _CTCMAIN_H_
-
-#include <asm/ccwdev.h>
-#include <asm/ccwgroup.h>
-
-#include <linux/skbuff.h>
-#include <linux/netdevice.h>
-
-#include "fsm.h"
-#include "cu3088.h"
-
-
-/**
- * CCW commands, used in this driver.
- */
-#define CCW_CMD_WRITE		0x01
-#define CCW_CMD_READ		0x02
-#define CCW_CMD_SET_EXTENDED	0xc3
-#define CCW_CMD_PREPARE		0xe3
-
-#define CTC_PROTO_S390          0
-#define CTC_PROTO_LINUX         1
-#define CTC_PROTO_OS390         3
-
-#define CTC_BUFSIZE_LIMIT       65535
-#define CTC_BUFSIZE_DEFAULT     32768
-
-#define CTC_TIMEOUT_5SEC        5000
-
-#define CTC_INITIAL_BLOCKLEN    2
-
-#define READ			0
-#define WRITE			1
-
-#define CTC_ID_SIZE             BUS_ID_SIZE+3
-
-
-struct ctc_profile {
-	unsigned long maxmulti;
-	unsigned long maxcqueue;
-	unsigned long doios_single;
-	unsigned long doios_multi;
-	unsigned long txlen;
-	unsigned long tx_time;
-	struct timespec send_stamp;
-};
-
-/**
- * Definition of one channel
- */
-struct channel {
-
-	/**
-	 * Pointer to next channel in list.
-	 */
-	struct channel *next;
-	char id[CTC_ID_SIZE];
-	struct ccw_device *cdev;
-
-	/**
-	 * Type of this channel.
-	 * CTC/A or Escon for valid channels.
-	 */
-	enum channel_types type;
-
-	/**
-	 * Misc. flags. See CHANNEL_FLAGS_... below
-	 */
-	__u32 flags;
-
-	/**
-	 * The protocol of this channel
-	 */
-	__u16 protocol;
-
-	/**
-	 * I/O and irq related stuff
-	 */
-	struct ccw1 *ccw;
-	struct irb *irb;
-
-	/**
-	 * RX/TX buffer size
-	 */
-	int max_bufsize;
-
-	/**
-	 * Transmit/Receive buffer.
-	 */
-	struct sk_buff *trans_skb;
-
-	/**
-	 * Universal I/O queue.
-	 */
-	struct sk_buff_head io_queue;
-
-	/**
-	 * TX queue for collecting skb's during busy.
-	 */
-	struct sk_buff_head collect_queue;
-
-	/**
-	 * Amount of data in collect_queue.
-	 */
-	int collect_len;
-
-	/**
-	 * spinlock for collect_queue and collect_len
-	 */
-	spinlock_t collect_lock;
-
-	/**
-	 * Timer for detecting unresposive
-	 * I/O operations.
-	 */
-	fsm_timer timer;
-
-	/**
-	 * Retry counter for misc. operations.
-	 */
-	int retry;
-
-	/**
-	 * The finite state machine of this channel
-	 */
-	fsm_instance *fsm;
-
-	/**
-	 * The corresponding net_device this channel
-	 * belongs to.
-	 */
-	struct net_device *netdev;
-
-	struct ctc_profile prof;
-
-	unsigned char *trans_skb_data;
-
-	__u16 logflags;
-};
-
-#define CHANNEL_FLAGS_READ            0
-#define CHANNEL_FLAGS_WRITE           1
-#define CHANNEL_FLAGS_INUSE           2
-#define CHANNEL_FLAGS_BUFSIZE_CHANGED 4
-#define CHANNEL_FLAGS_FAILED          8
-#define CHANNEL_FLAGS_WAITIRQ        16
-#define CHANNEL_FLAGS_RWMASK 1
-#define CHANNEL_DIRECTION(f) (f & CHANNEL_FLAGS_RWMASK)
-
-#define LOG_FLAG_ILLEGALPKT  1
-#define LOG_FLAG_ILLEGALSIZE 2
-#define LOG_FLAG_OVERRUN     4
-#define LOG_FLAG_NOMEM       8
-
-#define CTC_LOGLEVEL_INFO     1
-#define CTC_LOGLEVEL_NOTICE   2
-#define CTC_LOGLEVEL_WARN     4
-#define CTC_LOGLEVEL_EMERG    8
-#define CTC_LOGLEVEL_ERR     16
-#define CTC_LOGLEVEL_DEBUG   32
-#define CTC_LOGLEVEL_CRIT    64
-
-#define CTC_LOGLEVEL_DEFAULT \
-(CTC_LOGLEVEL_INFO | CTC_LOGLEVEL_NOTICE | CTC_LOGLEVEL_WARN | CTC_LOGLEVEL_CRIT)
-
-#define CTC_LOGLEVEL_MAX     ((CTC_LOGLEVEL_CRIT<<1)-1)
-
-#define ctc_pr_debug(fmt, arg...) \
-do { if (loglevel & CTC_LOGLEVEL_DEBUG) printk(KERN_DEBUG fmt,##arg); } while (0)
-
-#define ctc_pr_info(fmt, arg...) \
-do { if (loglevel & CTC_LOGLEVEL_INFO) printk(KERN_INFO fmt,##arg); } while (0)
-
-#define ctc_pr_notice(fmt, arg...) \
-do { if (loglevel & CTC_LOGLEVEL_NOTICE) printk(KERN_NOTICE fmt,##arg); } while (0)
-
-#define ctc_pr_warn(fmt, arg...) \
-do { if (loglevel & CTC_LOGLEVEL_WARN) printk(KERN_WARNING fmt,##arg); } while (0)
-
-#define ctc_pr_emerg(fmt, arg...) \
-do { if (loglevel & CTC_LOGLEVEL_EMERG) printk(KERN_EMERG fmt,##arg); } while (0)
-
-#define ctc_pr_err(fmt, arg...) \
-do { if (loglevel & CTC_LOGLEVEL_ERR) printk(KERN_ERR fmt,##arg); } while (0)
-
-#define ctc_pr_crit(fmt, arg...) \
-do { if (loglevel & CTC_LOGLEVEL_CRIT) printk(KERN_CRIT fmt,##arg); } while (0)
-
-struct ctc_priv {
-	struct net_device_stats stats;
-	unsigned long tbusy;
-	/**
-	 * The finite state machine of this interface.
-	 */
-	fsm_instance *fsm;
-	/**
-	 * The protocol of this device
-	 */
-	__u16 protocol;
- 	/**
- 	 * Timer for restarting after I/O Errors
- 	 */
- 	fsm_timer               restart_timer;
-
-	int buffer_size;
-
-	struct channel *channel[2];
-};
-
-/**
- * Definition of our link level header.
- */
-struct ll_header {
-	__u16 length;
-	__u16 type;
-	__u16 unused;
-};
-#define LL_HEADER_LENGTH (sizeof(struct ll_header))
-
-/**
- * Compatibility macros for busy handling
- * of network devices.
- */
-static __inline__ void
-ctc_clear_busy(struct net_device * dev)
-{
-	clear_bit(0, &(((struct ctc_priv *) dev->priv)->tbusy));
-	netif_wake_queue(dev);
-}
-
-static __inline__ int
-ctc_test_and_set_busy(struct net_device * dev)
-{
-	netif_stop_queue(dev);
-	return test_and_set_bit(0, &((struct ctc_priv *) dev->priv)->tbusy);
-}
-
-#endif

-- 

^ permalink raw reply

* [patch 1/4] ctc / netiucv: consolidate fsm_action_nop
From: Ursula Braun @ 2008-02-06 18:27 UTC (permalink / raw)
  To: jgarzik, netdev, linux-s390; +Cc: Peter Tiedemann
In-Reply-To: <20080206182723.103842000@linux.vnet.ibm.com>

[-- Attachment #1: 700-fsm.diff --]
[-- Type: text/plain, Size: 2232 bytes --]

From: Peter Tiedemann <ptiedem@de.ibm.com>

move fsm_action_nop to fsm.h to avoid duplicate definitions in
both drivers ctc and netiucv.

Signed-off-by: Peter Tiedemann <ptiedem@de.ibm.com>
Signed-off-by: Ursula Braun <braunu@de.ibm.com>

---
 drivers/s390/net/ctcmain.c |    8 --------
 drivers/s390/net/fsm.h     |    8 ++++++++
 drivers/s390/net/netiucv.c |    8 +-------
 3 files changed, 9 insertions(+), 15 deletions(-)

Index: linux-2.6-uschi/drivers/s390/net/fsm.h
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/fsm.h
+++ linux-2.6-uschi/drivers/s390/net/fsm.h
@@ -260,4 +260,12 @@ extern int fsm_addtimer(fsm_timer *timer
  */
 extern void fsm_modtimer(fsm_timer *timer, int millisec, int event, void *arg);
 
+/**
+ * NOP action for statemachines
+ */
+static inline void
+fsm_action_nop(fsm_instance *fi, int event, void *arg)
+{
+}
+
 #endif /* _FSM_H_ */
Index: linux-2.6-uschi/drivers/s390/net/netiucv.c
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/netiucv.c
+++ linux-2.6-uschi/drivers/s390/net/netiucv.c
@@ -137,6 +137,7 @@ PRINT_##importance(header "%02x %02x %02
 #define PRINTK_HEADER " iucv: "       /* for debugging */
 
 static struct device_driver netiucv_driver = {
+	.owner = THIS_MODULE,
 	.name = "netiucv",
 	.bus  = &iucv_bus,
 };
@@ -571,13 +572,6 @@ static void netiucv_callback_connres(str
 	fsm_event(conn->fsm, CONN_EVENT_CONN_RES, conn);
 }
 
-/**
- * Dummy NOP action for all statemachines
- */
-static void fsm_action_nop(fsm_instance *fi, int event, void *arg)
-{
-}
-
 /*
  * Actions of the connection statemachine
  */
Index: linux-2.6-uschi/drivers/s390/net/ctcmain.c
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/ctcmain.c
+++ linux-2.6-uschi/drivers/s390/net/ctcmain.c
@@ -644,14 +644,6 @@ ctc_checkalloc_buffer(struct channel *ch
 }
 
 /**
- * Dummy NOP action for statemachines
- */
-static void
-fsm_action_nop(fsm_instance * fi, int event, void *arg)
-{
-}
-
-/**
  * Actions for channel - statemachines.
  *****************************************************************************/
 

-- 

^ permalink raw reply

* [patch 2/4] drivers/s390/net: Kconfig brush up
From: Ursula Braun @ 2008-02-06 18:27 UTC (permalink / raw)
  To: jgarzik, netdev, linux-s390; +Cc: Peter Tiedemann
In-Reply-To: <20080206182723.103842000@linux.vnet.ibm.com>

[-- Attachment #1: 701-kconfig.diff --]
[-- Type: text/plain, Size: 4356 bytes --]

From: Peter Tiedemann <ptiedem@de.ibm.com>
From: Ursula Braun <braunu@de.ibm.com>

adapt drivers/s390/net/Kconfig to current IBM wording
and further cosmetics

Signed-off-by: Peter Tiedemann <ptiedem@de.ibm.com>
Signed-off-by: Ursula Braun <braunu@de.ibm.com>

---
 drivers/s390/net/Kconfig |   43 ++++++++++++++++++++++---------------------
 1 file changed, 22 insertions(+), 21 deletions(-)

Index: linux-2.6-uschi/drivers/s390/net/Kconfig
===================================================================
--- linux-2.6-uschi.orig/drivers/s390/net/Kconfig
+++ linux-2.6-uschi/drivers/s390/net/Kconfig
@@ -5,22 +5,23 @@ config LCS
 	tristate "Lan Channel Station Interface"
 	depends on CCW && NETDEVICES && (NET_ETHERNET || TR || FDDI)
 	help
-	   Select this option if you want to use LCS networking  on IBM S/390
-  	   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.ko. If you do not know what it is, it's safe to say "Y".
+	   Select this option if you want to use LCS networking on IBM System z.
+	   This device driver supports Token Ring (IEEE 802.5),
+	   FDDI (IEEE 802.7) and Ethernet.
+	   To compile as a module, choose M. The module name is lcs.ko.
+	   If you do not know what it is, it's safe to choose Y.
 
 config CTC
 	tristate "CTC device support"
 	depends on CCW && NETDEVICES
 	help
-	  Select this option if you want to use channel-to-channel networking
-	  on IBM S/390 or zSeries. This device driver supports real 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.ko.  If you do not know what it is, it's safe to say "Y".
+	  Select this option if you want to use channel-to-channel
+	  point-to-point networking on IBM System z.
+	  This device driver supports real CTC coupling using ESCON.
+	  It also supports virtual CTCs when running under VM.
+	  To compile as a module, choose M. The module name is ctc.ko.
+	  To compile into the kernel, choose Y.
+	  If you do not need any channel-to-channel connection, choose N.
 
 config NETIUCV
 	tristate "IUCV network device support (VM only)"
@@ -29,9 +30,9 @@ config NETIUCV
 	  Select this option if you want to use inter-user communication
 	  vehicle networking under VM or VIF. It enables a fast communication
 	  link between VM guests. Using ifconfig a point-to-point connection
-	  can be established to the Linux for zSeries and S7390 system
-	  running on the other VM guest. This option is also available
-	  as a module which will be called netiucv.ko. If unsure, say "Y".
+	  can be established to the Linux on IBM System z
+	  running on the other VM guest. To compile as a module, choose M.
+	  The module name is netiucv.ko. If unsure, choose Y.
 
 config SMSGIUCV
 	tristate "IUCV special message support (VM only)"
@@ -47,22 +48,22 @@ config CLAW
 	  This driver supports channel attached CLAW devices.
 	  CLAW is Common Link Access for Workstation.  Common devices
           that use CLAW are RS/6000s, Cisco Routers (CIP) and 3172 devices.
-	  To compile as a module choose M here:  The module will be called
-	  claw.ko to compile into the kernel choose Y
+	  To compile as a module, choose M. The module name is claw.ko.
+	  To compile into the kernel, choose Y.
 
 config QETH
 	tristate "Gigabit Ethernet device support"
 	depends on CCW && NETDEVICES && IP_MULTICAST && QDIO
 	help
-	  This driver supports the IBM S/390 and zSeries OSA Express adapters
+	  This driver supports the IBM System z OSA Express adapters
 	  in QDIO mode (all media types), HiperSockets interfaces and VM GuestLAN
 	  interfaces in QDIO and HIPER mode.
 	
-	  For details please refer to the documentation provided by IBM at   
-	  <http://www10.software.ibm.com/developerworks/opensource/linux390>
+	  For details please refer to the documentation provided by IBM at
+	  <http://www.ibm.com/developerworks/linux/linux390>
 
-	  To compile this driver as a module, choose M here: the
-	  module will be called qeth.ko.
+	  To compile this driver as a module, choose M.
+	  The module name is qeth.ko.
 
 
 comment "Gigabit Ethernet default settings"

-- 

^ permalink raw reply

* [patch 0/4] s390: ctc patches for 2.6.25 (3rd try)
From: Ursula Braun @ 2008-02-06 18:27 UTC (permalink / raw)
  To: jgarzik, netdev, linux-s390

-- 
Jeff,

hmmm, another send is necessary, sorry again.
Description for patch 3/4 needs to be changed.

The following patches are intended for 2.6.25. Besides clean-ups
they replace the old ctc driver by a reworked ctcm driver.
This ctcm driver supports the channel-to-channel connections of the
old ctc driver plus an additional MPC protocol to provide SNA
connectivity.

Patch 1/4: clean-ups in ctc and netiucv
Patch 2/4: clean-ups in Kconfig
Patch 3/4: reworked ctc driver
Patch 4/4: removal of old ctc driver

Regards,    Ursula Braun


^ permalink raw reply

* [ofa-general] Re: [PATCH 2.6.25] cxgb3: Handle ARP completions that mark neighbors stale.
From: Divy Le Ray @ 2008-02-06 18:27 UTC (permalink / raw)
  To: Steve Wise; +Cc: netdev, general, linux-kernel, jeff
In-Reply-To: <20080206180519.4680.34741.stgit@dell3.ogc.int>

Steve Wise wrote:
> cxgb3: Handle ARP completions that mark neighbors stale.
>
> When ARP completes due to a request rather than a reply the neighbor is
> marked NUD_STALE instead of reachable (see arp_process()).  The handler
> for the resulting netevent needs to check also for NUD_STALE.
>
> Failure to use the arp entry can cause RDMA connection failures.
>
> Signed-off-by: Steve Wise <swise@opengridcomputing.com>
>   

Acked-by: Divy Le Ray <divy@chelsio.com>

Divy

^ permalink raw reply

* Re: [PATCH] Add IPv6 support to TCP SYN cookies
From: Glenn Griffin @ 2008-02-06 18:30 UTC (permalink / raw)
  To: Evgeniy Polyakov
  Cc: Glenn Griffin, Alan Cox, Andi Kleen, netdev, linux-kernel
In-Reply-To: <20080206091353.GA12927@2ka.mipt.ru>

> > +static u32 cookie_hash(struct in6_addr *saddr, struct in6_addr *daddr,
> > +		       __be16 sport, __be16 dport, u32 count, int c)
> > +{
> > +	__u32 tmp[16 + 5 + SHA_WORKSPACE_WORDS];
> 
> This huge buffer should not be allocated on stack.

I can replace it will a kmalloc, but for my benefit what's the practical
size we try and limit the stack to?  It seemed at first glance to me
that 404 bytes plus the arguments, etc. was not such a large buffer for
a non-recursive function.  Plus the alternative with a kmalloc requires
propogating the possible error status back up to tcp_ipv6.c in the event
we are unable to allocate enough memory, so it can simply drop the
connection.  Not an impossible task by any means but it does
significantly complicate things and I would like to know it's worth the
effort.  Also would it be worth it to provide a supplemental patch for
the ipv4 implementation as it allocates the same buffer?

--Glenn

^ permalink raw reply

* Re: [patch 2.6.24-git] net/enc28j60: low power mode
From: David Brownell @ 2008-02-06 18:19 UTC (permalink / raw)
  To: netdev, lanconelli.claudio
In-Reply-To: <47A9EA42.3080800@eptar.com>

> > Keep enc28j60 chips in low-power mode when they're not in use.
> > At typically 120 mA, these chips run hot even when idle.  Low
> > power mode cuts that power usage by a factor of around 100.
>
> Good idea, but with your patch applied, after some ifconfig down - 
> ifconfig up cycle, the
> enc28j60 is left in an unknown state and it doesn' Rx/Tx anything.

The driver seemed to already have some goofage there:

  # ifconfig eth1 up
  net eth1: link down
  net eth1: link down
  net eth1: normal mode
  net eth1: multicast mode
  net eth1: multicast mode
  #

I'd normally expect it not to go down when told to go up, and
then only to do the multicast thing once ...


> In such cases If I dump the counters with ifconfig I got rx error 
> counter > 0 and the RX and TX packets counters are freezed.
> Actually I don't know what causes the freeze, it needs investigation. 
> The cause can be the rx error condition or the power down/up commands.
> May be receiving packets while it's going to wakeup causes problems.

The enc28j60_setlink() was odd too.  It insists the link be down
before changing duplex, then brings the link up ... so I had to
put it down again to maintain the "lowpower if not up" invariant.

But the way it brings the link up is to enc28j60_hw_init(), which
it also does when bringing the link up.  So there's no need to
bring the link up when changing duplex ...


> > +/*
> > + * Low power mode shrinks power consumption about 100x, so we'd like
> > + * the chip to be in that mode whenever it's inactive.
> > + */
> > +static void enc28j60_lowpower(struct enc28j60_net *priv, bool is_low)
> > +{
> > +	int	tmp;
> > +
> > +	dev_dbg(&priv->spi->dev, "%s power...\n", is_low ? "low" : "high");
>
> use
> if(netif_msg_drv(priv)) ...
> Doing so we can switch on/off messages runtime using ethtool.

OK, although there's still a role for "-DDEBUG" compile-time
mesage removal.


> printk(...  instead of dev_dbg(), please.

Actually, I had to resist sending a patch converting this driver
to stop abusing printk in all those locations it should have been
using dev_*() messaging instead.

And to use the dev_*() messaging correctly ... the above shouldn't
have said "net eth1", but either "eth1:" or "enc28j60 spi1.0".

The general policy in the kernel is to avoid using printk for driver
messaging.  Couple messages to the hardware, so that when there are
two instances it's easy to tell which chip is affected.  That happens
for free with the "driver and device" prefix of the dev_*() messages.
	
In absense of interface renaming, network devices sometimes use "eth1"
style message prefixes ... after a previous message coupling that to
the particular hardware.

This driver also abuses __FUNCTION__ (general policy:  don't use it)
and underuses the "-DDEBUG" compile-time string removal.


> > +
> > +	mutex_lock(&priv->lock);
> > +	if (is_low) {
> > +		nolock_reg_bfclr(priv, ECON1, ECON1_RXEN);
> > +		for (;;) {
> > +			tmp = nolock_regb_read(priv, ESTAT);
> > +			if (!(tmp & ESTAT_RXBUSY))
> > +				break;
> > +		}
> >   
> Avoid infinite waiting loops, please.
> Look at enc28j60_phy_read() for example.

Then there should be a single routine for all such busy-wait loops,
so each such usage doesn't need to be open-coded.  Less space, and
more obviously correct.  I'll add one and make phy_read() use it too.


> > +		for (;;) {
> > +			tmp = nolock_regb_read(priv, ECON1);
> > +			if (!(tmp & ECON1_TXRTS))
> > +				break;
> > +		}
> >   
> idem
> > +		/* ECON2_VRPS was set during initialization */
> > +		nolock_reg_bfset(priv, ECON2, ECON2_PWRSV);
> > +	} else {
> > +		nolock_reg_bfclr(priv, ECON2, ECON2_PWRSV);
> > +		for (;;) {
> > +			tmp = nolock_regb_read(priv, ESTAT);
> > +			if (tmp & ESTAT_CLKRDY)
> > +				break;
> > +		}
> >   
> idem
>

^ permalink raw reply

* Re: [PATCH] Add IPv6 support to TCP SYN cookies
From: Andi Kleen @ 2008-02-06 18:45 UTC (permalink / raw)
  To: Glenn Griffin
  Cc: Andi Kleen, Alan Cox, Evgeniy Polyakov, netdev, linux-kernel
In-Reply-To: <47a9ee5e.15538c0a.7043.05ba@mx.google.com>

On Wed, Feb 06, 2008 at 09:36:11AM -0800, Glenn Griffin wrote:
> > I didn't think a module could have multiple module_inits. Are you
> > sure that works?
> 
> Indeed.  That will fail whenever ipv6 is compiled as a module.  It's
> been removed.  It snuck in from the v4 implementation, where I'm still
> having trouble understanding why it's needed there.

s/needed/used/

ipv4 is never modular so it works.

Arguably it would be cleaner if it was __initcall()

-Andi

^ permalink raw reply

* [PATCH] [resend] 3c509: convert to isa_driver and pnp_driver v3
From: Ondrej Zary @ 2008-02-06 18:09 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev, Linux Kernel, Andrew Morton
In-Reply-To: <47A4D791.3050700@garzik.org>

Hello,
this patch converts 3c509 driver to isa_driver and pnp_driver. The result is 
that autoloading using udev and hibernation works with ISA PnP cards. It also 
adds hibernation support for non-PnP ISA cards.

xcvr module parameter was removed as its value was not used.

Tested using 3 ISA cards in various combinations of PnP and non-PnP modes.

Signed-off-by: Ondrej Zary <linux@rainbow-software.org>

--- linux-2.6.24-orig/drivers/net/3c509.c	2008-01-27 19:48:19.000000000 +0100
+++ linux-2.6.24-pentium/drivers/net/3c509.c	2008-02-04 22:30:37.000000000 +0100
@@ -54,25 +54,24 @@
 		v1.19a 28Oct2002 Davud Ruggiero <jdr@farfalle.com>
 			- Increase *read_eeprom udelay to workaround oops with 2 cards.
 		v1.19b 08Nov2002 Marc Zyngier <maz@wild-wind.fr.eu.org>
-		    - Introduce driver model for EISA cards.
+			- Introduce driver model for EISA cards.
+		v1.20  04Feb2008 Ondrej Zary <linux@rainbow-software.org>
+			- convert to isa_driver and pnp_driver and some cleanups
 */
 
 #define DRV_NAME	"3c509"
-#define DRV_VERSION	"1.19b"
-#define DRV_RELDATE	"08Nov2002"
+#define DRV_VERSION	"1.20"
+#define DRV_RELDATE	"04Feb2008"
 
 /* A few values that may be tweaked. */
 
 /* Time in jiffies before concluding the transmitter is hung. */
 #define TX_TIMEOUT  (400*HZ/1000)
-/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
-static int max_interrupt_work = 10;
 
 #include <linux/module.h>
-#ifdef CONFIG_MCA
 #include <linux/mca.h>
-#endif
-#include <linux/isapnp.h>
+#include <linux/isa.h>
+#include <linux/pnp.h>
 #include <linux/string.h>
 #include <linux/interrupt.h>
 #include <linux/errno.h>
@@ -97,10 +96,6 @@
 
 static char version[] __initdata = DRV_NAME ".c:" DRV_VERSION " " DRV_RELDATE " becker@scyld.com\n";
 
-#if defined(CONFIG_PM) && (defined(CONFIG_MCA) || defined(CONFIG_EISA))
-#define EL3_SUSPEND
-#endif
-
 #ifdef EL3_DEBUG
 static int el3_debug = EL3_DEBUG;
 #else
@@ -111,6 +106,7 @@
  * a global variable so that the mca/eisa probe routines can increment
  * it */
 static int el3_cards = 0;
+#define EL3_MAX_CARDS 8
 
 /* To minimize the size of the driver source I only define operating
    constants if they are used several times.  You'll need the manual
@@ -119,7 +115,7 @@
 #define EL3_DATA 0x00
 #define EL3_CMD 0x0e
 #define EL3_STATUS 0x0e
-#define	 EEPROM_READ 0x80
+#define	EEPROM_READ 0x80
 
 #define EL3_IO_EXTENT	16
 
@@ -168,23 +164,31 @@
  */
 #define SKB_QUEUE_SIZE	64
 
+typedef enum { EL3_ISA, EL3_PNP, EL3_MCA, EL3_EISA } el3_cardtype;
+
 struct el3_private {
 	struct net_device_stats stats;
-	struct net_device *next_dev;
 	spinlock_t lock;
 	/* skb send-queue */
 	int head, size;
 	struct sk_buff *queue[SKB_QUEUE_SIZE];
-	enum {
-		EL3_MCA,
-		EL3_PNP,
-		EL3_EISA,
-	} type;						/* type of device */
-	struct device *dev;
+	el3_cardtype type;
 };
-static int id_port __initdata = 0x110;	/* Start with 0x110 to avoid new sound cards.*/
-static struct net_device *el3_root_dev;
+static int id_port;
+static int current_tag;
+static struct net_device *el3_devs[EL3_MAX_CARDS];
+
+/* Parameters that may be passed into the module. */
+static int debug = -1;
+static int irq[] = {-1, -1, -1, -1, -1, -1, -1, -1};
+/* Maximum events (Rx packets, etc.) to handle at each interrupt. */
+static int max_interrupt_work = 10;
+#ifdef CONFIG_PNP
+static int nopnp;
+#endif
 
+static int __init el3_common_init(struct net_device *dev);
+static void el3_common_remove (struct net_device *dev);
 static ushort id_read_eeprom(int index);
 static ushort read_eeprom(int ioaddr, int index);
 static int el3_open(struct net_device *dev);
@@ -199,23 +203,277 @@
 static void el3_down(struct net_device *dev);
 static void el3_up(struct net_device *dev);
 static const struct ethtool_ops ethtool_ops;
-#ifdef EL3_SUSPEND
+#ifdef CONFIG_PM
 static int el3_suspend(struct device *, pm_message_t);
 static int el3_resume(struct device *);
-#else
-#define el3_suspend NULL
-#define el3_resume NULL
 #endif
 
 
 /* generic device remove for all device types */
-#if defined(CONFIG_EISA) || defined(CONFIG_MCA)
 static int el3_device_remove (struct device *device);
-#endif
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static void el3_poll_controller(struct net_device *dev);
 #endif
 
+/* Return 0 on success, 1 on error, 2 when found already detected PnP card */
+static int el3_isa_id_sequence(__be16 *phys_addr)
+{
+	short lrs_state = 0xff;
+	int i;
+
+	/* ISA boards are detected by sending the ID sequence to the
+	   ID_PORT.  We find cards past the first by setting the 'current_tag'
+	   on cards as they are found.  Cards with their tag set will not
+	   respond to subsequent ID sequences. */
+
+	outb(0x00, id_port);
+	outb(0x00, id_port);
+	for (i = 0; i < 255; i++) {
+		outb(lrs_state, id_port);
+		lrs_state <<= 1;
+		lrs_state = lrs_state & 0x100 ? lrs_state ^ 0xcf : lrs_state;
+	}
+	/* For the first probe, clear all board's tag registers. */
+	if (current_tag == 0)
+		outb(0xd0, id_port);
+	else				/* Otherwise kill off already-found boards. */
+		outb(0xd8, id_port);
+	if (id_read_eeprom(7) != 0x6d50)
+		return 1;
+	/* Read in EEPROM data, which does contention-select.
+	   Only the lowest address board will stay "on-line".
+	   3Com got the byte order backwards. */
+	for (i = 0; i < 3; i++)
+		phys_addr[i] = htons(id_read_eeprom(i));
+#ifdef CONFIG_PNP
+	if (!nopnp) {
+		/* The ISA PnP 3c509 cards respond to the ID sequence too.
+		   This check is needed in order not to register them twice. */
+		for (i = 0; i < el3_cards; i++) {
+			struct el3_private *lp = netdev_priv(el3_devs[i]);
+			if (lp->type == EL3_PNP && !memcmp(phys_addr, el3_devs[i]->dev_addr, ETH_ALEN)) {
+				if (el3_debug > 3)
+					printk(KERN_DEBUG "3c509 with address %02x %02x %02x %02x %02x %02x was found by ISAPnP\n",
+						phys_addr[0] & 0xff, phys_addr[0] >> 8,
+						phys_addr[1] & 0xff, phys_addr[1] >> 8,
+						phys_addr[2] & 0xff, phys_addr[2] >> 8);
+				/* Set the adaptor tag so that the next card can be found. */
+				outb(0xd0 + ++current_tag, id_port);
+				return 2;
+			}
+		}
+	}
+#endif /* CONFIG_PNP */
+	return 0;
+
+}
+
+static void __devinit el3_dev_fill(struct net_device *dev, __be16 *phys_addr,
+			           int ioaddr, int irq, int if_port,
+			           el3_cardtype type)
+{
+	struct el3_private *lp = netdev_priv(dev);
+
+	memcpy(dev->dev_addr, phys_addr, ETH_ALEN);
+	dev->base_addr = ioaddr;
+	dev->irq = irq;
+	dev->if_port = if_port;
+	lp->type = type;
+}
+
+static int __devinit el3_isa_match(struct device *pdev,
+				   unsigned int ndev)
+{
+	struct net_device *dev;
+	int ioaddr, isa_irq, if_port, err;
+	unsigned int iobase;
+	__be16 phys_addr[3];
+
+	while ((err = el3_isa_id_sequence(phys_addr)) == 2)
+		;	/* Skip to next card when PnP card found */
+	if (err == 1)
+		return 0;
+
+	iobase = id_read_eeprom(8);
+	if_port = iobase >> 14;
+	ioaddr = 0x200 + ((iobase & 0x1f) << 4);
+	if (irq[el3_cards] > 1 && irq[el3_cards] < 16)
+		isa_irq = irq[el3_cards];
+	else
+		isa_irq = id_read_eeprom(9) >> 12;
+
+	dev = alloc_etherdev(sizeof (struct el3_private));
+	if (!dev)
+		return -ENOMEM;
+
+	netdev_boot_setup_check(dev);
+
+	if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509-isa")) {
+		free_netdev(dev);
+		return 0;
+	}
+
+	/* Set the adaptor tag so that the next card can be found. */
+	outb(0xd0 + ++current_tag, id_port);
+
+	/* Activate the adaptor at the EEPROM location. */
+	outb((ioaddr >> 4) | 0xe0, id_port);
+
+	EL3WINDOW(0);
+	if (inw(ioaddr) != 0x6d50) {
+		free_netdev(dev);
+		return 0;
+	}
+
+	/* Free the interrupt so that some other card can use it. */
+	outw(0x0f00, ioaddr + WN0_IRQ);
+
+	el3_dev_fill(dev, phys_addr, ioaddr, isa_irq, if_port, EL3_ISA);
+	dev_set_drvdata(pdev, dev);
+	if (el3_common_init(dev)) {
+		free_netdev(dev);
+		return 0;
+	}
+
+	el3_devs[el3_cards++] = dev;
+	return 1;
+}
+
+static int __devexit el3_isa_remove(struct device *pdev,
+				    unsigned int ndev)
+{
+	el3_device_remove(pdev);
+	dev_set_drvdata(pdev, NULL);
+	return 0;
+}
+
+#ifdef CONFIG_PM
+static int el3_isa_suspend(struct device *dev, unsigned int n,
+			   pm_message_t state)
+{
+	current_tag = 0;
+	return el3_suspend(dev, state);
+}
+
+static int el3_isa_resume(struct device *dev, unsigned int n)
+{
+	struct net_device *ndev = dev_get_drvdata(dev);
+	int ioaddr = ndev->base_addr, err;
+	__be16 phys_addr[3];
+
+	while ((err = el3_isa_id_sequence(phys_addr)) == 2)
+		;	/* Skip to next card when PnP card found */
+	if (err == 1)
+		return 0;
+	/* Set the adaptor tag so that the next card can be found. */
+	outb(0xd0 + ++current_tag, id_port);
+	/* Enable the card */
+	outb((ioaddr >> 4) | 0xe0, id_port);
+	EL3WINDOW(0);
+	if (inw(ioaddr) != 0x6d50)
+		return 1;
+	/* Free the interrupt so that some other card can use it. */
+	outw(0x0f00, ioaddr + WN0_IRQ);
+	return el3_resume(dev);
+}
+#endif
+
+static struct isa_driver el3_isa_driver = {
+	.match		= el3_isa_match,
+	.remove		= __devexit_p(el3_isa_remove),
+#ifdef CONFIG_PM
+	.suspend	= el3_isa_suspend,
+	.resume		= el3_isa_resume,
+#endif
+	.driver		= {
+		.name	= "3c509"
+	},
+};
+static int isa_registered;
+
+#ifdef CONFIG_PNP
+static struct pnp_device_id el3_pnp_ids[] = {
+	{ .id = "TCM5090" }, /* 3Com Etherlink III (TP) */
+	{ .id = "TCM5091" }, /* 3Com Etherlink III */
+	{ .id = "TCM5094" }, /* 3Com Etherlink III (combo) */
+	{ .id = "TCM5095" }, /* 3Com Etherlink III (TPO) */
+	{ .id = "TCM5098" }, /* 3Com Etherlink III (TPC) */
+	{ .id = "PNP80f7" }, /* 3Com Etherlink III compatible */
+	{ .id = "PNP80f8" }, /* 3Com Etherlink III compatible */
+	{ .id = "" }
+};
+MODULE_DEVICE_TABLE(pnp, el3_pnp_ids);
+
+static int __devinit el3_pnp_probe(struct pnp_dev *pdev,
+				    const struct pnp_device_id *id)
+{
+	short i;
+	int ioaddr, irq, if_port;
+	u16 phys_addr[3];
+	struct net_device *dev = NULL;
+	int err;
+
+	ioaddr = pnp_port_start(pdev, 0);
+	if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509-pnp"))
+		return -EBUSY;
+	irq = pnp_irq(pdev, 0);
+	EL3WINDOW(0);
+	for (i = 0; i < 3; i++)
+		phys_addr[i] = htons(read_eeprom(ioaddr, i));
+	if_port = read_eeprom(ioaddr, 8) >> 14;
+	dev = alloc_etherdev(sizeof (struct el3_private));
+	if (!dev) {
+		release_region(ioaddr, EL3_IO_EXTENT);
+		return -ENOMEM;
+	}
+	SET_NETDEV_DEV(dev, &pdev->dev);
+	netdev_boot_setup_check(dev);
+
+	el3_dev_fill(dev, phys_addr, ioaddr, irq, if_port, EL3_PNP);
+	pnp_set_drvdata (pdev, dev);
+	err = el3_common_init(dev);
+
+	if (err) {
+		pnp_set_drvdata (pdev, NULL);
+		free_netdev(dev);
+		return err;
+	}
+
+	el3_devs[el3_cards++] = dev;
+	return 0;
+}
+
+static void __devexit el3_pnp_remove(struct pnp_dev *pdev)
+{
+	el3_common_remove(pnp_get_drvdata(pdev));
+	pnp_set_drvdata(pdev, NULL);
+}
+
+#ifdef CONFIG_PM
+static int el3_pnp_suspend(struct pnp_dev *pdev, pm_message_t state)
+{
+	return el3_suspend(&pdev->dev, state);
+}
+
+static int el3_pnp_resume(struct pnp_dev *pdev)
+{
+	return el3_resume(&pdev->dev);
+}
+#endif
+
+static struct pnp_driver el3_pnp_driver = {
+	.name		= "3c509",
+	.id_table	= el3_pnp_ids,
+	.probe		= el3_pnp_probe,
+	.remove		= __devexit_p(el3_pnp_remove),
+#ifdef CONFIG_PM
+	.suspend	= el3_pnp_suspend,
+	.resume		= el3_pnp_resume,
+#endif
+};
+static int pnp_registered;
+#endif /* CONFIG_PNP */
+
 #ifdef CONFIG_EISA
 static struct eisa_device_id el3_eisa_ids[] = {
 		{ "TCM5092" },
@@ -230,13 +488,14 @@
 static struct eisa_driver el3_eisa_driver = {
 		.id_table = el3_eisa_ids,
 		.driver   = {
-				.name    = "3c509",
+				.name    = "3c579",
 				.probe   = el3_eisa_probe,
 				.remove  = __devexit_p (el3_device_remove),
 				.suspend = el3_suspend,
 				.resume  = el3_resume,
 		}
 };
+static int eisa_registered;
 #endif
 
 #ifdef CONFIG_MCA
@@ -271,45 +530,9 @@
 				.resume  = el3_resume,
 		},
 };
+static int mca_registered;
 #endif /* CONFIG_MCA */
 
-#if defined(__ISAPNP__)
-static struct isapnp_device_id el3_isapnp_adapters[] __initdata = {
-	{	ISAPNP_ANY_ID, ISAPNP_ANY_ID,
-		ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5090),
-		(long) "3Com Etherlink III (TP)" },
-	{	ISAPNP_ANY_ID, ISAPNP_ANY_ID,
-		ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5091),
-		(long) "3Com Etherlink III" },
-	{	ISAPNP_ANY_ID, ISAPNP_ANY_ID,
-		ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5094),
-		(long) "3Com Etherlink III (combo)" },
-	{	ISAPNP_ANY_ID, ISAPNP_ANY_ID,
-		ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5095),
-		(long) "3Com Etherlink III (TPO)" },
-	{	ISAPNP_ANY_ID, ISAPNP_ANY_ID,
-		ISAPNP_VENDOR('T', 'C', 'M'), ISAPNP_FUNCTION(0x5098),
-		(long) "3Com Etherlink III (TPC)" },
-	{	ISAPNP_ANY_ID, ISAPNP_ANY_ID,
-		ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_FUNCTION(0x80f7),
-		(long) "3Com Etherlink III compatible" },
-	{	ISAPNP_ANY_ID, ISAPNP_ANY_ID,
-		ISAPNP_VENDOR('P', 'N', 'P'), ISAPNP_FUNCTION(0x80f8),
-		(long) "3Com Etherlink III compatible" },
-	{ }	/* terminate list */
-};
-
-static __be16 el3_isapnp_phys_addr[8][3];
-static int nopnp;
-#endif /* __ISAPNP__ */
-
-/* With the driver model introduction for EISA devices, both init
- * and cleanup have been split :
- * - EISA devices probe/remove starts in el3_eisa_probe/el3_device_remove
- * - MCA/ISA still use el3_probe
- *
- * Both call el3_common_init/el3_common_remove. */
-
 static int __init el3_common_init(struct net_device *dev)
 {
 	struct el3_private *lp = netdev_priv(dev);
@@ -360,231 +583,11 @@
 
 static void el3_common_remove (struct net_device *dev)
 {
-	struct el3_private *lp = netdev_priv(dev);
-
-	(void) lp;				/* Keep gcc quiet... */
-#if defined(__ISAPNP__)
-	if (lp->type == EL3_PNP)
-		pnp_device_detach(to_pnp_dev(lp->dev));
-#endif
-
 	unregister_netdev (dev);
 	release_region(dev->base_addr, EL3_IO_EXTENT);
 	free_netdev (dev);
 }
 
-static int __init el3_probe(int card_idx)
-{
-	struct net_device *dev;
-	struct el3_private *lp;
-	short lrs_state = 0xff, i;
-	int ioaddr, irq, if_port;
-	__be16 phys_addr[3];
-	static int current_tag;
-	int err = -ENODEV;
-#if defined(__ISAPNP__)
-	static int pnp_cards;
-	struct pnp_dev *idev = NULL;
-	int pnp_found = 0;
-
-	if (nopnp == 1)
-		goto no_pnp;
-
-	for (i=0; el3_isapnp_adapters[i].vendor != 0; i++) {
-		int j;
-		while ((idev = pnp_find_dev(NULL,
-					    el3_isapnp_adapters[i].vendor,
-					    el3_isapnp_adapters[i].function,
-					    idev))) {
-			if (pnp_device_attach(idev) < 0)
-				continue;
-			if (pnp_activate_dev(idev) < 0) {
-__again:
-				pnp_device_detach(idev);
-				continue;
-			}
-			if (!pnp_port_valid(idev, 0) || !pnp_irq_valid(idev, 0))
-				goto __again;
-			ioaddr = pnp_port_start(idev, 0);
-			if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509 PnP")) {
-				pnp_device_detach(idev);
-				return -EBUSY;
-			}
-			irq = pnp_irq(idev, 0);
-			if (el3_debug > 3)
-				printk ("ISAPnP reports %s at i/o 0x%x, irq %d\n",
-					(char*) el3_isapnp_adapters[i].driver_data, ioaddr, irq);
-			EL3WINDOW(0);
-			for (j = 0; j < 3; j++)
-				el3_isapnp_phys_addr[pnp_cards][j] =
-					phys_addr[j] =
-						htons(read_eeprom(ioaddr, j));
-			if_port = read_eeprom(ioaddr, 8) >> 14;
-			dev = alloc_etherdev(sizeof (struct el3_private));
-			if (!dev) {
-					release_region(ioaddr, EL3_IO_EXTENT);
-					pnp_device_detach(idev);
-					return -ENOMEM;
-			}
-
-			SET_NETDEV_DEV(dev, &idev->dev);
-			pnp_cards++;
-
-			netdev_boot_setup_check(dev);
-			pnp_found = 1;
-			goto found;
-		}
-	}
-no_pnp:
-#endif /* __ISAPNP__ */
-
-	/* Select an open I/O location at 0x1*0 to do contention select. */
-	for ( ; id_port < 0x200; id_port += 0x10) {
-		if (!request_region(id_port, 1, "3c509"))
-			continue;
-		outb(0x00, id_port);
-		outb(0xff, id_port);
-		if (inb(id_port) & 0x01){
-			release_region(id_port, 1);
-			break;
-		} else
-			release_region(id_port, 1);
-	}
-	if (id_port >= 0x200) {
-		/* Rare -- do we really need a warning? */
-		printk(" WARNING: No I/O port available for 3c509 activation.\n");
-		return -ENODEV;
-	}
-
-	/* Next check for all ISA bus boards by sending the ID sequence to the
-	   ID_PORT.  We find cards past the first by setting the 'current_tag'
-	   on cards as they are found.  Cards with their tag set will not
-	   respond to subsequent ID sequences. */
-
-	outb(0x00, id_port);
-	outb(0x00, id_port);
-	for(i = 0; i < 255; i++) {
-		outb(lrs_state, id_port);
-		lrs_state <<= 1;
-		lrs_state = lrs_state & 0x100 ? lrs_state ^ 0xcf : lrs_state;
-	}
-
-	/* For the first probe, clear all board's tag registers. */
-	if (current_tag == 0)
-		outb(0xd0, id_port);
-	else				/* Otherwise kill off already-found boards. */
-		outb(0xd8, id_port);
-
-	if (id_read_eeprom(7) != 0x6d50) {
-		return -ENODEV;
-	}
-
-	/* Read in EEPROM data, which does contention-select.
-	   Only the lowest address board will stay "on-line".
-	   3Com got the byte order backwards. */
-	for (i = 0; i < 3; i++) {
-		phys_addr[i] = htons(id_read_eeprom(i));
-	}
-
-#if defined(__ISAPNP__)
-	if (nopnp == 0) {
-		/* The ISA PnP 3c509 cards respond to the ID sequence.
-		   This check is needed in order not to register them twice. */
-		for (i = 0; i < pnp_cards; i++) {
-			if (phys_addr[0] == el3_isapnp_phys_addr[i][0] &&
-			    phys_addr[1] == el3_isapnp_phys_addr[i][1] &&
-			    phys_addr[2] == el3_isapnp_phys_addr[i][2])
-			{
-				if (el3_debug > 3)
-					printk("3c509 with address %02x %02x %02x %02x %02x %02x was found by ISAPnP\n",
-						phys_addr[0] & 0xff, phys_addr[0] >> 8,
-						phys_addr[1] & 0xff, phys_addr[1] >> 8,
-						phys_addr[2] & 0xff, phys_addr[2] >> 8);
-				/* Set the adaptor tag so that the next card can be found. */
-				outb(0xd0 + ++current_tag, id_port);
-				goto no_pnp;
-			}
-		}
-	}
-#endif /* __ISAPNP__ */
-
-	{
-		unsigned int iobase = id_read_eeprom(8);
-		if_port = iobase >> 14;
-		ioaddr = 0x200 + ((iobase & 0x1f) << 4);
-	}
-	irq = id_read_eeprom(9) >> 12;
-
-	dev = alloc_etherdev(sizeof (struct el3_private));
-	if (!dev)
-		return -ENOMEM;
-
-	netdev_boot_setup_check(dev);
-
-	/* Set passed-in IRQ or I/O Addr. */
-	if (dev->irq > 1  &&  dev->irq < 16)
-			irq = dev->irq;
-
-	if (dev->base_addr) {
-		if (dev->mem_end == 0x3c509 	/* Magic key */
-		    && dev->base_addr >= 0x200  &&  dev->base_addr <= 0x3e0)
-			ioaddr = dev->base_addr & 0x3f0;
-		else if (dev->base_addr != ioaddr)
-			goto out;
-	}
-
-	if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509")) {
-		err = -EBUSY;
-		goto out;
-	}
-
-	/* Set the adaptor tag so that the next card can be found. */
-	outb(0xd0 + ++current_tag, id_port);
-
-	/* Activate the adaptor at the EEPROM location. */
-	outb((ioaddr >> 4) | 0xe0, id_port);
-
-	EL3WINDOW(0);
-	if (inw(ioaddr) != 0x6d50)
-		goto out1;
-
-	/* Free the interrupt so that some other card can use it. */
-	outw(0x0f00, ioaddr + WN0_IRQ);
-
-#if defined(__ISAPNP__)
- found:							/* PNP jumps here... */
-#endif /* __ISAPNP__ */
-
-	memcpy(dev->dev_addr, phys_addr, sizeof(phys_addr));
-	dev->base_addr = ioaddr;
-	dev->irq = irq;
-	dev->if_port = if_port;
-	lp = netdev_priv(dev);
-#if defined(__ISAPNP__)
-	lp->dev = &idev->dev;
-	if (pnp_found)
-		lp->type = EL3_PNP;
-#endif
-	err = el3_common_init(dev);
-
-	if (err)
-		goto out1;
-
-	el3_cards++;
-	lp->next_dev = el3_root_dev;
-	el3_root_dev = dev;
-	return 0;
-
-out1:
-#if defined(__ISAPNP__)
-	if (idev)
-		pnp_device_detach(idev);
-#endif
-out:
-	free_netdev(dev);
-	return err;
-}
-
 #ifdef CONFIG_MCA
 static int __init el3_mca_probe(struct device *device)
 {
@@ -613,7 +616,7 @@
 	irq = pos5 & 0x0f;
 
 
-	printk("3c529: found %s at slot %d\n",
+	printk(KERN_INFO "3c529: found %s at slot %d\n",
 		   el3_mca_adapter_names[mdev->index], slot + 1);
 
 	/* claim the slot */
@@ -626,7 +629,7 @@
 	irq = mca_device_transform_irq(mdev, irq);
 	ioaddr = mca_device_transform_ioport(mdev, ioaddr);
 	if (el3_debug > 2) {
-			printk("3c529: irq %d  ioaddr 0x%x  ifport %d\n", irq, ioaddr, if_port);
+			printk(KERN_DEBUG "3c529: irq %d  ioaddr 0x%x  ifport %d\n", irq, ioaddr, if_port);
 	}
 	EL3WINDOW(0);
 	for (i = 0; i < 3; i++) {
@@ -641,13 +644,7 @@
 
 	netdev_boot_setup_check(dev);
 
-	memcpy(dev->dev_addr, phys_addr, sizeof(phys_addr));
-	dev->base_addr = ioaddr;
-	dev->irq = irq;
-	dev->if_port = if_port;
-	lp = netdev_priv(dev);
-	lp->dev = device;
-	lp->type = EL3_MCA;
+	el3_dev_fill(dev, phys_addr, ioaddr, irq, if_port, EL3_MCA);
 	device->driver_data = dev;
 	err = el3_common_init(dev);
 
@@ -657,7 +654,7 @@
 		return -ENOMEM;
 	}
 
-	el3_cards++;
+	el3_devs[el3_cards++] = dev;
 	return 0;
 }
 
@@ -678,7 +675,7 @@
 	edev = to_eisa_device (device);
 	ioaddr = edev->base_addr;
 
-	if (!request_region(ioaddr, EL3_IO_EXTENT, "3c509"))
+	if (!request_region(ioaddr, EL3_IO_EXTENT, "3c579-eisa"))
 		return -EBUSY;
 
 	/* Change the register set to the configuration window 0. */
@@ -700,13 +697,7 @@
 
 	netdev_boot_setup_check(dev);
 
-	memcpy(dev->dev_addr, phys_addr, sizeof(phys_addr));
-	dev->base_addr = ioaddr;
-	dev->irq = irq;
-	dev->if_port = if_port;
-	lp = netdev_priv(dev);
-	lp->dev = device;
-	lp->type = EL3_EISA;
+	el3_dev_fill(dev, phys_addr, ioaddr, irq, if_port, EL3_EISA);
 	eisa_set_drvdata (edev, dev);
 	err = el3_common_init(dev);
 
@@ -716,12 +707,11 @@
 		return err;
 	}
 
-	el3_cards++;
+	el3_devs[el3_cards++] = dev;
 	return 0;
 }
 #endif
 
-#if defined(CONFIG_EISA) || defined(CONFIG_MCA)
 /* This remove works for all device types.
  *
  * The net dev must be stored in the driver_data field */
@@ -734,7 +724,6 @@
 	el3_common_remove (dev);
 	return 0;
 }
-#endif
 
 /* Read a word from the EEPROM using the regular EEPROM access register.
    Assume that we are in register window zero.
@@ -749,7 +738,7 @@
 }
 
 /* Read a word from the EEPROM when in the ISA ID probe state. */
-static ushort __init id_read_eeprom(int index)
+static ushort id_read_eeprom(int index)
 {
 	int bit, word = 0;
 
@@ -765,7 +754,7 @@
 		word = (word << 1) + (inb(id_port) & 0x01);
 
 	if (el3_debug > 3)
-		printk("  3c509 EEPROM word %d %#4.4x.\n", index, word);
+		printk(KERN_DEBUG "  3c509 EEPROM word %d %#4.4x.\n", index, word);
 
 	return word;
 }
@@ -787,13 +776,13 @@
 
 	EL3WINDOW(0);
 	if (el3_debug > 3)
-		printk("%s: Opening, IRQ %d	 status@%x %4.4x.\n", dev->name,
+		printk(KERN_DEBUG "%s: Opening, IRQ %d	 status@%x %4.4x.\n", dev->name,
 			   dev->irq, ioaddr + EL3_STATUS, inw(ioaddr + EL3_STATUS));
 
 	el3_up(dev);
 
 	if (el3_debug > 3)
-		printk("%s: Opened 3c509  IRQ %d  status %4.4x.\n",
+		printk(KERN_DEBUG "%s: Opened 3c509  IRQ %d  status %4.4x.\n",
 			   dev->name, dev->irq, inw(ioaddr + EL3_STATUS));
 
 	return 0;
@@ -806,7 +795,7 @@
 	int ioaddr = dev->base_addr;
 
 	/* Transmitter timeout, serious problems. */
-	printk("%s: transmit timed out, Tx_status %2.2x status %4.4x "
+	printk(KERN_WARNING "%s: transmit timed out, Tx_status %2.2x status %4.4x "
 		   "Tx FIFO room %d.\n",
 		   dev->name, inb(ioaddr + TX_STATUS), inw(ioaddr + EL3_STATUS),
 		   inw(ioaddr + TX_FREE));
@@ -831,7 +820,7 @@
 	lp->stats.tx_bytes += skb->len;
 
 	if (el3_debug > 4) {
-		printk("%s: el3_start_xmit(length = %u) called, status %4.4x.\n",
+		printk(KERN_DEBUG "%s: el3_start_xmit(length = %u) called, status %4.4x.\n",
 			   dev->name, skb->len, inw(ioaddr + EL3_STATUS));
 	}
 #if 0
@@ -840,7 +829,7 @@
 		ushort status = inw(ioaddr + EL3_STATUS);
 		if (status & 0x0001 		/* IRQ line active, missed one. */
 			&& inw(ioaddr + EL3_STATUS) & 1) { 			/* Make sure. */
-			printk("%s: Missed interrupt, status then %04x now %04x"
+			printk(KERN_DEBUG "%s: Missed interrupt, status then %04x now %04x"
 				   "  Tx %2.2x Rx %4.4x.\n", dev->name, status,
 				   inw(ioaddr + EL3_STATUS), inb(ioaddr + TX_STATUS),
 				   inw(ioaddr + RX_STATUS));
@@ -914,7 +903,7 @@
 
 	if (el3_debug > 4) {
 		status = inw(ioaddr + EL3_STATUS);
-		printk("%s: interrupt, status %4.4x.\n", dev->name, status);
+		printk(KERN_DEBUG "%s: interrupt, status %4.4x.\n", dev->name, status);
 	}
 
 	while ((status = inw(ioaddr + EL3_STATUS)) &
@@ -925,7 +914,7 @@
 
 		if (status & TxAvailable) {
 			if (el3_debug > 5)
-				printk("	TX room bit was handled.\n");
+				printk(KERN_DEBUG "	TX room bit was handled.\n");
 			/* There's room in the FIFO for a full-sized packet. */
 			outw(AckIntr | TxAvailable, ioaddr + EL3_CMD);
 			netif_wake_queue (dev);
@@ -964,7 +953,7 @@
 		}
 
 		if (--i < 0) {
-			printk("%s: Infinite loop in interrupt, status %4.4x.\n",
+			printk(KERN_ERR "%s: Infinite loop in interrupt, status %4.4x.\n",
 				   dev->name, status);
 			/* Clear all interrupts. */
 			outw(AckIntr | 0xFF, ioaddr + EL3_CMD);
@@ -975,7 +964,7 @@
 	}
 
 	if (el3_debug > 4) {
-		printk("%s: exiting interrupt, status %4.4x.\n", dev->name,
+		printk(KERN_DEBUG "%s: exiting interrupt, status %4.4x.\n", dev->name,
 			   inw(ioaddr + EL3_STATUS));
 	}
 	spin_unlock(&lp->lock);
@@ -1450,7 +1439,7 @@
 }
 
 /* Power Management support functions */
-#ifdef EL3_SUSPEND
+#ifdef CONFIG_PM
 
 static int
 el3_suspend(struct device *pdev, pm_message_t state)
@@ -1500,79 +1489,102 @@
 	return 0;
 }
 
-#endif /* EL3_SUSPEND */
-
-/* Parameters that may be passed into the module. */
-static int debug = -1;
-static int irq[] = {-1, -1, -1, -1, -1, -1, -1, -1};
-static int xcvr[] = {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1};
+#endif /* CONFIG_PM */
 
 module_param(debug,int, 0);
 module_param_array(irq, int, NULL, 0);
-module_param_array(xcvr, int, NULL, 0);
 module_param(max_interrupt_work, int, 0);
 MODULE_PARM_DESC(debug, "debug level (0-6)");
 MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)");
-MODULE_PARM_DESC(xcvr,"transceiver(s) (0=internal, 1=external)");
 MODULE_PARM_DESC(max_interrupt_work, "maximum events handled per interrupt");
-#if defined(__ISAPNP__)
+#ifdef CONFIG_PNP
 module_param(nopnp, int, 0);
 MODULE_PARM_DESC(nopnp, "disable ISA PnP support (0-1)");
-MODULE_DEVICE_TABLE(isapnp, el3_isapnp_adapters);
-#endif	/* __ISAPNP__ */
-MODULE_DESCRIPTION("3Com Etherlink III (3c509, 3c509B) ISA/PnP ethernet driver");
+#endif	/* CONFIG_PNP */
+MODULE_DESCRIPTION("3Com Etherlink III (3c509, 3c509B, 3c529, 3c579) ethernet driver");
 MODULE_LICENSE("GPL");
 
 static int __init el3_init_module(void)
 {
 	int ret = 0;
-	el3_cards = 0;
 
 	if (debug >= 0)
 		el3_debug = debug;
 
-	el3_root_dev = NULL;
-	while (el3_probe(el3_cards) == 0) {
-		if (irq[el3_cards] > 1)
-			el3_root_dev->irq = irq[el3_cards];
-		if (xcvr[el3_cards] >= 0)
-			el3_root_dev->if_port = xcvr[el3_cards];
-		el3_cards++;
+#ifdef CONFIG_PNP
+	if (!nopnp) {
+		ret = pnp_register_driver(&el3_pnp_driver);
+		if (!ret)
+			pnp_registered = 1;
+	}
+#endif
+	/* Select an open I/O location at 0x1*0 to do ISA contention select. */
+	/* Start with 0x110 to avoid some sound cards.*/
+	for (id_port = 0x110 ; id_port < 0x200; id_port += 0x10) {
+		if (!request_region(id_port, 1, "3c509-control"))
+			continue;
+		outb(0x00, id_port);
+		outb(0xff, id_port);
+		if (inb(id_port) & 0x01)
+			break;
+		else
+			release_region(id_port, 1);
+	}
+	if (id_port >= 0x200) {
+		id_port = 0;
+		printk(KERN_ERR "No I/O port available for 3c509 activation.\n");
+	} else {
+		ret = isa_register_driver(&el3_isa_driver, EL3_MAX_CARDS);
+		if (!ret)
+			isa_registered = 1;
 	}
-
 #ifdef CONFIG_EISA
 	ret = eisa_driver_register(&el3_eisa_driver);
+	if (!ret)
+		eisa_registeted = 1;
 #endif
 #ifdef CONFIG_MCA
-	{
-		int err = mca_register_driver(&el3_mca_driver);
-		if (ret == 0)
-			ret = err;
-	}
+	ret = mca_register_driver(&el3_mca_driver);
+	if (!ret)
+		mca_registered = 1;
+#endif
+
+#ifdef CONFIG_PNP
+	if (pnp_registered)
+		ret = 0;
+#endif
+	if (isa_registered)
+		ret = 0;
+#ifdef CONFIG_EISA
+	if (eisa_registered)
+		ret = 0;
+#endif
+#ifdef CONFIG_MCA
+	if (mca_registered)
+		ret = 0;
 #endif
 	return ret;
 }
 
 static void __exit el3_cleanup_module(void)
 {
-	struct net_device *next_dev;
-
-	while (el3_root_dev) {
-		struct el3_private *lp = netdev_priv(el3_root_dev);
-
-		next_dev = lp->next_dev;
-		el3_common_remove (el3_root_dev);
-		el3_root_dev = next_dev;
-	}
-
+#ifdef CONFIG_PNP
+	if (pnp_registered)
+		pnp_unregister_driver(&el3_pnp_driver);
+#endif
+	if (isa_registered)
+		isa_unregister_driver(&el3_isa_driver);
+	if (id_port)
+		release_region(id_port, 1);
 #ifdef CONFIG_EISA
-	eisa_driver_unregister (&el3_eisa_driver);
+	if (eisa_registered)
+		eisa_driver_unregister (&el3_eisa_driver);
 #endif
 #ifdef CONFIG_MCA
-	mca_unregister_driver(&el3_mca_driver);
+	if (mca_registered)
+		mca_unregister_driver(&el3_mca_driver);
 #endif
 }
 
 module_init (el3_init_module);
 module_exit (el3_cleanup_module);
-


-- 
Ondrej Zary

^ permalink raw reply

* [ofa-general] [PATCH 2.6.25] cxgb3: Handle ARP completions that mark neighbors stale.
From: Steve Wise @ 2008-02-06 18:05 UTC (permalink / raw)
  To: jeff, divy; +Cc: netdev, linux-kernel, general


cxgb3: Handle ARP completions that mark neighbors stale.

When ARP completes due to a request rather than a reply the neighbor is
marked NUD_STALE instead of reachable (see arp_process()).  The handler
for the resulting netevent needs to check also for NUD_STALE.

Failure to use the arp entry can cause RDMA connection failures.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>
---

 drivers/net/cxgb3/l2t.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/cxgb3/l2t.c b/drivers/net/cxgb3/l2t.c
index d660af7..d80bbdb 100644
--- a/drivers/net/cxgb3/l2t.c
+++ b/drivers/net/cxgb3/l2t.c
@@ -404,7 +404,7 @@ found:
 			if (neigh->nud_state & NUD_FAILED) {
 				arpq = e->arpq_head;
 				e->arpq_head = e->arpq_tail = NULL;
-			} else if (neigh_is_connected(neigh))
+			} else if (neigh->nud_state & (NUD_CONNECTED|NUD_STALE))
 				setup_l2e_send_pending(dev, NULL, e);
 		} else {
 			e->state = neigh_is_connected(neigh) ?

^ permalink raw reply related

* Re: [patch 2.6.24-git] net/enc28j60: oops fix
From: David Brownell @ 2008-02-06 17:33 UTC (permalink / raw)
  To: netdev, lanconelli.claudio
In-Reply-To: <47A9EA42.3080800@eptar.com>

> > Prevent unaligned packet oops on enc28j60 packet RX.
>
> How can I reproduce the unaligned packet oops?

Use any architecture that doesn't support unaligned accesses
in kernel space.  I used AVR32 for this (it's got a pretty
solid SPI master controller driver). ARM isn't immune either,
and there are others.  That's why NET_IP_ALIGN exists.


> Did you use any utilities to force this condition?

"ping" ... the first RX packet oopsed.


> Can you split the patch in 2 parts, unaligned rx and power save?

Below is: unaligned access.

- Dave


=========== CUT HERE
Prevent oops on enc28j60 packet RX:  make sure buffers are aligned.
Not all architectures support unaligned accesses in kernel space.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
 drivers/net/enc28j60.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

--- a/drivers/net/enc28j60.c	2008-02-06 09:29:00.000000000 -0800
+++ b/drivers/net/enc28j60.c	2008-02-06 09:30:03.000000000 -0800
@@ -900,7 +900,7 @@ static void enc28j60_hw_rx(struct net_de
 		if (RSV_GETBIT(rxstat, RSV_LENCHECKERR))
 			ndev->stats.rx_frame_errors++;
 	} else {
-		skb = dev_alloc_skb(len);
+		skb = dev_alloc_skb(len + NET_IP_ALIGN);
 		if (!skb) {
 			if (netif_msg_rx_err(priv))
 				dev_err(&ndev->dev,
@@ -908,6 +908,7 @@ static void enc28j60_hw_rx(struct net_de
 			ndev->stats.rx_dropped++;
 		} else {
 			skb->dev = ndev;
+			skb_reserve(skb, NET_IP_ALIGN);
 			/* copy the packet from the receive buffer */
 			enc28j60_mem_read(priv, priv->next_pk_ptr + sizeof(rsv),
 					len, skb_put(skb, len));

^ permalink raw reply

* Re: [PATCH] Add IPv6 support to TCP SYN cookies
From: Glenn Griffin @ 2008-02-06 17:36 UTC (permalink / raw)
  To: Andi Kleen
  Cc: Glenn Griffin, Alan Cox, Evgeniy Polyakov, netdev, linux-kernel
In-Reply-To: <20080206075030.GA454@one.firstfloor.org>

> I didn't think a module could have multiple module_inits. Are you
> sure that works?

Indeed.  That will fail whenever ipv6 is compiled as a module.  It's
been removed.  It snuck in from the v4 implementation, where I'm still
having trouble understanding why it's needed there.

--Glenn

^ permalink raw reply

* Re: [patch 2.6.24-git] net/enc28j60: oops fix, low power mode
From: Claudio Lanconelli @ 2008-02-06 17:11 UTC (permalink / raw)
  To: netdev; +Cc: David Brownell
In-Reply-To: <20080205190124.E72F48E45F@adsl-69-226-248-13.dsl.pltn13.pacbell.net>

David Brownell wrote:
> From: David Brownell <dbrownell@users.sourceforge.net>
>
> Prevent unaligned packet oops on enc28j60 packet RX.
>   
How can I reproduce the unaligned packet oops? Did you use any utilities 
to force this condition?
> Keep enc28j60 chips in low-power mode when they're not in use.
> At typically 120 mA, these chips run hot even when idle.  Low
> power mode cuts that power usage by a factor of around 100.
>   
Good idea, but with your patch applied, after some ifconfig down - 
ifconfig up cycle, the
enc28j60 is left in an unknown state and it doesn' Rx/Tx anything.
In such cases If I dump the counters with ifconfig I got rx error 
counter > 0 and the RX and TX packets counters are freezed.
Actually I don't know what causes the freeze, it needs investigation. 
The cause can be the rx error condition or the power down/up commands.
May be receiving packets while it's going to wakeup causes problems.

Can you split the patch in 2 parts, unaligned rx and power save?

> +/*
> + * Low power mode shrinks power consumption about 100x, so we'd like
> + * the chip to be in that mode whenever it's inactive.
> + */
> +static void enc28j60_lowpower(struct enc28j60_net *priv, bool is_low)
> +{
> +	int	tmp;
> +
> +	dev_dbg(&priv->spi->dev, "%s power...\n", is_low ? "low" : "high");
>   
use
if(netif_msg_drv(priv)) printk(...
instead of dev_dbg(), please.
Doing so we can switch on/off messages runtime using ethtool.

> +
> +	mutex_lock(&priv->lock);
> +	if (is_low) {
> +		nolock_reg_bfclr(priv, ECON1, ECON1_RXEN);
> +		for (;;) {
> +			tmp = nolock_regb_read(priv, ESTAT);
> +			if (!(tmp & ESTAT_RXBUSY))
> +				break;
> +		}
>   
Avoid infinite waiting loops, please.
Look at enc28j60_phy_read() for example.
> +		for (;;) {
> +			tmp = nolock_regb_read(priv, ECON1);
> +			if (!(tmp & ECON1_TXRTS))
> +				break;
> +		}
>   
idem
> +		/* ECON2_VRPS was set during initialization */
> +		nolock_reg_bfset(priv, ECON2, ECON2_PWRSV);
> +	} else {
> +		nolock_reg_bfclr(priv, ECON2, ECON2_PWRSV);
> +		for (;;) {
> +			tmp = nolock_regb_read(priv, ESTAT);
> +			if (tmp & ESTAT_CLKRDY)
> +				break;
> +		}
>   
idem


^ permalink raw reply

* Re: oops with ipcomp
From: Herbert Xu @ 2008-02-06 17:07 UTC (permalink / raw)
  To: Beschorner Daniel; +Cc: netdev
In-Reply-To: <3C59DB883F7B0B4D8096010D45ACCD134F20BB@exch.facton.local>

On Wed, Feb 06, 2008 at 03:43:25PM +0100, Beschorner Daniel wrote:
> 
> Net_A - GW_A --- GW_B - Net_B
> 
> The Net_A - Net_B ESP/AES/IPComp tunnel works fine, the tunnel between
> Net_B and the external IP address of GW_A triggers the oops in GW_A.

That's interesting.  So which one out of A and B is running 2.6.24?

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply

* Re: [PATCH] net: NEWEMAC: Remove "rgmii-interface" from rgmii matching table
From: Olof Johansson @ 2008-02-06 16:35 UTC (permalink / raw)
  To: Josh Boyer; +Cc: Stefan Roese, linuxppc-dev, jeff, netdev
In-Reply-To: <20080206102340.1cdf7f8d@zod.rchland.ibm.com>

On Wed, Feb 06, 2008 at 10:23:40AM -0600, Josh Boyer wrote:
> On Wed, 6 Feb 2008 10:01:57 -0600
> Olof Johansson <olof@lixom.net> wrote:
> 
> > On Wed, Feb 06, 2008 at 01:21:59PM +0100, Stefan Roese wrote:
> > > With the removal the the "rgmii-interface" device_type property from the
> > > dts files, the newemac driver needs an update to only rely on compatible
> > > property.
> > 
> > What about systems using an older dts, such as one kexec:ing from an
> > older kernel?
> 
> Like what?  Kexec doesn't work on 4xx yet.

Sure, but similar restrictions would apply for customers who have a
flashed device tree that want to boot a newer kernel. Deprecating old
device tree support is something that should be done very carefully.

> > Just because the device tree source is distributed in the kernel tree
> > doesn't mean it can give up backwards compatibility.
> 
> We checked Axon, which is the only non-DTS machine that uses EMAC and
> it will work fine with this change.

Ah, ok. I remember discussions about this patch before then, sounds like
it's safe. I just triggered on the dts-centric patch description.

Objections withdrawn. :)


-Olof

^ permalink raw reply

* Re: [PATCH] net: NEWEMAC: Remove "rgmii-interface" from rgmii matching table
From: Josh Boyer @ 2008-02-06 16:23 UTC (permalink / raw)
  To: Olof Johansson; +Cc: Stefan Roese, linuxppc-dev, jeff, netdev
In-Reply-To: <20080206160157.GA18228@lixom.net>

On Wed, 6 Feb 2008 10:01:57 -0600
Olof Johansson <olof@lixom.net> wrote:

> On Wed, Feb 06, 2008 at 01:21:59PM +0100, Stefan Roese wrote:
> > With the removal the the "rgmii-interface" device_type property from the
> > dts files, the newemac driver needs an update to only rely on compatible
> > property.
> 
> What about systems using an older dts, such as one kexec:ing from an
> older kernel?

Like what?  Kexec doesn't work on 4xx yet.

> Just because the device tree source is distributed in the kernel tree
> doesn't mean it can give up backwards compatibility.

We checked Axon, which is the only non-DTS machine that uses EMAC and
it will work fine with this change.

josh

^ permalink raw reply

* Re: [PATCH] net: NEWEMAC: Remove "rgmii-interface" from rgmii matching table
From: Olof Johansson @ 2008-02-06 16:01 UTC (permalink / raw)
  To: Stefan Roese; +Cc: jeff, linuxppc-dev, netdev
In-Reply-To: <1202300519-7294-1-git-send-email-sr@denx.de>

On Wed, Feb 06, 2008 at 01:21:59PM +0100, Stefan Roese wrote:
> With the removal the the "rgmii-interface" device_type property from the
> dts files, the newemac driver needs an update to only rely on compatible
> property.

What about systems using an older dts, such as one kexec:ing from an
older kernel?

Just because the device tree source is distributed in the kernel tree
doesn't mean it can give up backwards compatibility.


-Olof


^ permalink raw reply

* Re: [bisected] Re: [bug] networking broke, ssh: connect to port 22: Protocol error
From: Casey Schaufler @ 2008-02-06 15:58 UTC (permalink / raw)
  To: Ingo Molnar, David Miller
  Cc: linux-kernel, netdev, Linus Torvalds, Casey Schaufler
In-Reply-To: <20080206133506.GA21202@elte.hu>


--- Ingo Molnar <mingo@elte.hu> wrote:

> 
> * Ingo Molnar <mingo@elte.hu> wrote:
> 
> > yeah, although various other upstream breakages prevented real long 
> > randconfig series in the past 2-3 days. I'd say it's either in this 
> > pull from your tree:
> 
> ok, i have bisected it down but the result made no sense, so i 
> double-checked it and noticed that the .config mutated during the test.
> 
> the diff below is the diff between the 'good' and 'bad' .config, with 
> this notable detail:
> 
>  @@ -2336,7 +2350,7 @@ CONFIG_SECURITY_NETWORK=y
>   CONFIG_SECURITY_CAPABILITIES=y
>   # CONFIG_SECURITY_FILE_CAPABILITIES is not set
>   # CONFIG_SECURITY_ROOTPLUG is not set
>  -# CONFIG_SECURITY_SMACK is not set
>  +CONFIG_SECURITY_SMACK=y
>   CONFIG_XOR_BLOCKS=m
>   CONFIG_ASYNC_CORE=m
>   CONFIG_ASYNC_MEMCPY=m
> 
> so i disabled CONFIG_SECURITY_SMACK, and viola, just 2 hours of hard 
> work later networking works on my testbox again :-/
> 
> And we have this 1 day old commit:
> 
>   commit e114e473771c848c3cfec05f0123e70f1cdbdc99
>   Author: Casey Schaufler <casey@schaufler-ca.com>
>   Date:   Mon Feb 4 22:29:50 2008 -0800
> 
>       Smack: Simplified Mandatory Access Control Kernel
> 
> that adds SMACK.
> 
> So unlike some other security modules like SELINUX, enabling SMACK 
> breaks un-aware userspace and breaks TCP networking?
> 
> I dont think that's expected behavior - and i'd definitely like to 
> enable SMACK in automated tests to check for regressions, etc.

As Stephen mentions later, Smack uses CIPSO. sshd does not like
any IP options because of traceroute, and must be built with that
check disabled with the current Smack version. I have been looking
at using unlabeled packets for the "ambient" label, it appears that
doing so would make life simpler. I will get right on it.

Application behavior in the presence of IP options isn't
always what I think it ought to be.


Casey Schaufler
casey@schaufler-ca.com

^ permalink raw reply

* Re: oops with ipcomp
From: Beschorner Daniel @ 2008-02-06 14:43 UTC (permalink / raw)
  To: netdev; +Cc: Herbert Xu

> Unable to handle kernel paging request at ffffc200000fb000 RIP: 
>  [<ffffffff8031b8f0>] deflate_slow+0x40/0x400

Here is some more information about the scenario in which I can easily
reproduce the oops now:

Net_A - GW_A --- GW_B - Net_B

The Net_A - Net_B ESP/AES/IPComp tunnel works fine, the tunnel between
Net_B and the external IP address of GW_A triggers the oops in GW_A.

Daniel

^ permalink raw reply

* Re: [PATCH] iputils/ping_common.c: avoid gethostbyaddr during ping flood
From: Chris Caputo @ 2008-02-06 14:02 UTC (permalink / raw)
  To: netdev

[Resend with whitespace preserved.]

Unless a destination is specified by IP address, a ping flood results in a 
gethostbyaddr() for every echo reply.  Thus a DNS flood can accompany a 
ping flood.
 
This patch makes it so a gethostbyaddr() is not performed with each echo 
reply during a ping flood.

Signed-off-by: Chris Caputo <ccaputo@alt.net>
---
 ping_common.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

===================================================================
diff -ur iputils-s20071127/ping_common.c iputils/ping_common.c
--- iputils-s20071127/ping_common.c	2007-11-27 00:57:27.000000000 +0000
+++ iputils/ping_common.c	2008-02-06 12:38:01.000000000 +0000
@@ -114,10 +114,6 @@
 	case 'd':
 		options |= F_SO_DEBUG;
 		break;
-	case 'f':
-		options |= F_FLOOD;
-		setbuf(stdout, (char *)NULL);
-		break;
 	case 'i':		/* wait between sending packets */
 	{
 		if (strchr(optarg, '.')) {
@@ -168,6 +164,10 @@
 			exit(2);
 		}
 		break;
+	case 'f':
+		options |= F_FLOOD;
+		setbuf(stdout, (char *)NULL);
+		/* fallthrough to numeric - avoid gethostbyaddr during flood */
 	case 'n':
 		options |= F_NUMERIC;
 		break;

^ permalink raw reply

* Re: [bisected] Re: [bug] networking broke, ssh: connect to port 22: Protocol error
From: Stephen Smalley @ 2008-02-06 13:55 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: David Miller, linux-kernel, netdev, Linus Torvalds,
	Casey Schaufler
In-Reply-To: <20080206133506.GA21202@elte.hu>


On Wed, 2008-02-06 at 14:35 +0100, Ingo Molnar wrote:
> * Ingo Molnar <mingo@elte.hu> wrote:
> 
> > yeah, although various other upstream breakages prevented real long 
> > randconfig series in the past 2-3 days. I'd say it's either in this 
> > pull from your tree:
> 
> ok, i have bisected it down but the result made no sense, so i 
> double-checked it and noticed that the .config mutated during the test.
> 
> the diff below is the diff between the 'good' and 'bad' .config, with 
> this notable detail:
> 
>  @@ -2336,7 +2350,7 @@ CONFIG_SECURITY_NETWORK=y
>   CONFIG_SECURITY_CAPABILITIES=y
>   # CONFIG_SECURITY_FILE_CAPABILITIES is not set
>   # CONFIG_SECURITY_ROOTPLUG is not set
>  -# CONFIG_SECURITY_SMACK is not set
>  +CONFIG_SECURITY_SMACK=y
>   CONFIG_XOR_BLOCKS=m
>   CONFIG_ASYNC_CORE=m
>   CONFIG_ASYNC_MEMCPY=m
> 
> so i disabled CONFIG_SECURITY_SMACK, and viola, just 2 hours of hard 
> work later networking works on my testbox again :-/
> 
> And we have this 1 day old commit:
> 
>   commit e114e473771c848c3cfec05f0123e70f1cdbdc99
>   Author: Casey Schaufler <casey@schaufler-ca.com>
>   Date:   Mon Feb 4 22:29:50 2008 -0800
> 
>       Smack: Simplified Mandatory Access Control Kernel
> 
> that adds SMACK.
> 
> So unlike some other security modules like SELINUX, enabling SMACK 
> breaks un-aware userspace and breaks TCP networking?
> 
> I dont think that's expected behavior - and i'd definitely like to 
> enable SMACK in automated tests to check for regressions, etc.

It is expected behavior for Smack due to default use of CIPSO for packet
labeling, see:
http://lkml.org/lkml/2007/10/14/210

> 	Ingo
> 
> --- .config.good	2008-02-06 14:13:35.000000000 +0100
> +++ .config.bad	2008-02-06 14:17:28.000000000 +0100
> @@ -1,7 +1,7 @@
>  #
>  # Automatically generated make config: don't edit
>  # Linux kernel version: 2.6.24
> -# Wed Feb  6 14:11:27 2008
> +# Wed Feb  6 14:15:22 2008
>  #
>  # CONFIG_64BIT is not set
>  CONFIG_X86_32=y
> @@ -94,15 +94,16 @@ CONFIG_FUTEX=y
>  CONFIG_ANON_INODES=y
>  # CONFIG_EPOLL is not set
>  CONFIG_SIGNALFD=y
> -CONFIG_TIMERFD=y
> +# CONFIG_TIMERFD is not set
>  CONFIG_EVENTFD=y
>  # CONFIG_SHMEM is not set
>  # CONFIG_VM_EVENT_COUNTERS is not set
>  # CONFIG_SLAB is not set
>  # CONFIG_SLUB is not set
>  CONFIG_SLOB=y
> -# CONFIG_PROFILING is not set
> +CONFIG_PROFILING=y
>  # CONFIG_MARKERS is not set
> +CONFIG_OPROFILE=y
>  CONFIG_HAVE_OPROFILE=y
>  # CONFIG_KPROBES is not set
>  CONFIG_HAVE_KPROBES=y
> @@ -691,7 +692,7 @@ CONFIG_MAC80211_RC_DEFAULT=""
>  # CONFIG_MAC80211_RC_PID is not set
>  # CONFIG_MAC80211_RC_SIMPLE is not set
>  # CONFIG_MAC80211_DEBUGFS is not set
> -# CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set
> +CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT=y
>  # CONFIG_MAC80211_DEBUG is not set
>  CONFIG_IEEE80211=m
>  # CONFIG_IEEE80211_DEBUG is not set
> @@ -744,6 +745,7 @@ CONFIG_CDROM_PKTCDVD=y
>  CONFIG_CDROM_PKTCDVD_BUFFERS=8
>  CONFIG_CDROM_PKTCDVD_WCACHE=y
>  CONFIG_ATA_OVER_ETH=y
> +CONFIG_VIRTIO_BLK=y
>  # CONFIG_MISC_DEVICES is not set
>  # CONFIG_IDE is not set
>  
> @@ -796,9 +798,19 @@ CONFIG_BLK_DEV_3W_XXXX_RAID=y
>  CONFIG_SCSI_3W_9XXX=m
>  CONFIG_SCSI_ACARD=y
>  # CONFIG_SCSI_AACRAID is not set
> -# CONFIG_SCSI_AIC7XXX is not set
> -# CONFIG_SCSI_AIC7XXX_OLD is not set
> -# CONFIG_SCSI_AIC79XX is not set
> +CONFIG_SCSI_AIC7XXX=y
> +CONFIG_AIC7XXX_CMDS_PER_DEVICE=32
> +CONFIG_AIC7XXX_RESET_DELAY_MS=5000
> +# CONFIG_AIC7XXX_DEBUG_ENABLE is not set
> +CONFIG_AIC7XXX_DEBUG_MASK=0
> +# CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set
> +CONFIG_SCSI_AIC7XXX_OLD=m
> +CONFIG_SCSI_AIC79XX=y
> +CONFIG_AIC79XX_CMDS_PER_DEVICE=32
> +CONFIG_AIC79XX_RESET_DELAY_MS=5000
> +CONFIG_AIC79XX_DEBUG_ENABLE=y
> +CONFIG_AIC79XX_DEBUG_MASK=0
> +# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
>  CONFIG_SCSI_AIC94XX=m
>  # CONFIG_AIC94XX_DEBUG is not set
>  CONFIG_SCSI_DPT_I2O=m
> @@ -1181,6 +1193,7 @@ CONFIG_NETCONSOLE=y
>  CONFIG_NETPOLL=y
>  # CONFIG_NETPOLL_TRAP is not set
>  CONFIG_NET_POLL_CONTROLLER=y
> +# CONFIG_VIRTIO_NET is not set
>  CONFIG_ISDN=y
>  # CONFIG_ISDN_I4L is not set
>  # CONFIG_ISDN_CAPI is not set
> @@ -2043,7 +2056,8 @@ CONFIG_INFINIBAND_AMSO1100=m
>  CONFIG_INFINIBAND_AMSO1100_DEBUG=y
>  # CONFIG_INFINIBAND_CXGB3 is not set
>  CONFIG_MLX4_INFINIBAND=m
> -# CONFIG_INFINIBAND_NES is not set
> +CONFIG_INFINIBAND_NES=m
> +CONFIG_INFINIBAND_NES_DEBUG=y
>  CONFIG_INFINIBAND_IPOIB=m
>  CONFIG_INFINIBAND_IPOIB_CM=y
>  CONFIG_INFINIBAND_IPOIB_DEBUG=y
> @@ -2336,7 +2350,7 @@ CONFIG_SECURITY_NETWORK=y
>  CONFIG_SECURITY_CAPABILITIES=y
>  # CONFIG_SECURITY_FILE_CAPABILITIES is not set
>  # CONFIG_SECURITY_ROOTPLUG is not set
> -# CONFIG_SECURITY_SMACK is not set
> +CONFIG_SECURITY_SMACK=y
>  CONFIG_XOR_BLOCKS=m
>  CONFIG_ASYNC_CORE=m
>  CONFIG_ASYNC_MEMCPY=m
> @@ -2396,7 +2410,9 @@ CONFIG_CRYPTO_AUTHENC=y
>  # CONFIG_CRYPTO_HW is not set
>  CONFIG_VIRTUALIZATION=y
>  # CONFIG_LGUEST is not set
> -# CONFIG_VIRTIO_PCI is not set
> +CONFIG_VIRTIO=y
> +CONFIG_VIRTIO_RING=y
> +CONFIG_VIRTIO_PCI=y
>  # CONFIG_VIRTIO_BALLOON is not set
>  
>  #
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
-- 
Stephen Smalley
National Security Agency

^ permalink raw reply

* [IPV4]: route: fix crash ip_route_input
From: Patrick McHardy @ 2008-02-06 13:36 UTC (permalink / raw)
  To: David S. Miller
  Cc: Netfilter Development Mailinglist, Denis V. Lunev,
	Linux Netdev List

[-- Attachment #1: Type: text/plain, Size: 0 bytes --]



[-- Attachment #2: 05.diff --]
[-- Type: text/x-patch, Size: 1015 bytes --]

commit dad61a4af7d23146ce67ec2f069f6ba9b75a578d
Author: Patrick McHardy <kaber@trash.net>
Date:   Wed Feb 6 14:35:11 2008 +0100

    [IPV4]: route: fix crash ip_route_input
    
    ip_route_me_harder() may call ip_route_input() with skbs that don't
    have skb->dev set for skbs rerouted in LOCAL_OUT and TCP resets
    generated by the REJECT target, resulting in a crash when dereferencing
    skb->dev->nd_net. Since ip_route_input() has an input device argument,
    it seems correct to use that one anyway.
    
    Bug introduced in b5921910a1 (Routing cache virtualization).
    
    Signed-off-by: Patrick McHardy <kaber@trash.net>

diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 8842ecb..525787b 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -2041,7 +2041,7 @@ int ip_route_input(struct sk_buff *skb, __be32 daddr, __be32 saddr,
 	int iif = dev->ifindex;
 	struct net *net;
 
-	net = skb->dev->nd_net;
+	net = dev->nd_net;
 	tos &= IPTOS_RT_MASK;
 	hash = rt_hash(daddr, saddr, iif);
 

^ permalink raw reply related

* [bisected] Re: [bug] networking broke, ssh: connect to port 22: Protocol error
From: Ingo Molnar @ 2008-02-06 13:35 UTC (permalink / raw)
  To: David Miller; +Cc: linux-kernel, netdev, Linus Torvalds, Casey Schaufler
In-Reply-To: <20080206131129.GB9950@elte.hu>


* Ingo Molnar <mingo@elte.hu> wrote:

> yeah, although various other upstream breakages prevented real long 
> randconfig series in the past 2-3 days. I'd say it's either in this 
> pull from your tree:

ok, i have bisected it down but the result made no sense, so i 
double-checked it and noticed that the .config mutated during the test.

the diff below is the diff between the 'good' and 'bad' .config, with 
this notable detail:

 @@ -2336,7 +2350,7 @@ CONFIG_SECURITY_NETWORK=y
  CONFIG_SECURITY_CAPABILITIES=y
  # CONFIG_SECURITY_FILE_CAPABILITIES is not set
  # CONFIG_SECURITY_ROOTPLUG is not set
 -# CONFIG_SECURITY_SMACK is not set
 +CONFIG_SECURITY_SMACK=y
  CONFIG_XOR_BLOCKS=m
  CONFIG_ASYNC_CORE=m
  CONFIG_ASYNC_MEMCPY=m

so i disabled CONFIG_SECURITY_SMACK, and viola, just 2 hours of hard 
work later networking works on my testbox again :-/

And we have this 1 day old commit:

  commit e114e473771c848c3cfec05f0123e70f1cdbdc99
  Author: Casey Schaufler <casey@schaufler-ca.com>
  Date:   Mon Feb 4 22:29:50 2008 -0800

      Smack: Simplified Mandatory Access Control Kernel

that adds SMACK.

So unlike some other security modules like SELINUX, enabling SMACK 
breaks un-aware userspace and breaks TCP networking?

I dont think that's expected behavior - and i'd definitely like to 
enable SMACK in automated tests to check for regressions, etc.

	Ingo

--- .config.good	2008-02-06 14:13:35.000000000 +0100
+++ .config.bad	2008-02-06 14:17:28.000000000 +0100
@@ -1,7 +1,7 @@
 #
 # Automatically generated make config: don't edit
 # Linux kernel version: 2.6.24
-# Wed Feb  6 14:11:27 2008
+# Wed Feb  6 14:15:22 2008
 #
 # CONFIG_64BIT is not set
 CONFIG_X86_32=y
@@ -94,15 +94,16 @@ CONFIG_FUTEX=y
 CONFIG_ANON_INODES=y
 # CONFIG_EPOLL is not set
 CONFIG_SIGNALFD=y
-CONFIG_TIMERFD=y
+# CONFIG_TIMERFD is not set
 CONFIG_EVENTFD=y
 # CONFIG_SHMEM is not set
 # CONFIG_VM_EVENT_COUNTERS is not set
 # CONFIG_SLAB is not set
 # CONFIG_SLUB is not set
 CONFIG_SLOB=y
-# CONFIG_PROFILING is not set
+CONFIG_PROFILING=y
 # CONFIG_MARKERS is not set
+CONFIG_OPROFILE=y
 CONFIG_HAVE_OPROFILE=y
 # CONFIG_KPROBES is not set
 CONFIG_HAVE_KPROBES=y
@@ -691,7 +692,7 @@ CONFIG_MAC80211_RC_DEFAULT=""
 # CONFIG_MAC80211_RC_PID is not set
 # CONFIG_MAC80211_RC_SIMPLE is not set
 # CONFIG_MAC80211_DEBUGFS is not set
-# CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT is not set
+CONFIG_MAC80211_DEBUG_PACKET_ALIGNMENT=y
 # CONFIG_MAC80211_DEBUG is not set
 CONFIG_IEEE80211=m
 # CONFIG_IEEE80211_DEBUG is not set
@@ -744,6 +745,7 @@ CONFIG_CDROM_PKTCDVD=y
 CONFIG_CDROM_PKTCDVD_BUFFERS=8
 CONFIG_CDROM_PKTCDVD_WCACHE=y
 CONFIG_ATA_OVER_ETH=y
+CONFIG_VIRTIO_BLK=y
 # CONFIG_MISC_DEVICES is not set
 # CONFIG_IDE is not set
 
@@ -796,9 +798,19 @@ CONFIG_BLK_DEV_3W_XXXX_RAID=y
 CONFIG_SCSI_3W_9XXX=m
 CONFIG_SCSI_ACARD=y
 # CONFIG_SCSI_AACRAID is not set
-# CONFIG_SCSI_AIC7XXX is not set
-# CONFIG_SCSI_AIC7XXX_OLD is not set
-# CONFIG_SCSI_AIC79XX is not set
+CONFIG_SCSI_AIC7XXX=y
+CONFIG_AIC7XXX_CMDS_PER_DEVICE=32
+CONFIG_AIC7XXX_RESET_DELAY_MS=5000
+# CONFIG_AIC7XXX_DEBUG_ENABLE is not set
+CONFIG_AIC7XXX_DEBUG_MASK=0
+# CONFIG_AIC7XXX_REG_PRETTY_PRINT is not set
+CONFIG_SCSI_AIC7XXX_OLD=m
+CONFIG_SCSI_AIC79XX=y
+CONFIG_AIC79XX_CMDS_PER_DEVICE=32
+CONFIG_AIC79XX_RESET_DELAY_MS=5000
+CONFIG_AIC79XX_DEBUG_ENABLE=y
+CONFIG_AIC79XX_DEBUG_MASK=0
+# CONFIG_AIC79XX_REG_PRETTY_PRINT is not set
 CONFIG_SCSI_AIC94XX=m
 # CONFIG_AIC94XX_DEBUG is not set
 CONFIG_SCSI_DPT_I2O=m
@@ -1181,6 +1193,7 @@ CONFIG_NETCONSOLE=y
 CONFIG_NETPOLL=y
 # CONFIG_NETPOLL_TRAP is not set
 CONFIG_NET_POLL_CONTROLLER=y
+# CONFIG_VIRTIO_NET is not set
 CONFIG_ISDN=y
 # CONFIG_ISDN_I4L is not set
 # CONFIG_ISDN_CAPI is not set
@@ -2043,7 +2056,8 @@ CONFIG_INFINIBAND_AMSO1100=m
 CONFIG_INFINIBAND_AMSO1100_DEBUG=y
 # CONFIG_INFINIBAND_CXGB3 is not set
 CONFIG_MLX4_INFINIBAND=m
-# CONFIG_INFINIBAND_NES is not set
+CONFIG_INFINIBAND_NES=m
+CONFIG_INFINIBAND_NES_DEBUG=y
 CONFIG_INFINIBAND_IPOIB=m
 CONFIG_INFINIBAND_IPOIB_CM=y
 CONFIG_INFINIBAND_IPOIB_DEBUG=y
@@ -2336,7 +2350,7 @@ CONFIG_SECURITY_NETWORK=y
 CONFIG_SECURITY_CAPABILITIES=y
 # CONFIG_SECURITY_FILE_CAPABILITIES is not set
 # CONFIG_SECURITY_ROOTPLUG is not set
-# CONFIG_SECURITY_SMACK is not set
+CONFIG_SECURITY_SMACK=y
 CONFIG_XOR_BLOCKS=m
 CONFIG_ASYNC_CORE=m
 CONFIG_ASYNC_MEMCPY=m
@@ -2396,7 +2410,9 @@ CONFIG_CRYPTO_AUTHENC=y
 # CONFIG_CRYPTO_HW is not set
 CONFIG_VIRTUALIZATION=y
 # CONFIG_LGUEST is not set
-# CONFIG_VIRTIO_PCI is not set
+CONFIG_VIRTIO=y
+CONFIG_VIRTIO_RING=y
+CONFIG_VIRTIO_PCI=y
 # CONFIG_VIRTIO_BALLOON is not set
 
 #


^ permalink raw reply

* Re: [bug] networking broke, ssh: connect to port 22: Protocol error
From: Ingo Molnar @ 2008-02-06 13:11 UTC (permalink / raw)
  To: David Miller; +Cc: linux-kernel, netdev
In-Reply-To: <20080206.043246.63923682.davem@davemloft.net>


* David Miller <davem@davemloft.net> wrote:

> From: Ingo Molnar <mingo@elte.hu>
> Date: Wed, 6 Feb 2008 13:22:48 +0100
> 
> > So no, it does not fix the problem. The config i sent is a rather 
> > generic one, it should boot on most whitebox PCs. TCP connections 
> > will fail immediately, all the time.
> 
> I suspect this got added recently with how often and how thoroughly 
> you test things :-)

yeah, although various other upstream breakages prevented real long 
randconfig series in the past 2-3 days. I'd say it's either in this pull 
from your tree:

  Author: Linus Torvalds <torvalds@woody.linux-foundation.org>
  Date:   Tue Feb 5 10:09:07 2008 -0800

    Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (21 commits)

or perhaps in this one:

  Author: Linus Torvalds <torvalds@linux-foundation.org>
  Date:   Mon Feb 4 07:43:36 2008 -0800

    Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (77 commits)

i'll figure it out, it's totally reproducible so it should be easy to 
bisect. Just wanted to know whether you had anything queued up already 
for something like this.

	Ingo

^ permalink raw reply

* [PATCH] iputils/ping_common.c: avoid gethostbyaddr during ping flood
From: Chris Caputo @ 2008-02-06 13:02 UTC (permalink / raw)
  To: netdev

Unless a destination is specified by IP address, a ping flood results in a 
gethostbyaddr() for every echo reply.  Thus a DNS flood can accompany a 
ping flood.

This patch makes it so a gethostbyaddr() is not performed with each echo 
reply during a ping flood.

Signed-off-by: Chris Caputo <ccaputo@alt.net>
---
 ping_common.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

===================================================================
diff -ur iputils-s20071127/ping_common.c iputils/ping_common.c
--- iputils-s20071127/ping_common.c     2007-11-27 00:57:27.000000000 +0000
+++ iputils/ping_common.c       2008-02-06 12:38:01.000000000 +0000
@@ -114,10 +114,6 @@
        case 'd':
                options |= F_SO_DEBUG;
                break;
-       case 'f':
-               options |= F_FLOOD;
-               setbuf(stdout, (char *)NULL);
-               break;
        case 'i':               /* wait between sending packets */
        {
                if (strchr(optarg, '.')) {
@@ -168,6 +164,10 @@
                        exit(2);
                }
                break;
+       case 'f':
+               options |= F_FLOOD;
+               setbuf(stdout, (char *)NULL);
+               /* fallthrough to numeric - avoid gethostbyaddr during flood */
        case 'n':
                options |= F_NUMERIC;
                break;

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox