···1/*2 *3- * linux/drivers/s390/net/ctcdbug.h ($Revision: 1.4 $)4 *5 * CTC / ESCON network driver - s390 dbf exploit.6 *···9 * Author(s): Original Code written by10 * Peter Tiedemann (ptiedem@de.ibm.com)11 *12- * $Revision: 1.4 $ $Date: 2004/10/15 09:26:58 $13 *14 * This program is free software; you can redistribute it and/or modify15 * it under the terms of the GNU General Public License as published by···25 * along with this program; if not, write to the Free Software26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.27 */28-02930#include <asm/debug.h>031/**32 * Debug Facility stuff33 */···43#define CTC_DBF_DATA_LEN 12844#define CTC_DBF_DATA_INDEX 345#define CTC_DBF_DATA_NR_AREAS 146-#define CTC_DBF_DATA_LEVEL 24748#define CTC_DBF_TRACE_NAME "ctc_trace"49#define CTC_DBF_TRACE_LEN 16···123 printk("\n");124}12500
···1/*2 *3+ * linux/drivers/s390/net/ctcdbug.h ($Revision: 1.5 $)4 *5 * CTC / ESCON network driver - s390 dbf exploit.6 *···9 * Author(s): Original Code written by10 * Peter Tiedemann (ptiedem@de.ibm.com)11 *12+ * $Revision: 1.5 $ $Date: 2005/02/27 19:46:44 $13 *14 * This program is free software; you can redistribute it and/or modify15 * it under the terms of the GNU General Public License as published by···25 * along with this program; if not, write to the Free Software26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.27 */28+#ifndef _CTCDBUG_H_29+#define _CTCDBUG_H_3031#include <asm/debug.h>32+#include "ctcmain.h"33/**34 * Debug Facility stuff35 */···41#define CTC_DBF_DATA_LEN 12842#define CTC_DBF_DATA_INDEX 343#define CTC_DBF_DATA_NR_AREAS 144+#define CTC_DBF_DATA_LEVEL 34546#define CTC_DBF_TRACE_NAME "ctc_trace"47#define CTC_DBF_TRACE_LEN 16···121 printk("\n");122}123124+125+#endif
+207-411
drivers/s390/net/ctcmain.c
···1/*2- * $Id: ctcmain.c,v 1.72 2005/03/17 10:51:52 ptiedem Exp $3 *4 * CTC / ESCON network driver5 *···37 * along with this program; if not, write to the Free Software38 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.39 *40- * RELEASE-TAG: CTC/ESCON network driver $Revision: 1.72 $41 *42 */4344#undef DEBUG45-46#include <linux/module.h>47#include <linux/init.h>48#include <linux/kernel.h>···73#include "ctctty.h"74#include "fsm.h"75#include "cu3088.h"076#include "ctcdbug.h"07778MODULE_AUTHOR("(C) 2000 IBM Corp. by Fritz Elfert (felfert@millenux.com)");79MODULE_DESCRIPTION("Linux for S/390 CTC/Escon Driver");80MODULE_LICENSE("GPL");81-82-/**83- * CCW commands, used in this driver.84- */85-#define CCW_CMD_WRITE 0x0186-#define CCW_CMD_READ 0x0287-#define CCW_CMD_SET_EXTENDED 0xc388-#define CCW_CMD_PREPARE 0xe389-90-#define CTC_PROTO_S390 091-#define CTC_PROTO_LINUX 192-#define CTC_PROTO_LINUX_TTY 293-#define CTC_PROTO_OS390 394-#define CTC_PROTO_MAX 395-96-#define CTC_BUFSIZE_LIMIT 6553597-#define CTC_BUFSIZE_DEFAULT 3276898-99-#define CTC_TIMEOUT_5SEC 5000100-101-#define CTC_INITIAL_BLOCKLEN 2102-103-#define READ 0104-#define WRITE 1105-106-#define CTC_ID_SIZE BUS_ID_SIZE+3107-108-109-struct ctc_profile {110- unsigned long maxmulti;111- unsigned long maxcqueue;112- unsigned long doios_single;113- unsigned long doios_multi;114- unsigned long txlen;115- unsigned long tx_time;116- struct timespec send_stamp;117-};118-119-/**120- * Definition of one channel121- */122-struct channel {123-124- /**125- * Pointer to next channel in list.126- */127- struct channel *next;128- char id[CTC_ID_SIZE];129- struct ccw_device *cdev;130-131- /**132- * Type of this channel.133- * CTC/A or Escon for valid channels.134- */135- enum channel_types type;136-137- /**138- * Misc. flags. See CHANNEL_FLAGS_... below139- */140- __u32 flags;141-142- /**143- * The protocol of this channel144- */145- __u16 protocol;146-147- /**148- * I/O and irq related stuff149- */150- struct ccw1 *ccw;151- struct irb *irb;152-153- /**154- * RX/TX buffer size155- */156- int max_bufsize;157-158- /**159- * Transmit/Receive buffer.160- */161- struct sk_buff *trans_skb;162-163- /**164- * Universal I/O queue.165- */166- struct sk_buff_head io_queue;167-168- /**169- * TX queue for collecting skb's during busy.170- */171- struct sk_buff_head collect_queue;172-173- /**174- * Amount of data in collect_queue.175- */176- int collect_len;177-178- /**179- * spinlock for collect_queue and collect_len180- */181- spinlock_t collect_lock;182-183- /**184- * Timer for detecting unresposive185- * I/O operations.186- */187- fsm_timer timer;188-189- /**190- * Retry counter for misc. operations.191- */192- int retry;193-194- /**195- * The finite state machine of this channel196- */197- fsm_instance *fsm;198-199- /**200- * The corresponding net_device this channel201- * belongs to.202- */203- struct net_device *netdev;204-205- struct ctc_profile prof;206-207- unsigned char *trans_skb_data;208-209- __u16 logflags;210-};211-212-#define CHANNEL_FLAGS_READ 0213-#define CHANNEL_FLAGS_WRITE 1214-#define CHANNEL_FLAGS_INUSE 2215-#define CHANNEL_FLAGS_BUFSIZE_CHANGED 4216-#define CHANNEL_FLAGS_FAILED 8217-#define CHANNEL_FLAGS_WAITIRQ 16218-#define CHANNEL_FLAGS_RWMASK 1219-#define CHANNEL_DIRECTION(f) (f & CHANNEL_FLAGS_RWMASK)220-221-#define LOG_FLAG_ILLEGALPKT 1222-#define LOG_FLAG_ILLEGALSIZE 2223-#define LOG_FLAG_OVERRUN 4224-#define LOG_FLAG_NOMEM 8225-226-#define CTC_LOGLEVEL_INFO 1227-#define CTC_LOGLEVEL_NOTICE 2228-#define CTC_LOGLEVEL_WARN 4229-#define CTC_LOGLEVEL_EMERG 8230-#define CTC_LOGLEVEL_ERR 16231-#define CTC_LOGLEVEL_DEBUG 32232-#define CTC_LOGLEVEL_CRIT 64233-234-#define CTC_LOGLEVEL_DEFAULT \235-(CTC_LOGLEVEL_INFO | CTC_LOGLEVEL_NOTICE | CTC_LOGLEVEL_WARN | CTC_LOGLEVEL_CRIT)236-237-#define CTC_LOGLEVEL_MAX ((CTC_LOGLEVEL_CRIT<<1)-1)238-239-static int loglevel = CTC_LOGLEVEL_DEFAULT;240-241-#define ctc_pr_debug(fmt, arg...) \242-do { if (loglevel & CTC_LOGLEVEL_DEBUG) printk(KERN_DEBUG fmt,##arg); } while (0)243-244-#define ctc_pr_info(fmt, arg...) \245-do { if (loglevel & CTC_LOGLEVEL_INFO) printk(KERN_INFO fmt,##arg); } while (0)246-247-#define ctc_pr_notice(fmt, arg...) \248-do { if (loglevel & CTC_LOGLEVEL_NOTICE) printk(KERN_NOTICE fmt,##arg); } while (0)249-250-#define ctc_pr_warn(fmt, arg...) \251-do { if (loglevel & CTC_LOGLEVEL_WARN) printk(KERN_WARNING fmt,##arg); } while (0)252-253-#define ctc_pr_emerg(fmt, arg...) \254-do { if (loglevel & CTC_LOGLEVEL_EMERG) printk(KERN_EMERG fmt,##arg); } while (0)255-256-#define ctc_pr_err(fmt, arg...) \257-do { if (loglevel & CTC_LOGLEVEL_ERR) printk(KERN_ERR fmt,##arg); } while (0)258-259-#define ctc_pr_crit(fmt, arg...) \260-do { if (loglevel & CTC_LOGLEVEL_CRIT) printk(KERN_CRIT fmt,##arg); } while (0)261-262-/**263- * Linked list of all detected channels.264- */265-static struct channel *channels = NULL;266-267-struct ctc_priv {268- struct net_device_stats stats;269- unsigned long tbusy;270- /**271- * The finite state machine of this interface.272- */273- fsm_instance *fsm;274- /**275- * The protocol of this device276- */277- __u16 protocol;278- /**279- * Timer for restarting after I/O Errors280- */281- fsm_timer restart_timer;282-283- int buffer_size;284-285- struct channel *channel[2];286-};287-288-/**289- * Definition of our link level header.290- */291-struct ll_header {292- __u16 length;293- __u16 type;294- __u16 unused;295-};296-#define LL_HEADER_LENGTH (sizeof(struct ll_header))297-298-/**299- * Compatibility macros for busy handling300- * of network devices.301- */302-static __inline__ void303-ctc_clear_busy(struct net_device * dev)304-{305- clear_bit(0, &(((struct ctc_priv *) dev->priv)->tbusy));306- if (((struct ctc_priv *)dev->priv)->protocol != CTC_PROTO_LINUX_TTY)307- netif_wake_queue(dev);308-}309-310-static __inline__ int311-ctc_test_and_set_busy(struct net_device * dev)312-{313- if (((struct ctc_priv *)dev->priv)->protocol != CTC_PROTO_LINUX_TTY)314- netif_stop_queue(dev);315- return test_and_set_bit(0, &((struct ctc_priv *) dev->priv)->tbusy);316-}317-318-/**319- * Print Banner.320- */321-static void322-print_banner(void)323-{324- static int printed = 0;325- char vbuf[] = "$Revision: 1.72 $";326- char *version = vbuf;327-328- if (printed)329- return;330- if ((version = strchr(version, ':'))) {331- char *p = strchr(version + 1, '$');332- if (p)333- *p = '\0';334- } else335- version = " ??? ";336- printk(KERN_INFO "CTC driver Version%s"337-#ifdef DEBUG338- " (DEBUG-VERSION, " __DATE__ __TIME__ ")"339-#endif340- " initialized\n", version);341- printed = 1;342-}343-344-/**345- * Return type of a detected device.346- */347-static enum channel_types348-get_channel_type(struct ccw_device_id *id)349-{350- enum channel_types type = (enum channel_types) id->driver_info;351-352- if (type == channel_type_ficon)353- type = channel_type_escon;354-355- return type;356-}357-358/**359 * States of the interface statemachine.360 */···95 /**96 * MUST be always the last element!!97 */98- NR_DEV_STATES99};100101static const char *dev_state_names[] = {···123 /**124 * MUST be always the last element!!125 */126- NR_DEV_EVENTS127};128129static const char *dev_event_names[] = {···200 NR_CH_EVENTS,201};202203-static const char *ch_event_names[] = {204- "ccw_device success",205- "ccw_device busy",206- "ccw_device enodev",207- "ccw_device ioerr",208- "ccw_device unknown",209-210- "Status ATTN & BUSY",211- "Status ATTN",212- "Status BUSY",213-214- "Unit check remote reset",215- "Unit check remote system reset",216- "Unit check TX timeout",217- "Unit check TX parity",218- "Unit check Hardware failure",219- "Unit check RX parity",220- "Unit check ZERO",221- "Unit check Unknown",222-223- "SubChannel check Unknown",224-225- "Machine check failure",226- "Machine check operational",227-228- "IRQ normal",229- "IRQ final",230-231- "Timer",232-233- "Start",234- "Stop",235-};236-237/**238 * States of the channel statemachine.239 */···233 * MUST be always the last element!!234 */235 NR_CH_STATES,000000000000000000000000000000000000000000000000000000000000000000000000000000000236};237238static const char *ch_state_names[] = {···1705 ch->cdev = cdev;1706 snprintf(ch->id, CTC_ID_SIZE, "ch-%s", cdev->dev.bus_id);1707 ch->type = type;1708- loglevel = CTC_LOGLEVEL_DEFAULT;1709 ch->fsm = init_fsm(ch->id, ch_state_names,1710 ch_event_names, NR_CH_STATES, NR_CH_EVENTS,1711 ch_fsm, CH_FSM_LEN, GFP_KERNEL);···2467/*2468 * sysfs attributes2469 */02470static ssize_t2471buffer_show(struct device *dev, char *buf)2472{···2486 struct ctc_priv *priv;2487 struct net_device *ndev;2488 int bs1;024892490 DBF_TEXT(trace, 3, __FUNCTION__);02491 priv = dev->driver_data;2492- if (!priv)02493 return -ENODEV;2494- ndev = priv->channel[READ]->netdev;2495- if (!ndev)2496- return -ENODEV;2497- sscanf(buf, "%u", &bs1);249802499 if (bs1 > CTC_BUFSIZE_LIMIT)2500- return -EINVAL;00000000002501 if ((ndev->flags & IFF_RUNNING) &&2502 (bs1 < (ndev->mtu + LL_HEADER_LENGTH + 2)))2503- return -EINVAL;2504- if (bs1 < (576 + LL_HEADER_LENGTH + 2))2505- return -EINVAL;25062507- priv->buffer_size = bs1;2508- priv->channel[READ]->max_bufsize =2509- priv->channel[WRITE]->max_bufsize = bs1;2510 if (!(ndev->flags & IFF_RUNNING))2511 ndev->mtu = bs1 - LL_HEADER_LENGTH - 2;2512 priv->channel[READ]->flags |= CHANNEL_FLAGS_BUFSIZE_CHANGED;2513 priv->channel[WRITE]->flags |= CHANNEL_FLAGS_BUFSIZE_CHANGED;2514002515 return count;25160002517}25182519static ssize_t2520loglevel_show(struct device *dev, char *buf)2521{2522- struct ctc_priv *priv;2523-2524- priv = dev->driver_data;2525- if (!priv)2526- return -ENODEV;2527 return sprintf(buf, "%d\n", loglevel);2528}25292530static ssize_t2531loglevel_write(struct device *dev, const char *buf, size_t count)2532{2533- struct ctc_priv *priv;2534 int ll1;25352536 DBF_TEXT(trace, 5, __FUNCTION__);2537- priv = dev->driver_data;2538- if (!priv)2539- return -ENODEV;2540 sscanf(buf, "%i", &ll1);25412542 if ((ll1 > CTC_LOGLEVEL_MAX) || (ll1 < 0))···2610 return count;2611}26122613-static DEVICE_ATTR(buffer, 0644, buffer_show, buffer_write);2614-static DEVICE_ATTR(loglevel, 0644, loglevel_show, loglevel_write);2615-static DEVICE_ATTR(stats, 0644, stats_show, stats_write);2616-2617-static int2618-ctc_add_attributes(struct device *dev)2619-{2620-// device_create_file(dev, &dev_attr_buffer);2621- device_create_file(dev, &dev_attr_loglevel);2622- device_create_file(dev, &dev_attr_stats);2623- return 0;2624-}2625-2626-static void2627-ctc_remove_attributes(struct device *dev)2628-{2629- device_remove_file(dev, &dev_attr_stats);2630- device_remove_file(dev, &dev_attr_loglevel);2631-// device_remove_file(dev, &dev_attr_buffer);2632-}2633-26342635static void2636ctc_netdev_unregister(struct net_device * dev)···2653#endif2654}26552656-/**2657- * Initialize everything of the net device except the name and the2658- * channel structs.2659- */2660-static struct net_device *2661-ctc_init_netdevice(struct net_device * dev, int alloc_device, 2662- struct ctc_priv *privptr)2663-{2664- if (!privptr)2665- return NULL;2666-2667- DBF_TEXT(setup, 3, __FUNCTION__);2668- if (alloc_device) {2669- dev = kmalloc(sizeof (struct net_device), GFP_KERNEL);2670- if (!dev)2671- return NULL;2672- memset(dev, 0, sizeof (struct net_device));2673- }2674-2675- dev->priv = privptr;2676- privptr->fsm = init_fsm("ctcdev", dev_state_names,2677- dev_event_names, NR_DEV_STATES, NR_DEV_EVENTS,2678- dev_fsm, DEV_FSM_LEN, GFP_KERNEL);2679- if (privptr->fsm == NULL) {2680- if (alloc_device)2681- kfree(dev);2682- return NULL;2683- }2684- fsm_newstate(privptr->fsm, DEV_STATE_STOPPED);2685- fsm_settimer(privptr->fsm, &privptr->restart_timer);2686- if (dev->mtu == 0)2687- dev->mtu = CTC_BUFSIZE_DEFAULT - LL_HEADER_LENGTH - 2;2688- dev->hard_start_xmit = ctc_tx;2689- dev->open = ctc_open;2690- dev->stop = ctc_close;2691- dev->get_stats = ctc_stats;2692- dev->change_mtu = ctc_change_mtu;2693- dev->hard_header_len = LL_HEADER_LENGTH + 2;2694- dev->addr_len = 0;2695- dev->type = ARPHRD_SLIP;2696- dev->tx_queue_len = 100;2697- dev->flags = IFF_POINTOPOINT | IFF_NOARP;2698- SET_MODULE_OWNER(dev);2699- return dev;2700-}2701-2702static ssize_t2703ctc_proto_show(struct device *dev, char *buf)2704{···2685 return count;2686}26872688-static DEVICE_ATTR(protocol, 0644, ctc_proto_show, ctc_proto_store);26892690static ssize_t2691ctc_type_show(struct device *dev, char *buf)···2698 return sprintf(buf, "%s\n", cu3088_type[cgdev->cdev[0]->id.driver_info]);2699}2700002701static DEVICE_ATTR(type, 0444, ctc_type_show, NULL);00027022703static struct attribute *ctc_attr[] = {2704 &dev_attr_protocol.attr,···2715static struct attribute_group ctc_attr_group = {2716 .attrs = ctc_attr,2717};00000000000000027182719static int2720ctc_add_files(struct device *dev)···2755 *2756 * @returns 0 on success, !0 on failure.2757 */2758-2759static int2760ctc_probe_device(struct ccwgroup_device *cgdev)2761{2762 struct ctc_priv *priv;2763 int rc;027642765 pr_debug("%s() called\n", __FUNCTION__);2766- DBF_TEXT(trace, 3, __FUNCTION__);27672768 if (!get_device(&cgdev->dev))2769 return -ENODEV;···2787 cgdev->cdev[1]->handler = ctc_irq_handler;2788 cgdev->dev.driver_data = priv;27890000000000002790 return 0;2791}00000000000000000000000000000000000000000000000027922793/**2794 *···2868 struct ctc_priv *privptr;2869 struct net_device *dev;2870 int ret;028712872 pr_debug("%s() called\n", __FUNCTION__);2873 DBF_TEXT(setup, 3, __FUNCTION__);···2876 privptr = cgdev->dev.driver_data;2877 if (!privptr)2878 return -ENODEV;00028792880 type = get_channel_type(&cgdev->cdev[0]->id);2881···2968 struct ctc_priv *priv;2969 struct net_device *ndev;29702971- DBF_TEXT(trace, 3, __FUNCTION__);2972 pr_debug("%s() called\n", __FUNCTION__);029732974 priv = cgdev->dev.driver_data;2975 ndev = NULL;···3007 channel_remove(priv->channel[READ]);3008 if (priv->channel[WRITE])3009 channel_remove(priv->channel[WRITE]);3010-3011 priv->channel[READ] = priv->channel[WRITE] = NULL;30123013 return 0;···3019 struct ctc_priv *priv;30203021 pr_debug("%s() called\n", __FUNCTION__);3022- DBF_TEXT(trace, 3, __FUNCTION__);30233024 priv = cgdev->dev.driver_data;3025 if (!priv)···3056static void __exit3057ctc_exit(void)3058{03059 unregister_cu3088_discipline(&ctc_group_driver);3060 ctc_tty_cleanup();3061 ctc_unregister_dbf_views();···3073ctc_init(void)3074{3075 int ret = 0;000030763077 print_banner();3078
···1+/*2+ * $Id: ctcmain.h,v 1.4 2005/03/24 09:04:17 mschwide Exp $3+ *4+ * CTC / ESCON network driver5+ *6+ * Copyright (C) 2001 IBM Deutschland Entwicklung GmbH, IBM Corporation7+ * Author(s): Fritz Elfert (elfert@de.ibm.com, felfert@millenux.com)8+ Peter Tiedemann (ptiedem@de.ibm.com)9+ *10+ *11+ * Documentation used:12+ * - Principles of Operation (IBM doc#: SA22-7201-06)13+ * - Common IO/-Device Commands and Self Description (IBM doc#: SA22-7204-02)14+ * - Common IO/-Device Commands and Self Description (IBM doc#: SN22-5535)15+ * - ESCON Channel-to-Channel Adapter (IBM doc#: SA22-7203-00)16+ * - ESCON I/O Interface (IBM doc#: SA22-7202-02917+ *18+ * This program is free software; you can redistribute it and/or modify19+ * it under the terms of the GNU General Public License as published by20+ * the Free Software Foundation; either version 2, or (at your option)21+ * any later version.22+ *23+ * This program is distributed in the hope that it will be useful,24+ * but WITHOUT ANY WARRANTY; without even the implied warranty of25+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the26+ * GNU General Public License for more details.27+ *28+ * You should have received a copy of the GNU General Public License29+ * along with this program; if not, write to the Free Software30+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.31+ *32+ * RELEASE-TAG: CTC/ESCON network driver $Revision: 1.4 $33+ *34+ */35+36+#ifndef _CTCMAIN_H_37+#define _CTCMAIN_H_38+39+#include <asm/ccwdev.h>40+#include <asm/ccwgroup.h>41+42+#include "ctctty.h"43+#include "fsm.h"44+#include "cu3088.h"45+46+47+/**48+ * CCW commands, used in this driver.49+ */50+#define CCW_CMD_WRITE 0x0151+#define CCW_CMD_READ 0x0252+#define CCW_CMD_SET_EXTENDED 0xc353+#define CCW_CMD_PREPARE 0xe354+55+#define CTC_PROTO_S390 056+#define CTC_PROTO_LINUX 157+#define CTC_PROTO_LINUX_TTY 258+#define CTC_PROTO_OS390 359+#define CTC_PROTO_MAX 360+61+#define CTC_BUFSIZE_LIMIT 6553562+#define CTC_BUFSIZE_DEFAULT 3276863+64+#define CTC_TIMEOUT_5SEC 500065+66+#define CTC_INITIAL_BLOCKLEN 267+68+#define READ 069+#define WRITE 170+71+#define CTC_ID_SIZE BUS_ID_SIZE+372+73+74+struct ctc_profile {75+ unsigned long maxmulti;76+ unsigned long maxcqueue;77+ unsigned long doios_single;78+ unsigned long doios_multi;79+ unsigned long txlen;80+ unsigned long tx_time;81+ struct timespec send_stamp;82+};83+84+/**85+ * Definition of one channel86+ */87+struct channel {88+89+ /**90+ * Pointer to next channel in list.91+ */92+ struct channel *next;93+ char id[CTC_ID_SIZE];94+ struct ccw_device *cdev;95+96+ /**97+ * Type of this channel.98+ * CTC/A or Escon for valid channels.99+ */100+ enum channel_types type;101+102+ /**103+ * Misc. flags. See CHANNEL_FLAGS_... below104+ */105+ __u32 flags;106+107+ /**108+ * The protocol of this channel109+ */110+ __u16 protocol;111+112+ /**113+ * I/O and irq related stuff114+ */115+ struct ccw1 *ccw;116+ struct irb *irb;117+118+ /**119+ * RX/TX buffer size120+ */121+ int max_bufsize;122+123+ /**124+ * Transmit/Receive buffer.125+ */126+ struct sk_buff *trans_skb;127+128+ /**129+ * Universal I/O queue.130+ */131+ struct sk_buff_head io_queue;132+133+ /**134+ * TX queue for collecting skb's during busy.135+ */136+ struct sk_buff_head collect_queue;137+138+ /**139+ * Amount of data in collect_queue.140+ */141+ int collect_len;142+143+ /**144+ * spinlock for collect_queue and collect_len145+ */146+ spinlock_t collect_lock;147+148+ /**149+ * Timer for detecting unresposive150+ * I/O operations.151+ */152+ fsm_timer timer;153+154+ /**155+ * Retry counter for misc. operations.156+ */157+ int retry;158+159+ /**160+ * The finite state machine of this channel161+ */162+ fsm_instance *fsm;163+164+ /**165+ * The corresponding net_device this channel166+ * belongs to.167+ */168+ struct net_device *netdev;169+170+ struct ctc_profile prof;171+172+ unsigned char *trans_skb_data;173+174+ __u16 logflags;175+};176+177+#define CHANNEL_FLAGS_READ 0178+#define CHANNEL_FLAGS_WRITE 1179+#define CHANNEL_FLAGS_INUSE 2180+#define CHANNEL_FLAGS_BUFSIZE_CHANGED 4181+#define CHANNEL_FLAGS_FAILED 8182+#define CHANNEL_FLAGS_WAITIRQ 16183+#define CHANNEL_FLAGS_RWMASK 1184+#define CHANNEL_DIRECTION(f) (f & CHANNEL_FLAGS_RWMASK)185+186+#define LOG_FLAG_ILLEGALPKT 1187+#define LOG_FLAG_ILLEGALSIZE 2188+#define LOG_FLAG_OVERRUN 4189+#define LOG_FLAG_NOMEM 8190+191+#define CTC_LOGLEVEL_INFO 1192+#define CTC_LOGLEVEL_NOTICE 2193+#define CTC_LOGLEVEL_WARN 4194+#define CTC_LOGLEVEL_EMERG 8195+#define CTC_LOGLEVEL_ERR 16196+#define CTC_LOGLEVEL_DEBUG 32197+#define CTC_LOGLEVEL_CRIT 64198+199+#define CTC_LOGLEVEL_DEFAULT \200+(CTC_LOGLEVEL_INFO | CTC_LOGLEVEL_NOTICE | CTC_LOGLEVEL_WARN | CTC_LOGLEVEL_CRIT)201+202+#define CTC_LOGLEVEL_MAX ((CTC_LOGLEVEL_CRIT<<1)-1)203+204+#define ctc_pr_debug(fmt, arg...) \205+do { if (loglevel & CTC_LOGLEVEL_DEBUG) printk(KERN_DEBUG fmt,##arg); } while (0)206+207+#define ctc_pr_info(fmt, arg...) \208+do { if (loglevel & CTC_LOGLEVEL_INFO) printk(KERN_INFO fmt,##arg); } while (0)209+210+#define ctc_pr_notice(fmt, arg...) \211+do { if (loglevel & CTC_LOGLEVEL_NOTICE) printk(KERN_NOTICE fmt,##arg); } while (0)212+213+#define ctc_pr_warn(fmt, arg...) \214+do { if (loglevel & CTC_LOGLEVEL_WARN) printk(KERN_WARNING fmt,##arg); } while (0)215+216+#define ctc_pr_emerg(fmt, arg...) \217+do { if (loglevel & CTC_LOGLEVEL_EMERG) printk(KERN_EMERG fmt,##arg); } while (0)218+219+#define ctc_pr_err(fmt, arg...) \220+do { if (loglevel & CTC_LOGLEVEL_ERR) printk(KERN_ERR fmt,##arg); } while (0)221+222+#define ctc_pr_crit(fmt, arg...) \223+do { if (loglevel & CTC_LOGLEVEL_CRIT) printk(KERN_CRIT fmt,##arg); } while (0)224+225+struct ctc_priv {226+ struct net_device_stats stats;227+ unsigned long tbusy;228+ /**229+ * The finite state machine of this interface.230+ */231+ fsm_instance *fsm;232+ /**233+ * The protocol of this device234+ */235+ __u16 protocol;236+ /**237+ * Timer for restarting after I/O Errors238+ */239+ fsm_timer restart_timer;240+241+ int buffer_size;242+243+ struct channel *channel[2];244+};245+246+/**247+ * Definition of our link level header.248+ */249+struct ll_header {250+ __u16 length;251+ __u16 type;252+ __u16 unused;253+};254+#define LL_HEADER_LENGTH (sizeof(struct ll_header))255+256+/**257+ * Compatibility macros for busy handling258+ * of network devices.259+ */260+static __inline__ void261+ctc_clear_busy(struct net_device * dev)262+{263+ clear_bit(0, &(((struct ctc_priv *) dev->priv)->tbusy));264+ if (((struct ctc_priv *)dev->priv)->protocol != CTC_PROTO_LINUX_TTY)265+ netif_wake_queue(dev);266+}267+268+static __inline__ int269+ctc_test_and_set_busy(struct net_device * dev)270+{271+ if (((struct ctc_priv *)dev->priv)->protocol != CTC_PROTO_LINUX_TTY)272+ netif_stop_queue(dev);273+ return test_and_set_bit(0, &((struct ctc_priv *) dev->priv)->tbusy);274+}275+276+#endif
···23 /* Device is a OSA2 card */24 channel_type_osa2,2500026 /* Device is a channel, but we don't know27 * anything about it */28 channel_type_unknown,
···23 /* Device is a OSA2 card */24 channel_type_osa2,2526+ /* Device is a CLAW channel device */27+ channel_type_claw,28+29 /* Device is a channel, but we don't know30 * anything about it */31 channel_type_unknown,
+5-5
drivers/s390/net/iucv.c
···1/* 2- * $Id: iucv.c,v 1.43 2005/02/09 14:47:43 braunu Exp $3 *4 * IUCV network driver5 *···29 * along with this program; if not, write to the Free Software30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.31 *32- * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.43 $33 *34 */35···355static void356iucv_banner(void)357{358- char vbuf[] = "$Revision: 1.43 $";359 char *version = vbuf;360361 if ((version = strchr(version, ':'))) {···2553#endif2554EXPORT_SYMBOL (iucv_reply_prmmsg);2555EXPORT_SYMBOL (iucv_send);2556-#if 02557EXPORT_SYMBOL (iucv_send2way);2558EXPORT_SYMBOL (iucv_send2way_array);2559-EXPORT_SYMBOL (iucv_send_array);2560EXPORT_SYMBOL (iucv_send2way_prmmsg);2561EXPORT_SYMBOL (iucv_send2way_prmmsg_array);002562EXPORT_SYMBOL (iucv_send_prmmsg);2563EXPORT_SYMBOL (iucv_setmask);2564#endif
···1/* 2+ * $Id: iucv.c,v 1.45 2005/04/26 22:59:06 braunu Exp $3 *4 * IUCV network driver5 *···29 * along with this program; if not, write to the Free Software30 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.31 *32+ * RELEASE-TAG: IUCV lowlevel driver $Revision: 1.45 $33 *34 */35···355static void356iucv_banner(void)357{358+ char vbuf[] = "$Revision: 1.45 $";359 char *version = vbuf;360361 if ((version = strchr(version, ':'))) {···2553#endif2554EXPORT_SYMBOL (iucv_reply_prmmsg);2555EXPORT_SYMBOL (iucv_send);02556EXPORT_SYMBOL (iucv_send2way);2557EXPORT_SYMBOL (iucv_send2way_array);02558EXPORT_SYMBOL (iucv_send2way_prmmsg);2559EXPORT_SYMBOL (iucv_send2way_prmmsg_array);2560+#if 02561+EXPORT_SYMBOL (iucv_send_array);2562EXPORT_SYMBOL (iucv_send_prmmsg);2563EXPORT_SYMBOL (iucv_setmask);2564#endif
+17-16
drivers/s390/net/lcs.c
···11 * Frank Pavlic (pavlic@de.ibm.com) and12 * Martin Schwidefsky <schwidefsky@de.ibm.com>13 *14- * $Revision: 1.96 $ $Date: 2004/11/11 13:42:33 $15 *16 * This program is free software; you can redistribute it and/or modify17 * it under the terms of the GNU General Public License as published by···59/**60 * initialization string for output61 */62-#define VERSION_LCS_C "$Revision: 1.96 $"6364static char version[] __initdata = "LCS driver ("VERSION_LCS_C "/" VERSION_LCS_H ")";65static char debug_buffer[255];···1098 PRINT_ERR("Query IPAssist failed. Assuming unsupported!\n");1099 return -EOPNOTSUPP;1100 }1101- /* Print out supported assists: IPv6 */1102- PRINT_INFO("LCS device %s %s IPv6 support\n", card->dev->name,1103- (card->ip_assists_supported & LCS_IPASS_IPV6_SUPPORT) ?1104- "with" : "without");1105- /* Print out supported assist: Multicast */1106- PRINT_INFO("LCS device %s %s Multicast support\n", card->dev->name,1107- (card->ip_assists_supported & LCS_IPASS_MULTICAST_SUPPORT) ?1108- "with" : "without");1109 if (card->ip_assists_supported & LCS_IPASS_MULTICAST_SUPPORT)1110 return 0;1111 return -EOPNOTSUPP;···1152 }1153 }1154 /* re-insert all entries from the failed_list into ipm_list */1155- list_for_each_entry(ipm, &failed_list, list) {1156 list_del_init(&ipm->list);1157 list_add_tail(&ipm->list, &card->ipm_list);1158 }···2190 if (!dev)2191 goto out;2192 card->dev = dev;2193-netdev_out:2194 card->dev->priv = card;2195 card->dev->open = lcs_open_device;2196 card->dev->stop = lcs_stop_device;2197 card->dev->hard_start_xmit = lcs_start_xmit;2198 card->dev->get_stats = lcs_getstats;2199 SET_MODULE_OWNER(dev);2200- if (lcs_register_netdev(ccwgdev) != 0)2201- goto out;2202 memcpy(card->dev->dev_addr, card->mac, LCS_MAC_LENGTH);2203#ifdef CONFIG_IP_MULTICAST2204 if (!lcs_check_multicast_support(card))2205 card->dev->set_multicast_list = lcs_set_multicast_list;2206#endif2207- netif_stop_queue(card->dev);2208 lcs_set_allowed_threads(card,0xffffffff);2209 if (recover_state == DEV_STATE_RECOVER) {2210 lcs_set_multicast_list(card->dev);2211 card->dev->flags |= IFF_UP;2212 netif_wake_queue(card->dev);2213 card->state = DEV_STATE_UP;2214- } else2215 lcs_stopcard(card);02216000000000002217 return 0;2218out:2219
···11 * Frank Pavlic (pavlic@de.ibm.com) and12 * Martin Schwidefsky <schwidefsky@de.ibm.com>13 *14+ * $Revision: 1.98 $ $Date: 2005/04/18 13:41:29 $15 *16 * This program is free software; you can redistribute it and/or modify17 * it under the terms of the GNU General Public License as published by···59/**60 * initialization string for output61 */62+#define VERSION_LCS_C "$Revision: 1.98 $"6364static char version[] __initdata = "LCS driver ("VERSION_LCS_C "/" VERSION_LCS_H ")";65static char debug_buffer[255];···1098 PRINT_ERR("Query IPAssist failed. Assuming unsupported!\n");1099 return -EOPNOTSUPP;1100 }000000001101 if (card->ip_assists_supported & LCS_IPASS_MULTICAST_SUPPORT)1102 return 0;1103 return -EOPNOTSUPP;···1160 }1161 }1162 /* re-insert all entries from the failed_list into ipm_list */1163+ list_for_each_entry_safe(ipm, tmp, &failed_list, list) {1164 list_del_init(&ipm->list);1165 list_add_tail(&ipm->list, &card->ipm_list);1166 }···2198 if (!dev)2199 goto out;2200 card->dev = dev;02201 card->dev->priv = card;2202 card->dev->open = lcs_open_device;2203 card->dev->stop = lcs_stop_device;2204 card->dev->hard_start_xmit = lcs_start_xmit;2205 card->dev->get_stats = lcs_getstats;2206 SET_MODULE_OWNER(dev);002207 memcpy(card->dev->dev_addr, card->mac, LCS_MAC_LENGTH);2208#ifdef CONFIG_IP_MULTICAST2209 if (!lcs_check_multicast_support(card))2210 card->dev->set_multicast_list = lcs_set_multicast_list;2211#endif2212+netdev_out:2213 lcs_set_allowed_threads(card,0xffffffff);2214 if (recover_state == DEV_STATE_RECOVER) {2215 lcs_set_multicast_list(card->dev);2216 card->dev->flags |= IFF_UP;2217 netif_wake_queue(card->dev);2218 card->state = DEV_STATE_UP;2219+ } else {2220 lcs_stopcard(card);2221+ }22222223+ if (lcs_register_netdev(ccwgdev) != 0)2224+ goto out;2225+2226+ /* Print out supported assists: IPv6 */2227+ PRINT_INFO("LCS device %s %s IPv6 support\n", card->dev->name,2228+ (card->ip_assists_supported & LCS_IPASS_IPV6_SUPPORT) ?2229+ "with" : "without");2230+ /* Print out supported assist: Multicast */2231+ PRINT_INFO("LCS device %s %s Multicast support\n", card->dev->name,2232+ (card->ip_assists_supported & LCS_IPASS_MULTICAST_SUPPORT) ?2233+ "with" : "without");2234 return 0;2235out:2236