diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-10-03 19:28:46 +0200 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-10-03 19:28:46 +0200 |
commit | f68ec0c24755e5cdb779be6240925f2175311d84 (patch) | |
tree | a7b7128e61a8456385d82bd1c7ca5f14eecbf2ca /drivers/s390 | |
parent | 98920dc3d1113b883cbc73e3293446d3525c6042 (diff) | |
parent | 94aca1dac6f6d21f4b07e4864baf7768cabcc6e7 (diff) |
Merge commit 'v2.6.27-rc8' into x86/setup
Diffstat (limited to 'drivers/s390')
49 files changed, 2136 insertions, 3434 deletions
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index 1b6c52ef733..acb78017e7d 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c @@ -2333,13 +2333,11 @@ int dasd_generic_notify(struct ccw_device *cdev, int event) { struct dasd_device *device; struct dasd_ccw_req *cqr; - unsigned long flags; int ret; - device = dasd_device_from_cdev(cdev); + device = dasd_device_from_cdev_locked(cdev); if (IS_ERR(device)) return 0; - spin_lock_irqsave(get_ccwdev_lock(cdev), flags); ret = 0; switch (event) { case CIO_GONE: @@ -2369,7 +2367,6 @@ int dasd_generic_notify(struct ccw_device *cdev, int event) ret = 1; break; } - spin_unlock_irqrestore(get_ccwdev_lock(cdev), flags); dasd_put_device(device); return ret; } diff --git a/drivers/s390/block/dasd_alias.c b/drivers/s390/block/dasd_alias.c index 2d8df0b3053..20676cdef4a 100644 --- a/drivers/s390/block/dasd_alias.c +++ b/drivers/s390/block/dasd_alias.c @@ -91,7 +91,8 @@ static struct alias_pav_group *_find_group(struct alias_lcu *lcu, else search_unit_addr = uid->base_unit_addr; list_for_each_entry(pos, &lcu->grouplist, group) { - if (pos->uid.base_unit_addr == search_unit_addr) + if (pos->uid.base_unit_addr == search_unit_addr && + !strncmp(pos->uid.vduit, uid->vduit, sizeof(uid->vduit))) return pos; }; return NULL; @@ -332,6 +333,7 @@ static int _add_device_to_lcu(struct alias_lcu *lcu, group->uid.base_unit_addr = uid->real_unit_addr; else group->uid.base_unit_addr = uid->base_unit_addr; + memcpy(group->uid.vduit, uid->vduit, sizeof(uid->vduit)); INIT_LIST_HEAD(&group->group); INIT_LIST_HEAD(&group->baselist); INIT_LIST_HEAD(&group->aliaslist); diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index d774e79476f..cd3335c1c30 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c @@ -913,7 +913,8 @@ dasd_vendor_show(struct device *dev, struct device_attribute *attr, char *buf) static DEVICE_ATTR(vendor, 0444, dasd_vendor_show, NULL); #define UID_STRLEN ( /* vendor */ 3 + 1 + /* serial */ 14 + 1 +\ - /* SSID */ 4 + 1 + /* unit addr */ 2 + 1) + /* SSID */ 4 + 1 + /* unit addr */ 2 + 1 +\ + /* vduit */ 32 + 1) static ssize_t dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) @@ -945,8 +946,17 @@ dasd_uid_show(struct device *dev, struct device_attribute *attr, char *buf) sprintf(ua_string, "%02x", uid->real_unit_addr); break; } - snprintf(uid_string, sizeof(uid_string), "%s.%s.%04x.%s", - uid->vendor, uid->serial, uid->ssid, ua_string); + if (strlen(uid->vduit) > 0) + snprintf(uid_string, sizeof(uid_string), + "%s.%s.%04x.%s.%s", + uid->vendor, uid->serial, + uid->ssid, ua_string, + uid->vduit); + else + snprintf(uid_string, sizeof(uid_string), + "%s.%s.%04x.%s", + uid->vendor, uid->serial, + uid->ssid, ua_string); spin_unlock(&dasd_devmap_lock); return snprintf(buf, PAGE_SIZE, "%s\n", uid_string); } diff --git a/drivers/s390/block/dasd_eckd.c b/drivers/s390/block/dasd_eckd.c index 3590fdb5b2f..773b3fe275b 100644 --- a/drivers/s390/block/dasd_eckd.c +++ b/drivers/s390/block/dasd_eckd.c @@ -313,8 +313,8 @@ static int prefix(struct ccw1 *ccw, struct PFX_eckd_data *pfxdata, int trk, memset(pfxdata, 0, sizeof(*pfxdata)); /* prefix data */ pfxdata->format = 0; - pfxdata->base_address = basepriv->conf_data.ned1.unit_addr; - pfxdata->base_lss = basepriv->conf_data.ned1.ID; + pfxdata->base_address = basepriv->ned->unit_addr; + pfxdata->base_lss = basepriv->ned->ID; pfxdata->validity.define_extend = 1; /* private uid is kept up to date, conf_data may be outdated */ @@ -536,36 +536,40 @@ dasd_eckd_cdl_reclen(int recid) /* * Generate device unique id that specifies the physical device. */ -static int -dasd_eckd_generate_uid(struct dasd_device *device, struct dasd_uid *uid) +static int dasd_eckd_generate_uid(struct dasd_device *device, + struct dasd_uid *uid) { struct dasd_eckd_private *private; - struct dasd_eckd_confdata *confdata; + int count; private = (struct dasd_eckd_private *) device->private; if (!private) return -ENODEV; - confdata = &private->conf_data; - if (!confdata) + if (!private->ned || !private->gneq) return -ENODEV; memset(uid, 0, sizeof(struct dasd_uid)); - memcpy(uid->vendor, confdata->ned1.HDA_manufacturer, + memcpy(uid->vendor, private->ned->HDA_manufacturer, sizeof(uid->vendor) - 1); EBCASC(uid->vendor, sizeof(uid->vendor) - 1); - memcpy(uid->serial, confdata->ned1.HDA_location, + memcpy(uid->serial, private->ned->HDA_location, sizeof(uid->serial) - 1); EBCASC(uid->serial, sizeof(uid->serial) - 1); - uid->ssid = confdata->neq.subsystemID; - uid->real_unit_addr = confdata->ned1.unit_addr; - if (confdata->ned2.sneq.flags == 0x40 && - confdata->ned2.sneq.format == 0x0001) { - uid->type = confdata->ned2.sneq.sua_flags; + uid->ssid = private->gneq->subsystemID; + uid->real_unit_addr = private->ned->unit_addr;; + if (private->sneq) { + uid->type = private->sneq->sua_flags; if (uid->type == UA_BASE_PAV_ALIAS) - uid->base_unit_addr = confdata->ned2.sneq.base_unit_addr; + uid->base_unit_addr = private->sneq->base_unit_addr; } else { uid->type = UA_BASE_DEVICE; } + if (private->vdsneq) { + for (count = 0; count < 16; count++) { + sprintf(uid->vduit+2*count, "%02x", + private->vdsneq->uit[count]); + } + } return 0; } @@ -623,6 +627,15 @@ static int dasd_eckd_read_conf_lpm(struct dasd_device *device, ret = -ENOMEM; goto out_error; } + + /* + * buffer has to start with EBCDIC "V1.0" to show + * support for virtual device SNEQ + */ + rcd_buf[0] = 0xE5; + rcd_buf[1] = 0xF1; + rcd_buf[2] = 0x4B; + rcd_buf[3] = 0xF0; cqr = dasd_eckd_build_rcd_lpm(device, rcd_buf, ciw, lpm); if (IS_ERR(cqr)) { ret = PTR_ERR(cqr); @@ -646,8 +659,62 @@ out_error: return ret; } -static int -dasd_eckd_read_conf(struct dasd_device *device) +static int dasd_eckd_identify_conf_parts(struct dasd_eckd_private *private) +{ + + struct dasd_sneq *sneq; + int i, count; + + private->ned = NULL; + private->sneq = NULL; + private->vdsneq = NULL; + private->gneq = NULL; + count = private->conf_len / sizeof(struct dasd_sneq); + sneq = (struct dasd_sneq *)private->conf_data; + for (i = 0; i < count; ++i) { + if (sneq->flags.identifier == 1 && sneq->format == 1) + private->sneq = sneq; + else if (sneq->flags.identifier == 1 && sneq->format == 4) + private->vdsneq = (struct vd_sneq *)sneq; + else if (sneq->flags.identifier == 2) + private->gneq = (struct dasd_gneq *)sneq; + else if (sneq->flags.identifier == 3 && sneq->res1 == 1) + private->ned = (struct dasd_ned *)sneq; + sneq++; + } + if (!private->ned || !private->gneq) { + private->ned = NULL; + private->sneq = NULL; + private->vdsneq = NULL; + private->gneq = NULL; + return -EINVAL; + } + return 0; + +}; + +static unsigned char dasd_eckd_path_access(void *conf_data, int conf_len) +{ + struct dasd_gneq *gneq; + int i, count, found; + + count = conf_len / sizeof(*gneq); + gneq = (struct dasd_gneq *)conf_data; + found = 0; + for (i = 0; i < count; ++i) { + if (gneq->flags.identifier == 2) { + found = 1; + break; + } + gneq++; + } + if (found) + return ((char *)gneq)[18] & 0x07; + else + return 0; +} + +static int dasd_eckd_read_conf(struct dasd_device *device) { void *conf_data; int conf_len, conf_data_saved; @@ -661,7 +728,6 @@ dasd_eckd_read_conf(struct dasd_device *device) path_data->opm = ccw_device_get_path_mask(device->cdev); lpm = 0x80; conf_data_saved = 0; - /* get configuration data per operational path */ for (lpm = 0x80; lpm; lpm>>= 1) { if (lpm & path_data->opm){ @@ -678,22 +744,20 @@ dasd_eckd_read_conf(struct dasd_device *device) "data retrieved"); continue; /* no error */ } - if (conf_len != sizeof(struct dasd_eckd_confdata)) { - MESSAGE(KERN_WARNING, - "sizes of configuration data mismatch" - "%d (read) vs %ld (expected)", - conf_len, - sizeof(struct dasd_eckd_confdata)); - kfree(conf_data); - continue; /* no error */ - } /* save first valid configuration data */ - if (!conf_data_saved){ - memcpy(&private->conf_data, conf_data, - sizeof(struct dasd_eckd_confdata)); + if (!conf_data_saved) { + kfree(private->conf_data); + private->conf_data = conf_data; + private->conf_len = conf_len; + if (dasd_eckd_identify_conf_parts(private)) { + private->conf_data = NULL; + private->conf_len = 0; + kfree(conf_data); + continue; + } conf_data_saved++; } - switch (((char *)conf_data)[242] & 0x07){ + switch (dasd_eckd_path_access(conf_data, conf_len)) { case 0x02: path_data->npm |= lpm; break; @@ -701,7 +765,8 @@ dasd_eckd_read_conf(struct dasd_device *device) path_data->ppm |= lpm; break; } - kfree(conf_data); + if (conf_data != private->conf_data) + kfree(conf_data); } } return 0; @@ -952,6 +1017,7 @@ out_err2: dasd_free_block(device->block); device->block = NULL; out_err1: + kfree(private->conf_data); kfree(device->private); device->private = NULL; return rc; @@ -959,7 +1025,17 @@ out_err1: static void dasd_eckd_uncheck_device(struct dasd_device *device) { + struct dasd_eckd_private *private; + + private = (struct dasd_eckd_private *) device->private; dasd_alias_disconnect_device_from_lcu(device); + private->ned = NULL; + private->sneq = NULL; + private->vdsneq = NULL; + private->gneq = NULL; + private->conf_len = 0; + kfree(private->conf_data); + private->conf_data = NULL; } static struct dasd_ccw_req * @@ -1746,9 +1822,10 @@ dasd_eckd_fill_info(struct dasd_device * device, info->characteristics_size = sizeof(struct dasd_eckd_characteristics); memcpy(info->characteristics, &private->rdc_data, sizeof(struct dasd_eckd_characteristics)); - info->confdata_size = sizeof(struct dasd_eckd_confdata); - memcpy(info->configuration_data, &private->conf_data, - sizeof(struct dasd_eckd_confdata)); + info->confdata_size = min((unsigned long)private->conf_len, + sizeof(info->configuration_data)); + memcpy(info->configuration_data, private->conf_data, + info->confdata_size); return 0; } diff --git a/drivers/s390/block/dasd_eckd.h b/drivers/s390/block/dasd_eckd.h index fc2509c939b..2476f87d21d 100644 --- a/drivers/s390/block/dasd_eckd.h +++ b/drivers/s390/block/dasd_eckd.h @@ -231,133 +231,62 @@ struct dasd_eckd_characteristics { __u8 reserved3[10]; } __attribute__ ((packed)); -struct dasd_eckd_confdata { +/* elements of the configuration data */ +struct dasd_ned { struct { - struct { - unsigned char identifier:2; - unsigned char token_id:1; - unsigned char sno_valid:1; - unsigned char subst_sno:1; - unsigned char recNED:1; - unsigned char emuNED:1; - unsigned char reserved:1; - } __attribute__ ((packed)) flags; - __u8 descriptor; - __u8 dev_class; - __u8 reserved; - unsigned char dev_type[6]; - unsigned char dev_model[3]; - unsigned char HDA_manufacturer[3]; - unsigned char HDA_location[2]; - unsigned char HDA_seqno[12]; - __u8 ID; - __u8 unit_addr; - } __attribute__ ((packed)) ned1; - union { - struct { - struct { - unsigned char identifier:2; - unsigned char token_id:1; - unsigned char sno_valid:1; - unsigned char subst_sno:1; - unsigned char recNED:1; - unsigned char emuNED:1; - unsigned char reserved:1; - } __attribute__ ((packed)) flags; - __u8 descriptor; - __u8 reserved[2]; - unsigned char dev_type[6]; - unsigned char dev_model[3]; - unsigned char DASD_manufacturer[3]; - unsigned char DASD_location[2]; - unsigned char DASD_seqno[12]; - __u16 ID; - } __attribute__ ((packed)) ned; - struct { - unsigned char flags; /* byte 0 */ - unsigned char res1; /* byte 1 */ - __u16 format; /* byte 2-3 */ - unsigned char res2[4]; /* byte 4-7 */ - unsigned char sua_flags; /* byte 8 */ - __u8 base_unit_addr; /* byte 9 */ - unsigned char res3[22]; /* byte 10-31 */ - } __attribute__ ((packed)) sneq; - } __attribute__ ((packed)) ned2; + __u8 identifier:2; + __u8 token_id:1; + __u8 sno_valid:1; + __u8 subst_sno:1; + __u8 recNED:1; + __u8 emuNED:1; + __u8 reserved:1; + } __attribute__ ((packed)) flags; + __u8 descriptor; + __u8 dev_class; + __u8 reserved; + __u8 dev_type[6]; + __u8 dev_model[3]; + __u8 HDA_manufacturer[3]; + __u8 HDA_location[2]; + __u8 HDA_seqno[12]; + __u8 ID; + __u8 unit_addr; +} __attribute__ ((packed)); + +struct dasd_sneq { struct { - struct { - unsigned char identifier:2; - unsigned char token_id:1; - unsigned char sno_valid:1; - unsigned char subst_sno:1; - unsigned char recNED:1; - unsigned char emuNED:1; - unsigned char reserved:1; - } __attribute__ ((packed)) flags; - __u8 descriptor; - __u8 reserved[2]; - unsigned char cont_type[6]; - unsigned char cont_model[3]; - unsigned char cont_manufacturer[3]; - unsigned char cont_location[2]; - unsigned char cont_seqno[12]; - __u16 ID; - } __attribute__ ((packed)) ned3; + __u8 identifier:2; + __u8 reserved:6; + } __attribute__ ((packed)) flags; + __u8 res1; + __u16 format; + __u8 res2[4]; /* byte 4- 7 */ + __u8 sua_flags; /* byte 8 */ + __u8 base_unit_addr; /* byte 9 */ + __u8 res3[22]; /* byte 10-31 */ +} __attribute__ ((packed)); + +struct vd_sneq { struct { - struct { - unsigned char identifier:2; - unsigned char token_id:1; - unsigned char sno_valid:1; - unsigned char subst_sno:1; - unsigned char recNED:1; - unsigned char emuNED:1; - unsigned char reserved:1; - } __attribute__ ((packed)) flags; - __u8 descriptor; - __u8 reserved[2]; - unsigned char cont_type[6]; - unsigned char empty[3]; - unsigned char cont_manufacturer[3]; - unsigned char cont_location[2]; - unsigned char cont_seqno[12]; - __u16 ID; - } __attribute__ ((packed)) ned4; - unsigned char ned5[32]; - unsigned char ned6[32]; - unsigned char ned7[32]; + __u8 identifier:2; + __u8 reserved:6; + } __attribute__ ((packed)) flags; + __u8 res1; + __u16 format; + __u8 res2[4]; /* byte 4- 7 */ + __u8 uit[16]; /* byte 8-23 */ + __u8 res3[8]; /* byte 24-31 */ +} __attribute__ ((packed)); + +struct dasd_gneq { struct { - struct { - unsigned char identifier:2; - unsigned char reserved:6; - } __attribute__ ((packed)) flags; - __u8 selector; - __u16 interfaceID; - __u32 reserved; - __u16 subsystemID; - struct { - unsigned char sp0:1; - unsigned char sp1:1; - unsigned char reserved:5; - unsigned char scluster:1; - } __attribute__ ((packed)) spathID; - __u8 unit_address; - __u8 dev_ID; - __u8 dev_address; - __u8 adapterID; - __u16 link_address; - struct { - unsigned char parallel:1; - unsigned char escon:1; - unsigned char reserved:1; - unsigned char ficon:1; - unsigned char reserved2:4; - } __attribute__ ((packed)) protocol_type; - struct { - unsigned char PID_in_236:1; - unsigned char reserved:7; - } __attribute__ ((packed)) format_flags; - __u8 log_dev_address; - unsigned char reserved2[12]; - } __attribute__ ((packed)) neq; + __u8 identifier:2; + __u8 reserved:6; + } __attribute__ ((packed)) flags; + __u8 reserved[7]; + __u16 subsystemID; + __u8 reserved2[22]; } __attribute__ ((packed)); struct dasd_eckd_path { @@ -379,7 +308,7 @@ struct dasd_psf_prssd_data { unsigned char flags; unsigned char reserved[4]; unsigned char suborder; - unsigned char varies[9]; + unsigned char varies[5]; } __attribute__ ((packed)); /* @@ -463,7 +392,14 @@ struct alias_pav_group { struct dasd_eckd_private { struct dasd_eckd_characteristics rdc_data; - struct dasd_eckd_confdata conf_data; + u8 *conf_data; + int conf_len; + /* pointers to specific parts in the conf_data */ + struct dasd_ned *ned; + struct dasd_sneq *sneq; + struct vd_sneq *vdsneq; + struct dasd_gneq *gneq; + struct dasd_eckd_path path_data; struct eckd_count count_area[5]; int init_cqr_status; diff --git a/drivers/s390/block/dasd_eer.c b/drivers/s390/block/dasd_eer.c index 29da4413ad4..bf512ac75b9 100644 --- a/drivers/s390/block/dasd_eer.c +++ b/drivers/s390/block/dasd_eer.c @@ -16,6 +16,7 @@ #include <linux/poll.h> #include <linux/mutex.h> #include <linux/smp_lock.h> +#include <linux/err.h> #include <asm/uaccess.h> #include <asm/atomic.h> @@ -457,7 +458,7 @@ int dasd_eer_enable(struct dasd_device *device) cqr = dasd_kmalloc_request("ECKD", 1 /* SNSS */, SNSS_DATA_SIZE, device); - if (!cqr) + if (IS_ERR(cqr)) return -ENOMEM; cqr->startdev = device; diff --git a/drivers/s390/block/dasd_int.h b/drivers/s390/block/dasd_int.h index fb2f931cf84..31ecaa4a40e 100644 --- a/drivers/s390/block/dasd_int.h +++ b/drivers/s390/block/dasd_int.h @@ -307,6 +307,7 @@ struct dasd_uid { __u16 ssid; __u8 real_unit_addr; __u8 base_unit_addr; + char vduit[33]; }; /* diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c index 01fcdd91b84..711b3004b3e 100644 --- a/drivers/s390/block/dcssblk.c +++ b/drivers/s390/block/dcssblk.c @@ -384,6 +384,11 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char * get minor, add to list */ down_write(&dcssblk_devices_sem); + if (dcssblk_get_device_by_name(local_buf)) { + up_write(&dcssblk_devices_sem); + rc = -EEXIST; + goto unload_seg; + } rc = dcssblk_assign_free_minor(dev_info); if (rc) { up_write(&dcssblk_devices_sem); diff --git a/drivers/s390/char/raw3270.c b/drivers/s390/char/raw3270.c index 81a96e01908..c3dee900a5c 100644 --- a/drivers/s390/char/raw3270.c +++ b/drivers/s390/char/raw3270.c @@ -1168,17 +1168,19 @@ static int raw3270_create_attributes(struct raw3270 *rp) if (rc) goto out; - rp->clttydev = device_create(class3270, &rp->cdev->dev, - MKDEV(IBM_TTY3270_MAJOR, rp->minor), - "tty%s", rp->cdev->dev.bus_id); + rp->clttydev = device_create_drvdata(class3270, &rp->cdev->dev, + MKDEV(IBM_TTY3270_MAJOR, rp->minor), + NULL, + "tty%s", rp->cdev->dev.bus_id); if (IS_ERR(rp->clttydev)) { rc = PTR_ERR(rp->clttydev); goto out_ttydev; } - rp->cltubdev = device_create(class3270, &rp->cdev->dev, - MKDEV(IBM_FS3270_MAJOR, rp->minor), - "tub%s", rp->cdev->dev.bus_id); + rp->cltubdev = device_create_drvdata(class3270, &rp->cdev->dev, + MKDEV(IBM_FS3270_MAJOR, rp->minor), + NULL, + "tub%s", rp->cdev->dev.bus_id); if (!IS_ERR(rp->cltubdev)) goto out; diff --git a/drivers/s390/char/sclp.c b/drivers/s390/char/sclp.c index 3c8b25e6c34..1fd8f2193ed 100644 --- a/drivers/s390/char/sclp.c +++ b/drivers/s390/char/sclp.c @@ -399,6 +399,7 @@ sclp_tod_from_jiffies(unsigned long jiffies) void sclp_sync_wait(void) { + unsigned long long old_tick; unsigned long flags; unsigned long cr0, cr0_sync; u64 timeout; @@ -419,11 +420,12 @@ sclp_sync_wait(void) if (!irq_context) local_bh_disable(); /* Enable service-signal interruption, disable timer interrupts */ + old_tick = local_tick_disable(); trace_hardirqs_on(); __ctl_store(cr0, 0, 0); cr0_sync = cr0; + cr0_sync &= 0xffff00a0; cr0_sync |= 0x00000200; - cr0_sync &= 0xFFFFF3AC; __ctl_load(cr0_sync, 0, 0); __raw_local_irq_stosm(0x01); /* Loop until driver state indicates finished request */ @@ -439,9 +441,9 @@ sclp_sync_wait(void) __ctl_load(cr0, 0, 0); if (!irq_context) _local_bh_enable(); + local_tick_enable(old_tick); local_irq_restore(flags); } - EXPORT_SYMBOL(sclp_sync_wait); /* Dispatch changes in send and receive mask to registered listeners. */ diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c index 0c2b77493db..eb5f1b8bc57 100644 --- a/drivers/s390/char/sclp_cmd.c +++ b/drivers/s390/char/sclp_cmd.c @@ -427,6 +427,8 @@ static int sclp_mem_notifier(struct notifier_block *nb, sclp_attach_storage(id); switch (action) { case MEM_ONLINE: + case MEM_GOING_OFFLINE: + case MEM_CANCEL_OFFLINE: break; case MEM_GOING_ONLINE: rc = sclp_mem_change_state(start, size, 1); @@ -434,6 +436,9 @@ static int sclp_mem_notifier(struct notifier_block *nb, case MEM_CANCEL_ONLINE: sclp_mem_change_state(start, size, 0); break; + case MEM_OFFLINE: + sclp_mem_change_state(start, size, 0); + break; default: rc = -EINVAL; break; diff --git a/drivers/s390/char/sclp_config.c b/drivers/s390/char/sclp_config.c index fff4ff485d9..4cebd6ee6d2 100644 --- a/drivers/s390/char/sclp_config.c +++ b/drivers/s390/char/sclp_config.c @@ -8,7 +8,6 @@ #include <linux/init.h> #include <linux/errno.h> #include <linux/cpu.h> -#include <linux/kthread.h> #include <linux/sysdev.h> #include <linux/workqueue.h> #include <asm/smp.h> @@ -41,19 +40,9 @@ static void sclp_cpu_capability_notify(struct work_struct *work) put_online_cpus(); } -static int sclp_cpu_kthread(void *data) -{ - smp_rescan_cpus(); - return 0; -} - static void __ref sclp_cpu_change_notify(struct work_struct *work) { - /* Can't call smp_rescan_cpus() from workqueue context since it may - * deadlock in case of cpu hotplug. So we have to create a kernel - * thread in order to call it. - */ - kthread_run(sclp_cpu_kthread, NULL, "cpu_rescan"); + smp_rescan_cpus(); } static void sclp_conf_receiver_fn(struct evbuf_header *evbuf) diff --git a/drivers/s390/char/tape_char.c b/drivers/s390/char/tape_char.c index 687720b552d..be0ce2215c8 100644 --- a/drivers/s390/char/tape_char.c +++ b/drivers/s390/char/tape_char.c @@ -109,7 +109,7 @@ tapechar_check_idalbuffer(struct tape_device *device, size_t block_size) /* The current idal buffer is not correct. Allocate a new one. */ new = idal_buffer_alloc(block_size, 0); - if (new == NULL) + if (IS_ERR(new)) return -ENOMEM; if (device->char_data.idal_buf != NULL) diff --git a/drivers/s390/char/tape_class.c b/drivers/s390/char/tape_class.c index 6dfdb7c1798..12c2a5aaf31 100644 --- a/drivers/s390/char/tape_class.c +++ b/drivers/s390/char/tape_class.c @@ -69,10 +69,9 @@ struct tape_class_device *register_tape_dev( if (rc) goto fail_with_cdev; - tcd->class_device = device_create(tape_class, device, - tcd->char_device->dev, - "%s", tcd->device_name - ); + tcd->class_device = device_create_drvdata(tape_class, device, + tcd->char_device->dev, + NULL, "%s", tcd->device_name); rc = IS_ERR(tcd->class_device) ? PTR_ERR(tcd->class_device) : 0; if (rc) goto fail_with_cdev; diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c index 2a1af4e60be..cc8fd781ee2 100644 --- a/drivers/s390/char/tape_std.c +++ b/drivers/s390/char/tape_std.c @@ -248,7 +248,7 @@ tape_std_mtsetblk(struct tape_device *device, int count) /* Allocate a new idal buffer. */ new = idal_buffer_alloc(count, 0); - if (new == NULL) + if (IS_ERR(new)) return -ENOMEM; if (device->char_data.idal_buf != NULL) idal_buffer_free(device->char_data.idal_buf); diff --git a/drivers/s390/char/vmur.c b/drivers/s390/char/vmur.c index b0ac44b2712..c1f352b8486 100644 --- a/drivers/s390/char/vmur.c +++ b/drivers/s390/char/vmur.c @@ -896,8 +896,9 @@ static int ur_set_online(struct ccw_device *cdev) goto fail_free_cdev; } - urd->device = device_create(vmur_class, NULL, urd->char_device->dev, - "%s", node_id); + urd->device = device_create_drvdata(vmur_class, NULL, + urd->char_device->dev, NULL, + "%s", node_id); if (IS_ERR(urd->device)) { rc = PTR_ERR(urd->device); TRACE("ur_set_online: device_create rc=%d\n", rc); diff --git a/drivers/s390/cio/ccwgroup.c b/drivers/s390/cio/ccwgroup.c index 26a930e832b..9a50f245774 100644 --- a/drivers/s390/cio/ccwgroup.c +++ b/drivers/s390/cio/ccwgroup.c @@ -112,8 +112,11 @@ ccwgroup_release (struct device *dev) gdev = to_ccwgroupdev(dev); for (i = 0; i < gdev->count; i++) { - dev_set_drvdata(&gdev->cdev[i]->dev, NULL); - put_device(&gdev->cdev[i]->dev); + if (gdev->cdev[i]) { + if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev) + dev_set_drvdata(&gdev->cdev[i]->dev, NULL); + put_device(&gdev->cdev[i]->dev); + } } kfree(gdev); } @@ -221,6 +224,13 @@ int ccwgroup_create_from_string(struct device *root, unsigned int creator_id, atomic_set(&gdev->onoff, 0); mutex_init(&gdev->reg_mutex); mutex_lock(&gdev->reg_mutex); + gdev->creator_id = creator_id; + gdev->count = num_devices; + gdev->dev.bus = &ccwgroup_bus_type; + gdev->dev.parent = root; + gdev->dev.release = ccwgroup_release; + device_initialize(&gdev->dev); + curr_buf = buf; for (i = 0; i < num_devices && curr_buf; i++) { rc = __get_next_bus_id(&curr_buf, tmp_bus_id); @@ -258,16 +268,11 @@ int ccwgroup_create_from_string(struct device *root, unsigned int creator_id, rc = -EINVAL; goto error; } - gdev->creator_id = creator_id; - gdev->count = num_devices; - gdev->dev.bus = &ccwgroup_bus_type; - gdev->dev.parent = root; - gdev->dev.release = ccwgroup_release; snprintf (gdev->dev.bus_id, BUS_ID_SIZE, "%s", gdev->cdev[0]->dev.bus_id); - rc = device_register(&gdev->dev); + rc = device_add(&gdev->dev); if (rc) goto error; get_device(&gdev->dev); @@ -292,6 +297,7 @@ error: if (dev_get_drvdata(&gdev->cdev[i]->dev) == gdev) dev_set_drvdata(&gdev->cdev[i]->dev, NULL); put_device(&gdev->cdev[i]->dev); + gdev->cdev[i] = NULL; } mutex_unlock(&gdev->reg_mutex); put_device(&gdev->dev); diff --git a/drivers/s390/cio/chp.c b/drivers/s390/cio/chp.c index db00b059173..f1216cf6fa8 100644 --- a/drivers/s390/cio/chp.c +++ b/drivers/s390/cio/chp.c @@ -423,7 +423,7 @@ int chp_new(struct chp_id chpid) ret = sysfs_create_group(&chp->dev.kobj, &chp_attr_group); if (ret) { device_unregister(&chp->dev); - goto out_free; + goto out; } mutex_lock(&channel_subsystems[chpid.cssid]->mutex); if (channel_subsystems[chpid.cssid]->cm_enabled) { @@ -432,14 +432,15 @@ int chp_new(struct chp_id chpid) sysfs_remove_group(&chp->dev.kobj, &chp_attr_group); device_unregister(&chp->dev); mutex_unlock(&channel_subsystems[chpid.cssid]->mutex); - goto out_free; + goto out; } } channel_subsystems[chpid.cssid]->chps[chpid.id] = chp; mutex_unlock(&channel_subsystems[chpid.cssid]->mutex); - return ret; + goto out; out_free: kfree(chp); +out: return ret; } diff --git a/drivers/s390/cio/cio.c b/drivers/s390/cio/cio.c index 33bff8fec7d..326f4cc7f92 100644 --- a/drivers/s390/cio/cio.c +++ b/drivers/s390/cio/cio.c @@ -174,6 +174,7 @@ cio_start_key (struct subchannel *sch, /* subchannel structure */ CIO_TRACE_EVENT(4, sch->dev.bus_id); orb = &to_io_private(sch)->orb; + memset(orb, 0, sizeof(union orb)); /* sch is always under 2G. */ orb->cmd.intparm = (u32)(addr_t)sch; orb->cmd.fmt = 1; @@ -208,8 +209,10 @@ cio_start_key (struct subchannel *sch, /* subchannel structure */ case 1: /* status pending */ case 2: /* busy */ return -EBUSY; - default: /* device/path not operational */ + case 3: /* device/path not operational */ return cio_start_handle_notoper(sch, lpm); + default: + return ccode; } } diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 46c021d880d..1261e1a9e8c 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c @@ -477,7 +477,6 @@ void css_schedule_eval_all(void) void css_wait_for_slow_path(void) { - flush_workqueue(ccw_device_notify_work); flush_workqueue(slow_path_wq); } @@ -634,6 +633,11 @@ channel_subsystem_release(struct device *dev) css = to_css(dev); mutex_destroy(&css->mutex); + if (css->pseudo_subchannel) { + /* Implies that it has been generated but never registered. */ + css_subchannel_release(&css->pseudo_subchannel->dev); + css->pseudo_subchannel = NULL; + } kfree(css); } @@ -786,11 +790,15 @@ init_channel_subsystem (void) } channel_subsystems[i] = css; ret = setup_css(i); - if (ret) - goto out_free; + if (ret) { + kfree(channel_subsystems[i]); + goto out_unregister; + } ret = device_register(&css->device); - if (ret) - goto out_free_all; + if (ret) { + put_device(&css->device); + goto out_unregister; + } if (css_chsc_characteristics.secm) { ret = device_create_file(&css->device, &dev_attr_cm_enable); @@ -803,7 +811,7 @@ init_channel_subsystem (void) } ret = register_reboot_notifier(&css_reboot_notifier); if (ret) - goto out_pseudo; + goto out_unregister; css_init_done = 1; /* Enable default isc for I/O subchannels. */ @@ -811,18 +819,12 @@ init_channel_subsystem (void) for_each_subchannel(__init_channel_subsystem, NULL); return 0; -out_pseudo: - device_unregister(&channel_subsystems[i]->pseudo_subchannel->dev); out_file: - device_remove_file(&channel_subsystems[i]->device, - &dev_attr_cm_enable); + if (css_chsc_characteristics.secm) + device_remove_file(&channel_subsystems[i]->device, + &dev_attr_cm_enable); out_device: device_unregister(&channel_subsystems[i]->device); -out_free_all: - kfree(channel_subsystems[i]->pseudo_subchannel->lock); - kfree(channel_subsystems[i]->pseudo_subchannel); -out_free: - kfree(channel_subsystems[i]); out_unregister: while (i > 0) { struct channel_subsystem *css; @@ -830,6 +832,7 @@ out_unregister: i--; css = channel_subsystems[i]; device_unregister(&css->pseudo_subchannel->dev); + css->pseudo_subchannel = NULL; if (css_chsc_characteristics.secm) device_remove_file(&css->device, &dev_attr_cm_enable); diff --git a/drivers/s390/cio/device.c b/drivers/s390/cio/device.c index e818d0c54c0..28221030b88 100644 --- a/drivers/s390/cio/device.c +++ b/drivers/s390/cio/device.c @@ -150,7 +150,6 @@ static struct css_driver io_subchannel_driver = { }; struct workqueue_struct *ccw_device_work; -struct workqueue_struct *ccw_device_notify_work; wait_queue_head_t ccw_device_init_wq; atomic_t ccw_device_init_count; @@ -168,11 +167,6 @@ init_ccw_bus_type (void) ccw_device_work = create_singlethread_workqueue("cio"); if (!ccw_device_work) return -ENOMEM; /* FIXME: better errno ? */ - ccw_device_notify_work = create_singlethread_workqueue("cio_notify"); - if (!ccw_device_notify_work) { - ret = -ENOMEM; /* FIXME: better errno ? */ - goto out_err; - } slow_path_wq = create_singlethread_workqueue("kslowcrw"); if (!slow_path_wq) { ret = -ENOMEM; /* FIXME: better errno ? */ @@ -192,8 +186,6 @@ init_ccw_bus_type (void) out_err: if (ccw_device_work) destroy_workqueue(ccw_device_work); - if (ccw_device_notify_work) - destroy_workqueue(ccw_device_notify_work); if (slow_path_wq) destroy_workqueue(slow_path_wq); return ret; @@ -204,7 +196,6 @@ cleanup_ccw_bus_type (void) { css_driver_unregister(&io_subchannel_driver); bus_unregister(&ccw_bus_type); - destroy_workqueue(ccw_device_notify_work); destroy_workqueue(ccw_device_work); } @@ -1496,11 +1487,22 @@ static void device_set_disconnected(struct ccw_device *cdev) ccw_device_schedule_recovery(); } +void ccw_device_set_notoper(struct ccw_device *cdev) +{ + struct subchannel *sch = to_subchannel(cdev->dev.parent); + + CIO_TRACE_EVENT(2, "notoper"); + CIO_TRACE_EVENT(2, sch->dev.bus_id); + ccw_device_set_timeout(cdev, 0); + cio_disable_subchannel(sch); + cdev->private->state = DEV_STATE_NOT_OPER; +} + static int io_subchannel_sch_event(struct subchannel *sch, int slow) { int event, ret, disc; unsigned long flags; - enum { NONE, UNREGISTER, UNREGISTER_PROBE, REPROBE } action; + enum { NONE, UNREGISTER, UNREGISTER_PROBE, REPROBE, DISC } action; struct ccw_device *cdev; spin_lock_irqsave(sch->lock, flags); @@ -1535,16 +1537,11 @@ static int io_subchannel_sch_event(struct subchannel *sch, int slow) } /* fall through */ case CIO_GONE: - /* Prevent unwanted effects when opening lock. */ - cio_disable_subchannel(sch); - device_set_disconnected(cdev); /* Ask driver what to do with device. */ - action = UNREGISTER; - spin_unlock_irqrestore(sch->lock, flags); - ret = io_subchannel_notify(sch, event); - spin_lock_irqsave(sch->lock, flags); - if (ret) - action = NONE; + if (io_subchannel_notify(sch, event)) + action = DISC; + else + action = UNREGISTER; break; case CIO_REVALIDATE: /* Device will be removed, so no notify necessary. */ @@ -1565,6 +1562,7 @@ static int io_subchannel_sch_event(struct subchannel *sch, int slow) switch (action) { case UNREGISTER: case UNREGISTER_PROBE: + ccw_device_set_notoper(cdev); /* Unregister device (will use subchannel lock). */ spin_unlock_irqrestore(sch->lock, flags); css_sch_device_unregister(sch); @@ -1577,6 +1575,9 @@ static int io_subchannel_sch_event(struct subchannel *sch, int slow) case REPROBE: ccw_device_trigger_reprobe(cdev); break; + case DISC: + device_set_disconnected(cdev); + break; default: break; } @@ -1828,5 +1829,4 @@ EXPORT_SYMBOL(ccw_driver_unregister); EXPORT_SYMBOL(get_ccwdev_by_busid); EXPORT_SYMBOL(ccw_bus_type); EXPORT_SYMBOL(ccw_device_work); -EXPORT_SYMBOL(ccw_device_notify_work); EXPORT_SYMBOL_GPL(ccw_device_get_subchannel_id); diff --git a/drivers/s390/cio/device.h b/drivers/s390/cio/device.h index 9800a8335a3..6f5c3f2b358 100644 --- a/drivers/s390/cio/device.h +++ b/drivers/s390/cio/device.h @@ -72,7 +72,6 @@ dev_fsm_final_state(struct ccw_device *cdev) } extern struct workqueue_struct *ccw_device_work; -extern struct workqueue_struct *ccw_device_notify_work; extern wait_queue_head_t ccw_device_init_wq; extern atomic_t ccw_device_init_count; @@ -120,6 +119,7 @@ int ccw_device_stlck(struct ccw_device *); void ccw_device_trigger_reprobe(struct ccw_device *); void ccw_device_kill_io(struct ccw_device *); int ccw_device_notify(struct ccw_device *, int); +void ccw_device_set_notoper(struct ccw_device *cdev); /* qdio needs this. */ void ccw_device_set_timeout(struct ccw_device *, int); diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 8b5fe57fb2f..84cc9ea346d 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c @@ -337,26 +337,34 @@ int ccw_device_notify(struct ccw_device *cdev, int event) return 0; if (!cdev->online) return 0; + CIO_MSG_EVENT(2, "notify called for 0.%x.%04x, event=%d\n", + cdev->private->dev_id.ssid, cdev->private->dev_id.devno, + event); return cdev->drv->notify ? cdev->drv->notify(cdev, event) : 0; } -static void -ccw_device_oper_notify(struct work_struct *work) +static void cmf_reenable_delayed(struct work_struct *work) { struct ccw_device_private *priv; struct ccw_device *cdev; - int ret; priv = container_of(work, struct ccw_device_private, kick_work); cdev = priv->cdev; - ret = ccw_device_notify(cdev, CIO_OPER); - if (ret) { + cmf_reenable(cdev); +} + +static void ccw_device_oper_notify(struct ccw_device *cdev) +{ + if (ccw_device_notify(cdev, CIO_OPER)) { /* Reenable channel measurements, if needed. */ - cmf_reenable(cdev); - wake_up(&cdev->private->wait_q); - } else - /* Driver doesn't want device back. */ - ccw_device_do_unreg_rereg(work); + PREPARE_WORK(&cdev->private->kick_work, cmf_reenable_delayed); + queue_work(ccw_device_work, &cdev->private->kick_work); + return; + } + /* Driver doesn't want device back. */ + ccw_device_set_notoper(cdev); + PREPARE_WORK(&cdev->private->kick_work, ccw_device_do_unreg_rereg); + queue_work(ccw_device_work, &cdev->private->kick_work); } /* @@ -386,8 +394,7 @@ ccw_device_done(struct ccw_device *cdev, int state) if (cdev->private->flags.donotify) { cdev->private->flags.donotify = 0; - PREPARE_WORK(&cdev->private->kick_work, ccw_device_oper_notify); - queue_work(ccw_device_notify_work, &cdev->private->kick_work); + ccw_device_oper_notify(cdev); } wake_up(&cdev->private->wait_q); @@ -651,6 +658,13 @@ ccw_device_offline(struct ccw_device *cdev) { struct subchannel *sch; + /* Allow ccw_device_offline while disconnected. */ + if (cdev->private->state == DEV_STATE_DISCONNECTED || + cdev->private->state == DEV_STATE_NOT_OPER) { + cdev->private->flags.donotify = 0; + ccw_device_done(cdev, DEV_STATE_NOT_OPER); + return 0; + } if (ccw_device_is_orphan(cdev)) { ccw_device_done(cdev, DEV_STATE_OFFLINE); return 0; diff --git a/drivers/s390/cio/idset.c b/drivers/s390/cio/idset.c index ef7bc0a125e..cf8f24a4b5e 100644 --- a/drivers/s390/cio/idset.c +++ b/drivers/s390/cio/idset.c @@ -5,7 +5,7 @@ * Author(s): Peter Oberparleiter <peter.oberparleiter@de.ibm.com> */ -#include <linux/slab.h> +#include <linux/vmalloc.h> #include <linux/bitops.h> #include "idset.h" #include "css.h" @@ -25,18 +25,18 @@ static struct idset *idset_new(int num_ssid, int num_id) { struct idset *set; - set = kzalloc(sizeof(struct idset) + bitmap_size(num_ssid, num_id), - GFP_KERNEL); + set = vmalloc(sizeof(struct idset) + bitmap_size(num_ssid, num_id)); if (set) { set->num_ssid = num_ssid; set->num_id = num_id; + memset(set->bitmap, 0, bitmap_size(num_ssid, num_id)); } return set; } void idset_free(struct idset *set) { - kfree(set); + vfree(set); } void idset_clear(struct idset *set) diff --git a/drivers/s390/cio/qdio_debug.h b/drivers/s390/cio/qdio_debug.h index 8484b83698e..5a4d85b829a 100644 --- a/drivers/s390/cio/qdio_debug.h +++ b/drivers/s390/cio/qdio_debug.h @@ -61,18 +61,18 @@ /* s390dbf views */ #define QDIO_DBF_SETUP_LEN 8 -#define QDIO_DBF_SETUP_PAGES 4 +#define QDIO_DBF_SETUP_PAGES 8 #define QDIO_DBF_SETUP_NR_AREAS 1 #define QDIO_DBF_TRACE_LEN 8 #define QDIO_DBF_TRACE_NR_AREAS 2 #ifdef CONFIG_QDIO_DEBUG -#define QDIO_DBF_TRACE_PAGES 16 +#define QDIO_DBF_TRACE_PAGES 32 #define QDIO_DBF_SETUP_LEVEL 6 #define QDIO_DBF_TRACE_LEVEL 4 #else /* !CONFIG_QDIO_DEBUG */ -#define QDIO_DBF_TRACE_PAGES 4 +#define QDIO_DBF_TRACE_PAGES 8 #define QDIO_DBF_SETUP_LEVEL 2 #define QDIO_DBF_TRACE_LEVEL 2 #endif /* CONFIG_QDIO_DEBUG */ diff --git a/drivers/s390/cio/qdio_main.c b/drivers/s390/cio/qdio_main.c index d10c73cc168..e6eabc85342 100644 --- a/drivers/s390/cio/qdio_main.c +++ b/drivers/s390/cio/qdio_main.c @@ -330,6 +330,7 @@ static int qdio_siga_output(struct qdio_q *q) int cc; u32 busy_bit; u64 start_time = 0; + char dbf_text[15]; QDIO_DBF_TEXT5(0, trace, "sigaout"); QDIO_DBF_HEX5(0, trace, &q, sizeof(void *)); @@ -338,6 +339,9 @@ static int qdio_siga_output(struct qdio_q *q) again: cc = qdio_do_siga_output(q, &busy_bit); if (queue_type(q) == QDIO_IQDIO_QFMT && cc == 2 && busy_bit) { + sprintf(dbf_text, "bb%4x%2x", q->irq_ptr->schid.sch_no, q->nr); + QDIO_DBF_TEXT3(0, trace, dbf_text); + if (!start_time) start_time = get_usecs(); else if ((get_usecs() - start_time) < QDIO_BUSY_BIT_PATIENCE) @@ -748,16 +752,18 @@ static void qdio_kick_outbound_q(struct qdio_q *q) rc = qdio_siga_output(q); switch (rc) { case 0: - /* went smooth this time, reset timestamp */ - q->u.out.timestamp = 0; - /* TODO: improve error handling for CC=0 case */ #ifdef CONFIG_QDIO_DEBUG - QDIO_DBF_TEXT3(0, trace, "cc2reslv"); - sprintf(dbf_text, "%4x%2x%2x", q->irq_ptr->schid.sch_no, q->nr, - atomic_read(&q->u.out.busy_siga_counter)); - QDIO_DBF_TEXT3(0, trace, dbf_text); + if (q->u.out.timestamp) { + QDIO_DBF_TEXT3(0, trace, "cc2reslv"); + sprintf(dbf_text, "%4x%2x%2x", q->irq_ptr->schid.sch_no, + q->nr, + atomic_read(&q->u.out.busy_siga_counter)); + QDIO_DBF_TEXT3(0, trace, dbf_text); + } #endif /* CONFIG_QDIO_DEBUG */ + /* went smooth this time, reset timestamp */ + q->u.out.timestamp = 0; break; /* cc=2 and busy bit */ case (2 | QDIO_ERROR_SIGA_BUSY): @@ -1066,14 +1072,12 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm, if (IS_ERR(irb)) { switch (PTR_ERR(irb)) { case -EIO: - sprintf(dbf_text, "ierr%4x", - cdev->private->schid.sch_no); + sprintf(dbf_text, "ierr%4x", irq_ptr->schid.sch_no); QDIO_DBF_TEXT2(1, setup, dbf_text); qdio_int_error(cdev); return; case -ETIMEDOUT: - sprintf(dbf_text, "qtoh%4x", - cdev->private->schid.sch_no); + sprintf(dbf_text, "qtoh%4x", irq_ptr->schid.sch_no); QDIO_DBF_TEXT2(1, setup, dbf_text); qdio_int_error(cdev); return; @@ -1124,8 +1128,10 @@ void qdio_int_handler(struct ccw_device *cdev, unsigned long intparm, struct qdio_ssqd_desc *qdio_get_ssqd_desc(struct ccw_device *cdev) { struct qdio_irq *irq_ptr; + char dbf_text[15]; - QDIO_DBF_TEXT0(0, setup, "getssqd"); + sprintf(dbf_text, "qssq%4x", cdev->private->schid.sch_no); + QDIO_DBF_TEXT0(0, setup, dbf_text); irq_ptr = cdev->private->qdio_data; if (!irq_ptr) @@ -1149,14 +1155,13 @@ int qdio_cleanup(struct ccw_device *cdev, int how) char dbf_text[15]; int rc; + sprintf(dbf_text, "qcln%4x", cdev->private->schid.sch_no); + QDIO_DBF_TEXT0(0, setup, dbf_text); + irq_ptr = cdev->private->qdio_data; if (!irq_ptr) return -ENODEV; - sprintf(dbf_text, "qcln%4x", irq_ptr->schid.sch_no); - QDIO_DBF_TEXT1(0, trace, dbf_text); - QDIO_DBF_TEXT0(0, setup, dbf_text); - rc = qdio_shutdown(cdev, how); if (rc == 0) rc = qdio_free(cdev); @@ -1191,6 +1196,9 @@ int qdio_shutdown(struct ccw_device *cdev, int how) unsigned long flags; char dbf_text[15]; + sprintf(dbf_text, "qshu%4x", cdev->private->schid.sch_no); + QDIO_DBF_TEXT0(0, setup, dbf_text); + irq_ptr = cdev->private->qdio_data; if (!irq_ptr) return -ENODEV; @@ -1205,10 +1213,6 @@ int qdio_shutdown(struct ccw_device *cdev, int how) return 0; } - sprintf(dbf_text, "qsqs%4x", irq_ptr->schid.sch_no); - QDIO_DBF_TEXT1(0, trace, dbf_text); - QDIO_DBF_TEXT0(0, setup, dbf_text); - tiqdio_remove_input_queues(irq_ptr); qdio_shutdown_queues(cdev); qdio_shutdown_debug_entries(irq_ptr, cdev); @@ -1247,7 +1251,6 @@ no_cleanup: qdio_set_state(irq_ptr, QDIO_IRQ_STATE_INACTIVE); mutex_unlock(&irq_ptr->setup_mutex); - module_put(THIS_MODULE); if (rc) return rc; return 0; @@ -1263,16 +1266,14 @@ int qdio_free(struct ccw_device *cdev) struct qdio_irq *irq_ptr; char dbf_text[15]; + sprintf(dbf_text, "qfre%4x", cdev->private->schid.sch_no); + QDIO_DBF_TEXT0(0, setup, dbf_text); + irq_ptr = cdev->private->qdio_data; if (!irq_ptr) return -ENODEV; mutex_lock(&irq_ptr->setup_mutex); - - sprintf(dbf_text, "qfqs%4x", irq_ptr->schid.sch_no); - QDIO_DBF_TEXT1(0, trace, dbf_text); - QDIO_DBF_TEXT0(0, setup, dbf_text); - cdev->private->qdio_data = NULL; mutex_unlock(&irq_ptr->setup_mutex); @@ -1295,7 +1296,6 @@ int qdio_initialize(struct qdio_initialize *init_data) sprintf(dbf_text, "qini%4x", init_data->cdev->private->schid.sch_no); QDIO_DBF_TEXT0(0, setup, dbf_text); - QDIO_DBF_TEXT0(0, trace, dbf_text); rc = qdio_allocate(init_data); if (rc) @@ -1319,7 +1319,6 @@ int qdio_allocate(struct qdio_initialize *init_data) sprintf(dbf_text, "qalc%4x", init_data->cdev->private->schid.sch_no); QDIO_DBF_TEXT0(0, setup, dbf_text); - QDIO_DBF_TEXT0(0, trace, dbf_text); if ((init_data->no_input_qs && !init_data->input_handler) || (init_data->no_output_qs && !init_data->output_handler)) @@ -1355,7 +1354,7 @@ int qdio_allocate(struct qdio_initialize *init_data) goto out_rel; /* qdr is used in ccw1.cda which is u32 */ - irq_ptr->qdr = kzalloc(sizeof(struct qdr), GFP_KERNEL | GFP_DMA); + irq_ptr->qdr = (struct qdr *) get_zeroed_page(GFP_KERNEL | GFP_DMA); if (!irq_ptr->qdr) goto out_rel; WARN_ON((unsigned long)irq_ptr->qdr & 0xfff); @@ -1389,6 +1388,9 @@ int qdio_establish(struct qdio_initialize *init_data) unsigned long saveflags; int rc; + sprintf(dbf_text, "qest%4x", cdev->private->schid.sch_no); + QDIO_DBF_TEXT0(0, setup, dbf_text); + irq_ptr = cdev->private->qdio_data; if (!irq_ptr) return -ENODEV; @@ -1396,13 +1398,6 @@ int qdio_establish(struct qdio_initialize *init_data) if (cdev->private->state != DEV_STATE_ONLINE) return -EINVAL; - if (!try_module_get(THIS_MODULE)) - return -EINVAL; - - sprintf(dbf_text, "qest%4x", cdev->private->schid.sch_no); - QDIO_DBF_TEXT0(0, setup, dbf_text); - QDIO_DBF_TEXT0(0, trace, dbf_text); - mutex_lock(&irq_ptr->setup_mutex); qdio_setup_irq(init_data); @@ -1472,6 +1467,9 @@ int qdio_activate(struct ccw_device *cdev) unsigned long saveflags; char dbf_text[20]; + sprintf(dbf_text, "qact%4x", cdev->private->schid.sch_no); + QDIO_DBF_TEXT0(0, setup, dbf_text); + irq_ptr = cdev->private->qdio_data; if (!irq_ptr) return -ENODEV; @@ -1485,10 +1483,6 @@ int qdio_activate(struct ccw_device *cdev) goto out; } - sprintf(dbf_text, "qact%4x", irq_ptr->schid.sch_no); - QDIO_DBF_TEXT2(0, setup, dbf_text); - QDIO_DBF_TEXT2(0, trace, dbf_text); - irq_ptr->ccw.cmd_code = irq_ptr->aqueue.cmd; irq_ptr->ccw.flags = CCW_FLAG_SLI; irq_ptr->ccw.count = irq_ptr->aqueue.count; @@ -1663,7 +1657,7 @@ int do_QDIO(struct ccw_device *cdev, unsigned int callflags, #ifdef CONFIG_QDIO_DEBUG char dbf_text[20]; - sprintf(dbf_text, "doQD%04x", cdev->private->schid.sch_no); + sprintf(dbf_text, "doQD%4x", cdev->private->schid.sch_no); QDIO_DBF_TEXT3(0, trace, dbf_text); #endif /* CONFIG_QDIO_DEBUG */ diff --git a/drivers/s390/cio/qdio_perf.c b/drivers/s390/cio/qdio_perf.c index ea01b85b1cc..ec5c4a41423 100644 --- a/drivers/s390/cio/qdio_perf.c +++ b/drivers/s390/cio/qdio_perf.c @@ -142,7 +142,7 @@ int __init qdio_setup_perf_stats(void) return 0; } -void __exit qdio_remove_perf_stats(void) +void qdio_remove_perf_stats(void) { #ifdef CONFIG_PROC_FS remove_proc_entry("qdio_perf", NULL); diff --git a/drivers/s390/cio/qdio_setup.c b/drivers/s390/cio/qdio_setup.c index f0923a8aced..1679e2f91c9 100644 --- a/drivers/s390/cio/qdio_setup.c +++ b/drivers/s390/cio/qdio_setup.c @@ -165,7 +165,7 @@ static void setup_queues(struct qdio_irq *irq_ptr, void **output_sbal_array = qdio_init->output_sbal_addr_array; int i; - sprintf(dbf_text, "qfqs%4x", qdio_init->cdev->private->schid.sch_no); + sprintf(dbf_text, "qset%4x", qdio_init->cdev->private->schid.sch_no); QDIO_DBF_TEXT0(0, setup, dbf_text); for_each_input_queue(irq_ptr, q, i) { @@ -285,7 +285,7 @@ void qdio_setup_ssqd_info(struct qdio_irq *irq_ptr) rc = __get_ssqd_info(irq_ptr); if (rc) { QDIO_DBF_TEXT2(0, setup, "ssqdasig"); - sprintf(dbf_text, "schno%x", irq_ptr->schid.sch_no); + sprintf(dbf_text, "schn%4x", irq_ptr->schid.sch_no); QDIO_DBF_TEXT2(0, setup, dbf_text); sprintf(dbf_text, "rc:%d", rc); QDIO_DBF_TEXT2(0, setup, dbf_text); @@ -325,7 +325,7 @@ void qdio_release_memory(struct qdio_irq *irq_ptr) kmem_cache_free(qdio_q_cache, q); } } - kfree(irq_ptr->qdr); + free_page((unsigned long) irq_ptr->qdr); free_page(irq_ptr->chsc_page); free_page((unsigned long) irq_ptr); } @@ -447,7 +447,7 @@ void qdio_print_subchannel_info(struct qdio_irq *irq_ptr, { char s[80]; - sprintf(s, "%s ", cdev->dev.bus_id); + sprintf(s, "%s sc:%x ", cdev->dev.bus_id, irq_ptr->schid.sch_no); switch (irq_ptr->qib.qfmt) { case QDIO_QETH_QFMT: @@ -515,7 +515,7 @@ int __init qdio_setup_init(void) return 0; } -void __exit qdio_setup_exit(void) +void qdio_setup_exit(void) { kmem_cache_destroy(qdio_q_cache); } diff --git a/drivers/s390/cio/qdio_thinint.c b/drivers/s390/cio/qdio_thinint.c index 9291a771d81..ea7f6140026 100644 --- a/drivers/s390/cio/qdio_thinint.c +++ b/drivers/s390/cio/qdio_thinint.c @@ -113,7 +113,11 @@ void tiqdio_remove_input_queues(struct qdio_irq *irq_ptr) struct qdio_q *q; int i; - for_each_input_queue(irq_ptr, q, i) { + for (i = 0; i < irq_ptr->nr_input_qs; i++) { + q = irq_ptr->input_qs[i]; + /* if establish triggered an error */ + if (!q || !q->entry.prev || !q->entry.next) + continue; list_del_rcu(&q->entry); synchronize_rcu(); } diff --git a/drivers/s390/kvm/Makefile b/drivers/s390/kvm/Makefile index 4a5ec39f9ca..0815690ac1e 100644 --- a/drivers/s390/kvm/Makefile +++ b/drivers/s390/kvm/Makefile @@ -6,4 +6,4 @@ # it under the terms of the GNU General Public License (version 2 only) # as published by the Free Software Foundation. -obj-$(CONFIG_VIRTIO) += kvm_virtio.o +obj-$(CONFIG_S390_GUEST) += kvm_virtio.o diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c index 5ab34340919..292b60da6dc 100644 --- a/drivers/s390/kvm/kvm_virtio.c +++ b/drivers/s390/kvm/kvm_virtio.c @@ -15,6 +15,7 @@ #include <linux/err.h> #include <linux/virtio.h> #include <linux/virtio_config.h> +#include <linux/virtio_console.h> #include <linux/interrupt.h> #include <linux/virtio_ring.h> #include <linux/pfn.h> @@ -87,16 +88,20 @@ static u32 kvm_get_features(struct virtio_device *vdev) return features; } -static void kvm_set_features(struct virtio_device *vdev, u32 features) +static void kvm_finalize_features(struct virtio_device *vdev) { - unsigned int i; + unsigned int i, bits; struct kvm_device_desc *desc = to_kvmdev(vdev)->desc; /* Second half of bitmap is features we accept. */ u8 *out_features = kvm_vq_features(desc) + desc->feature_len; + /* Give virtio_ring a chance to accept features. */ + vring_transport_features(vdev); + memset(out_features, 0, desc->feature_len); - for (i = 0; i < min(desc->feature_len * 8, 32); i++) { - if (features & (1 << i)) + bits = min_t(unsigned, desc->feature_len, sizeof(vdev->features)) * 8; + for (i = 0; i < bits; i++) { + if (test_bit(i, vdev->features)) out_features[i / 8] |= (1 << (i % 8)); } } @@ -222,7 +227,7 @@ static void kvm_del_vq(struct virtqueue *vq) */ static struct virtio_config_ops kvm_vq_configspace_ops = { .get_features = kvm_get_features, - .set_features = kvm_set_features, + .finalize_features = kvm_finalize_features, .get = kvm_get, .set = kvm_set, .get_status = kvm_get_status, @@ -333,6 +338,25 @@ static int __init kvm_devices_init(void) return 0; } +/* code for early console output with virtio_console */ +static __init int early_put_chars(u32 vtermno, const char *buf, int count) +{ + char scratch[17]; + unsigned int len = count; + + if (len > sizeof(scratch) - 1) + len = sizeof(scratch) - 1; + scratch[len] = '\0'; + memcpy(scratch, buf, len); + kvm_hypercall1(KVM_S390_VIRTIO_NOTIFY, __pa(scratch)); + return len; +} + +void __init s390_virtio_console_init(void) +{ + virtio_cons_early_init(early_put_chars); +} + /* * We do this after core stuff, but before the drivers. */ diff --git a/drivers/s390/net/claw.c b/drivers/s390/net/claw.c index c644669a75c..e10ac9ab2d4 100644 --- a/drivers/s390/net/claw.c +++ b/drivers/s390/net/claw.c @@ -58,13 +58,13 @@ * 1.10 Changes for Buffer allocation * 1.15 Changed for 2.6 Kernel No longer compiles on 2.4 or lower * 1.25 Added Packing support + * 1.5 */ #include <asm/ccwdev.h> #include <asm/ccwgroup.h> #include <asm/debug.h> #include <asm/idals.h> #include <asm/io.h> - #include <linux/bitops.h> #include <linux/ctype.h> #include <linux/delay.h> @@ -90,36 +90,10 @@ #include "cu3088.h" #include "claw.h" -MODULE_AUTHOR("Andy Richter <richtera@us.ibm.com>"); -MODULE_DESCRIPTION("Linux for zSeries CLAW Driver\n" \ - "Copyright 2000,2005 IBM Corporation\n"); -MODULE_LICENSE("GPL"); - -/* Debugging is based on DEBUGMSG, IOTRACE, or FUNCTRACE options: - DEBUGMSG - Enables output of various debug messages in the code - IOTRACE - Enables output of CCW and other IO related traces - FUNCTRACE - Enables output of function entry/exit trace - Define any combination of above options to enable tracing - - CLAW also uses the s390dbf file system see claw_trace and claw_setup +/* + CLAW uses the s390dbf file system see claw_trace and claw_setup */ -/* following enables tracing */ -//#define DEBUGMSG -//#define IOTRACE -//#define FUNCTRACE - -#ifdef DEBUGMSG -#define DEBUG -#endif - -#ifdef IOTRACE -#define DEBUG -#endif - -#ifdef FUNCTRACE -#define DEBUG -#endif static char debug_buffer[255]; /** @@ -146,7 +120,6 @@ claw_register_debug_facility(void) claw_dbf_setup = debug_register("claw_setup", 2, 1, 8); claw_dbf_trace = debug_register("claw_trace", 2, 2, 8); if (claw_dbf_setup == NULL || claw_dbf_trace == NULL) { - printk(KERN_WARNING "Not enough memory for debug facility.\n"); claw_unregister_debug_facility(); return -ENOMEM; } @@ -160,14 +133,14 @@ claw_register_debug_facility(void) static inline void claw_set_busy(struct net_device *dev) { - ((struct claw_privbk *) dev->priv)->tbusy=1; + ((struct claw_privbk *)dev->ml_priv)->tbusy = 1; eieio(); } static inline void claw_clear_busy(struct net_device *dev) { - clear_bit(0, &(((struct claw_privbk *) dev->priv)->tbusy)); + clear_bit(0, &(((struct claw_privbk *) dev->ml_priv)->tbusy)); netif_wake_queue(dev); eieio(); } @@ -176,20 +149,20 @@ static inline int claw_check_busy(struct net_device *dev) { eieio(); - return ((struct claw_privbk *) dev->priv)->tbusy; + return ((struct claw_privbk *) dev->ml_priv)->tbusy; } static inline void claw_setbit_busy(int nr,struct net_device *dev) { netif_stop_queue(dev); - set_bit(nr, (void *)&(((struct claw_privbk *)dev->priv)->tbusy)); + set_bit(nr, (void *)&(((struct claw_privbk *)dev->ml_priv)->tbusy)); } static inline void claw_clearbit_busy(int nr,struct net_device *dev) { - clear_bit(nr,(void *)&(((struct claw_privbk *)dev->priv)->tbusy)); + clear_bit(nr, (void *)&(((struct claw_privbk *)dev->ml_priv)->tbusy)); netif_wake_queue(dev); } @@ -198,7 +171,7 @@ claw_test_and_setbit_busy(int nr,struct net_device *dev) { netif_stop_queue(dev); return test_and_set_bit(nr, - (void *)&(((struct claw_privbk *) dev->priv)->tbusy)); + (void *)&(((struct claw_privbk *) dev->ml_priv)->tbusy)); } @@ -232,9 +205,6 @@ static void probe_error( struct ccwgroup_device *cgdev); static struct net_device_stats *claw_stats(struct net_device *dev); static int pages_to_order_of_mag(int num_of_pages); static struct sk_buff *claw_pack_skb(struct claw_privbk *privptr); -#ifdef DEBUG -static void dumpit (char *buf, int len); -#endif /* sysfs Functions */ static ssize_t claw_hname_show(struct device *dev, struct device_attribute *attr, char *buf); static ssize_t claw_hname_write(struct device *dev, struct device_attribute *attr, @@ -263,12 +233,12 @@ static int claw_snd_disc(struct net_device *dev, struct clawctl * p_ctl); static int claw_snd_sys_validate_rsp(struct net_device *dev, struct clawctl * p_ctl, __u32 return_code); static int claw_strt_conn_req(struct net_device *dev ); -static void claw_strt_read ( struct net_device *dev, int lock ); -static void claw_strt_out_IO( struct net_device *dev ); -static void claw_free_wrt_buf( struct net_device *dev ); +static void claw_strt_read(struct net_device *dev, int lock); +static void claw_strt_out_IO(struct net_device *dev); +static void claw_free_wrt_buf(struct net_device *dev); /* Functions for unpack reads */ -static void unpack_read (struct net_device *dev ); +static void unpack_read(struct net_device *dev); /* ccwgroup table */ @@ -284,7 +254,6 @@ static struct ccwgroup_driver claw_group_driver = { }; /* -* * Key functions */ @@ -298,23 +267,15 @@ claw_probe(struct ccwgroup_device *cgdev) int rc; struct claw_privbk *privptr=NULL; -#ifdef FUNCTRACE - printk(KERN_INFO "%s Enter\n",__func__); -#endif - CLAW_DBF_TEXT(2,setup,"probe"); + CLAW_DBF_TEXT(2, setup, "probe"); if (!get_device(&cgdev->dev)) return -ENODEV; -#ifdef DEBUGMSG - printk(KERN_INFO "claw: variable cgdev =\n"); - dumpit((char *)cgdev, sizeof(struct ccwgroup_device)); -#endif privptr = kzalloc(sizeof(struct claw_privbk), GFP_KERNEL); + cgdev->dev.driver_data = privptr; if (privptr == NULL) { probe_error(cgdev); put_device(&cgdev->dev); - printk(KERN_WARNING "Out of memory %s %s Exit Line %d \n", - cgdev->cdev[0]->dev.bus_id,__func__,__LINE__); - CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); + CLAW_DBF_TEXT_(2, setup, "probex%d", -ENOMEM); return -ENOMEM; } privptr->p_mtc_envelope= kzalloc( MAX_ENVELOPE_SIZE, GFP_KERNEL); @@ -322,9 +283,7 @@ claw_probe(struct ccwgroup_device *cgdev) if ((privptr->p_mtc_envelope==NULL) || (privptr->p_env==NULL)) { probe_error(cgdev); put_device(&cgdev->dev); - printk(KERN_WARNING "Out of memory %s %s Exit Line %d \n", - cgdev->cdev[0]->dev.bus_id,__func__,__LINE__); - CLAW_DBF_TEXT_(2,setup,"probex%d",-ENOMEM); + CLAW_DBF_TEXT_(2, setup, "probex%d", -ENOMEM); return -ENOMEM; } memcpy(privptr->p_env->adapter_name,WS_NAME_NOT_DEF,8); @@ -341,19 +300,13 @@ claw_probe(struct ccwgroup_device *cgdev) put_device(&cgdev->dev); printk(KERN_WARNING "add_files failed %s %s Exit Line %d \n", cgdev->cdev[0]->dev.bus_id,__func__,__LINE__); - CLAW_DBF_TEXT_(2,setup,"probex%d",rc); + CLAW_DBF_TEXT_(2, setup, "probex%d", rc); return rc; } - printk(KERN_INFO "claw: sysfs files added for %s\n",cgdev->cdev[0]->dev.bus_id); privptr->p_env->p_priv = privptr; cgdev->cdev[0]->handler = claw_irq_handler; cgdev->cdev[1]->handler = claw_irq_handler; - cgdev->dev.driver_data = privptr; -#ifdef FUNCTRACE - printk(KERN_INFO "claw:%s exit on line %d, " - "rc = 0\n",__func__,__LINE__); -#endif - CLAW_DBF_TEXT(2,setup,"prbext 0"); + CLAW_DBF_TEXT(2, setup, "prbext 0"); return 0; } /* end of claw_probe */ @@ -366,41 +319,22 @@ static int claw_tx(struct sk_buff *skb, struct net_device *dev) { int rc; - struct claw_privbk *privptr=dev->priv; + struct claw_privbk *privptr = dev->ml_priv; unsigned long saveflags; struct chbk *p_ch; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s enter\n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(4,trace,"claw_tx"); + CLAW_DBF_TEXT(4, trace, "claw_tx"); p_ch=&privptr->channel[WRITE]; if (skb == NULL) { - printk(KERN_WARNING "%s: null pointer passed as sk_buffer\n", - dev->name); privptr->stats.tx_dropped++; -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() exit on line %d, rc = EIO\n", - dev->name,__func__, __LINE__); -#endif - CLAW_DBF_TEXT_(2,trace,"clawtx%d",-EIO); + privptr->stats.tx_errors++; + CLAW_DBF_TEXT_(2, trace, "clawtx%d", -EIO); return -EIO; } - -#ifdef IOTRACE - printk(KERN_INFO "%s: variable sk_buff=\n",dev->name); - dumpit((char *) skb, sizeof(struct sk_buff)); - printk(KERN_INFO "%s: variable dev=\n",dev->name); - dumpit((char *) dev, sizeof(struct net_device)); -#endif spin_lock_irqsave(get_ccwdev_lock(p_ch->cdev), saveflags); rc=claw_hw_tx( skb, dev, 1 ); spin_unlock_irqrestore(get_ccwdev_lock(p_ch->cdev), saveflags); -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s exit on line %d, rc = %d\n", - dev->name, __func__, __LINE__, rc); -#endif - CLAW_DBF_TEXT_(4,trace,"clawtx%d",rc); + CLAW_DBF_TEXT_(4, trace, "clawtx%d", rc); return rc; } /* end of claw_tx */ @@ -419,7 +353,7 @@ claw_pack_skb(struct claw_privbk *privptr) new_skb = NULL; /* assume no dice */ pkt_cnt = 0; - CLAW_DBF_TEXT(4,trace,"PackSKBe"); + CLAW_DBF_TEXT(4, trace, "PackSKBe"); if (!skb_queue_empty(&p_ch->collect_queue)) { /* some data */ held_skb = skb_dequeue(&p_ch->collect_queue); @@ -457,13 +391,8 @@ claw_pack_skb(struct claw_privbk *privptr) skb_queue_head(&p_ch->collect_queue,held_skb); } } -#ifdef IOTRACE - printk(KERN_INFO "%s: %s() Packed %d len %d\n", - p_env->ndev->name, - __func__,pkt_cnt,new_skb->len); -#endif } - CLAW_DBF_TEXT(4,trace,"PackSKBx"); + CLAW_DBF_TEXT(4, trace, "PackSKBx"); return new_skb; } @@ -475,31 +404,14 @@ claw_pack_skb(struct claw_privbk *privptr) static int claw_change_mtu(struct net_device *dev, int new_mtu) { - struct claw_privbk *privptr=dev->priv; + struct claw_privbk *privptr = dev->ml_priv; int buff_size; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter \n",dev->name,__func__); -#endif -#ifdef DEBUGMSG - printk(KERN_INFO "variable dev =\n"); - dumpit((char *) dev, sizeof(struct net_device)); - printk(KERN_INFO "variable new_mtu = %d\n", new_mtu); -#endif - CLAW_DBF_TEXT(4,trace,"setmtu"); + CLAW_DBF_TEXT(4, trace, "setmtu"); buff_size = privptr->p_env->write_size; if ((new_mtu < 60) || (new_mtu > buff_size)) { -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d, rc=EINVAL\n", - dev->name, - __func__, __LINE__); -#endif return -EINVAL; } dev->mtu = new_mtu; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n",dev->name, - __func__, __LINE__); -#endif return 0; } /* end of claw_change_mtu */ @@ -521,24 +433,13 @@ claw_open(struct net_device *dev) struct timer_list timer; struct ccwbk *p_buf; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter \n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(4,trace,"open"); - if (!dev || (dev->name[0] == 0x00)) { - CLAW_DBF_TEXT(2,trace,"BadDev"); - printk(KERN_WARNING "claw: Bad device at open failing \n"); - return -ENODEV; - } - privptr = (struct claw_privbk *)dev->priv; + CLAW_DBF_TEXT(4, trace, "open"); + privptr = (struct claw_privbk *)dev->ml_priv; /* allocate and initialize CCW blocks */ if (privptr->buffs_alloc == 0) { rc=init_ccw_bk(dev); if (rc) { - printk(KERN_INFO "%s:%s Exit on line %d, rc=ENOMEM\n", - dev->name, - __func__, __LINE__); - CLAW_DBF_TEXT(2,trace,"openmem"); + CLAW_DBF_TEXT(2, trace, "openmem"); return -ENOMEM; } } @@ -557,7 +458,7 @@ claw_open(struct net_device *dev) tasklet_init(&privptr->channel[READ].tasklet, claw_irq_tasklet, (unsigned long) &privptr->channel[READ]); for ( i = 0; i < 2; i++) { - CLAW_DBF_TEXT_(2,trace,"opn_ch%d",i); + CLAW_DBF_TEXT_(2, trace, "opn_ch%d", i); init_waitqueue_head(&privptr->channel[i].wait); /* skb_queue_head_init(&p_ch->io_queue); */ if (i == WRITE) @@ -595,15 +496,8 @@ claw_open(struct net_device *dev) ~(DEV_STAT_CHN_END | DEV_STAT_DEV_END)) != 0x00) || (((privptr->channel[READ].flag | privptr->channel[WRITE].flag) & CLAW_TIMER) != 0x00)) { -#ifdef DEBUGMSG - printk(KERN_INFO "%s: channel problems during open - read:" - " %02x - write: %02x\n", - dev->name, - privptr->channel[READ].last_dstat, - privptr->channel[WRITE].last_dstat); -#endif printk(KERN_INFO "%s: remote side is not ready\n", dev->name); - CLAW_DBF_TEXT(2,trace,"notrdy"); + CLAW_DBF_TEXT(2, trace, "notrdy"); for ( i = 0; i < 2; i++) { spin_lock_irqsave( @@ -659,23 +553,14 @@ claw_open(struct net_device *dev) privptr->p_buff_read=NULL; privptr->p_buff_write=NULL; claw_clear_busy(dev); -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d, rc=EIO\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(2,trace,"open EIO"); + CLAW_DBF_TEXT(2, trace, "open EIO"); return -EIO; } /* Send SystemValidate command */ claw_clear_busy(dev); - -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d, rc=0\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"openok"); + CLAW_DBF_TEXT(4, trace, "openok"); return 0; } /* end of claw_open */ @@ -694,22 +579,14 @@ claw_irq_handler(struct ccw_device *cdev, struct claw_env *p_env; struct chbk *p_ch_r=NULL; - -#ifdef FUNCTRACE - printk(KERN_INFO "%s enter \n",__func__); -#endif - CLAW_DBF_TEXT(4,trace,"clawirq"); + CLAW_DBF_TEXT(4, trace, "clawirq"); /* Bypass all 'unsolicited interrupts' */ if (!cdev->dev.driver_data) { printk(KERN_WARNING "claw: unsolicited interrupt for device:" "%s received c-%02x d-%02x\n", cdev->dev.bus_id, irb->scsw.cmd.cstat, irb->scsw.cmd.dstat); -#ifdef FUNCTRACE - printk(KERN_INFO "claw: %s() " - "exit on line %d\n",__func__,__LINE__); -#endif - CLAW_DBF_TEXT(2,trace,"badirq"); + CLAW_DBF_TEXT(2, trace, "badirq"); return; } privptr = (struct claw_privbk *)cdev->dev.driver_data; @@ -722,41 +599,25 @@ claw_irq_handler(struct ccw_device *cdev, else { printk(KERN_WARNING "claw: Can't determine channel for " "interrupt, device %s\n", cdev->dev.bus_id); - CLAW_DBF_TEXT(2,trace,"badchan"); + CLAW_DBF_TEXT(2, trace, "badchan"); return; } - CLAW_DBF_TEXT_(4,trace,"IRQCH=%d",p_ch->flag); + CLAW_DBF_TEXT_(4, trace, "IRQCH=%d", p_ch->flag); dev = (struct net_device *) (p_ch->ndev); p_env=privptr->p_env; -#ifdef IOTRACE - printk(KERN_INFO "%s: interrupt for device: %04x " - "received c-%02x d-%02x state-%02x\n", - dev->name, p_ch->devno, irb->scsw.cmd.cstat, - irb->scsw.cmd.dstat, p_ch->claw_state); -#endif - /* Copy interruption response block. */ memcpy(p_ch->irb, irb, sizeof(struct irb)); - /* Check for good subchannel return code, otherwise error message */ + /* Check for good subchannel return code, otherwise info message */ if (irb->scsw.cmd.cstat && !(irb->scsw.cmd.cstat & SCHN_STAT_PCI)) { printk(KERN_INFO "%s: subchannel check for device: %04x -" " Sch Stat %02x Dev Stat %02x CPA - %04x\n", dev->name, p_ch->devno, irb->scsw.cmd.cstat, irb->scsw.cmd.dstat, irb->scsw.cmd.cpa); -#ifdef IOTRACE - dumpit((char *)irb,sizeof(struct irb)); - dumpit((char *)(unsigned long)irb->scsw.cmd.cpa, - sizeof(struct ccw1)); -#endif -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(2,trace,"chanchk"); + CLAW_DBF_TEXT(2, trace, "chanchk"); /* return; */ } @@ -768,233 +629,138 @@ claw_irq_handler(struct ccw_device *cdev, p_ch->last_dstat = irb->scsw.cmd.dstat; switch (p_ch->claw_state) { - case CLAW_STOP:/* HALT_IO by claw_release (halt sequence) */ -#ifdef DEBUGMSG - printk(KERN_INFO "%s: CLAW_STOP enter\n", dev->name); -#endif - if (!((p_ch->irb->scsw.cmd.stctl & - SCSW_STCTL_SEC_STATUS) || - (p_ch->irb->scsw.cmd.stctl == - SCSW_STCTL_STATUS_PEND) || - (p_ch->irb->scsw.cmd.stctl == - (SCSW_STCTL_ALERT_STATUS | - SCSW_STCTL_STATUS_PEND)))) { -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - return; - } - wake_up(&p_ch->wait); /* wake up claw_release */ - -#ifdef DEBUGMSG - printk(KERN_INFO "%s: CLAW_STOP exit\n", dev->name); -#endif -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"stop"); - return; - - case CLAW_START_HALT_IO: /* HALT_IO issued by claw_open */ -#ifdef DEBUGMSG - printk(KERN_INFO "%s: process CLAW_STAT_HALT_IO\n", - dev->name); -#endif - if (!((p_ch->irb->scsw.cmd.stctl & - SCSW_STCTL_SEC_STATUS) || - (p_ch->irb->scsw.cmd.stctl == - SCSW_STCTL_STATUS_PEND) || - (p_ch->irb->scsw.cmd.stctl == - (SCSW_STCTL_ALERT_STATUS | - SCSW_STCTL_STATUS_PEND)))) { -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"haltio"); - return; - } - if (p_ch->flag == CLAW_READ) { - p_ch->claw_state = CLAW_START_READ; - wake_up(&p_ch->wait); /* wake claw_open (READ)*/ - } + case CLAW_STOP:/* HALT_IO by claw_release (halt sequence) */ + if (!((p_ch->irb->scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS) || + (p_ch->irb->scsw.cmd.stctl == SCSW_STCTL_STATUS_PEND) || + (p_ch->irb->scsw.cmd.stctl == + (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND)))) + return; + wake_up(&p_ch->wait); /* wake up claw_release */ + CLAW_DBF_TEXT(4, trace, "stop"); + return; + case CLAW_START_HALT_IO: /* HALT_IO issued by claw_open */ + if (!((p_ch->irb->scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS) || + (p_ch->irb->scsw.cmd.stctl == SCSW_STCTL_STATUS_PEND) || + (p_ch->irb->scsw.cmd.stctl == + (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND)))) { + CLAW_DBF_TEXT(4, trace, "haltio"); + return; + } + if (p_ch->flag == CLAW_READ) { + p_ch->claw_state = CLAW_START_READ; + wake_up(&p_ch->wait); /* wake claw_open (READ)*/ + } else if (p_ch->flag == CLAW_WRITE) { + p_ch->claw_state = CLAW_START_WRITE; + /* send SYSTEM_VALIDATE */ + claw_strt_read(dev, LOCK_NO); + claw_send_control(dev, + SYSTEM_VALIDATE_REQUEST, + 0, 0, 0, + p_env->host_name, + p_env->adapter_name); + } else { + printk(KERN_WARNING "claw: unsolicited " + "interrupt for device:" + "%s received c-%02x d-%02x\n", + cdev->dev.bus_id, + irb->scsw.cmd.cstat, + irb->scsw.cmd.dstat); + return; + } + CLAW_DBF_TEXT(4, trace, "haltio"); + return; + case CLAW_START_READ: + CLAW_DBF_TEXT(4, trace, "ReadIRQ"); + if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) { + clear_bit(0, (void *)&p_ch->IO_active); + if ((p_ch->irb->ecw[0] & 0x41) == 0x41 || + (p_ch->irb->ecw[0] & 0x40) == 0x40 || + (p_ch->irb->ecw[0]) == 0) { + privptr->stats.rx_errors++; + printk(KERN_INFO "%s: Restart is " + "required after remote " + "side recovers \n", + dev->name); + } + CLAW_DBF_TEXT(4, trace, "notrdy"); + return; + } + if ((p_ch->irb->scsw.cmd.cstat & SCHN_STAT_PCI) && + (p_ch->irb->scsw.cmd.dstat == 0)) { + if (test_and_set_bit(CLAW_BH_ACTIVE, + (void *)&p_ch->flag_a) == 0) + tasklet_schedule(&p_ch->tasklet); else - if (p_ch->flag == CLAW_WRITE) { - p_ch->claw_state = CLAW_START_WRITE; - /* send SYSTEM_VALIDATE */ - claw_strt_read(dev, LOCK_NO); - claw_send_control(dev, - SYSTEM_VALIDATE_REQUEST, - 0, 0, 0, - p_env->host_name, - p_env->adapter_name ); - } else { - printk(KERN_WARNING "claw: unsolicited " - "interrupt for device:" - "%s received c-%02x d-%02x\n", - cdev->dev.bus_id, - irb->scsw.cmd.cstat, - irb->scsw.cmd.dstat); - return; - } -#ifdef DEBUGMSG - printk(KERN_INFO "%s: process CLAW_STAT_HALT_IO exit\n", - dev->name); -#endif -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"haltio"); - return; - case CLAW_START_READ: - CLAW_DBF_TEXT(4,trace,"ReadIRQ"); - if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) { - clear_bit(0, (void *)&p_ch->IO_active); - if ((p_ch->irb->ecw[0] & 0x41) == 0x41 || - (p_ch->irb->ecw[0] & 0x40) == 0x40 || - (p_ch->irb->ecw[0]) == 0) - { - privptr->stats.rx_errors++; - printk(KERN_INFO "%s: Restart is " - "required after remote " - "side recovers \n", - dev->name); - } -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"notrdy"); - return; - } - if ((p_ch->irb->scsw.cmd.cstat & SCHN_STAT_PCI) && - (p_ch->irb->scsw.cmd.dstat == 0)) { - if (test_and_set_bit(CLAW_BH_ACTIVE, - (void *)&p_ch->flag_a) == 0) { - tasklet_schedule(&p_ch->tasklet); - } - else { - CLAW_DBF_TEXT(4,trace,"PCINoBH"); - } -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"PCI_read"); - return; - } - if (!((p_ch->irb->scsw.cmd.stctl & - SCSW_STCTL_SEC_STATUS) || - (p_ch->irb->scsw.cmd.stctl == - SCSW_STCTL_STATUS_PEND) || - (p_ch->irb->scsw.cmd.stctl == - (SCSW_STCTL_ALERT_STATUS | - SCSW_STCTL_STATUS_PEND)))) { -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"SPend_rd"); - return; - } - clear_bit(0, (void *)&p_ch->IO_active); - claw_clearbit_busy(TB_RETRY,dev); - if (test_and_set_bit(CLAW_BH_ACTIVE, - (void *)&p_ch->flag_a) == 0) { - tasklet_schedule(&p_ch->tasklet); - } - else { - CLAW_DBF_TEXT(4,trace,"RdBHAct"); - } - -#ifdef DEBUGMSG - printk(KERN_INFO "%s: process CLAW_START_READ exit\n", - dev->name); -#endif -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"RdIRQXit"); - return; - case CLAW_START_WRITE: - if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) { - printk(KERN_INFO "%s: Unit Check Occured in " - "write channel\n",dev->name); - clear_bit(0, (void *)&p_ch->IO_active); - if (p_ch->irb->ecw[0] & 0x80 ) { - printk(KERN_INFO "%s: Resetting Event " - "occurred:\n",dev->name); - init_timer(&p_ch->timer); - p_ch->timer.function = - (void *)claw_write_retry; - p_ch->timer.data = (unsigned long)p_ch; - p_ch->timer.expires = jiffies + 10*HZ; - add_timer(&p_ch->timer); - printk(KERN_INFO "%s: write connection " - "restarting\n",dev->name); - } -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"rstrtwrt"); - return; - } - if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_EXCEP) { - clear_bit(0, (void *)&p_ch->IO_active); - printk(KERN_INFO "%s: Unit Exception " - "Occured in write channel\n", - dev->name); - } - if (!((p_ch->irb->scsw.cmd.stctl & - SCSW_STCTL_SEC_STATUS) || - (p_ch->irb->scsw.cmd.stctl == - SCSW_STCTL_STATUS_PEND) || - (p_ch->irb->scsw.cmd.stctl == - (SCSW_STCTL_ALERT_STATUS | - SCSW_STCTL_STATUS_PEND)))) { -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"writeUE"); - return; - } - clear_bit(0, (void *)&p_ch->IO_active); - if (claw_test_and_setbit_busy(TB_TX,dev)==0) { - claw_write_next(p_ch); - claw_clearbit_busy(TB_TX,dev); - claw_clear_busy(dev); - } - p_ch_r=(struct chbk *)&privptr->channel[READ]; - if (test_and_set_bit(CLAW_BH_ACTIVE, - (void *)&p_ch_r->flag_a) == 0) { - tasklet_schedule(&p_ch_r->tasklet); - } - -#ifdef DEBUGMSG - printk(KERN_INFO "%s: process CLAW_START_WRITE exit\n", - dev->name); -#endif -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"StWtExit"); - return; - default: - printk(KERN_WARNING "%s: wrong selection code - irq " - "state=%d\n",dev->name,p_ch->claw_state); -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(2,trace,"badIRQ"); - return; + CLAW_DBF_TEXT(4, trace, "PCINoBH"); + CLAW_DBF_TEXT(4, trace, "PCI_read"); + return; + } + if (!((p_ch->irb->scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS) || + (p_ch->irb->scsw.cmd.stctl == SCSW_STCTL_STATUS_PEND) || + (p_ch->irb->scsw.cmd.stctl == + (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND)))) { + CLAW_DBF_TEXT(4, trace, "SPend_rd"); + return; + } + clear_bit(0, (void *)&p_ch->IO_active); + claw_clearbit_busy(TB_RETRY, dev); + if (test_and_set_bit(CLAW_BH_ACTIVE, + (void *)&p_ch->flag_a) == 0) + tasklet_schedule(&p_ch->tasklet); + else + CLAW_DBF_TEXT(4, trace, "RdBHAct"); + CLAW_DBF_TEXT(4, trace, "RdIRQXit"); + return; + case CLAW_START_WRITE: + if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) { + printk(KERN_INFO "%s: Unit Check Occured in " + "write channel\n", dev->name); + clear_bit(0, (void *)&p_ch->IO_active); + if (p_ch->irb->ecw[0] & 0x80) { + printk(KERN_INFO "%s: Resetting Event " + "occurred:\n", dev->name); + init_timer(&p_ch->timer); + p_ch->timer.function = + (void *)claw_write_retry; + p_ch->timer.data = (unsigned long)p_ch; + p_ch->timer.expires = jiffies + 10*HZ; + add_timer(&p_ch->timer); + printk(KERN_INFO "%s: write connection " + "restarting\n", dev->name); + } + CLAW_DBF_TEXT(4, trace, "rstrtwrt"); + return; + } + if (p_ch->irb->scsw.cmd.dstat & DEV_STAT_UNIT_EXCEP) { + clear_bit(0, (void *)&p_ch->IO_active); + printk(KERN_INFO "%s: Unit Exception " + "Occured in write channel\n", + dev->name); + } + if (!((p_ch->irb->scsw.cmd.stctl & SCSW_STCTL_SEC_STATUS) || + (p_ch->irb->scsw.cmd.stctl == SCSW_STCTL_STATUS_PEND) || + (p_ch->irb->scsw.cmd.stctl == + (SCSW_STCTL_ALERT_STATUS | SCSW_STCTL_STATUS_PEND)))) { + CLAW_DBF_TEXT(4, trace, "writeUE"); + return; + } + clear_bit(0, (void *)&p_ch->IO_active); + if (claw_test_and_setbit_busy(TB_TX, dev) == 0) { + claw_write_next(p_ch); + claw_clearbit_busy(TB_TX, dev); + claw_clear_busy(dev); + } + p_ch_r = (struct chbk *)&privptr->channel[READ]; + if (test_and_set_bit(CLAW_BH_ACTIVE, + (void *)&p_ch_r->flag_a) == 0) + tasklet_schedule(&p_ch_r->tasklet); + CLAW_DBF_TEXT(4, trace, "StWtExit"); + return; + default: + printk(KERN_WARNING "%s: wrong selection code - irq " + "state=%d\n", dev->name, p_ch->claw_state); + CLAW_DBF_TEXT(2, trace, "badIRQ"); + return; } } /* end of claw_irq_handler */ @@ -1013,29 +779,11 @@ claw_irq_tasklet ( unsigned long data ) p_ch = (struct chbk *) data; dev = (struct net_device *)p_ch->ndev; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter \n",dev->name,__func__); -#endif -#ifdef DEBUGMSG - printk(KERN_INFO "%s: variable p_ch =\n",dev->name); - dumpit((char *) p_ch, sizeof(struct chbk)); -#endif - CLAW_DBF_TEXT(4,trace,"IRQtask"); - - privptr = (struct claw_privbk *) dev->priv; - -#ifdef DEBUGMSG - printk(KERN_INFO "%s: bh routine - state-%02x\n" , - dev->name, p_ch->claw_state); -#endif - + CLAW_DBF_TEXT(4, trace, "IRQtask"); + privptr = (struct claw_privbk *)dev->ml_priv; unpack_read(dev); clear_bit(CLAW_BH_ACTIVE, (void *)&p_ch->flag_a); - CLAW_DBF_TEXT(4,trace,"TskletXt"); -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif + CLAW_DBF_TEXT(4, trace, "TskletXt"); return; } /* end of claw_irq_bh */ @@ -1057,19 +805,10 @@ claw_release(struct net_device *dev) if (!dev) return 0; - privptr = (struct claw_privbk *) dev->priv; + privptr = (struct claw_privbk *)dev->ml_priv; if (!privptr) return 0; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter \n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(4,trace,"release"); -#ifdef DEBUGMSG - printk(KERN_INFO "%s: variable dev =\n",dev->name); - dumpit((char *) dev, sizeof(struct net_device)); - printk(KERN_INFO "Priv Buffalloc %d\n",privptr->buffs_alloc); - printk(KERN_INFO "Priv p_buff_ccw = %p\n",&privptr->p_buff_ccw); -#endif + CLAW_DBF_TEXT(4, trace, "release"); privptr->release_pend=1; claw_setbit_busy(TB_STOP,dev); for ( i = 1; i >=0 ; i--) { @@ -1101,19 +840,15 @@ claw_release(struct net_device *dev) privptr->pk_skb = NULL; } if(privptr->buffs_alloc != 1) { -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"none2fre"); + CLAW_DBF_TEXT(4, trace, "none2fre"); return 0; } - CLAW_DBF_TEXT(4,trace,"freebufs"); + CLAW_DBF_TEXT(4, trace, "freebufs"); if (privptr->p_buff_ccw != NULL) { free_pages((unsigned long)privptr->p_buff_ccw, (int)pages_to_order_of_mag(privptr->p_buff_ccw_num)); } - CLAW_DBF_TEXT(4,trace,"freeread"); + CLAW_DBF_TEXT(4, trace, "freeread"); if (privptr->p_env->read_size < PAGE_SIZE) { if (privptr->p_buff_read != NULL) { free_pages((unsigned long)privptr->p_buff_read, @@ -1129,7 +864,7 @@ claw_release(struct net_device *dev) p_buf=p_buf->next; } } - CLAW_DBF_TEXT(4,trace,"freewrit"); + CLAW_DBF_TEXT(4, trace, "freewrit"); if (privptr->p_env->write_size < PAGE_SIZE ) { free_pages((unsigned long)privptr->p_buff_write, (int)pages_to_order_of_mag(privptr->p_buff_write_num)); @@ -1143,7 +878,7 @@ claw_release(struct net_device *dev) p_buf=p_buf->next; } } - CLAW_DBF_TEXT(4,trace,"clearptr"); + CLAW_DBF_TEXT(4, trace, "clearptr"); privptr->buffs_alloc = 0; privptr->p_buff_ccw=NULL; privptr->p_buff_read=NULL; @@ -1180,18 +915,12 @@ claw_release(struct net_device *dev) dev->name, privptr->channel[READ].last_dstat, privptr->channel[WRITE].last_dstat); - CLAW_DBF_TEXT(2,trace,"badclose"); + CLAW_DBF_TEXT(2, trace, "badclose"); } -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"rlsexit"); + CLAW_DBF_TEXT(4, trace, "rlsexit"); return 0; } /* end of claw_release */ - - /*-------------------------------------------------------------------* * claw_write_retry * * * @@ -1203,32 +932,12 @@ claw_write_retry ( struct chbk *p_ch ) struct net_device *dev=p_ch->ndev; - -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); - printk(KERN_INFO "claw: variable p_ch =\n"); - dumpit((char *) p_ch, sizeof(struct chbk)); -#endif - CLAW_DBF_TEXT(4,trace,"w_retry"); + CLAW_DBF_TEXT(4, trace, "w_retry"); if (p_ch->claw_state == CLAW_STOP) { -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif return; } -#ifdef DEBUGMSG - printk( KERN_INFO "%s:%s state-%02x\n" , - dev->name, - __func__, - p_ch->claw_state); -#endif claw_strt_out_IO( dev ); -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"rtry_xit"); + CLAW_DBF_TEXT(4, trace, "rtry_xit"); return; } /* end of claw_write_retry */ @@ -1247,16 +956,11 @@ claw_write_next ( struct chbk * p_ch ) struct sk_buff *pk_skb; int rc; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter \n",p_ch->ndev->name,__func__); - printk(KERN_INFO "%s: variable p_ch =\n",p_ch->ndev->name); - dumpit((char *) p_ch, sizeof(struct chbk)); -#endif - CLAW_DBF_TEXT(4,trace,"claw_wrt"); + CLAW_DBF_TEXT(4, trace, "claw_wrt"); if (p_ch->claw_state == CLAW_STOP) return; dev = (struct net_device *) p_ch->ndev; - privptr = (struct claw_privbk *) dev->priv; + privptr = (struct claw_privbk *) dev->ml_priv; claw_free_wrt_buf( dev ); if ((privptr->write_free_count > 0) && !skb_queue_empty(&p_ch->collect_queue)) { @@ -1272,11 +976,6 @@ claw_write_next ( struct chbk * p_ch ) if (privptr->p_write_active_first!=NULL) { claw_strt_out_IO(dev); } - -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif return; } /* end of claw_write_next */ @@ -1288,22 +987,12 @@ claw_write_next ( struct chbk * p_ch ) static void claw_timer ( struct chbk * p_ch ) { -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Entry\n",p_ch->ndev->name,__func__); - printk(KERN_INFO "%s: variable p_ch =\n",p_ch->ndev->name); - dumpit((char *) p_ch, sizeof(struct chbk)); -#endif - CLAW_DBF_TEXT(4,trace,"timer"); + CLAW_DBF_TEXT(4, trace, "timer"); p_ch->flag |= CLAW_TIMER; wake_up(&p_ch->wait); -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - p_ch->ndev->name,__func__,__LINE__); -#endif return; } /* end of claw_timer */ - /* * * functions @@ -1324,10 +1013,8 @@ pages_to_order_of_mag(int num_of_pages) { int order_of_mag=1; /* assume 2 pages */ int nump=2; -#ifdef FUNCTRACE - printk(KERN_INFO "%s Enter pages = %d \n",__func__,num_of_pages); -#endif - CLAW_DBF_TEXT_(5,trace,"pages%d",num_of_pages); + + CLAW_DBF_TEXT_(5, trace, "pages%d", num_of_pages); if (num_of_pages == 1) {return 0; } /* magnitude of 0 = 1 page */ /* 512 pages = 2Meg on 4k page systems */ if (num_of_pages >= 512) {return 9; } @@ -1338,11 +1025,7 @@ pages_to_order_of_mag(int num_of_pages) order_of_mag +=1; } if (order_of_mag > 9) { order_of_mag = 9; } /* I know it's paranoid */ -#ifdef FUNCTRACE - printk(KERN_INFO "%s Exit on line %d, order = %d\n", - __func__,__LINE__, order_of_mag); -#endif - CLAW_DBF_TEXT_(5,trace,"mag%d",order_of_mag); + CLAW_DBF_TEXT_(5, trace, "mag%d", order_of_mag); return order_of_mag; } @@ -1358,33 +1041,15 @@ add_claw_reads(struct net_device *dev, struct ccwbk* p_first, struct claw_privbk *privptr; struct ccw1 temp_ccw; struct endccw * p_end; -#ifdef IOTRACE - struct ccwbk* p_buf; -#endif -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter \n",dev->name,__func__); -#endif -#ifdef DEBUGMSG - printk(KERN_INFO "dev\n"); - dumpit((char *) dev, sizeof(struct net_device)); - printk(KERN_INFO "p_first\n"); - dumpit((char *) p_first, sizeof(struct ccwbk)); - printk(KERN_INFO "p_last\n"); - dumpit((char *) p_last, sizeof(struct ccwbk)); -#endif - CLAW_DBF_TEXT(4,trace,"addreads"); - privptr = dev->priv; + CLAW_DBF_TEXT(4, trace, "addreads"); + privptr = dev->ml_priv; p_end = privptr->p_end_ccw; /* first CCW and last CCW contains a new set of read channel programs * to apend the running channel programs */ if ( p_first==NULL) { -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"addexit"); + CLAW_DBF_TEXT(4, trace, "addexit"); return 0; } @@ -1411,21 +1076,11 @@ add_claw_reads(struct net_device *dev, struct ccwbk* p_first, } if ( privptr-> p_read_active_first ==NULL ) { -#ifdef DEBUGMSG - printk(KERN_INFO "%s:%s p_read_active_first == NULL \n", - dev->name,__func__); - printk(KERN_INFO "%s:%s Read active first/last changed \n", - dev->name,__func__); -#endif privptr-> p_read_active_first= p_first; /* set new first */ privptr-> p_read_active_last = p_last; /* set new last */ } else { -#ifdef DEBUGMSG - printk(KERN_INFO "%s:%s Read in progress \n", - dev->name,__func__); -#endif /* set up TIC ccw */ temp_ccw.cda= (__u32)__pa(&p_first->read); temp_ccw.count=0; @@ -1462,27 +1117,7 @@ add_claw_reads(struct net_device *dev, struct ccwbk* p_first, privptr->p_read_active_last->next = p_first; privptr->p_read_active_last=p_last; } /* end of if ( privptr-> p_read_active_first ==NULL) */ -#ifdef IOTRACE - printk(KERN_INFO "%s:%s dump p_last CCW BK \n",dev->name,__func__); - dumpit((char *)p_last, sizeof(struct ccwbk)); - printk(KERN_INFO "%s:%s dump p_end CCW BK \n",dev->name,__func__); - dumpit((char *)p_end, sizeof(struct endccw)); - - printk(KERN_INFO "%s:%s dump p_first CCW BK \n",dev->name,__func__); - dumpit((char *)p_first, sizeof(struct ccwbk)); - printk(KERN_INFO "%s:%s Dump Active CCW chain \n", - dev->name,__func__); - p_buf=privptr->p_read_active_first; - while (p_buf!=NULL) { - dumpit((char *)p_buf, sizeof(struct ccwbk)); - p_buf=p_buf->next; - } -#endif -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"addexit"); + CLAW_DBF_TEXT(4, trace, "addexit"); return 0; } /* end of add_claw_reads */ @@ -1494,44 +1129,29 @@ add_claw_reads(struct net_device *dev, struct ccwbk* p_first, static void ccw_check_return_code(struct ccw_device *cdev, int return_code) { -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() > enter \n", - cdev->dev.bus_id,__func__); -#endif - CLAW_DBF_TEXT(4,trace,"ccwret"); -#ifdef DEBUGMSG - printk(KERN_INFO "variable cdev =\n"); - dumpit((char *) cdev, sizeof(struct ccw_device)); - printk(KERN_INFO "variable return_code = %d\n",return_code); -#endif + CLAW_DBF_TEXT(4, trace, "ccwret"); if (return_code != 0) { switch (return_code) { - case -EBUSY: - printk(KERN_INFO "%s: Busy !\n", - cdev->dev.bus_id); - break; - case -ENODEV: - printk(KERN_EMERG "%s: Missing device called " - "for IO ENODEV\n", cdev->dev.bus_id); - break; - case -EIO: - printk(KERN_EMERG "%s: Status pending... EIO \n", - cdev->dev.bus_id); - break; - case -EINVAL: - printk(KERN_EMERG "%s: Invalid Dev State EINVAL \n", - cdev->dev.bus_id); - break; - default: - printk(KERN_EMERG "%s: Unknown error in " + case -EBUSY: /* BUSY is a transient state no action needed */ + break; + case -ENODEV: + printk(KERN_EMERG "%s: Missing device called " + "for IO ENODEV\n", cdev->dev.bus_id); + break; + case -EIO: + printk(KERN_EMERG "%s: Status pending... EIO \n", + cdev->dev.bus_id); + break; + case -EINVAL: + printk(KERN_EMERG "%s: Invalid Dev State EINVAL \n", + cdev->dev.bus_id); + break; + default: + printk(KERN_EMERG "%s: Unknown error in " "Do_IO %d\n",cdev->dev.bus_id, return_code); - } - } -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() > exit on line %d\n", - cdev->dev.bus_id,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"ccwret"); + } + } + CLAW_DBF_TEXT(4, trace, "ccwret"); } /* end of ccw_check_return_code */ /*-------------------------------------------------------------------* @@ -1541,173 +1161,46 @@ ccw_check_return_code(struct ccw_device *cdev, int return_code) static void ccw_check_unit_check(struct chbk * p_ch, unsigned char sense ) { - struct net_device *dev = p_ch->ndev; - -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() > enter\n",dev->name,__func__); -#endif -#ifdef DEBUGMSG - printk(KERN_INFO "%s: variable dev =\n",dev->name); - dumpit((char *)dev, sizeof(struct net_device)); - printk(KERN_INFO "%s: variable sense =\n",dev->name); - dumpit((char *)&sense, 2); -#endif - CLAW_DBF_TEXT(4,trace,"unitchek"); + struct net_device *ndev = p_ch->ndev; + CLAW_DBF_TEXT(4, trace, "unitchek"); printk(KERN_INFO "%s: Unit Check with sense byte:0x%04x\n", - dev->name, sense); + ndev->name, sense); if (sense & 0x40) { if (sense & 0x01) { printk(KERN_WARNING "%s: Interface disconnect or " "Selective reset " - "occurred (remote side)\n", dev->name); + "occurred (remote side)\n", ndev->name); } else { printk(KERN_WARNING "%s: System reset occured" - " (remote side)\n", dev->name); + " (remote side)\n", ndev->name); } } else if (sense & 0x20) { if (sense & 0x04) { printk(KERN_WARNING "%s: Data-streaming " - "timeout)\n", dev->name); + "timeout)\n", ndev->name); } else { printk(KERN_WARNING "%s: Data-transfer parity" - " error\n", dev->name); + " error\n", ndev->name); } } else if (sense & 0x10) { if (sense & 0x20) { printk(KERN_WARNING "%s: Hardware malfunction " - "(remote side)\n", dev->name); + "(remote side)\n", ndev->name); } else { printk(KERN_WARNING "%s: read-data parity error " - "(remote side)\n", dev->name); + "(remote side)\n", ndev->name); } } -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() exit on line %d\n", - dev->name,__func__,__LINE__); -#endif } /* end of ccw_check_unit_check */ - - -/*-------------------------------------------------------------------* -* Dump buffer format * -* * -*--------------------------------------------------------------------*/ -#ifdef DEBUG -static void -dumpit(char* buf, int len) -{ - - __u32 ct, sw, rm, dup; - char *ptr, *rptr; - char tbuf[82], tdup[82]; -#if (CONFIG_64BIT) - char addr[22]; -#else - char addr[12]; -#endif - char boff[12]; - char bhex[82], duphex[82]; - char basc[40]; - - sw = 0; - rptr =ptr=buf; - rm = 16; - duphex[0] = 0x00; - dup = 0; - for ( ct=0; ct < len; ct++, ptr++, rptr++ ) { - if (sw == 0) { -#if (CONFIG_64BIT) - sprintf(addr, "%16.16lX",(unsigned long)rptr); -#else - sprintf(addr, "%8.8X",(__u32)rptr); -#endif - sprintf(boff, "%4.4X", (__u32)ct); - bhex[0] = '\0'; - basc[0] = '\0'; - } - if ((sw == 4) || (sw == 12)) { - strcat(bhex, " "); - } - if (sw == 8) { - strcat(bhex, " "); - } -#if (CONFIG_64BIT) - sprintf(tbuf,"%2.2lX", (unsigned long)*ptr); -#else - sprintf(tbuf,"%2.2X", (__u32)*ptr); -#endif - tbuf[2] = '\0'; - strcat(bhex, tbuf); - if ((0!=isprint(*ptr)) && (*ptr >= 0x20)) { - basc[sw] = *ptr; - } - else { - basc[sw] = '.'; - } - basc[sw+1] = '\0'; - sw++; - rm--; - if (sw==16) { - if ((strcmp(duphex, bhex)) !=0) { - if (dup !=0) { - sprintf(tdup,"Duplicate as above to" - " %s", addr); - printk( KERN_INFO " " - " --- %s ---\n",tdup); - } - printk( KERN_INFO " %s (+%s) : %s [%s]\n", - addr, boff, bhex, basc); - dup = 0; - strcpy(duphex, bhex); - } - else { - dup++; - } - sw = 0; - rm = 16; - } - } /* endfor */ - - if (sw != 0) { - for ( ; rm > 0; rm--, sw++ ) { - if ((sw==4) || (sw==12)) strcat(bhex, " "); - if (sw==8) strcat(bhex, " "); - strcat(bhex, " "); - strcat(basc, " "); - } - if (dup !=0) { - sprintf(tdup,"Duplicate as above to %s", addr); - printk( KERN_INFO " --- %s ---\n", - tdup); - } - printk( KERN_INFO " %s (+%s) : %s [%s]\n", - addr, boff, bhex, basc); - } - else { - if (dup >=1) { - sprintf(tdup,"Duplicate as above to %s", addr); - printk( KERN_INFO " --- %s ---\n", - tdup); - } - if (dup !=0) { - printk( KERN_INFO " %s (+%s) : %s [%s]\n", - addr, boff, bhex, basc); - } - } - return; - -} /* end of dumpit */ -#endif - /*-------------------------------------------------------------------* * find_link * *--------------------------------------------------------------------*/ @@ -1718,17 +1211,8 @@ find_link(struct net_device *dev, char *host_name, char *ws_name ) struct claw_env *p_env; int rc=0; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s > enter \n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(2,setup,"findlink"); -#ifdef DEBUGMSG - printk(KERN_INFO "%s: variable dev = \n",dev->name); - dumpit((char *) dev, sizeof(struct net_device)); - printk(KERN_INFO "%s: variable host_name = %s\n",dev->name, host_name); - printk(KERN_INFO "%s: variable ws_name = %s\n",dev->name, ws_name); -#endif - privptr=dev->priv; + CLAW_DBF_TEXT(2, setup, "findlink"); + privptr = dev->ml_priv; p_env=privptr->p_env; switch (p_env->packing) { @@ -1750,10 +1234,6 @@ find_link(struct net_device *dev, char *host_name, char *ws_name ) break; } -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif return 0; } /* end of find_link */ @@ -1782,27 +1262,11 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) int lock; struct clawph *pk_head; struct chbk *ch; -#ifdef IOTRACE - struct ccwbk *p_buf; -#endif -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() > enter\n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(4,trace,"hw_tx"); -#ifdef DEBUGMSG - printk(KERN_INFO "%s: variable dev skb =\n",dev->name); - dumpit((char *) skb, sizeof(struct sk_buff)); - printk(KERN_INFO "%s: variable dev =\n",dev->name); - dumpit((char *) dev, sizeof(struct net_device)); - printk(KERN_INFO "%s: variable linkid = %ld\n",dev->name,linkid); -#endif - privptr = (struct claw_privbk *) (dev->priv); + + CLAW_DBF_TEXT(4, trace, "hw_tx"); + privptr = (struct claw_privbk *)(dev->ml_priv); p_ch=(struct chbk *)&privptr->channel[WRITE]; p_env =privptr->p_env; -#ifdef IOTRACE - printk(KERN_INFO "%s: %s() dump sk_buff \n",dev->name,__func__); - dumpit((char *)skb ,sizeof(struct sk_buff)); -#endif claw_free_wrt_buf(dev); /* Clean up free chain if posible */ /* scan the write queue to free any completed write packets */ p_first_ccw=NULL; @@ -1834,11 +1298,6 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) claw_strt_out_IO(dev ); claw_free_wrt_buf( dev ); if (privptr->write_free_count==0) { -#ifdef IOTRACE - printk(KERN_INFO "%s: " - "(claw_check_busy) no free write " - "buffers\n", dev->name); -#endif ch = &privptr->channel[WRITE]; atomic_inc(&skb->users); skb_queue_tail(&ch->collect_queue, skb); @@ -1851,10 +1310,6 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) } /* tx lock */ if (claw_test_and_setbit_busy(TB_TX,dev)) { /* set to busy */ -#ifdef DEBUGMSG - printk(KERN_INFO "%s: busy (claw_test_and_setbit_" - "busy)\n", dev->name); -#endif ch = &privptr->channel[WRITE]; atomic_inc(&skb->users); skb_queue_tail(&ch->collect_queue, skb); @@ -1871,28 +1326,16 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) privptr->p_write_free_chain == NULL ) { claw_setbit_busy(TB_NOBUFFER,dev); - -#ifdef DEBUGMSG - printk(KERN_INFO "%s: busy (claw_setbit_busy" - "(TB_NOBUFFER))\n", dev->name); - printk(KERN_INFO " free_count: %d, numBuffers : %d\n", - (int)privptr->write_free_count,(int) numBuffers ); -#endif ch = &privptr->channel[WRITE]; atomic_inc(&skb->users); skb_queue_tail(&ch->collect_queue, skb); - CLAW_DBF_TEXT(2,trace,"clawbusy"); + CLAW_DBF_TEXT(2, trace, "clawbusy"); goto Done2; } pDataAddress=skb->data; len_of_data=skb->len; while (len_of_data > 0) { -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() length-of-data is %ld \n", - dev->name ,__func__,len_of_data); - dumpit((char *)pDataAddress ,64); -#endif p_this_ccw=privptr->p_write_free_chain; /* get a block */ if (p_this_ccw == NULL) { /* lost the race */ ch = &privptr->channel[WRITE]; @@ -1924,12 +1367,6 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) (__u32)__pa(&p_this_ccw->write); } p_last_ccw=p_this_ccw; /* save new last block */ -#ifdef IOTRACE - printk(KERN_INFO "%s: %s() > CCW and Buffer %ld bytes long \n", - dev->name,__func__,bytesInThisBuffer); - dumpit((char *)p_this_ccw, sizeof(struct ccwbk)); - dumpit((char *)p_this_ccw->p_buffer, 64); -#endif } /* FirstCCW and LastCCW now contain a new set of write channel @@ -1962,13 +1399,11 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) pEnd->write1_nop2.count=1; } /* end if if (pEnd->write1) */ - if (privptr->p_write_active_first==NULL ) { privptr->p_write_active_first=p_first_ccw; privptr->p_write_active_last=p_last_ccw; } else { - /* set up Tic CCWs */ tempCCW.cda=(__u32)__pa(&p_first_ccw->write); @@ -2007,19 +1442,6 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) } } /* endif (p_first_ccw!=NULL) */ - - -#ifdef IOTRACE - printk(KERN_INFO "%s: %s() > Dump Active CCW chain \n", - dev->name,__func__); - p_buf=privptr->p_write_active_first; - while (p_buf!=NULL) { - dumpit((char *)p_buf, sizeof(struct ccwbk)); - p_buf=p_buf->next; - } - p_buf=(struct ccwbk*)privptr->p_end_ccw; - dumpit((char *)p_buf, sizeof(struct endccw)); -#endif dev_kfree_skb_any(skb); if (linkid==0) { lock=LOCK_NO; @@ -2029,21 +1451,12 @@ claw_hw_tx(struct sk_buff *skb, struct net_device *dev, long linkid) } claw_strt_out_IO(dev ); /* if write free count is zero , set NOBUFFER */ -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() > free_count is %d\n", - dev->name,__func__, - (int) privptr->write_free_count ); -#endif if (privptr->write_free_count==0) { claw_setbit_busy(TB_NOBUFFER,dev); } Done2: claw_clearbit_busy(TB_TX,dev); Done: -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() > exit on line %d, rc = %d \n", - dev->name,__func__,__LINE__, rc); -#endif return(rc); } /* end of claw_hw_tx */ @@ -2070,19 +1483,12 @@ init_ccw_bk(struct net_device *dev) struct ccwbk*p_last_CCWB; struct ccwbk*p_first_CCWB; struct endccw *p_endccw=NULL; - addr_t real_address; - struct claw_privbk *privptr=dev->priv; + addr_t real_address; + struct claw_privbk *privptr = dev->ml_priv; struct clawh *pClawH=NULL; addr_t real_TIC_address; int i,j; -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() enter \n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(4,trace,"init_ccw"); -#ifdef DEBUGMSG - printk(KERN_INFO "%s: variable dev =\n",dev->name); - dumpit((char *) dev, sizeof(struct net_device)); -#endif + CLAW_DBF_TEXT(4, trace, "init_ccw"); /* initialize statistics field */ privptr->active_link_ID=0; @@ -2107,20 +1513,6 @@ init_ccw_bk(struct net_device *dev) */ ccw_blocks_required = privptr->p_env->read_buffers+privptr->p_env->write_buffers+1; -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() " - "ccw_blocks_required=%d\n", - dev->name,__func__, - ccw_blocks_required); - printk(KERN_INFO "%s: %s() " - "PAGE_SIZE=0x%x\n", - dev->name,__func__, - (unsigned int)PAGE_SIZE); - printk(KERN_INFO "%s: %s() > " - "PAGE_MASK=0x%x\n", - dev->name,__func__, - (unsigned int)PAGE_MASK); -#endif /* * compute number of CCW blocks that will fit in a page */ @@ -2128,14 +1520,6 @@ init_ccw_bk(struct net_device *dev) ccw_pages_required= DIV_ROUND_UP(ccw_blocks_required, ccw_blocks_perpage); -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() > ccw_blocks_perpage=%d\n", - dev->name,__func__, - ccw_blocks_perpage); - printk(KERN_INFO "%s: %s() > ccw_pages_required=%d\n", - dev->name,__func__, - ccw_pages_required); -#endif /* * read and write sizes are set by 2 constants in claw.h * 4k and 32k. Unpacked values other than 4k are not going to @@ -2166,36 +1550,6 @@ init_ccw_bk(struct net_device *dev) claw_write_pages = privptr->p_env->write_buffers * privptr->p_buff_pages_perwrite; } -#ifdef DEBUGMSG - if (privptr->p_env->read_size < PAGE_SIZE) { - printk(KERN_INFO "%s: %s() reads_perpage=%d\n", - dev->name,__func__, - claw_reads_perpage); - } - else { - printk(KERN_INFO "%s: %s() pages_perread=%d\n", - dev->name,__func__, - privptr->p_buff_pages_perread); - } - printk(KERN_INFO "%s: %s() read_pages=%d\n", - dev->name,__func__, - claw_read_pages); - if (privptr->p_env->write_size < PAGE_SIZE) { - printk(KERN_INFO "%s: %s() writes_perpage=%d\n", - dev->name,__func__, - claw_writes_perpage); - } - else { - printk(KERN_INFO "%s: %s() pages_perwrite=%d\n", - dev->name,__func__, - privptr->p_buff_pages_perwrite); - } - printk(KERN_INFO "%s: %s() write_pages=%d\n", - dev->name,__func__, - claw_write_pages); -#endif - - /* * allocate ccw_pages_required */ @@ -2204,17 +1558,6 @@ init_ccw_bk(struct net_device *dev) (void *)__get_free_pages(__GFP_DMA, (int)pages_to_order_of_mag(ccw_pages_required )); if (privptr->p_buff_ccw==NULL) { - printk(KERN_INFO "%s: %s() " - "__get_free_pages for CCWs failed : " - "pages is %d\n", - dev->name,__func__, - ccw_pages_required ); -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() > " - "exit on line %d, rc = ENOMEM\n", - dev->name,__func__, - __LINE__); -#endif return -ENOMEM; } privptr->p_buff_ccw_num=ccw_pages_required; @@ -2229,11 +1572,6 @@ init_ccw_bk(struct net_device *dev) privptr->p_end_ccw = (struct endccw *)&privptr->end_ccw; real_address = (__u32)__pa(privptr->p_end_ccw); /* Initialize ending CCW block */ -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() begin initialize ending CCW blocks\n", - dev->name,__func__); -#endif - p_endccw=privptr->p_end_ccw; p_endccw->real=real_address; p_endccw->write1=0x00; @@ -2287,21 +1625,10 @@ init_ccw_bk(struct net_device *dev) p_endccw->read2_nop2.count = 1; p_endccw->read2_nop2.cda = 0; -#ifdef IOTRACE - printk(KERN_INFO "%s: %s() dump claw ending CCW BK \n", - dev->name,__func__); - dumpit((char *)p_endccw, sizeof(struct endccw)); -#endif - /* * Build a chain of CCWs * */ - -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() Begin build a chain of CCW buffer \n", - dev->name,__func__); -#endif p_buff=privptr->p_buff_ccw; p_free_chain=NULL; @@ -2316,26 +1643,10 @@ init_ccw_bk(struct net_device *dev) } p_buff+=PAGE_SIZE; } -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() " - "End build a chain of CCW buffer \n", - dev->name,__func__); - p_buf=p_free_chain; - while (p_buf!=NULL) { - dumpit((char *)p_buf, sizeof(struct ccwbk)); - p_buf=p_buf->next; - } -#endif - /* * Initialize ClawSignalBlock * */ -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() " - "Begin initialize ClawSignalBlock \n", - dev->name,__func__); -#endif if (privptr->p_claw_signal_blk==NULL) { privptr->p_claw_signal_blk=p_free_chain; p_free_chain=p_free_chain->next; @@ -2344,12 +1655,6 @@ init_ccw_bk(struct net_device *dev) pClawH->opcode=0xff; pClawH->flag=CLAW_BUSY; } -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() > End initialize " - "ClawSignalBlock\n", - dev->name,__func__); - dumpit((char *)privptr->p_claw_signal_blk, sizeof(struct ccwbk)); -#endif /* * allocate write_pages_required and add to free chain @@ -2360,17 +1665,7 @@ init_ccw_bk(struct net_device *dev) (void *)__get_free_pages(__GFP_DMA, (int)pages_to_order_of_mag(claw_write_pages )); if (privptr->p_buff_write==NULL) { - printk(KERN_INFO "%s: %s() __get_free_pages for write" - " bufs failed : get is for %d pages\n", - dev->name,__func__,claw_write_pages ); - free_pages((unsigned long)privptr->p_buff_ccw, - (int)pages_to_order_of_mag(privptr->p_buff_ccw_num)); privptr->p_buff_ccw=NULL; -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() > exit on line %d," - "rc = ENOMEM\n", - dev->name,__func__,__LINE__); -#endif return -ENOMEM; } /* @@ -2380,10 +1675,6 @@ init_ccw_bk(struct net_device *dev) memset(privptr->p_buff_write, 0x00, ccw_pages_required * PAGE_SIZE); -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() Begin build claw write free " - "chain \n",dev->name,__func__); -#endif privptr->p_write_free_chain=NULL; p_buff=privptr->p_buff_write; @@ -2419,18 +1710,7 @@ init_ccw_bk(struct net_device *dev) p_buff=(void *)__get_free_pages(__GFP_DMA, (int)pages_to_order_of_mag( privptr->p_buff_pages_perwrite) ); -#ifdef IOTRACE - printk(KERN_INFO "%s:%s __get_free_pages " - "for writes buf: get for %d pages\n", - dev->name,__func__, - privptr->p_buff_pages_perwrite); -#endif if (p_buff==NULL) { - printk(KERN_INFO "%s:%s __get_free_pages " - "for writes buf failed : get is for %d pages\n", - dev->name, - __func__, - privptr->p_buff_pages_perwrite ); free_pages((unsigned long)privptr->p_buff_ccw, (int)pages_to_order_of_mag( privptr->p_buff_ccw_num)); @@ -2443,12 +1723,6 @@ init_ccw_bk(struct net_device *dev) privptr->p_buff_pages_perwrite)); p_buf=p_buf->next; } -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s exit on line %d, rc = ENOMEM\n", - dev->name, - __func__, - __LINE__); -#endif return -ENOMEM; } /* Error on get_pages */ memset(p_buff, 0x00, privptr->p_env->write_size ); @@ -2477,15 +1751,6 @@ init_ccw_bk(struct net_device *dev) privptr->write_free_count=privptr->p_env->write_buffers; -#ifdef DEBUGMSG - printk(KERN_INFO "%s:%s End build claw write free chain \n", - dev->name,__func__); - p_buf=privptr->p_write_free_chain; - while (p_buf!=NULL) { - dumpit((char *)p_buf, sizeof(struct ccwbk)); - p_buf=p_buf->next; - } -#endif /* * allocate read_pages_required and chain to free chain */ @@ -2495,10 +1760,6 @@ init_ccw_bk(struct net_device *dev) (void *)__get_free_pages(__GFP_DMA, (int)pages_to_order_of_mag(claw_read_pages) ); if (privptr->p_buff_read==NULL) { - printk(KERN_INFO "%s: %s() " - "__get_free_pages for read buf failed : " - "get is for %d pages\n", - dev->name,__func__,claw_read_pages ); free_pages((unsigned long)privptr->p_buff_ccw, (int)pages_to_order_of_mag( privptr->p_buff_ccw_num)); @@ -2508,10 +1769,6 @@ init_ccw_bk(struct net_device *dev) privptr->p_buff_write_num)); privptr->p_buff_ccw=NULL; privptr->p_buff_write=NULL; -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() > exit on line %d, rc =" - " ENOMEM\n",dev->name,__func__,__LINE__); -#endif return -ENOMEM; } memset(privptr->p_buff_read, 0x00, claw_read_pages * PAGE_SIZE); @@ -2520,10 +1777,6 @@ init_ccw_bk(struct net_device *dev) * Build CLAW read free chain * */ -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() Begin build claw read free chain \n", - dev->name,__func__); -#endif p_buff=privptr->p_buff_read; for (i=0 ; i< privptr->p_env->read_buffers ; i++) { p_buf = p_free_chain; @@ -2600,19 +1853,10 @@ init_ccw_bk(struct net_device *dev) } /* for read_buffers */ } /* read_size < PAGE_SIZE */ else { /* read Size >= PAGE_SIZE */ - -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() Begin build claw read free chain \n", - dev->name,__func__); -#endif for (i=0 ; i< privptr->p_env->read_buffers ; i++) { p_buff = (void *)__get_free_pages(__GFP_DMA, (int)pages_to_order_of_mag(privptr->p_buff_pages_perread) ); if (p_buff==NULL) { - printk(KERN_INFO "%s: %s() __get_free_pages for read " - "buf failed : get is for %d pages\n", - dev->name,__func__, - privptr->p_buff_pages_perread ); free_pages((unsigned long)privptr->p_buff_ccw, (int)pages_to_order_of_mag(privptr->p_buff_ccw_num)); /* free the write pages */ @@ -2633,11 +1877,6 @@ init_ccw_bk(struct net_device *dev) } privptr->p_buff_ccw=NULL; privptr->p_buff_write=NULL; -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() exit on line %d, rc = ENOMEM\n", - dev->name,__func__, - __LINE__); -#endif return -ENOMEM; } memset(p_buff, 0x00, privptr->p_env->read_size); @@ -2706,22 +1945,9 @@ init_ccw_bk(struct net_device *dev) } /* For read_buffers */ } /* read_size >= PAGE_SIZE */ } /* pBuffread = NULL */ -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() > End build claw read free chain \n", - dev->name,__func__); - p_buf=p_first_CCWB; - while (p_buf!=NULL) { - dumpit((char *)p_buf, sizeof(struct ccwbk)); - p_buf=p_buf->next; - } - -#endif add_claw_reads( dev ,p_first_CCWB , p_last_CCWB); privptr->buffs_alloc = 1; -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() exit on line %d\n", - dev->name,__func__,__LINE__); -#endif + return 0; } /* end of init_ccw_bk */ @@ -2734,34 +1960,18 @@ init_ccw_bk(struct net_device *dev) static void probe_error( struct ccwgroup_device *cgdev) { - struct claw_privbk *privptr; -#ifdef FUNCTRACE - printk(KERN_INFO "%s enter \n",__func__); -#endif - CLAW_DBF_TEXT(4,trace,"proberr"); -#ifdef DEBUGMSG - printk(KERN_INFO "%s variable cgdev =\n",__func__); - dumpit((char *) cgdev, sizeof(struct ccwgroup_device)); -#endif - privptr=(struct claw_privbk *)cgdev->dev.driver_data; - if (privptr!=NULL) { - kfree(privptr->p_env); - privptr->p_env=NULL; - kfree(privptr->p_mtc_envelope); - privptr->p_mtc_envelope=NULL; - kfree(privptr); - privptr=NULL; - } -#ifdef FUNCTRACE - printk(KERN_INFO "%s > exit on line %d\n", - __func__,__LINE__); -#endif + struct claw_privbk *privptr; - return; + CLAW_DBF_TEXT(4, trace, "proberr"); + privptr = (struct claw_privbk *) cgdev->dev.driver_data; + if (privptr != NULL) { + cgdev->dev.driver_data = NULL; + kfree(privptr->p_env); + kfree(privptr->p_mtc_envelope); + kfree(privptr); + } } /* probe_error */ - - /*-------------------------------------------------------------------* * claw_process_control * * * @@ -2783,32 +1993,19 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw) struct conncmd *p_connect=NULL; int rc; struct chbk *p_ch = NULL; -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() > enter \n", - dev->name,__func__); -#endif - CLAW_DBF_TEXT(2,setup,"clw_cntl"); -#ifdef DEBUGMSG - printk(KERN_INFO "%s: variable dev =\n",dev->name); - dumpit((char *) dev, sizeof(struct net_device)); - printk(KERN_INFO "%s: variable p_ccw =\n",dev->name); - dumpit((char *) p_ccw, sizeof(struct ccwbk *)); -#endif + struct device *tdev; + CLAW_DBF_TEXT(2, setup, "clw_cntl"); udelay(1000); /* Wait a ms for the control packets to *catch up to each other */ - privptr=dev->priv; + privptr = dev->ml_priv; p_env=privptr->p_env; + tdev = &privptr->channel[READ].cdev->dev; memcpy( &temp_host_name, p_env->host_name, 8); memcpy( &temp_ws_name, p_env->adapter_name , 8); printk(KERN_INFO "%s: CLAW device %.8s: " "Received Control Packet\n", dev->name, temp_ws_name); if (privptr->release_pend==1) { -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() > " - "exit on line %d, rc=0\n", - dev->name,__func__,__LINE__); -#endif return 0; } p_buf=p_ccw->p_buffer; @@ -2818,261 +2015,246 @@ claw_process_control( struct net_device *dev, struct ccwbk * p_ccw) } else { memcpy(p_ctlbk, p_buf, sizeof(struct clawctl)); } -#ifdef IOTRACE - printk(KERN_INFO "%s: dump claw control data inbound\n",dev->name); - dumpit((char *)p_ctlbk, sizeof(struct clawctl)); -#endif switch (p_ctlbk->command) { - case SYSTEM_VALIDATE_REQUEST: - if (p_ctlbk->version!=CLAW_VERSION_ID) { - claw_snd_sys_validate_rsp(dev, p_ctlbk, - CLAW_RC_WRONG_VERSION ); - printk("%s: %d is wrong version id. " - "Expected %d\n", - dev->name, p_ctlbk->version, - CLAW_VERSION_ID); - } - p_sysval=(struct sysval *)&(p_ctlbk->data); - printk( "%s: Recv Sys Validate Request: " - "Vers=%d,link_id=%d,Corr=%d,WS name=%." - "8s,Host name=%.8s\n", - dev->name, p_ctlbk->version, - p_ctlbk->linkid, - p_ctlbk->correlator, - p_sysval->WS_name, - p_sysval->host_name); - if (0!=memcmp(temp_host_name,p_sysval->host_name,8)) { - claw_snd_sys_validate_rsp(dev, p_ctlbk, - CLAW_RC_NAME_MISMATCH ); - CLAW_DBF_TEXT(2,setup,"HSTBAD"); - CLAW_DBF_TEXT_(2,setup,"%s",p_sysval->host_name); - CLAW_DBF_TEXT_(2,setup,"%s",temp_host_name); - printk(KERN_INFO "%s: Host name mismatch\n", - dev->name); - printk(KERN_INFO "%s: Received :%s: " - "expected :%s: \n", - dev->name, - p_sysval->host_name, - temp_host_name); - } - if (0!=memcmp(temp_ws_name,p_sysval->WS_name,8)) { - claw_snd_sys_validate_rsp(dev, p_ctlbk, - CLAW_RC_NAME_MISMATCH ); - CLAW_DBF_TEXT(2,setup,"WSNBAD"); - CLAW_DBF_TEXT_(2,setup,"%s",p_sysval->WS_name); - CLAW_DBF_TEXT_(2,setup,"%s",temp_ws_name); - printk(KERN_INFO "%s: WS name mismatch\n", - dev->name); - printk(KERN_INFO "%s: Received :%s: " - "expected :%s: \n", - dev->name, - p_sysval->WS_name, - temp_ws_name); - } - if (( p_sysval->write_frame_size < p_env->write_size) && - ( p_env->packing == 0)) { - claw_snd_sys_validate_rsp(dev, p_ctlbk, - CLAW_RC_HOST_RCV_TOO_SMALL ); - printk(KERN_INFO "%s: host write size is too " - "small\n", dev->name); - CLAW_DBF_TEXT(2,setup,"wrtszbad"); - } - if (( p_sysval->read_frame_size < p_env->read_size) && - ( p_env->packing == 0)) { - claw_snd_sys_validate_rsp(dev, p_ctlbk, - CLAW_RC_HOST_RCV_TOO_SMALL ); - printk(KERN_INFO "%s: host read size is too " - "small\n", dev->name); - CLAW_DBF_TEXT(2,setup,"rdsizbad"); - } - claw_snd_sys_validate_rsp(dev, p_ctlbk, 0 ); - printk("%s: CLAW device %.8s: System validate" - " completed.\n",dev->name, temp_ws_name); - printk("%s: sys Validate Rsize:%d Wsize:%d\n",dev->name, - p_sysval->read_frame_size,p_sysval->write_frame_size); - privptr->system_validate_comp=1; - if(strncmp(p_env->api_type,WS_APPL_NAME_PACKED,6) == 0) { - p_env->packing = PACKING_ASK; - } - claw_strt_conn_req(dev); - break; - - case SYSTEM_VALIDATE_RESPONSE: - p_sysval=(struct sysval *)&(p_ctlbk->data); - printk("%s: Recv Sys Validate Resp: Vers=%d,Corr=%d,RC=%d," - "WS name=%.8s,Host name=%.8s\n", - dev->name, - p_ctlbk->version, - p_ctlbk->correlator, - p_ctlbk->rc, - p_sysval->WS_name, - p_sysval->host_name); - switch (p_ctlbk->rc) - { - case 0: - printk(KERN_INFO "%s: CLAW device " - "%.8s: System validate " - "completed.\n", - dev->name, temp_ws_name); - if (privptr->system_validate_comp == 0) - claw_strt_conn_req(dev); - privptr->system_validate_comp=1; - break; - case CLAW_RC_NAME_MISMATCH: - printk(KERN_INFO "%s: Sys Validate " - "Resp : Host, WS name is " - "mismatch\n", - dev->name); - break; - case CLAW_RC_WRONG_VERSION: - printk(KERN_INFO "%s: Sys Validate " - "Resp : Wrong version\n", - dev->name); - break; - case CLAW_RC_HOST_RCV_TOO_SMALL: - printk(KERN_INFO "%s: Sys Validate " - "Resp : bad frame size\n", - dev->name); - break; - default: - printk(KERN_INFO "%s: Sys Validate " - "error code=%d \n", - dev->name, p_ctlbk->rc ); - break; - } - break; + case SYSTEM_VALIDATE_REQUEST: + if (p_ctlbk->version != CLAW_VERSION_ID) { + claw_snd_sys_validate_rsp(dev, p_ctlbk, + CLAW_RC_WRONG_VERSION); + printk("%s: %d is wrong version id. " + "Expected %d\n", + dev->name, p_ctlbk->version, + CLAW_VERSION_ID); + } + p_sysval = (struct sysval *)&(p_ctlbk->data); + printk("%s: Recv Sys Validate Request: " + "Vers=%d,link_id=%d,Corr=%d,WS name=%." + "8s,Host name=%.8s\n", + dev->name, p_ctlbk->version, + p_ctlbk->linkid, + p_ctlbk->correlator, + p_sysval->WS_name, + p_sysval->host_name); + if (memcmp(temp_host_name, p_sysval->host_name, 8)) { + claw_snd_sys_validate_rsp(dev, p_ctlbk, + CLAW_RC_NAME_MISMATCH); + CLAW_DBF_TEXT(2, setup, "HSTBAD"); + CLAW_DBF_TEXT_(2, setup, "%s", p_sysval->host_name); + CLAW_DBF_TEXT_(2, setup, "%s", temp_host_name); + printk(KERN_INFO "%s: Host name mismatch\n", + dev->name); + printk(KERN_INFO "%s: Received :%s: " + "expected :%s: \n", + dev->name, + p_sysval->host_name, + temp_host_name); + } + if (memcmp(temp_ws_name, p_sysval->WS_name, 8)) { + claw_snd_sys_validate_rsp(dev, p_ctlbk, + CLAW_RC_NAME_MISMATCH); + CLAW_DBF_TEXT(2, setup, "WSNBAD"); + CLAW_DBF_TEXT_(2, setup, "%s", p_sysval->WS_name); + CLAW_DBF_TEXT_(2, setup, "%s", temp_ws_name); + printk(KERN_INFO "%s: WS name mismatch\n", + dev->name); + printk(KERN_INFO "%s: Received :%s: " + "expected :%s: \n", + dev->name, + p_sysval->WS_name, + temp_ws_name); + } + if ((p_sysval->write_frame_size < p_env->write_size) && + (p_env->packing == 0)) { + claw_snd_sys_validate_rsp(dev, p_ctlbk, + CLAW_RC_HOST_RCV_TOO_SMALL); + printk(KERN_INFO "%s: host write size is too " + "small\n", dev->name); + CLAW_DBF_TEXT(2, setup, "wrtszbad"); + } + if ((p_sysval->read_frame_size < p_env->read_size) && + (p_env->packing == 0)) { + claw_snd_sys_validate_rsp(dev, p_ctlbk, + CLAW_RC_HOST_RCV_TOO_SMALL); + printk(KERN_INFO "%s: host read size is too " + "small\n", dev->name); + CLAW_DBF_TEXT(2, setup, "rdsizbad"); + } + claw_snd_sys_validate_rsp(dev, p_ctlbk, 0); + printk(KERN_INFO "%s: CLAW device %.8s: System validate " + "completed.\n", dev->name, temp_ws_name); + printk("%s: sys Validate Rsize:%d Wsize:%d\n", dev->name, + p_sysval->read_frame_size, p_sysval->write_frame_size); + privptr->system_validate_comp = 1; + if (strncmp(p_env->api_type, WS_APPL_NAME_PACKED, 6) == 0) + p_env->packing = PACKING_ASK; + claw_strt_conn_req(dev); + break; + case SYSTEM_VALIDATE_RESPONSE: + p_sysval = (struct sysval *)&(p_ctlbk->data); + printk("%s: Recv Sys Validate Resp: Vers=%d,Corr=%d,RC=%d," + "WS name=%.8s,Host name=%.8s\n", + dev->name, + p_ctlbk->version, + p_ctlbk->correlator, + p_ctlbk->rc, + p_sysval->WS_name, + p_sysval->host_name); + switch (p_ctlbk->rc) { + case 0: + printk(KERN_INFO "%s: CLAW device " + "%.8s: System validate " + "completed.\n", + dev->name, temp_ws_name); + if (privptr->system_validate_comp == 0) + claw_strt_conn_req(dev); + privptr->system_validate_comp = 1; + break; + case CLAW_RC_NAME_MISMATCH: + printk(KERN_INFO "%s: Sys Validate " + "Resp : Host, WS name is " + "mismatch\n", + dev->name); + break; + case CLAW_RC_WRONG_VERSION: + printk(KERN_INFO "%s: Sys Validate " + "Resp : Wrong version\n", + dev->name); + break; + case CLAW_RC_HOST_RCV_TOO_SMALL: + printk(KERN_INFO "%s: Sys Validate " + "Resp : bad frame size\n", + dev->name); + break; + default: + printk(KERN_INFO "%s: Sys Validate " + "error code=%d \n", + dev->name, p_ctlbk->rc); + break; + } + break; - case CONNECTION_REQUEST: - p_connect=(struct conncmd *)&(p_ctlbk->data); - printk(KERN_INFO "%s: Recv Conn Req: Vers=%d,link_id=%d," - "Corr=%d,HOST appl=%.8s,WS appl=%.8s\n", - dev->name, - p_ctlbk->version, - p_ctlbk->linkid, - p_ctlbk->correlator, - p_connect->host_name, - p_connect->WS_name); - if (privptr->active_link_ID!=0 ) { - claw_snd_disc(dev, p_ctlbk); - printk(KERN_INFO "%s: Conn Req error : " - "already logical link is active \n", - dev->name); - } - if (p_ctlbk->linkid!=1 ) { - claw_snd_disc(dev, p_ctlbk); - printk(KERN_INFO "%s: Conn Req error : " - "req logical link id is not 1\n", + case CONNECTION_REQUEST: + p_connect = (struct conncmd *)&(p_ctlbk->data); + printk(KERN_INFO "%s: Recv Conn Req: Vers=%d,link_id=%d," + "Corr=%d,HOST appl=%.8s,WS appl=%.8s\n", + dev->name, + p_ctlbk->version, + p_ctlbk->linkid, + p_ctlbk->correlator, + p_connect->host_name, + p_connect->WS_name); + if (privptr->active_link_ID != 0) { + claw_snd_disc(dev, p_ctlbk); + printk(KERN_INFO "%s: Conn Req error : " + "already logical link is active \n", + dev->name); + } + if (p_ctlbk->linkid != 1) { + claw_snd_disc(dev, p_ctlbk); + printk(KERN_INFO "%s: Conn Req error : " + "req logical link id is not 1\n", + dev->name); + } + rc = find_link(dev, p_connect->host_name, p_connect->WS_name); + if (rc != 0) { + claw_snd_disc(dev, p_ctlbk); + printk(KERN_INFO "%s: Conn Resp error: " + "req appl name does not match\n", + dev->name); + } + claw_send_control(dev, + CONNECTION_CONFIRM, p_ctlbk->linkid, + p_ctlbk->correlator, + 0, p_connect->host_name, + p_connect->WS_name); + if (p_env->packing == PACKING_ASK) { + p_env->packing = PACK_SEND; + claw_snd_conn_req(dev, 0); + } + printk(KERN_INFO "%s: CLAW device %.8s: Connection " + "completed link_id=%d.\n", + dev->name, temp_ws_name, + p_ctlbk->linkid); + privptr->active_link_ID = p_ctlbk->linkid; + p_ch = &privptr->channel[WRITE]; + wake_up(&p_ch->wait); /* wake up claw_open ( WRITE) */ + break; + case CONNECTION_RESPONSE: + p_connect = (struct conncmd *)&(p_ctlbk->data); + printk(KERN_INFO "%s: Revc Conn Resp: Vers=%d,link_id=%d," + "Corr=%d,RC=%d,Host appl=%.8s, WS appl=%.8s\n", + dev->name, + p_ctlbk->version, + p_ctlbk->linkid, + p_ctlbk->correlator, + p_ctlbk->rc, + p_connect->host_name, + p_connect->WS_name); + + if (p_ctlbk->rc != 0) { + printk(KERN_INFO "%s: Conn Resp error: rc=%d \n", + dev->name, p_ctlbk->rc); + return 1; + } + rc = find_link(dev, + p_connect->host_name, p_connect->WS_name); + if (rc != 0) { + claw_snd_disc(dev, p_ctlbk); + printk(KERN_INFO "%s: Conn Resp error: " + "req appl name does not match\n", + dev->name); + } + /* should be until CONNECTION_CONFIRM */ + privptr->active_link_ID = -(p_ctlbk->linkid); + break; + case CONNECTION_CONFIRM: + p_connect = (struct conncmd *)&(p_ctlbk->data); + printk(KERN_INFO "%s: Recv Conn Confirm:Vers=%d,link_id=%d," + "Corr=%d,Host appl=%.8s,WS appl=%.8s\n", + dev->name, + p_ctlbk->version, + p_ctlbk->linkid, + p_ctlbk->correlator, + p_connect->host_name, + p_connect->WS_name); + if (p_ctlbk->linkid == -(privptr->active_link_ID)) { + privptr->active_link_ID = p_ctlbk->linkid; + if (p_env->packing > PACKING_ASK) { + printk(KERN_INFO "%s: Confirmed Now packing\n", dev->name); - } - rc=find_link(dev, - p_connect->host_name, p_connect->WS_name); - if (rc!=0) { - claw_snd_disc(dev, p_ctlbk); - printk(KERN_INFO "%s: Conn Req error : " - "req appl name does not match\n", - dev->name); - } - claw_send_control(dev, - CONNECTION_CONFIRM, p_ctlbk->linkid, - p_ctlbk->correlator, - 0, p_connect->host_name, - p_connect->WS_name); - if (p_env->packing == PACKING_ASK) { - printk("%s: Now Pack ask\n",dev->name); - p_env->packing = PACK_SEND; - claw_snd_conn_req(dev,0); - } - printk(KERN_INFO "%s: CLAW device %.8s: Connection " - "completed link_id=%d.\n", - dev->name, temp_ws_name, - p_ctlbk->linkid); - privptr->active_link_ID=p_ctlbk->linkid; - p_ch=&privptr->channel[WRITE]; - wake_up(&p_ch->wait); /* wake up claw_open ( WRITE) */ - break; - case CONNECTION_RESPONSE: - p_connect=(struct conncmd *)&(p_ctlbk->data); - printk(KERN_INFO "%s: Revc Conn Resp: Vers=%d,link_id=%d," - "Corr=%d,RC=%d,Host appl=%.8s, WS appl=%.8s\n", - dev->name, - p_ctlbk->version, - p_ctlbk->linkid, - p_ctlbk->correlator, - p_ctlbk->rc, - p_connect->host_name, - p_connect->WS_name); - - if (p_ctlbk->rc !=0 ) { - printk(KERN_INFO "%s: Conn Resp error: rc=%d \n", - dev->name, p_ctlbk->rc); - return 1; - } - rc=find_link(dev, - p_connect->host_name, p_connect->WS_name); - if (rc!=0) { - claw_snd_disc(dev, p_ctlbk); - printk(KERN_INFO "%s: Conn Resp error: " - "req appl name does not match\n", - dev->name); - } - /* should be until CONNECTION_CONFIRM */ - privptr->active_link_ID = - (p_ctlbk->linkid); - break; - case CONNECTION_CONFIRM: - p_connect=(struct conncmd *)&(p_ctlbk->data); - printk(KERN_INFO "%s: Recv Conn Confirm:Vers=%d,link_id=%d," - "Corr=%d,Host appl=%.8s,WS appl=%.8s\n", - dev->name, - p_ctlbk->version, - p_ctlbk->linkid, - p_ctlbk->correlator, - p_connect->host_name, - p_connect->WS_name); - if (p_ctlbk->linkid== -(privptr->active_link_ID)) { - privptr->active_link_ID=p_ctlbk->linkid; - if (p_env->packing > PACKING_ASK) { - printk(KERN_INFO "%s: Confirmed Now packing\n",dev->name); - p_env->packing = DO_PACKED; - } - p_ch=&privptr->channel[WRITE]; - wake_up(&p_ch->wait); - } - else { - printk(KERN_INFO "%s: Conn confirm: " - "unexpected linkid=%d \n", - dev->name, p_ctlbk->linkid); - claw_snd_disc(dev, p_ctlbk); - } - break; - case DISCONNECT: - printk(KERN_INFO "%s: Disconnect: " - "Vers=%d,link_id=%d,Corr=%d\n", - dev->name, p_ctlbk->version, - p_ctlbk->linkid, p_ctlbk->correlator); - if ((p_ctlbk->linkid == 2) && - (p_env->packing == PACK_SEND)) { - privptr->active_link_ID = 1; p_env->packing = DO_PACKED; } - else - privptr->active_link_ID=0; - break; - case CLAW_ERROR: - printk(KERN_INFO "%s: CLAW ERROR detected\n", - dev->name); - break; - default: - printk(KERN_INFO "%s: Unexpected command code=%d \n", - dev->name, p_ctlbk->command); - break; + p_ch = &privptr->channel[WRITE]; + wake_up(&p_ch->wait); + } else { + printk(KERN_INFO "%s: Conn confirm: " + "unexpected linkid=%d \n", + dev->name, p_ctlbk->linkid); + claw_snd_disc(dev, p_ctlbk); + } + break; + case DISCONNECT: + printk(KERN_INFO "%s: Disconnect: " + "Vers=%d,link_id=%d,Corr=%d\n", + dev->name, p_ctlbk->version, + p_ctlbk->linkid, p_ctlbk->correlator); + if ((p_ctlbk->linkid == 2) && + (p_env->packing == PACK_SEND)) { + privptr->active_link_ID = 1; + p_env->packing = DO_PACKED; + } else + privptr->active_link_ID = 0; + break; + case CLAW_ERROR: + printk(KERN_INFO "%s: CLAW ERROR detected\n", + dev->name); + break; + default: + printk(KERN_INFO "%s: Unexpected command code=%d \n", + dev->name, p_ctlbk->command); + break; } -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s() exit on line %d, rc = 0\n", - dev->name,__func__,__LINE__); -#endif - return 0; } /* end of claw_process_control */ @@ -3092,19 +2274,8 @@ claw_send_control(struct net_device *dev, __u8 type, __u8 link, struct conncmd *p_connect; struct sk_buff *skb; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s > enter \n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(2,setup,"sndcntl"); -#ifdef DEBUGMSG - printk(KERN_INFO "%s: Sending Control Packet \n",dev->name); - printk(KERN_INFO "%s: variable type = 0x%X, link = " - "%d, correlator = %d, rc = %d\n", - dev->name,type, link, correlator, rc); - printk(KERN_INFO "%s: variable local_name = %s, " - "remote_name = %s\n",dev->name, local_name, remote_name); -#endif - privptr=dev->priv; + CLAW_DBF_TEXT(2, setup, "sndcntl"); + privptr = dev->ml_priv; p_ctl=(struct clawctl *)&privptr->ctl_bk; p_ctl->command=type; @@ -3125,7 +2296,7 @@ claw_send_control(struct net_device *dev, __u8 type, __u8 link, p_sysval->read_frame_size=DEF_PACK_BUFSIZE; p_sysval->write_frame_size=DEF_PACK_BUFSIZE; } else { - /* how big is the piggest group of packets */ + /* how big is the biggest group of packets */ p_sysval->read_frame_size=privptr->p_env->read_size; p_sysval->write_frame_size=privptr->p_env->write_size; } @@ -3155,29 +2326,14 @@ claw_send_control(struct net_device *dev, __u8 type, __u8 link, skb = dev_alloc_skb(sizeof(struct clawctl)); if (!skb) { - printk( "%s:%s low on mem, returning...\n", - dev->name,__func__); -#ifdef DEBUG - printk(KERN_INFO "%s:%s Exit, rc = ENOMEM\n", - dev->name,__func__); -#endif return -ENOMEM; } memcpy(skb_put(skb, sizeof(struct clawctl)), p_ctl, sizeof(struct clawctl)); -#ifdef IOTRACE - printk(KERN_INFO "%s: outbnd claw cntl data \n",dev->name); - dumpit((char *)p_ctl,sizeof(struct clawctl)); -#endif if (privptr->p_env->packing >= PACK_SEND) claw_hw_tx(skb, dev, 1); else claw_hw_tx(skb, dev, 0); -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - return 0; } /* end of claw_send_control */ @@ -3189,25 +2345,14 @@ static int claw_snd_conn_req(struct net_device *dev, __u8 link) { int rc; - struct claw_privbk *privptr=dev->priv; + struct claw_privbk *privptr = dev->ml_priv; struct clawctl *p_ctl; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter \n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(2,setup,"snd_conn"); -#ifdef DEBUGMSG - printk(KERN_INFO "%s: variable link = %X, dev =\n",dev->name, link); - dumpit((char *) dev, sizeof(struct net_device)); -#endif + CLAW_DBF_TEXT(2, setup, "snd_conn"); rc = 1; p_ctl=(struct clawctl *)&privptr->ctl_bk; p_ctl->linkid = link; if ( privptr->system_validate_comp==0x00 ) { -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d, rc = 1\n", - dev->name,__func__,__LINE__); -#endif return rc; } if (privptr->p_env->packing == PACKING_ASK ) @@ -3220,10 +2365,6 @@ claw_snd_conn_req(struct net_device *dev, __u8 link) if (privptr->p_env->packing == 0) rc=claw_send_control(dev, CONNECTION_REQUEST,0,0,0, HOST_APPL_NAME, privptr->p_env->api_type); -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d, rc = %d\n", - dev->name,__func__,__LINE__, rc); -#endif return rc; } /* end of claw_snd_conn_req */ @@ -3240,25 +2381,12 @@ claw_snd_disc(struct net_device *dev, struct clawctl * p_ctl) int rc; struct conncmd * p_connect; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(2,setup,"snd_dsc"); -#ifdef DEBUGMSG - printk(KERN_INFO "%s: variable dev =\n",dev->name); - dumpit((char *) dev, sizeof(struct net_device)); - printk(KERN_INFO "%s: variable p_ctl",dev->name); - dumpit((char *) p_ctl, sizeof(struct clawctl)); -#endif + CLAW_DBF_TEXT(2, setup, "snd_dsc"); p_connect=(struct conncmd *)&p_ctl->data; rc=claw_send_control(dev, DISCONNECT, p_ctl->linkid, p_ctl->correlator, 0, p_connect->host_name, p_connect->WS_name); -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d, rc = %d\n", - dev->name,__func__, __LINE__, rc); -#endif return rc; } /* end of claw_snd_disc */ @@ -3276,19 +2404,8 @@ claw_snd_sys_validate_rsp(struct net_device *dev, struct claw_privbk *privptr; int rc; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter\n", - dev->name,__func__); -#endif - CLAW_DBF_TEXT(2,setup,"chkresp"); -#ifdef DEBUGMSG - printk(KERN_INFO "%s: variable return_code = %d, dev =\n", - dev->name, return_code); - dumpit((char *) dev, sizeof(struct net_device)); - printk(KERN_INFO "%s: variable p_ctl =\n",dev->name); - dumpit((char *) p_ctl, sizeof(struct clawctl)); -#endif - privptr = dev->priv; + CLAW_DBF_TEXT(2, setup, "chkresp"); + privptr = dev->ml_priv; p_env=privptr->p_env; rc=claw_send_control(dev, SYSTEM_VALIDATE_RESPONSE, p_ctl->linkid, @@ -3296,10 +2413,6 @@ claw_snd_sys_validate_rsp(struct net_device *dev, return_code, p_env->host_name, p_env->adapter_name ); -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d, rc = %d\n", - dev->name,__func__,__LINE__, rc); -#endif return rc; } /* end of claw_snd_sys_validate_rsp */ @@ -3313,19 +2426,8 @@ claw_strt_conn_req(struct net_device *dev ) { int rc; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(2,setup,"conn_req"); -#ifdef DEBUGMSG - printk(KERN_INFO "%s: variable dev =\n",dev->name); - dumpit((char *) dev, sizeof(struct net_device)); -#endif + CLAW_DBF_TEXT(2, setup, "conn_req"); rc=claw_snd_conn_req(dev, 1); -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d, rc = %d\n", - dev->name,__func__,__LINE__, rc); -#endif return rc; } /* end of claw_strt_conn_req */ @@ -3339,15 +2441,9 @@ static struct net_device_stats *claw_stats(struct net_device *dev) { struct claw_privbk *privptr; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(4,trace,"stats"); - privptr = dev->priv; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif + + CLAW_DBF_TEXT(4, trace, "stats"); + privptr = dev->ml_priv; return &privptr->stats; } /* end of claw_stats */ @@ -3368,36 +2464,28 @@ unpack_read(struct net_device *dev ) struct clawph *p_packh; void *p_packd; struct clawctl *p_ctlrec=NULL; + struct device *p_dev; __u32 len_of_data; __u32 pack_off; __u8 link_num; __u8 mtc_this_frm=0; __u32 bytes_to_mov; - struct chbk *p_ch = NULL; int i=0; int p=0; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s enter \n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(4,trace,"unpkread"); + CLAW_DBF_TEXT(4, trace, "unpkread"); p_first_ccw=NULL; p_last_ccw=NULL; p_packh=NULL; p_packd=NULL; - privptr=dev->priv; + privptr = dev->ml_priv; + + p_dev = &privptr->channel[READ].cdev->dev; p_env = privptr->p_env; p_this_ccw=privptr->p_read_active_first; i=0; while (p_this_ccw!=NULL && p_this_ccw->header.flag!=CLAW_PENDING) { -#ifdef IOTRACE - printk(KERN_INFO "%s p_this_ccw \n",dev->name); - dumpit((char*)p_this_ccw, sizeof(struct ccwbk)); - printk(KERN_INFO "%s Inbound p_this_ccw->p_buffer(64)" - " pk=%d \n",dev->name,p_env->packing); - dumpit((char *)p_this_ccw->p_buffer, 64 ); -#endif pack_off = 0; p = 0; p_this_ccw->header.flag=CLAW_PENDING; @@ -3419,10 +2507,6 @@ unpack_read(struct net_device *dev ) else link_num=p_this_ccw->header.opcode / 8; if ((p_this_ccw->header.opcode & MORE_to_COME_FLAG)!=0) { -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s > More_to_come is ON\n", - dev->name,__func__); -#endif mtc_this_frm=1; if (p_this_ccw->header.length!= privptr->p_env->read_size ) { @@ -3445,22 +2529,12 @@ unpack_read(struct net_device *dev ) privptr->mtc_skipping=0; /* Ok, the end */ privptr->mtc_logical_link=-1; } -#ifdef DEBUGMSG - printk(KERN_INFO "%s:%s goto next " - "frame from MoretoComeSkip \n", - dev->name,__func__); -#endif goto NextFrame; } if (link_num==0) { claw_process_control(dev, p_this_ccw); -#ifdef DEBUGMSG - printk(KERN_INFO "%s:%s goto next " - "frame from claw_process_control \n", - dev->name,__func__); -#endif - CLAW_DBF_TEXT(4,trace,"UnpkCntl"); + CLAW_DBF_TEXT(4, trace, "UnpkCntl"); goto NextFrame; } unpack_next: @@ -3479,10 +2553,6 @@ unpack_next: bytes_to_mov=p_this_ccw->header.length; } if (privptr->mtc_logical_link<0) { -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s mtc_logical_link < 0 \n", - dev->name,__func__); -#endif /* * if More-To-Come is set in this frame then we don't know @@ -3496,15 +2566,6 @@ unpack_next: if (bytes_to_mov > (MAX_ENVELOPE_SIZE- privptr->mtc_offset) ) { /* error */ -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s > goto next " - "frame from MoretoComeSkip \n", - dev->name, - __func__); - printk(KERN_INFO " bytes_to_mov %d > (MAX_ENVELOPE_" - "SIZE-privptr->mtc_offset %d)\n", - bytes_to_mov,(MAX_ENVELOPE_SIZE- privptr->mtc_offset)); -#endif privptr->stats.rx_frame_errors++; goto NextFrame; } @@ -3516,16 +2577,6 @@ unpack_next: memcpy( privptr->p_mtc_envelope+ privptr->mtc_offset, p_this_ccw->p_buffer, bytes_to_mov); } -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() received data \n", - dev->name,__func__); - if (p_env->packing == DO_PACKED) - dumpit((char *)p_packd+sizeof(struct clawph),32); - else - dumpit((char *)p_this_ccw->p_buffer, 32); - printk(KERN_INFO "%s: %s() bytelength %d \n", - dev->name,__func__,bytes_to_mov); -#endif if (mtc_this_frm==0) { len_of_data=privptr->mtc_offset+bytes_to_mov; skb=dev_alloc_skb(len_of_data); @@ -3540,11 +2591,6 @@ unpack_next: privptr->stats.rx_packets++; privptr->stats.rx_bytes+=len_of_data; netif_rx(skb); -#ifdef DEBUGMSG - printk(KERN_INFO "%s: %s() netif_" - "rx(skb) completed \n", - dev->name,__func__); -#endif } else { privptr->stats.rx_dropped++; @@ -3581,28 +2627,14 @@ NextFrame: * chain to next block on active read queue */ p_this_ccw = privptr->p_read_active_first; - CLAW_DBF_TEXT_(4,trace,"rxpkt %d",p); + CLAW_DBF_TEXT_(4, trace, "rxpkt %d", p); } /* end of while */ /* check validity */ -#ifdef IOTRACE - printk(KERN_INFO "%s:%s processed frame is %d \n", - dev->name,__func__,i); - printk(KERN_INFO "%s:%s F:%lx L:%lx\n", - dev->name, - __func__, - (unsigned long)p_first_ccw, - (unsigned long)p_last_ccw); -#endif - CLAW_DBF_TEXT_(4,trace,"rxfrm %d",i); + CLAW_DBF_TEXT_(4, trace, "rxfrm %d", i); add_claw_reads(dev, p_first_ccw, p_last_ccw); - p_ch=&privptr->channel[READ]; claw_strt_read(dev, LOCK_YES); -#ifdef FUNCTRACE - printk(KERN_INFO "%s: %s exit on line %d\n", - dev->name, __func__, __LINE__); -#endif return; } /* end of unpack_read */ @@ -3616,18 +2648,13 @@ claw_strt_read (struct net_device *dev, int lock ) int rc = 0; __u32 parm; unsigned long saveflags = 0; - struct claw_privbk *privptr=dev->priv; + struct claw_privbk *privptr = dev->ml_priv; struct ccwbk*p_ccwbk; struct chbk *p_ch; struct clawh *p_clawh; p_ch=&privptr->channel[READ]; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter \n",dev->name,__func__); - printk(KERN_INFO "%s: variable lock = %d, dev =\n",dev->name, lock); - dumpit((char *) dev, sizeof(struct net_device)); -#endif - CLAW_DBF_TEXT(4,trace,"StRdNter"); + CLAW_DBF_TEXT(4, trace, "StRdNter"); p_clawh=(struct clawh *)privptr->p_claw_signal_blk; p_clawh->flag=CLAW_IDLE; /* 0x00 */ @@ -3637,21 +2664,11 @@ claw_strt_read (struct net_device *dev, int lock ) privptr->p_read_active_first->header.flag!=CLAW_PENDING )) { p_clawh->flag=CLAW_BUSY; /* 0xff */ } -#ifdef DEBUGMSG - printk(KERN_INFO "%s:%s state-%02x\n" , - dev->name,__func__, p_ch->claw_state); -#endif if (lock==LOCK_YES) { spin_lock_irqsave(get_ccwdev_lock(p_ch->cdev), saveflags); } if (test_and_set_bit(0, (void *)&p_ch->IO_active) == 0) { -#ifdef DEBUGMSG - printk(KERN_INFO "%s: HOT READ started in %s\n" , - dev->name,__func__); - p_clawh=(struct clawh *)privptr->p_claw_signal_blk; - dumpit((char *)&p_clawh->flag , 1); -#endif - CLAW_DBF_TEXT(4,trace,"HotRead"); + CLAW_DBF_TEXT(4, trace, "HotRead"); p_ccwbk=privptr->p_read_active_first; parm = (unsigned long) p_ch; rc = ccw_device_start (p_ch->cdev, &p_ccwbk->read, parm, @@ -3661,21 +2678,13 @@ claw_strt_read (struct net_device *dev, int lock ) } } else { -#ifdef DEBUGMSG - printk(KERN_INFO "%s: No READ started by %s() In progress\n" , - dev->name,__func__); -#endif - CLAW_DBF_TEXT(2,trace,"ReadAct"); + CLAW_DBF_TEXT(2, trace, "ReadAct"); } if (lock==LOCK_YES) { spin_unlock_irqrestore(get_ccwdev_lock(p_ch->cdev), saveflags); } -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - CLAW_DBF_TEXT(4,trace,"StRdExit"); + CLAW_DBF_TEXT(4, trace, "StRdExit"); return; } /* end of claw_strt_read */ @@ -3693,38 +2702,23 @@ claw_strt_out_IO( struct net_device *dev ) struct chbk *p_ch; struct ccwbk *p_first_ccw; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); -#endif if (!dev) { return; } - privptr=(struct claw_privbk *)dev->priv; + privptr = (struct claw_privbk *)dev->ml_priv; p_ch=&privptr->channel[WRITE]; -#ifdef DEBUGMSG - printk(KERN_INFO "%s:%s state-%02x\n" , - dev->name,__func__,p_ch->claw_state); -#endif - CLAW_DBF_TEXT(4,trace,"strt_io"); + CLAW_DBF_TEXT(4, trace, "strt_io"); p_first_ccw=privptr->p_write_active_first; if (p_ch->claw_state == CLAW_STOP) return; if (p_first_ccw == NULL) { -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif return; } if (test_and_set_bit(0, (void *)&p_ch->IO_active) == 0) { parm = (unsigned long) p_ch; -#ifdef DEBUGMSG - printk(KERN_INFO "%s:%s do_io \n" ,dev->name,__func__); - dumpit((char *)p_first_ccw, sizeof(struct ccwbk)); -#endif - CLAW_DBF_TEXT(2,trace,"StWrtIO"); + CLAW_DBF_TEXT(2, trace, "StWrtIO"); rc = ccw_device_start (p_ch->cdev,&p_first_ccw->write, parm, 0xff, 0); if (rc != 0) { @@ -3732,11 +2726,6 @@ claw_strt_out_IO( struct net_device *dev ) } } dev->trans_start = jiffies; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - dev->name,__func__,__LINE__); -#endif - return; } /* end of claw_strt_out_IO */ @@ -3749,37 +2738,16 @@ static void claw_free_wrt_buf( struct net_device *dev ) { - struct claw_privbk *privptr=(struct claw_privbk *)dev->priv; + struct claw_privbk *privptr = (struct claw_privbk *)dev->ml_priv; struct ccwbk*p_first_ccw; struct ccwbk*p_last_ccw; struct ccwbk*p_this_ccw; struct ccwbk*p_next_ccw; -#ifdef IOTRACE - struct ccwbk*p_buf; -#endif -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); - printk(KERN_INFO "%s: free count = %d variable dev =\n", - dev->name,privptr->write_free_count); -#endif - CLAW_DBF_TEXT(4,trace,"freewrtb"); + + CLAW_DBF_TEXT(4, trace, "freewrtb"); /* scan the write queue to free any completed write packets */ p_first_ccw=NULL; p_last_ccw=NULL; -#ifdef IOTRACE - printk(KERN_INFO "%s: Dump current CCW chain \n",dev->name ); - p_buf=privptr->p_write_active_first; - while (p_buf!=NULL) { - dumpit((char *)p_buf, sizeof(struct ccwbk)); - p_buf=p_buf->next; - } - if (p_buf==NULL) { - printk(KERN_INFO "%s: privptr->p_write_" - "active_first==NULL\n",dev->name ); - } - p_buf=(struct ccwbk*)privptr->p_end_ccw; - dumpit((char *)p_buf, sizeof(struct endccw)); -#endif p_this_ccw=privptr->p_write_active_first; while ( (p_this_ccw!=NULL) && (p_this_ccw->header.flag!=CLAW_PENDING)) { @@ -3809,31 +2777,8 @@ claw_free_wrt_buf( struct net_device *dev ) /* whole chain removed? */ if (privptr->p_write_active_first==NULL) { privptr->p_write_active_last=NULL; -#ifdef DEBUGMSG - printk(KERN_INFO "%s:%s p_write_" - "active_first==NULL\n",dev->name,__func__); -#endif } -#ifdef IOTRACE - printk(KERN_INFO "%s: Dump arranged CCW chain \n",dev->name ); - p_buf=privptr->p_write_active_first; - while (p_buf!=NULL) { - dumpit((char *)p_buf, sizeof(struct ccwbk)); - p_buf=p_buf->next; - } - if (p_buf==NULL) { - printk(KERN_INFO "%s: privptr->p_write_active_" - "first==NULL\n",dev->name ); - } - p_buf=(struct ccwbk*)privptr->p_end_ccw; - dumpit((char *)p_buf, sizeof(struct endccw)); -#endif - - CLAW_DBF_TEXT_(4,trace,"FWC=%d",privptr->write_free_count); -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d free_count =%d\n", - dev->name,__func__, __LINE__,privptr->write_free_count); -#endif + CLAW_DBF_TEXT_(4, trace, "FWC=%d", privptr->write_free_count); return; } @@ -3845,30 +2790,24 @@ static void claw_free_netdevice(struct net_device * dev, int free_dev) { struct claw_privbk *privptr; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(2,setup,"free_dev"); + CLAW_DBF_TEXT(2, setup, "free_dev"); if (!dev) return; - CLAW_DBF_TEXT_(2,setup,"%s",dev->name); - privptr = dev->priv; + CLAW_DBF_TEXT_(2, setup, "%s", dev->name); + privptr = dev->ml_priv; if (dev->flags & IFF_RUNNING) claw_release(dev); if (privptr) { privptr->channel[READ].ndev = NULL; /* say it's free */ } - dev->priv=NULL; + dev->ml_priv = NULL; #ifdef MODULE if (free_dev) { free_netdev(dev); } #endif - CLAW_DBF_TEXT(2,setup,"feee_ok"); -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit\n",dev->name,__func__); -#endif + CLAW_DBF_TEXT(2, setup, "free_ok"); } /** @@ -3879,17 +2818,8 @@ claw_free_netdevice(struct net_device * dev, int free_dev) static void claw_init_netdevice(struct net_device * dev) { -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter\n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(2,setup,"init_dev"); - CLAW_DBF_TEXT_(2,setup,"%s",dev->name); - if (!dev) { - printk(KERN_WARNING "claw:%s BAD Device exit line %d\n", - __func__,__LINE__); - CLAW_DBF_TEXT(2,setup,"baddev"); - return; - } + CLAW_DBF_TEXT(2, setup, "init_dev"); + CLAW_DBF_TEXT_(2, setup, "%s", dev->name); dev->mtu = CLAW_DEFAULT_MTU_SIZE; dev->hard_start_xmit = claw_tx; dev->open = claw_open; @@ -3901,10 +2831,7 @@ claw_init_netdevice(struct net_device * dev) dev->type = ARPHRD_SLIP; dev->tx_queue_len = 1300; dev->flags = IFF_POINTOPOINT | IFF_NOARP; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit\n",dev->name,__func__); -#endif - CLAW_DBF_TEXT(2,setup,"initok"); + CLAW_DBF_TEXT(2, setup, "initok"); return; } @@ -3921,10 +2848,7 @@ add_channel(struct ccw_device *cdev,int i,struct claw_privbk *privptr) struct chbk *p_ch; struct ccw_dev_id dev_id; -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Enter\n",cdev->dev.bus_id,__func__); -#endif - CLAW_DBF_TEXT_(2,setup,"%s",cdev->dev.bus_id); + CLAW_DBF_TEXT_(2, setup, "%s", cdev->dev.bus_id); privptr->channel[i].flag = i+1; /* Read is 1 Write is 2 */ p_ch = &privptr->channel[i]; p_ch->cdev = cdev; @@ -3932,18 +2856,8 @@ add_channel(struct ccw_device *cdev,int i,struct claw_privbk *privptr) ccw_device_get_id(cdev, &dev_id); p_ch->devno = dev_id.devno; if ((p_ch->irb = kzalloc(sizeof (struct irb),GFP_KERNEL)) == NULL) { - printk(KERN_WARNING "%s Out of memory in %s for irb\n", - p_ch->id,__func__); -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - p_ch->id,__func__,__LINE__); -#endif return -ENOMEM; } -#ifdef FUNCTRACE - printk(KERN_INFO "%s:%s Exit on line %d\n", - cdev->dev.bus_id,__func__,__LINE__); -#endif return 0; } @@ -3965,9 +2879,8 @@ claw_new_device(struct ccwgroup_device *cgdev) int ret; struct ccw_dev_id dev_id; - pr_debug("%s() called\n", __func__); printk(KERN_INFO "claw: add for %s\n",cgdev->cdev[READ]->dev.bus_id); - CLAW_DBF_TEXT(2,setup,"new_dev"); + CLAW_DBF_TEXT(2, setup, "new_dev"); privptr = cgdev->dev.driver_data; cgdev->cdev[READ]->dev.driver_data = privptr; cgdev->cdev[WRITE]->dev.driver_data = privptr; @@ -3982,22 +2895,21 @@ claw_new_device(struct ccwgroup_device *cgdev) if (ret == 0) ret = add_channel(cgdev->cdev[1],1,privptr); if (ret != 0) { - printk(KERN_WARNING - "add channel failed " - "with ret = %d\n", ret); - goto out; + printk(KERN_WARNING + "add channel failed with ret = %d\n", ret); + goto out; } ret = ccw_device_set_online(cgdev->cdev[READ]); if (ret != 0) { printk(KERN_WARNING - "claw: ccw_device_set_online %s READ failed " + "claw: ccw_device_set_online %s READ failed " "with ret = %d\n",cgdev->cdev[READ]->dev.bus_id,ret); goto out; } ret = ccw_device_set_online(cgdev->cdev[WRITE]); if (ret != 0) { printk(KERN_WARNING - "claw: ccw_device_set_online %s WRITE failed " + "claw: ccw_device_set_online %s WRITE failed " "with ret = %d\n",cgdev->cdev[WRITE]->dev.bus_id, ret); goto out; } @@ -4006,7 +2918,7 @@ claw_new_device(struct ccwgroup_device *cgdev) printk(KERN_WARNING "%s:alloc_netdev failed\n",__func__); goto out; } - dev->priv = privptr; + dev->ml_priv = privptr; cgdev->dev.driver_data = privptr; cgdev->cdev[READ]->dev.driver_data = privptr; cgdev->cdev[WRITE]->dev.driver_data = privptr; @@ -4014,18 +2926,16 @@ claw_new_device(struct ccwgroup_device *cgdev) SET_NETDEV_DEV(dev, &cgdev->dev); if (register_netdev(dev) != 0) { claw_free_netdevice(dev, 1); - CLAW_DBF_TEXT(2,trace,"regfail"); + CLAW_DBF_TEXT(2, trace, "regfail"); goto out; } dev->flags &=~IFF_RUNNING; if (privptr->buffs_alloc == 0) { ret=init_ccw_bk(dev); if (ret !=0) { - printk(KERN_WARNING - "claw: init_ccw_bk failed with ret=%d\n", ret); unregister_netdev(dev); claw_free_netdevice(dev,1); - CLAW_DBF_TEXT(2,trace,"ccwmem"); + CLAW_DBF_TEXT(2, trace, "ccwmem"); goto out; } } @@ -4047,7 +2957,6 @@ claw_new_device(struct ccwgroup_device *cgdev) out: ccw_device_set_offline(cgdev->cdev[1]); ccw_device_set_offline(cgdev->cdev[0]); - return -ENODEV; } @@ -4056,8 +2965,7 @@ claw_purge_skb_queue(struct sk_buff_head *q) { struct sk_buff *skb; - CLAW_DBF_TEXT(4,trace,"purgque"); - + CLAW_DBF_TEXT(4, trace, "purgque"); while ((skb = skb_dequeue(q))) { atomic_dec(&skb->users); dev_kfree_skb_any(skb); @@ -4078,8 +2986,7 @@ claw_shutdown_device(struct ccwgroup_device *cgdev) struct net_device *ndev; int ret; - pr_debug("%s() called\n", __func__); - CLAW_DBF_TEXT_(2,setup,"%s",cgdev->dev.bus_id); + CLAW_DBF_TEXT_(2, setup, "%s", cgdev->dev.bus_id); priv = cgdev->dev.driver_data; if (!priv) return -ENODEV; @@ -4092,7 +2999,7 @@ claw_shutdown_device(struct ccwgroup_device *cgdev) ret = claw_release(ndev); ndev->flags &=~IFF_RUNNING; unregister_netdev(ndev); - ndev->priv = NULL; /* cgdev data, not ndev's to free */ + ndev->ml_priv = NULL; /* cgdev data, not ndev's to free */ claw_free_netdevice(ndev, 1); priv->channel[READ].ndev = NULL; priv->channel[WRITE].ndev = NULL; @@ -4108,13 +3015,10 @@ claw_remove_device(struct ccwgroup_device *cgdev) { struct claw_privbk *priv; - pr_debug("%s() called\n", __func__); - CLAW_DBF_TEXT_(2,setup,"%s",cgdev->dev.bus_id); + BUG_ON(!cgdev); + CLAW_DBF_TEXT_(2, setup, "%s", cgdev->dev.bus_id); priv = cgdev->dev.driver_data; - if (!priv) { - printk(KERN_WARNING "claw: %s() no Priv exiting\n",__func__); - return; - } + BUG_ON(!priv); printk(KERN_INFO "claw: %s() called %s will be removed.\n", __func__,cgdev->cdev[0]->dev.bus_id); if (cgdev->state == CCWGROUP_ONLINE) @@ -4133,6 +3037,8 @@ claw_remove_device(struct ccwgroup_device *cgdev) cgdev->cdev[READ]->dev.driver_data = NULL; cgdev->cdev[WRITE]->dev.driver_data = NULL; put_device(&cgdev->dev); + + return; } @@ -4168,8 +3074,8 @@ claw_hname_write(struct device *dev, struct device_attribute *attr, const char * strncpy(p_env->host_name,buf, count); p_env->host_name[count-1] = 0x20; /* clear extra 0x0a */ p_env->host_name[MAX_NAME_LEN] = 0x00; - CLAW_DBF_TEXT(2,setup,"HstnSet"); - CLAW_DBF_TEXT_(2,setup,"%s",p_env->host_name); + CLAW_DBF_TEXT(2, setup, "HstnSet"); + CLAW_DBF_TEXT_(2, setup, "%s", p_env->host_name); return count; } @@ -4186,7 +3092,7 @@ claw_adname_show(struct device *dev, struct device_attribute *attr, char *buf) if (!priv) return -ENODEV; p_env = priv->p_env; - return sprintf(buf, "%s\n",p_env->adapter_name); + return sprintf(buf, "%s\n", p_env->adapter_name); } static ssize_t @@ -4205,8 +3111,8 @@ claw_adname_write(struct device *dev, struct device_attribute *attr, const char strncpy(p_env->adapter_name,buf, count); p_env->adapter_name[count-1] = 0x20; /* clear extra 0x0a */ p_env->adapter_name[MAX_NAME_LEN] = 0x00; - CLAW_DBF_TEXT(2,setup,"AdnSet"); - CLAW_DBF_TEXT_(2,setup,"%s",p_env->adapter_name); + CLAW_DBF_TEXT(2, setup, "AdnSet"); + CLAW_DBF_TEXT_(2, setup, "%s", p_env->adapter_name); return count; } @@ -4247,15 +3153,15 @@ claw_apname_write(struct device *dev, struct device_attribute *attr, const char p_env->read_size=DEF_PACK_BUFSIZE; p_env->write_size=DEF_PACK_BUFSIZE; p_env->packing=PACKING_ASK; - CLAW_DBF_TEXT(2,setup,"PACKING"); + CLAW_DBF_TEXT(2, setup, "PACKING"); } else { p_env->packing=0; p_env->read_size=CLAW_FRAME_SIZE; p_env->write_size=CLAW_FRAME_SIZE; - CLAW_DBF_TEXT(2,setup,"ApiSet"); + CLAW_DBF_TEXT(2, setup, "ApiSet"); } - CLAW_DBF_TEXT_(2,setup,"%s",p_env->api_type); + CLAW_DBF_TEXT_(2, setup, "%s", p_env->api_type); return count; } @@ -4295,8 +3201,8 @@ claw_wbuff_write(struct device *dev, struct device_attribute *attr, const char * if ((nnn > max ) || (nnn < 2)) return -EINVAL; p_env->write_buffers = nnn; - CLAW_DBF_TEXT(2,setup,"Wbufset"); - CLAW_DBF_TEXT_(2,setup,"WB=%d",p_env->write_buffers); + CLAW_DBF_TEXT(2, setup, "Wbufset"); + CLAW_DBF_TEXT_(2, setup, "WB=%d", p_env->write_buffers); return count; } @@ -4336,8 +3242,8 @@ claw_rbuff_write(struct device *dev, struct device_attribute *attr, const char * if ((nnn > max ) || (nnn < 2)) return -EINVAL; p_env->read_buffers = nnn; - CLAW_DBF_TEXT(2,setup,"Rbufset"); - CLAW_DBF_TEXT_(2,setup,"RB=%d",p_env->read_buffers); + CLAW_DBF_TEXT(2, setup, "Rbufset"); + CLAW_DBF_TEXT_(2, setup, "RB=%d", p_env->read_buffers); return count; } @@ -4359,16 +3265,14 @@ static struct attribute_group claw_attr_group = { static int claw_add_files(struct device *dev) { - pr_debug("%s() called\n", __func__); - CLAW_DBF_TEXT(2,setup,"add_file"); + CLAW_DBF_TEXT(2, setup, "add_file"); return sysfs_create_group(&dev->kobj, &claw_attr_group); } static void claw_remove_files(struct device *dev) { - pr_debug("%s() called\n", __func__); - CLAW_DBF_TEXT(2,setup,"rem_file"); + CLAW_DBF_TEXT(2, setup, "rem_file"); sysfs_remove_group(&dev->kobj, &claw_attr_group); } @@ -4397,35 +3301,27 @@ claw_init(void) int ret = 0; printk(KERN_INFO "claw: starting driver\n"); -#ifdef FUNCTRACE - printk(KERN_INFO "claw: %s() enter \n",__func__); -#endif ret = claw_register_debug_facility(); if (ret) { printk(KERN_WARNING "claw: %s() debug_register failed %d\n", __func__,ret); return ret; } - CLAW_DBF_TEXT(2,setup,"init_mod"); + CLAW_DBF_TEXT(2, setup, "init_mod"); ret = register_cu3088_discipline(&claw_group_driver); if (ret) { + CLAW_DBF_TEXT(2, setup, "init_bad"); claw_unregister_debug_facility(); printk(KERN_WARNING "claw; %s() cu3088 register failed %d\n", __func__,ret); } -#ifdef FUNCTRACE - printk(KERN_INFO "claw: %s() exit \n",__func__); -#endif return ret; } module_init(claw_init); module_exit(claw_cleanup); - - -/*--------------------------------------------------------------------* -* End of File * -*---------------------------------------------------------------------*/ - - +MODULE_AUTHOR("Andy Richter <richtera@us.ibm.com>"); +MODULE_DESCRIPTION("Linux for System z CLAW Driver\n" \ + "Copyright 2000,2008 IBM Corporation\n"); +MODULE_LICENSE("GPL"); diff --git a/drivers/s390/net/ctcm_dbug.c b/drivers/s390/net/ctcm_dbug.c index 8eb25d00b2e..1ca58f15347 100644 --- a/drivers/s390/net/ctcm_dbug.c +++ b/drivers/s390/net/ctcm_dbug.c @@ -7,6 +7,7 @@ */ #include <linux/stddef.h> +#include <linux/string.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/slab.h> @@ -22,15 +23,13 @@ * Debug Facility Stuff */ -DEFINE_PER_CPU(char[256], ctcm_dbf_txt_buf); - struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS] = { - [CTCM_DBF_SETUP] = {"ctc_setup", 8, 1, 64, 5, NULL}, - [CTCM_DBF_ERROR] = {"ctc_error", 8, 1, 64, 3, NULL}, - [CTCM_DBF_TRACE] = {"ctc_trace", 8, 1, 64, 3, NULL}, - [CTCM_DBF_MPC_SETUP] = {"mpc_setup", 8, 1, 64, 5, NULL}, - [CTCM_DBF_MPC_ERROR] = {"mpc_error", 8, 1, 64, 3, NULL}, - [CTCM_DBF_MPC_TRACE] = {"mpc_trace", 8, 1, 64, 3, NULL}, + [CTCM_DBF_SETUP] = {"ctc_setup", 8, 1, 64, CTC_DBF_INFO, NULL}, + [CTCM_DBF_ERROR] = {"ctc_error", 8, 1, 64, CTC_DBF_ERROR, NULL}, + [CTCM_DBF_TRACE] = {"ctc_trace", 8, 1, 64, CTC_DBF_ERROR, NULL}, + [CTCM_DBF_MPC_SETUP] = {"mpc_setup", 8, 1, 80, CTC_DBF_INFO, NULL}, + [CTCM_DBF_MPC_ERROR] = {"mpc_error", 8, 1, 80, CTC_DBF_ERROR, NULL}, + [CTCM_DBF_MPC_TRACE] = {"mpc_trace", 8, 1, 80, CTC_DBF_ERROR, NULL}, }; void ctcm_unregister_dbf_views(void) @@ -65,3 +64,17 @@ int ctcm_register_dbf_views(void) return 0; } +void ctcm_dbf_longtext(enum ctcm_dbf_names dbf_nix, int level, char *fmt, ...) +{ + char dbf_txt_buf[64]; + va_list args; + + if (level > (ctcm_dbf[dbf_nix].id)->level) + return; + va_start(args, fmt); + vsnprintf(dbf_txt_buf, sizeof(dbf_txt_buf), fmt, args); + va_end(args); + + debug_text_event(ctcm_dbf[dbf_nix].id, level, dbf_txt_buf); +} + diff --git a/drivers/s390/net/ctcm_dbug.h b/drivers/s390/net/ctcm_dbug.h index fdff34fe59a..26966d0b9ab 100644 --- a/drivers/s390/net/ctcm_dbug.h +++ b/drivers/s390/net/ctcm_dbug.h @@ -20,16 +20,17 @@ #else #define do_debug 0 #endif -#ifdef DEBUGDATA - #define do_debug_data 1 -#else - #define do_debug_data 0 -#endif #ifdef DEBUGCCW #define do_debug_ccw 1 + #define DEBUGDATA 1 #else #define do_debug_ccw 0 #endif +#ifdef DEBUGDATA + #define do_debug_data 1 +#else + #define do_debug_data 0 +#endif /* define dbf debug levels similar to kernel msg levels */ #define CTC_DBF_ALWAYS 0 /* always print this */ @@ -42,8 +43,6 @@ #define CTC_DBF_INFO 5 /* informational */ #define CTC_DBF_DEBUG 6 /* debug-level messages */ -DECLARE_PER_CPU(char[256], ctcm_dbf_txt_buf); - enum ctcm_dbf_names { CTCM_DBF_SETUP, CTCM_DBF_ERROR, @@ -67,6 +66,7 @@ extern struct ctcm_dbf_info ctcm_dbf[CTCM_DBF_INFOS]; int ctcm_register_dbf_views(void); void ctcm_unregister_dbf_views(void); +void ctcm_dbf_longtext(enum ctcm_dbf_names dbf_nix, int level, char *text, ...); static inline const char *strtail(const char *s, int n) { @@ -74,12 +74,6 @@ static inline const char *strtail(const char *s, int n) return (l > n) ? s + (l - n) : s; } -/* sort out levels early to avoid unnecessary sprintfs */ -static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level) -{ - return (dbf_grp->level >= level); -} - #define CTCM_FUNTAIL strtail((char *)__func__, 16) #define CTCM_DBF_TEXT(name, level, text) \ @@ -94,16 +88,7 @@ static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level) } while (0) #define CTCM_DBF_TEXT_(name, level, text...) \ - do { \ - if (ctcm_dbf_passes(ctcm_dbf[CTCM_DBF_##name].id, level)) { \ - char *ctcm_dbf_txt_buf = \ - get_cpu_var(ctcm_dbf_txt_buf); \ - sprintf(ctcm_dbf_txt_buf, text); \ - debug_text_event(ctcm_dbf[CTCM_DBF_##name].id, \ - level, ctcm_dbf_txt_buf); \ - put_cpu_var(ctcm_dbf_txt_buf); \ - } \ - } while (0) + ctcm_dbf_longtext(CTCM_DBF_##name, level, text) /* * cat : one of {setup, mpc_setup, trace, mpc_trace, error, mpc_error}. @@ -112,13 +97,13 @@ static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level) */ #define CTCM_DBF_DEV_NAME(cat, dev, text) \ do { \ - CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) : %s", \ + CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%s) :- %s", \ CTCM_FUNTAIL, dev->name, text); \ } while (0) #define MPC_DBF_DEV_NAME(cat, dev, text) \ do { \ - CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) : %s", \ + CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%s) := %s", \ CTCM_FUNTAIL, dev->name, text); \ } while (0) @@ -137,13 +122,13 @@ static inline int ctcm_dbf_passes(debug_info_t *dbf_grp, int level) */ #define CTCM_DBF_DEV(cat, dev, text) \ do { \ - CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) : %s", \ + CTCM_DBF_TEXT_(cat, CTC_DBF_INFO, "%s(%p) :-: %s", \ CTCM_FUNTAIL, dev, text); \ } while (0) #define MPC_DBF_DEV(cat, dev, text) \ do { \ - CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) : %s", \ + CTCM_DBF_TEXT_(MPC_##cat, CTC_DBF_INFO, "%s(%p) :=: %s", \ CTCM_FUNTAIL, dev, text); \ } while (0) diff --git a/drivers/s390/net/ctcm_fsms.c b/drivers/s390/net/ctcm_fsms.c index 7e6bd387f4d..42776550acf 100644 --- a/drivers/s390/net/ctcm_fsms.c +++ b/drivers/s390/net/ctcm_fsms.c @@ -190,7 +190,8 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg); void ctcm_ccw_check_rc(struct channel *ch, int rc, char *msg) { CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, - "ccw error %s (%s): %04x\n", ch->id, msg, rc); + "%s(%s): %s: %04x\n", + CTCM_FUNTAIL, ch->id, msg, rc); switch (rc) { case -EBUSY: ctcm_pr_warn("%s (%s): Busy !\n", ch->id, msg); @@ -212,7 +213,7 @@ void ctcm_purge_skb_queue(struct sk_buff_head *q) { struct sk_buff *skb; - CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); + CTCM_DBF_TEXT(TRACE, CTC_DBF_DEBUG, __func__); while ((skb = skb_dequeue(q))) { atomic_dec(&skb->users); @@ -244,13 +245,15 @@ static void chx_txdone(fsm_instance *fi, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct sk_buff *skb; int first = 1; int i; unsigned long duration; struct timespec done_stamp = current_kernel_time(); /* xtime */ + CTCM_PR_DEBUG("%s(%s): %s\n", __func__, ch->id, dev->name); + duration = (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 + (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000; @@ -258,8 +261,9 @@ static void chx_txdone(fsm_instance *fi, int event, void *arg) ch->prof.tx_time = duration; if (ch->irb->scsw.cmd.count != 0) - ctcm_pr_debug("%s: TX not complete, remaining %d bytes\n", - dev->name, ch->irb->scsw.cmd.count); + CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, + "%s(%s): TX not complete, remaining %d bytes", + CTCM_FUNTAIL, dev->name, ch->irb->scsw.cmd.count); fsm_deltimer(&ch->timer); while ((skb = skb_dequeue(&ch->io_queue))) { priv->stats.tx_packets++; @@ -332,9 +336,10 @@ void ctcm_chx_txidle(fsm_instance *fi, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; + + CTCM_PR_DEBUG("%s(%s): %s\n", __func__, ch->id, dev->name); - CTCM_DBF_TEXT(TRACE, 6, __FUNCTION__); fsm_deltimer(&ch->timer); fsm_newstate(fi, CTC_STATE_TXIDLE); fsm_event(priv->fsm, DEV_EVENT_TXUP, ch->netdev); @@ -352,7 +357,7 @@ static void chx_rx(fsm_instance *fi, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; int len = ch->max_bufsize - ch->irb->scsw.cmd.count; struct sk_buff *skb = ch->trans_skb; __u16 block_len = *((__u16 *)skb->data); @@ -361,15 +366,17 @@ static void chx_rx(fsm_instance *fi, int event, void *arg) fsm_deltimer(&ch->timer); if (len < 8) { - ctcm_pr_debug("%s: got packet with length %d < 8\n", - dev->name, len); + CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, + "%s(%s): got packet with length %d < 8\n", + CTCM_FUNTAIL, dev->name, len); priv->stats.rx_dropped++; priv->stats.rx_length_errors++; goto again; } if (len > ch->max_bufsize) { - ctcm_pr_debug("%s: got packet with length %d > %d\n", - dev->name, len, ch->max_bufsize); + CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, + "%s(%s): got packet with length %d > %d\n", + CTCM_FUNTAIL, dev->name, len, ch->max_bufsize); priv->stats.rx_dropped++; priv->stats.rx_length_errors++; goto again; @@ -388,8 +395,9 @@ static void chx_rx(fsm_instance *fi, int event, void *arg) break; } if ((len < block_len) || (len > check_len)) { - ctcm_pr_debug("%s: got block length %d != rx length %d\n", - dev->name, block_len, len); + CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, + "%s(%s): got block length %d != rx length %d\n", + CTCM_FUNTAIL, dev->name, block_len, len); if (do_debug) ctcmpc_dump_skb(skb, 0); @@ -425,17 +433,23 @@ static void chx_rx(fsm_instance *fi, int event, void *arg) */ static void chx_firstio(fsm_instance *fi, int event, void *arg) { - struct channel *ch = arg; int rc; + struct channel *ch = arg; + int fsmstate = fsm_getstate(fi); - CTCM_DBF_TEXT(TRACE, 6, __FUNCTION__); + CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, + "%s(%s) : %02x", + CTCM_FUNTAIL, ch->id, fsmstate); - if (fsm_getstate(fi) == CTC_STATE_TXIDLE) - ctcm_pr_debug("%s: remote side issued READ?, init.\n", ch->id); + ch->sense_rc = 0; /* reset unit check report control */ + if (fsmstate == CTC_STATE_TXIDLE) + CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, + "%s(%s): remote side issued READ?, init.\n", + CTCM_FUNTAIL, ch->id); fsm_deltimer(&ch->timer); if (ctcm_checkalloc_buffer(ch)) return; - if ((fsm_getstate(fi) == CTC_STATE_SETUPWAIT) && + if ((fsmstate == CTC_STATE_SETUPWAIT) && (ch->protocol == CTCM_PROTO_OS390)) { /* OS/390 resp. z/OS */ if (CHANNEL_DIRECTION(ch->flags) == READ) { @@ -445,13 +459,12 @@ static void chx_firstio(fsm_instance *fi, int event, void *arg) chx_rxidle(fi, event, arg); } else { struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; fsm_newstate(fi, CTC_STATE_TXIDLE); fsm_event(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 @@ -483,7 +496,7 @@ static void chx_firstio(fsm_instance *fi, int event, void *arg) if ((CHANNEL_DIRECTION(ch->flags) == READ) && (ch->protocol == CTCM_PROTO_S390)) { struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; fsm_event(priv->fsm, DEV_EVENT_RXUP, dev); } } @@ -501,15 +514,14 @@ static void chx_rxidle(fsm_instance *fi, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; __u16 buflen; int rc; - CTCM_DBF_TEXT(TRACE, 6, __FUNCTION__); fsm_deltimer(&ch->timer); buflen = *((__u16 *)ch->trans_skb->data); - if (do_debug) - ctcm_pr_debug("%s: Initial RX count %d\n", dev->name, buflen); + CTCM_PR_DEBUG("%s: %s: Initial RX count = %d\n", + __func__, dev->name, buflen); if (buflen >= CTCM_INITIAL_BLOCKLEN) { if (ctcm_checkalloc_buffer(ch)) @@ -524,9 +536,9 @@ static void chx_rxidle(fsm_instance *fi, int event, void *arg) } else fsm_event(priv->fsm, DEV_EVENT_RXUP, dev); } else { - if (do_debug) - ctcm_pr_debug("%s: Initial RX count %d not %d\n", - dev->name, buflen, CTCM_INITIAL_BLOCKLEN); + CTCM_PR_DEBUG("%s: %s: Initial RX count %d not %d\n", + __func__, dev->name, + buflen, CTCM_INITIAL_BLOCKLEN); chx_firstio(fi, event, arg); } } @@ -548,14 +560,12 @@ static void ctcm_chx_setmode(fsm_instance *fi, int event, void *arg) fsm_deltimer(&ch->timer); if (IS_MPC(ch)) { timeout = 1500; - if (do_debug) - ctcm_pr_debug("ctcm enter: %s(): cp=%i ch=0x%p id=%s\n", - __FUNCTION__, smp_processor_id(), ch, ch->id); + CTCM_PR_DEBUG("enter %s: cp=%i ch=0x%p id=%s\n", + __func__, smp_processor_id(), ch, ch->id); } fsm_addtimer(&ch->timer, timeout, CTC_EVENT_TIMER, ch); fsm_newstate(fi, CTC_STATE_SETUPWAIT); - if (do_debug_ccw && IS_MPC(ch)) - ctcmpc_dumpit((char *)&ch->ccw[6], sizeof(struct ccw1) * 2); + CTCM_CCW_DUMP((char *)&ch->ccw[6], sizeof(struct ccw1) * 2); if (event == CTC_EVENT_TIMER) /* only for timer not yet locked */ spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); @@ -583,24 +593,12 @@ static void ctcm_chx_setmode(fsm_instance *fi, int event, void *arg) */ static void ctcm_chx_start(fsm_instance *fi, int event, void *arg) { - struct channel *ch = arg; - int rc; - struct net_device *dev; + struct channel *ch = arg; unsigned long saveflags; + int rc; - CTCM_DBF_TEXT(TRACE, 5, __FUNCTION__); - if (ch == NULL) { - ctcm_pr_warn("chx_start ch=NULL\n"); - return; - } - if (ch->netdev == NULL) { - ctcm_pr_warn("chx_start dev=NULL, id=%s\n", ch->id); - return; - } - dev = ch->netdev; - - if (do_debug) - ctcm_pr_debug("%s: %s channel start\n", dev->name, + CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, "%s(%s): %s", + CTCM_FUNTAIL, ch->id, (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); if (ch->trans_skb != NULL) { @@ -618,11 +616,12 @@ static void ctcm_chx_start(fsm_instance *fi, int event, void *arg) ch->ccw[1].count = 0; } if (ctcm_checkalloc_buffer(ch)) { - ctcm_pr_notice("%s: %s trans_skb allocation delayed " - "until first transfer\n", dev->name, + CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, + "%s(%s): %s trans_skb alloc delayed " + "until first transfer", + CTCM_FUNTAIL, ch->id, (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; @@ -661,7 +660,6 @@ static void ctcm_chx_haltio(fsm_instance *fi, int event, void *arg) int rc; int oldstate; - CTCM_DBF_TEXT(TRACE, 2, __FUNCTION__); fsm_deltimer(&ch->timer); if (IS_MPC(ch)) fsm_deltimer(&ch->sweep_timer); @@ -684,7 +682,7 @@ static void ctcm_chx_haltio(fsm_instance *fi, int event, void *arg) fsm_deltimer(&ch->timer); if (event != CTC_EVENT_STOP) { fsm_newstate(fi, oldstate); - ctcm_ccw_check_rc(ch, rc, (char *)__FUNCTION__); + ctcm_ccw_check_rc(ch, rc, (char *)__func__); } } } @@ -701,9 +699,11 @@ static void ctcm_chx_cleanup(fsm_instance *fi, int state, struct channel *ch) { struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; - CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); + CTCM_DBF_TEXT_(SETUP, CTC_DBF_NOTICE, + "%s(%s): %s[%d]\n", + CTCM_FUNTAIL, dev->name, ch->id, state); fsm_deltimer(&ch->timer); if (IS_MPC(ch)) @@ -743,7 +743,6 @@ static void ctcm_chx_cleanup(fsm_instance *fi, int state, */ static void ctcm_chx_stopped(fsm_instance *fi, int event, void *arg) { - CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); ctcm_chx_cleanup(fi, CTC_STATE_STOPPED, arg); } @@ -771,7 +770,6 @@ static void ctcm_chx_stop(fsm_instance *fi, int event, void *arg) */ static void ctcm_chx_fail(fsm_instance *fi, int event, void *arg) { - CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); ctcm_chx_cleanup(fi, CTC_STATE_NOTOP, arg); } @@ -786,7 +784,7 @@ static void ctcm_chx_setuperr(fsm_instance *fi, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; /* * Special case: Got UC_RCRESET on setmode. @@ -809,8 +807,8 @@ static void ctcm_chx_setuperr(fsm_instance *fi, int event, void *arg) } CTCM_DBF_TEXT_(ERROR, CTC_DBF_CRIT, - "%s : %s error during %s channel setup state=%s\n", - dev->name, ctc_ch_event_names[event], + "%s(%s) : %s error during %s channel setup state=%s\n", + CTCM_FUNTAIL, dev->name, ctc_ch_event_names[event], (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX", fsm_getstate_str(fi)); @@ -838,10 +836,12 @@ static void ctcm_chx_restart(fsm_instance *fi, int event, void *arg) int oldstate; int rc; - CTCM_DBF_TEXT(TRACE, CTC_DBF_NOTICE, __FUNCTION__); + CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, + "%s: %s[%d] of %s\n", + CTCM_FUNTAIL, ch->id, event, dev->name); + fsm_deltimer(&ch->timer); - ctcm_pr_debug("%s: %s channel restart\n", dev->name, - (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); + fsm_addtimer(&ch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, ch); oldstate = fsm_getstate(fi); fsm_newstate(fi, CTC_STATE_STARTWAIT); @@ -874,15 +874,12 @@ static void ctcm_chx_rxiniterr(fsm_instance *fi, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; - CTCM_DBF_TEXT(SETUP, 3, __FUNCTION__); if (event == CTC_EVENT_TIMER) { if (!IS_MPCDEV(dev)) /* TODO : check if MPC deletes timer somewhere */ fsm_deltimer(&ch->timer); - ctcm_pr_debug("%s: Timeout during RX init handshake\n", - dev->name); if (ch->retry++ < 3) ctcm_chx_restart(fi, event, arg); else { @@ -905,11 +902,12 @@ static void ctcm_chx_rxinitfail(fsm_instance *fi, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; - CTCM_DBF_TEXT(SETUP, 3, __FUNCTION__); + CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, + "%s(%s): RX %s busy, init. fail", + CTCM_FUNTAIL, dev->name, ch->id); fsm_newstate(fi, CTC_STATE_RXERR); - ctcm_pr_warn("%s: RX busy. Initialization failed\n", dev->name); fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev); } @@ -925,13 +923,12 @@ static void ctcm_chx_rxdisc(fsm_instance *fi, int event, void *arg) struct channel *ch = arg; struct channel *ch2; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; - CTCM_DBF_DEV_NAME(TRACE, dev, "Got remote disconnect, re-initializing"); + CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, + "%s: %s: remote disconnect - re-init ...", + CTCM_FUNTAIL, dev->name); fsm_deltimer(&ch->timer); - if (do_debug) - ctcm_pr_debug("%s: Got remote disconnect, " - "re-initializing ...\n", dev->name); /* * Notify device statemachine */ @@ -957,12 +954,10 @@ static void ctcm_chx_txiniterr(fsm_instance *fi, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; if (event == CTC_EVENT_TIMER) { fsm_deltimer(&ch->timer); - CTCM_DBF_DEV_NAME(ERROR, dev, - "Timeout during TX init handshake"); if (ch->retry++ < 3) ctcm_chx_restart(fi, event, arg); else { @@ -971,9 +966,8 @@ static void ctcm_chx_txiniterr(fsm_instance *fi, int event, void *arg) } } else { CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, - "%s : %s error during channel setup state=%s", - dev->name, ctc_ch_event_names[event], - fsm_getstate_str(fi)); + "%s(%s): %s in %s", CTCM_FUNTAIL, ch->id, + ctc_ch_event_names[event], fsm_getstate_str(fi)); ctcm_pr_warn("%s: Error during TX init handshake\n", dev->name); } @@ -990,18 +984,18 @@ static void ctcm_chx_txretry(fsm_instance *fi, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct sk_buff *skb; - if (do_debug) - ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", - __FUNCTION__, smp_processor_id(), ch, ch->id); + CTCM_PR_DEBUG("Enter: %s: cp=%i ch=0x%p id=%s\n", + __func__, smp_processor_id(), ch, ch->id); fsm_deltimer(&ch->timer); if (ch->retry++ > 3) { struct mpc_group *gptr = priv->mpcg; - ctcm_pr_debug("%s: TX retry failed, restarting channel\n", - dev->name); + CTCM_DBF_TEXT_(TRACE, CTC_DBF_INFO, + "%s: %s: retries exceeded", + CTCM_FUNTAIL, ch->id); fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); /* call restart if not MPC or if MPC and mpcg fsm is ready. use gptr as mpc indicator */ @@ -1010,7 +1004,9 @@ static void ctcm_chx_txretry(fsm_instance *fi, int event, void *arg) goto done; } - ctcm_pr_debug("%s: TX retry %d\n", dev->name, ch->retry); + CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, + "%s : %s: retry %d", + CTCM_FUNTAIL, ch->id, ch->retry); skb = skb_peek(&ch->io_queue); if (skb) { int rc = 0; @@ -1018,8 +1014,9 @@ static void ctcm_chx_txretry(fsm_instance *fi, int event, void *arg) clear_normalized_cda(&ch->ccw[4]); ch->ccw[4].count = skb->len; if (set_normalized_cda(&ch->ccw[4], skb->data)) { - ctcm_pr_debug("%s: IDAL alloc failed, chan restart\n", - dev->name); + CTCM_DBF_TEXT_(TRACE, CTC_DBF_INFO, + "%s: %s: IDAL alloc failed", + CTCM_FUNTAIL, ch->id); fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); ctcm_chx_restart(fi, event, arg); goto done; @@ -1060,23 +1057,22 @@ static void ctcm_chx_iofatal(fsm_instance *fi, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; + int rd = CHANNEL_DIRECTION(ch->flags); - CTCM_DBF_TEXT(TRACE, 3, __FUNCTION__); fsm_deltimer(&ch->timer); - ctcm_pr_warn("%s %s : unrecoverable channel error\n", - CTC_DRIVER_NAME, dev->name); + CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, + "%s: %s: %s unrecoverable channel error", + CTCM_FUNTAIL, ch->id, rd == READ ? "RX" : "TX"); + if (IS_MPC(ch)) { priv->stats.tx_dropped++; priv->stats.tx_errors++; } - - if (CHANNEL_DIRECTION(ch->flags) == READ) { - ctcm_pr_debug("%s: RX I/O error\n", dev->name); + if (rd == READ) { fsm_newstate(fi, CTC_STATE_RXERR); fsm_event(priv->fsm, DEV_EVENT_RXDOWN, dev); } else { - ctcm_pr_debug("%s: TX I/O error\n", dev->name); fsm_newstate(fi, CTC_STATE_TXERR); fsm_event(priv->fsm, DEV_EVENT_TXDOWN, dev); } @@ -1211,32 +1207,32 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; struct sk_buff *skb; int first = 1; int i; - struct timespec done_stamp; __u32 data_space; unsigned long duration; struct sk_buff *peekskb; int rc; struct th_header *header; struct pdu *p_header; + struct timespec done_stamp = current_kernel_time(); /* xtime */ - if (do_debug) - ctcm_pr_debug("%s cp:%i enter: %s()\n", - dev->name, smp_processor_id(), __FUNCTION__); + CTCM_PR_DEBUG("Enter %s: %s cp:%i\n", + __func__, dev->name, smp_processor_id()); - done_stamp = current_kernel_time(); /* xtime */ - duration = (done_stamp.tv_sec - ch->prof.send_stamp.tv_sec) * 1000000 - + (done_stamp.tv_nsec - ch->prof.send_stamp.tv_nsec) / 1000; + 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.cmd.count != 0) - ctcm_pr_debug("%s: TX not complete, remaining %d bytes\n", - dev->name, ch->irb->scsw.cmd.count); + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, + "%s(%s): TX not complete, remaining %d bytes", + CTCM_FUNTAIL, dev->name, ch->irb->scsw.cmd.count); fsm_deltimer(&ch->timer); while ((skb = skb_dequeue(&ch->io_queue))) { priv->stats.tx_packets++; @@ -1250,7 +1246,6 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) } spin_lock(&ch->collect_lock); clear_normalized_cda(&ch->ccw[4]); - if ((ch->collect_len <= 0) || (grp->in_sweep != 0)) { spin_unlock(&ch->collect_lock); fsm_newstate(fi, CTC_STATE_TXIDLE); @@ -1269,17 +1264,13 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) if (ch->prof.maxcqueue < skb_queue_len(&ch->collect_queue)) ch->prof.maxcqueue = skb_queue_len(&ch->collect_queue); i = 0; - - if (do_debug_data) - ctcm_pr_debug("ctcmpc: %s() building " - "trans_skb from collect_q \n", __FUNCTION__); - + p_header = NULL; data_space = grp->group_max_buflen - TH_HEADER_LENGTH; - if (do_debug_data) - ctcm_pr_debug("ctcmpc: %s() building trans_skb from collect_q" - " data_space:%04x\n", __FUNCTION__, data_space); - p_header = NULL; + CTCM_PR_DBGDATA("%s: building trans_skb from collect_q" + " data_space:%04x\n", + __func__, data_space); + while ((skb = skb_dequeue(&ch->collect_queue))) { memcpy(skb_put(ch->trans_skb, skb->len), skb->data, skb->len); p_header = (struct pdu *) @@ -1290,15 +1281,12 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) else p_header->pdu_flag |= 0x20; - if (do_debug_data) { - ctcm_pr_debug("ctcmpc: %s()trans_skb len:%04x \n", - __FUNCTION__, ch->trans_skb->len); - ctcm_pr_debug("ctcmpc: %s() pdu header and data" - " for up to 32 bytes sent to vtam\n", - __FUNCTION__); - ctcmpc_dumpit((char *)p_header, - min_t(int, skb->len, 32)); - } + CTCM_PR_DBGDATA("%s: trans_skb len:%04x \n", + __func__, ch->trans_skb->len); + CTCM_PR_DBGDATA("%s: pdu header and data for up" + " to 32 bytes sent to vtam\n", __func__); + CTCM_D3_DUMP((char *)p_header, min_t(int, skb->len, 32)); + ch->collect_len -= skb->len; data_space -= skb->len; priv->stats.tx_packets++; @@ -1314,46 +1302,38 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) if (p_header) p_header->pdu_flag |= PDU_LAST; /*Say it's the last one*/ header = kzalloc(TH_HEADER_LENGTH, gfp_type()); - if (!header) { - printk(KERN_WARNING "ctcmpc: OUT OF MEMORY IN %s()" - ": Data Lost \n", __FUNCTION__); spin_unlock(&ch->collect_lock); fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); - goto done; + goto done; } - header->th_ch_flag = TH_HAS_PDU; /* Normal data */ ch->th_seq_num++; header->th_seq_num = ch->th_seq_num; - if (do_debug_data) - ctcm_pr_debug("%s: ToVTAM_th_seq= %08x\n" , - __FUNCTION__, ch->th_seq_num); + CTCM_PR_DBGDATA("%s: ToVTAM_th_seq= %08x\n" , + __func__, ch->th_seq_num); memcpy(skb_push(ch->trans_skb, TH_HEADER_LENGTH), header, TH_HEADER_LENGTH); /* put the TH on the packet */ kfree(header); - if (do_debug_data) { - ctcm_pr_debug("ctcmpc: %s()trans_skb len:%04x \n", - __FUNCTION__, ch->trans_skb->len); - - ctcm_pr_debug("ctcmpc: %s() up-to-50 bytes of trans_skb " - "data to vtam from collect_q\n", __FUNCTION__); - ctcmpc_dumpit((char *)ch->trans_skb->data, + CTCM_PR_DBGDATA("%s: trans_skb len:%04x \n", + __func__, ch->trans_skb->len); + CTCM_PR_DBGDATA("%s: up-to-50 bytes of trans_skb " + "data to vtam from collect_q\n", __func__); + CTCM_D3_DUMP((char *)ch->trans_skb->data, min_t(int, ch->trans_skb->len, 50)); - } spin_unlock(&ch->collect_lock); clear_normalized_cda(&ch->ccw[1]); if (set_normalized_cda(&ch->ccw[1], ch->trans_skb->data)) { dev_kfree_skb_any(ch->trans_skb); ch->trans_skb = NULL; - printk(KERN_WARNING - "ctcmpc: %s()CCW failure - data lost\n", - __FUNCTION__); + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ERROR, + "%s: %s: IDAL alloc failed", + CTCM_FUNTAIL, ch->id); fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); return; } @@ -1373,7 +1353,6 @@ static void ctcmpc_chx_txdone(fsm_instance *fi, int event, void *arg) } done: ctcm_clear_busy(dev); - ctcm_pr_debug("ctcmpc exit: %s %s()\n", dev->name, __FUNCTION__); return; } @@ -1389,30 +1368,29 @@ static void ctcmpc_chx_rx(fsm_instance *fi, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; struct sk_buff *skb = ch->trans_skb; struct sk_buff *new_skb; - unsigned long saveflags = 0; /* avoids compiler warning */ + unsigned long saveflags = 0; /* avoids compiler warning */ int len = ch->max_bufsize - ch->irb->scsw.cmd.count; - if (do_debug_data) { - CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, "mpc_ch_rx %s cp:%i %s\n", - dev->name, smp_processor_id(), ch->id); - CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, "mpc_ch_rx: maxbuf: %04x " - "len: %04x\n", ch->max_bufsize, len); - } + CTCM_PR_DEBUG("%s: %s: cp:%i %s maxbuf : %04x, len: %04x\n", + CTCM_FUNTAIL, dev->name, smp_processor_id(), + ch->id, ch->max_bufsize, len); fsm_deltimer(&ch->timer); if (skb == NULL) { - ctcm_pr_debug("ctcmpc exit: %s() TRANS_SKB = NULL \n", - __FUNCTION__); - goto again; + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): TRANS_SKB = NULL", + CTCM_FUNTAIL, dev->name); + goto again; } if (len < TH_HEADER_LENGTH) { - ctcm_pr_info("%s: got packet with invalid length %d\n", - dev->name, len); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): packet length %d to short", + CTCM_FUNTAIL, dev->name, len); priv->stats.rx_dropped++; priv->stats.rx_length_errors++; } else { @@ -1422,11 +1400,9 @@ static void ctcmpc_chx_rx(fsm_instance *fi, int event, void *arg) new_skb = __dev_alloc_skb(ch->max_bufsize, GFP_ATOMIC); if (new_skb == NULL) { - printk(KERN_INFO "ctcmpc:%s() NEW_SKB = NULL\n", - __FUNCTION__); - printk(KERN_WARNING "ctcmpc: %s() MEMORY ALLOC FAILED" - " - DATA LOST - MPC FAILED\n", - __FUNCTION__); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%d): skb allocation failed", + CTCM_FUNTAIL, dev->name); fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); goto again; } @@ -1479,9 +1455,8 @@ again: break; } - if (do_debug) - ctcm_pr_debug("ctcmpc exit : %s %s(): ch=0x%p id=%s\n", - dev->name, __FUNCTION__, ch, ch->id); + CTCM_PR_DEBUG("Exit %s: %s, ch=0x%p, id=%s\n", + __func__, dev->name, ch, ch->id); } @@ -1496,16 +1471,17 @@ static void ctcmpc_chx_firstio(fsm_instance *fi, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; + struct mpc_group *gptr = priv->mpcg; + + CTCM_PR_DEBUG("Enter %s: id=%s, ch=0x%p\n", + __func__, ch->id, ch); + + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_INFO, + "%s: %s: chstate:%i, grpstate:%i, prot:%i\n", + CTCM_FUNTAIL, ch->id, fsm_getstate(fi), + fsm_getstate(gptr->fsm), ch->protocol); - if (do_debug) { - struct mpc_group *gptr = priv->mpcg; - ctcm_pr_debug("ctcmpc enter: %s(): ch=0x%p id=%s\n", - __FUNCTION__, ch, ch->id); - ctcm_pr_debug("%s() %s chstate:%i grpstate:%i chprotocol:%i\n", - __FUNCTION__, ch->id, fsm_getstate(fi), - fsm_getstate(gptr->fsm), ch->protocol); - } if (fsm_getstate(fi) == CTC_STATE_TXIDLE) MPC_DBF_DEV_NAME(TRACE, dev, "remote side issued READ? "); @@ -1531,9 +1507,8 @@ static void ctcmpc_chx_firstio(fsm_instance *fi, int event, void *arg) ? CTC_STATE_RXINIT : CTC_STATE_TXINIT); done: - if (do_debug) - ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", - __FUNCTION__, ch, ch->id); + CTCM_PR_DEBUG("Exit %s: id=%s, ch=0x%p\n", + __func__, ch->id, ch); return; } @@ -1550,18 +1525,15 @@ void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; int rc; unsigned long saveflags = 0; /* avoids compiler warning */ fsm_deltimer(&ch->timer); - ctcm_pr_debug("%s cp:%i enter: %s()\n", - dev->name, smp_processor_id(), __FUNCTION__); - if (do_debug) - ctcm_pr_debug("%s() %s chstate:%i grpstate:%i\n", - __FUNCTION__, ch->id, - fsm_getstate(fi), fsm_getstate(grp->fsm)); + CTCM_PR_DEBUG("%s: %s: %s: cp:%i, chstate:%i grpstate:%i\n", + __func__, ch->id, dev->name, smp_processor_id(), + fsm_getstate(fi), fsm_getstate(grp->fsm)); fsm_newstate(fi, CTC_STATE_RXIDLE); /* XID processing complete */ @@ -1575,9 +1547,7 @@ void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg) skb_reset_tail_pointer(ch->trans_skb); ch->trans_skb->len = 0; ch->ccw[1].count = ch->max_bufsize; - if (do_debug_ccw) - ctcmpc_dumpit((char *)&ch->ccw[0], - sizeof(struct ccw1) * 3); + CTCM_CCW_DUMP((char *)&ch->ccw[0], sizeof(struct ccw1) * 3); if (event == CTC_EVENT_START) /* see remark about conditional locking */ spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); @@ -1598,9 +1568,6 @@ void ctcmpc_chx_rxidle(fsm_instance *fi, int event, void *arg) fsm_event(priv->fsm, DEV_EVENT_RXUP, dev); done: - if (do_debug) - ctcm_pr_debug("ctcmpc exit: %s %s()\n", - dev->name, __FUNCTION__); return; } @@ -1613,16 +1580,12 @@ static void ctcmpc_chx_attn(fsm_instance *fsm, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; - if (do_debug) { - ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s" - "GrpState:%s ChState:%s\n", - __FUNCTION__, smp_processor_id(), ch, ch->id, - fsm_getstate_str(grp->fsm), - fsm_getstate_str(ch->fsm)); - } + CTCM_PR_DEBUG("%s(%s): %s(ch=0x%p), cp=%i, ChStat:%s, GrpStat:%s\n", + __func__, dev->name, ch->id, ch, smp_processor_id(), + fsm_getstate_str(ch->fsm), fsm_getstate_str(grp->fsm)); switch (fsm_getstate(grp->fsm)) { case MPCG_STATE_XID2INITW: @@ -1664,11 +1627,7 @@ static void ctcmpc_chx_attn(fsm_instance *fsm, int event, void *arg) break; } - if (do_debug) - ctcm_pr_debug("ctcmpc exit : %s(): cp=%i ch=0x%p id=%s\n", - __FUNCTION__, smp_processor_id(), ch, ch->id); return; - } /* @@ -1680,14 +1639,12 @@ static void ctcmpc_chx_attnbusy(fsm_instance *fsm, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; - ctcm_pr_debug("ctcmpc enter: %s %s() %s \nGrpState:%s ChState:%s\n", - dev->name, - __FUNCTION__, ch->id, - fsm_getstate_str(grp->fsm), - fsm_getstate_str(ch->fsm)); + CTCM_PR_DEBUG("%s(%s): %s\n ChState:%s GrpState:%s\n", + __func__, dev->name, ch->id, + fsm_getstate_str(ch->fsm), fsm_getstate_str(grp->fsm)); fsm_deltimer(&ch->timer); @@ -1750,16 +1707,12 @@ static void ctcmpc_chx_attnbusy(fsm_instance *fsm, int event, void *arg) if (ch->in_mpcgroup) fsm_event(grp->fsm, MPCG_EVENT_XID0DO, ch); else - printk(KERN_WARNING "ctcmpc: %s() Not all channels have" - " been added to group\n", __FUNCTION__); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): channel %s not added to group", + CTCM_FUNTAIL, dev->name, ch->id); done: - if (do_debug) - ctcm_pr_debug("ctcmpc exit : %s()%s ch=0x%p id=%s\n", - __FUNCTION__, dev->name, ch, ch->id); - return; - } /* @@ -1771,16 +1724,10 @@ static void ctcmpc_chx_resend(fsm_instance *fsm, int event, void *arg) { struct channel *ch = arg; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; - ctcm_pr_debug("ctcmpc enter: %s %s() %s \nGrpState:%s ChState:%s\n", - dev->name, __FUNCTION__, ch->id, - fsm_getstate_str(grp->fsm), - fsm_getstate_str(ch->fsm)); - fsm_event(grp->fsm, MPCG_EVENT_XID0DO, ch); - return; } @@ -1793,7 +1740,7 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg) { struct channel *ach = arg; struct net_device *dev = ach->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; struct channel *wch = priv->channel[WRITE]; struct channel *rch = priv->channel[READ]; @@ -1802,19 +1749,16 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg) int rc = 0; unsigned long saveflags = 0; - if (do_debug) - ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", - __FUNCTION__, smp_processor_id(), ach, ach->id); + CTCM_PR_DEBUG("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", + __func__, smp_processor_id(), ach, ach->id); if (grp->in_sweep == 0) goto done; - if (do_debug_data) { - ctcm_pr_debug("ctcmpc: %s() 1: ToVTAM_th_seq= %08x\n" , - __FUNCTION__, wch->th_seq_num); - ctcm_pr_debug("ctcmpc: %s() 1: FromVTAM_th_seq= %08x\n" , - __FUNCTION__, rch->th_seq_num); - } + CTCM_PR_DBGDATA("%s: 1: ToVTAM_th_seq= %08x\n" , + __func__, wch->th_seq_num); + CTCM_PR_DBGDATA("%s: 1: FromVTAM_th_seq= %08x\n" , + __func__, rch->th_seq_num); if (fsm_getstate(wch->fsm) != CTC_STATE_TXIDLE) { /* give the previous IO time to complete */ @@ -1853,11 +1797,9 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg) header->sw.th_last_seq = wch->th_seq_num; - if (do_debug_ccw) - ctcmpc_dumpit((char *)&wch->ccw[3], sizeof(struct ccw1) * 3); - - ctcm_pr_debug("ctcmpc: %s() sweep packet\n", __FUNCTION__); - ctcmpc_dumpit((char *)header, TH_SWEEP_LENGTH); + CTCM_CCW_DUMP((char *)&wch->ccw[3], sizeof(struct ccw1) * 3); + CTCM_PR_DBGDATA("%s: sweep packet\n", __func__); + CTCM_D3_DUMP((char *)header, TH_SWEEP_LENGTH); fsm_addtimer(&wch->timer, CTCM_TIME_5_SEC, CTC_EVENT_TIMER, wch); fsm_newstate(wch->fsm, CTC_STATE_TX); @@ -1876,19 +1818,13 @@ static void ctcmpc_chx_send_sweep(fsm_instance *fsm, int event, void *arg) ctcm_clear_busy_do(dev); } - if (do_debug_data) { - ctcm_pr_debug("ctcmpc: %s()2: ToVTAM_th_seq= %08x\n" , - __FUNCTION__, wch->th_seq_num); - ctcm_pr_debug("ctcmpc: %s()2: FromVTAM_th_seq= %08x\n" , - __FUNCTION__, rch->th_seq_num); - } + CTCM_PR_DBGDATA("%s: To-/From-VTAM_th_seq = %08x/%08x\n" , + __func__, wch->th_seq_num, rch->th_seq_num); if (rc != 0) ctcm_ccw_check_rc(wch, rc, "send sweep"); done: - if (do_debug) - ctcm_pr_debug("ctcmpc exit: %s() %s\n", __FUNCTION__, ach->id); return; } @@ -2114,7 +2050,7 @@ int mpc_ch_fsm_len = ARRAY_SIZE(ctcmpc_ch_fsm); static void dev_action_start(fsm_instance *fi, int event, void *arg) { struct net_device *dev = arg; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; int direction; CTCMY_DBF_DEV_NAME(SETUP, dev, ""); @@ -2140,7 +2076,7 @@ static void dev_action_stop(fsm_instance *fi, int event, void *arg) { int direction; struct net_device *dev = arg; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; CTCMY_DBF_DEV_NAME(SETUP, dev, ""); @@ -2149,9 +2085,8 @@ static void dev_action_stop(fsm_instance *fi, int event, void *arg) struct channel *ch = priv->channel[direction]; fsm_event(ch->fsm, CTC_EVENT_STOP, ch); ch->th_seq_num = 0x00; - if (do_debug) - ctcm_pr_debug("ctcm: %s() CH_th_seq= %08x\n", - __FUNCTION__, ch->th_seq_num); + CTCM_PR_DEBUG("%s: CH_th_seq= %08x\n", + __func__, ch->th_seq_num); } if (IS_MPC(priv)) fsm_newstate(priv->mpcg->fsm, MPCG_STATE_RESET); @@ -2161,7 +2096,7 @@ static void dev_action_restart(fsm_instance *fi, int event, void *arg) { int restart_timer; struct net_device *dev = arg; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; CTCMY_DBF_DEV_NAME(TRACE, dev, ""); @@ -2198,9 +2133,12 @@ static void dev_action_restart(fsm_instance *fi, int event, void *arg) static void dev_action_chup(fsm_instance *fi, int event, void *arg) { struct net_device *dev = arg; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; + int dev_stat = fsm_getstate(fi); - CTCMY_DBF_DEV_NAME(SETUP, dev, ""); + CTCM_DBF_TEXT_(SETUP, CTC_DBF_NOTICE, + "%s(%s): priv = %p [%d,%d]\n ", CTCM_FUNTAIL, + dev->name, dev->ml_priv, dev_stat, event); switch (fsm_getstate(fi)) { case DEV_STATE_STARTWAIT_RXTX: @@ -2257,7 +2195,7 @@ static void dev_action_chdown(fsm_instance *fi, int event, void *arg) { struct net_device *dev = arg; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; CTCMY_DBF_DEV_NAME(SETUP, dev, ""); diff --git a/drivers/s390/net/ctcm_main.c b/drivers/s390/net/ctcm_main.c index 6b13c1c1beb..b11fec24c7d 100644 --- a/drivers/s390/net/ctcm_main.c +++ b/drivers/s390/net/ctcm_main.c @@ -69,7 +69,7 @@ struct channel *channels; void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) { struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; __u16 len = *((__u16 *) pskb->data); skb_put(pskb, 2 + LL_HEADER_LENGTH); @@ -84,20 +84,19 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) skb_pull(pskb, LL_HEADER_LENGTH); if ((ch->protocol == CTCM_PROTO_S390) && (header->type != ETH_P_IP)) { - if (!(ch->logflags & LOG_FLAG_ILLEGALPKT)) { + ch->logflags |= LOG_FLAG_ILLEGALPKT; /* * Check packet type only if we stick strictly * to S/390's protocol of OS390. This only * supports IP. Otherwise allow any packet * type. */ - ctcm_pr_warn("%s Illegal packet type 0x%04x " - "received, dropping\n", - dev->name, header->type); - ch->logflags |= LOG_FLAG_ILLEGALPKT; + CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, + "%s(%s): Illegal packet type 0x%04x" + " - dropping", + CTCM_FUNTAIL, dev->name, header->type); } - priv->stats.rx_dropped++; priv->stats.rx_frame_errors++; return; @@ -105,11 +104,11 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) pskb->protocol = ntohs(header->type); if (header->length <= LL_HEADER_LENGTH) { if (!(ch->logflags & LOG_FLAG_ILLEGALSIZE)) { - ctcm_pr_warn( - "%s Illegal packet size %d " - "received (MTU=%d blocklen=%d), " - "dropping\n", dev->name, header->length, - dev->mtu, len); + CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, + "%s(%s): Illegal packet size %d(%d,%d)" + "- dropping", + CTCM_FUNTAIL, dev->name, + header->length, dev->mtu, len); ch->logflags |= LOG_FLAG_ILLEGALSIZE; } @@ -122,10 +121,10 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) if ((header->length > skb_tailroom(pskb)) || (header->length > len)) { if (!(ch->logflags & LOG_FLAG_OVERRUN)) { - ctcm_pr_warn( - "%s Illegal packet size %d (beyond the" - " end of received data), dropping\n", - dev->name, header->length); + CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, + "%s(%s): Packet size %d (overrun)" + " - dropping", CTCM_FUNTAIL, + dev->name, header->length); ch->logflags |= LOG_FLAG_OVERRUN; } @@ -139,9 +138,9 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) skb = dev_alloc_skb(pskb->len); if (!skb) { if (!(ch->logflags & LOG_FLAG_NOMEM)) { - ctcm_pr_warn( - "%s Out of memory in ctcm_unpack_skb\n", - dev->name); + CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, + "%s(%s): MEMORY allocation error", + CTCM_FUNTAIL, dev->name); ch->logflags |= LOG_FLAG_NOMEM; } priv->stats.rx_dropped++; @@ -184,7 +183,7 @@ void ctcm_unpack_skb(struct channel *ch, struct sk_buff *pskb) */ static void channel_free(struct channel *ch) { - CTCM_DBF_TEXT(TRACE, 2, __FUNCTION__); + CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, "%s(%s)", CTCM_FUNTAIL, ch->id); ch->flags &= ~CHANNEL_FLAGS_INUSE; fsm_newstate(ch->fsm, CTC_STATE_IDLE); } @@ -251,19 +250,12 @@ static struct channel *channel_get(enum channel_types type, { struct channel *ch = channels; - if (do_debug) { - char buf[64]; - sprintf(buf, "%s(%d, %s, %d)\n", - CTCM_FUNTAIL, type, id, direction); - CTCM_DBF_TEXT(TRACE, CTC_DBF_INFO, buf); - } while (ch && (strncmp(ch->id, id, CTCM_ID_SIZE) || (ch->type != type))) ch = ch->next; if (!ch) { - char buf[64]; - sprintf(buf, "%s(%d, %s, %d) not found in channel list\n", + CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, + "%s(%d, %s, %d) not found in channel list\n", CTCM_FUNTAIL, type, id, direction); - CTCM_DBF_TEXT(ERROR, CTC_DBF_ERROR, buf); } else { if (ch->flags & CHANNEL_FLAGS_INUSE) ch = NULL; @@ -283,8 +275,9 @@ static long ctcm_check_irb_error(struct ccw_device *cdev, struct irb *irb) if (!IS_ERR(irb)) return 0; - CTCM_DBF_TEXT_(ERROR, CTC_DBF_WARN, "irb error %ld on device %s\n", - PTR_ERR(irb), cdev->dev.bus_id); + CTCM_DBF_TEXT_(ERROR, CTC_DBF_WARN, + "irb error %ld on device %s\n", + PTR_ERR(irb), cdev->dev.bus_id); switch (PTR_ERR(irb)) { case -EIO: @@ -307,58 +300,85 @@ static long ctcm_check_irb_error(struct ccw_device *cdev, struct irb *irb) * ch The channel, the sense code belongs to. * sense The sense code to inspect. */ -static inline void ccw_unit_check(struct channel *ch, unsigned char sense) +static inline void ccw_unit_check(struct channel *ch, __u8 sense) { - CTCM_DBF_TEXT(TRACE, 5, __FUNCTION__); + CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, + "%s(%s): %02x", + CTCM_FUNTAIL, ch->id, sense); + if (sense & SNS0_INTERVENTION_REQ) { if (sense & 0x01) { - ctcm_pr_debug("%s: Interface disc. or Sel. reset " - "(remote)\n", ch->id); + if (ch->sense_rc != 0x01) { + ctcm_pr_debug("%s: Interface disc. or Sel. " + "reset (remote)\n", ch->id); + ch->sense_rc = 0x01; + } fsm_event(ch->fsm, CTC_EVENT_UC_RCRESET, ch); } else { - ctcm_pr_debug("%s: System reset (remote)\n", ch->id); + if (ch->sense_rc != SNS0_INTERVENTION_REQ) { + ctcm_pr_debug("%s: System reset (remote)\n", + ch->id); + ch->sense_rc = SNS0_INTERVENTION_REQ; + } fsm_event(ch->fsm, CTC_EVENT_UC_RSRESET, ch); } } else if (sense & SNS0_EQUIPMENT_CHECK) { if (sense & SNS0_BUS_OUT_CHECK) { - ctcm_pr_warn("%s: Hardware malfunction (remote)\n", - ch->id); + if (ch->sense_rc != SNS0_BUS_OUT_CHECK) { + CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, + "%s(%s): remote HW error %02x", + CTCM_FUNTAIL, ch->id, sense); + ch->sense_rc = SNS0_BUS_OUT_CHECK; + } fsm_event(ch->fsm, CTC_EVENT_UC_HWFAIL, ch); } else { - ctcm_pr_warn("%s: Read-data parity error (remote)\n", - ch->id); + if (ch->sense_rc != SNS0_EQUIPMENT_CHECK) { + CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, + "%s(%s): remote read parity error %02x", + CTCM_FUNTAIL, ch->id, sense); + ch->sense_rc = SNS0_EQUIPMENT_CHECK; + } fsm_event(ch->fsm, CTC_EVENT_UC_RXPARITY, ch); } } else if (sense & SNS0_BUS_OUT_CHECK) { - if (sense & 0x04) { - ctcm_pr_warn("%s: Data-streaming timeout)\n", ch->id); + if (ch->sense_rc != SNS0_BUS_OUT_CHECK) { + CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, + "%s(%s): BUS OUT error %02x", + CTCM_FUNTAIL, ch->id, sense); + ch->sense_rc = SNS0_BUS_OUT_CHECK; + } + if (sense & 0x04) /* data-streaming timeout */ fsm_event(ch->fsm, CTC_EVENT_UC_TXTIMEOUT, ch); - } else { - ctcm_pr_warn("%s: Data-transfer parity error\n", - ch->id); + else /* Data-transfer parity error */ fsm_event(ch->fsm, CTC_EVENT_UC_TXPARITY, ch); - } } else if (sense & SNS0_CMD_REJECT) { - ctcm_pr_warn("%s: Command reject\n", ch->id); + if (ch->sense_rc != SNS0_CMD_REJECT) { + CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, + "%s(%s): Command rejected", + CTCM_FUNTAIL, ch->id); + ch->sense_rc = SNS0_CMD_REJECT; + } } else if (sense == 0) { - ctcm_pr_debug("%s: Unit check ZERO\n", ch->id); + CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, + "%s(%s): Unit check ZERO", + CTCM_FUNTAIL, ch->id); fsm_event(ch->fsm, CTC_EVENT_UC_ZERO, ch); } else { - ctcm_pr_warn("%s: Unit Check with sense code: %02x\n", - ch->id, sense); + CTCM_DBF_TEXT_(TRACE, CTC_DBF_WARN, + "%s(%s): Unit check code %02x unknown", + CTCM_FUNTAIL, ch->id, sense); fsm_event(ch->fsm, CTC_EVENT_UC_UNKNOWN, ch); } } int ctcm_ch_alloc_buffer(struct channel *ch) { - CTCM_DBF_TEXT(TRACE, 5, __FUNCTION__); - clear_normalized_cda(&ch->ccw[1]); ch->trans_skb = __dev_alloc_skb(ch->max_bufsize, GFP_ATOMIC | GFP_DMA); if (ch->trans_skb == NULL) { - ctcm_pr_warn("%s: Couldn't alloc %s trans_skb\n", - ch->id, + CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, + "%s(%s): %s trans_skb allocation error", + CTCM_FUNTAIL, ch->id, (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); return -ENOMEM; } @@ -367,9 +387,9 @@ int ctcm_ch_alloc_buffer(struct channel *ch) if (set_normalized_cda(&ch->ccw[1], ch->trans_skb->data)) { dev_kfree_skb(ch->trans_skb); ch->trans_skb = NULL; - ctcm_pr_warn("%s: set_normalized_cda for %s " - "trans_skb failed, dropping packets\n", - ch->id, + CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, + "%s(%s): %s set norm_cda failed", + CTCM_FUNTAIL, ch->id, (CHANNEL_DIRECTION(ch->flags) == READ) ? "RX" : "TX"); return -ENOMEM; } @@ -394,7 +414,7 @@ int ctcm_ch_alloc_buffer(struct channel *ch) */ int ctcm_open(struct net_device *dev) { - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; CTCMY_DBF_DEV_NAME(SETUP, dev, ""); if (!IS_MPC(priv)) @@ -412,7 +432,7 @@ int ctcm_open(struct net_device *dev) */ int ctcm_close(struct net_device *dev) { - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; CTCMY_DBF_DEV_NAME(SETUP, dev, ""); if (!IS_MPC(priv)) @@ -516,7 +536,7 @@ static int ctcm_transmit_skb(struct channel *ch, struct sk_buff *skb) atomic_dec(&skb->users); skb_pull(skb, LL_HEADER_LENGTH + 2); ctcm_clear_busy(ch->netdev); - return -EBUSY; + return -ENOMEM; } skb_reset_tail_pointer(ch->trans_skb); @@ -553,7 +573,7 @@ static int ctcm_transmit_skb(struct channel *ch, struct sk_buff *skb) skb_pull(skb, LL_HEADER_LENGTH + 2); } else if (ccw_idx == 0) { struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; priv->stats.tx_packets++; priv->stats.tx_bytes += skb->len - LL_HEADER_LENGTH; } @@ -570,15 +590,12 @@ static void ctcmpc_send_sweep_req(struct channel *rch) struct th_sweep *header; struct sk_buff *sweep_skb; struct channel *ch; - int rc = 0; + /* int rc = 0; */ - priv = dev->priv; + priv = dev->ml_priv; grp = priv->mpcg; ch = priv->channel[WRITE]; - if (do_debug) - MPC_DBF_DEV_NAME(TRACE, dev, ch->id); - /* sweep processing is not complete until response and request */ /* has completed for all read channels in group */ if (grp->in_sweep == 0) { @@ -590,17 +607,16 @@ static void ctcmpc_send_sweep_req(struct channel *rch) sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA); if (sweep_skb == NULL) { - printk(KERN_INFO "Couldn't alloc sweep_skb\n"); - rc = -ENOMEM; - goto done; + /* rc = -ENOMEM; */ + goto nomem; } header = kmalloc(TH_SWEEP_LENGTH, gfp_type()); if (!header) { dev_kfree_skb_any(sweep_skb); - rc = -ENOMEM; - goto done; + /* rc = -ENOMEM; */ + goto nomem; } header->th.th_seg = 0x00 ; @@ -621,12 +637,10 @@ static void ctcmpc_send_sweep_req(struct channel *rch) return; -done: - if (rc != 0) { - grp->in_sweep = 0; - ctcm_clear_busy(dev); - fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); - } +nomem: + grp->in_sweep = 0; + ctcm_clear_busy(dev); + fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); return; } @@ -638,7 +652,7 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) { struct pdu *p_header; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; struct th_header *header; struct sk_buff *nskb; @@ -648,11 +662,9 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) unsigned long saveflags = 0; /* avoids compiler warning */ __u16 block_len; - if (do_debug) - ctcm_pr_debug( - "ctcm enter: %s(): %s cp=%i ch=0x%p id=%s state=%s\n", - __FUNCTION__, dev->name, smp_processor_id(), ch, - ch->id, fsm_getstate_str(ch->fsm)); + CTCM_PR_DEBUG("Enter %s: %s, cp=%i ch=0x%p id=%s state=%s\n", + __func__, dev->name, smp_processor_id(), ch, + ch->id, fsm_getstate_str(ch->fsm)); if ((fsm_getstate(ch->fsm) != CTC_STATE_TXIDLE) || grp->in_sweep) { spin_lock_irqsave(&ch->collect_lock, saveflags); @@ -660,14 +672,8 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) p_header = kmalloc(PDU_HEADER_LENGTH, gfp_type()); if (!p_header) { - printk(KERN_WARNING "ctcm: OUT OF MEMORY IN %s():" - " Data Lost \n", __FUNCTION__); - - atomic_dec(&skb->users); - dev_kfree_skb_any(skb); spin_unlock_irqrestore(&ch->collect_lock, saveflags); - fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); - goto done; + goto nomem_exit; } p_header->pdu_offset = skb->len; @@ -682,13 +688,10 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) memcpy(skb_push(skb, PDU_HEADER_LENGTH), p_header, PDU_HEADER_LENGTH); - if (do_debug_data) { - ctcm_pr_debug("ctcm: %s() Putting on collect_q" - " - skb len: %04x \n", __FUNCTION__, skb->len); - ctcm_pr_debug("ctcm: %s() pdu header and data" - " for up to 32 bytes\n", __FUNCTION__); - ctcmpc_dump32((char *)skb->data, skb->len); - } + CTCM_PR_DEBUG("%s(%s): Put on collect_q - skb len: %04x \n" + "pdu header and data for up to 32 bytes:\n", + __func__, dev->name, skb->len); + CTCM_D3_DUMP((char *)skb->data, min_t(int, 32, skb->len)); skb_queue_tail(&ch->collect_queue, skb); ch->collect_len += skb->len; @@ -713,12 +716,7 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) if (hi) { nskb = __dev_alloc_skb(skb->len, GFP_ATOMIC | GFP_DMA); if (!nskb) { - printk(KERN_WARNING "ctcm: %s() OUT OF MEMORY" - "- Data Lost \n", __FUNCTION__); - atomic_dec(&skb->users); - dev_kfree_skb_any(skb); - fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); - goto done; + goto nomem_exit; } else { memcpy(skb_put(nskb, skb->len), skb->data, skb->len); atomic_inc(&nskb->users); @@ -730,15 +728,8 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) p_header = kmalloc(PDU_HEADER_LENGTH, gfp_type()); - if (!p_header) { - printk(KERN_WARNING "ctcm: %s() OUT OF MEMORY" - ": Data Lost \n", __FUNCTION__); - - atomic_dec(&skb->users); - dev_kfree_skb_any(skb); - fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); - goto done; - } + if (!p_header) + goto nomem_exit; p_header->pdu_offset = skb->len; p_header->pdu_proto = 0x01; @@ -768,15 +759,8 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) ch->prof.txlen += skb->len - PDU_HEADER_LENGTH; header = kmalloc(TH_HEADER_LENGTH, gfp_type()); - - if (!header) { - printk(KERN_WARNING "ctcm: %s() OUT OF MEMORY: Data Lost \n", - __FUNCTION__); - atomic_dec(&skb->users); - dev_kfree_skb_any(skb); - fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); - goto done; - } + if (!header) + goto nomem_exit; header->th_seg = 0x00; header->th_ch_flag = TH_HAS_PDU; /* Normal data */ @@ -785,41 +769,31 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) ch->th_seq_num++; header->th_seq_num = ch->th_seq_num; - if (do_debug_data) - ctcm_pr_debug("ctcm: %s() ToVTAM_th_seq= %08x\n" , - __FUNCTION__, ch->th_seq_num); + CTCM_PR_DBGDATA("%s(%s) ToVTAM_th_seq= %08x\n" , + __func__, dev->name, ch->th_seq_num); /* put the TH on the packet */ memcpy(skb_push(skb, TH_HEADER_LENGTH), header, TH_HEADER_LENGTH); kfree(header); - if (do_debug_data) { - ctcm_pr_debug("ctcm: %s(): skb len: %04x \n", - __FUNCTION__, skb->len); - ctcm_pr_debug("ctcm: %s(): pdu header and data for up to 32 " - "bytes sent to vtam\n", __FUNCTION__); - ctcmpc_dump32((char *)skb->data, skb->len); - } + CTCM_PR_DBGDATA("%s(%s): skb len: %04x\n - pdu header and data for " + "up to 32 bytes sent to vtam:\n", + __func__, dev->name, skb->len); + CTCM_D3_DUMP((char *)skb->data, min_t(int, 32, skb->len)); ch->ccw[4].count = skb->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. + * idal allocation failed, try via copying to trans_skb. + * trans_skb usually has a pre-allocated idal. */ if (ctcm_checkalloc_buffer(ch)) { /* - * Remove our header. It gets added - * again on retransmit. + * Remove our header. + * It gets added again on retransmit. */ - atomic_dec(&skb->users); - dev_kfree_skb_any(skb); - printk(KERN_WARNING "ctcm: %s()OUT OF MEMORY:" - " Data Lost \n", __FUNCTION__); - fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); - goto done; + goto nomem_exit; } skb_reset_tail_pointer(ch->trans_skb); @@ -829,14 +803,11 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) atomic_dec(&skb->users); dev_kfree_skb_irq(skb); ccw_idx = 0; - if (do_debug_data) { - ctcm_pr_debug("ctcm: %s() TRANS skb len: %d \n", - __FUNCTION__, ch->trans_skb->len); - ctcm_pr_debug("ctcm: %s up to 32 bytes of data" - " sent to vtam\n", __FUNCTION__); - ctcmpc_dump32((char *)ch->trans_skb->data, - ch->trans_skb->len); - } + CTCM_PR_DBGDATA("%s(%s): trans_skb len: %04x\n" + "up to 32 bytes sent to vtam:\n", + __func__, dev->name, ch->trans_skb->len); + CTCM_D3_DUMP((char *)ch->trans_skb->data, + min_t(int, 32, ch->trans_skb->len)); } else { skb_queue_tail(&ch->io_queue, skb); ccw_idx = 3; @@ -865,13 +836,21 @@ static int ctcmpc_transmit_skb(struct channel *ch, struct sk_buff *skb) priv->stats.tx_packets++; priv->stats.tx_bytes += skb->len - TH_HEADER_LENGTH; } - if (ch->th_seq_num > 0xf0000000) /* Chose 4Billion at random. */ + if (ch->th_seq_num > 0xf0000000) /* Chose at random. */ ctcmpc_send_sweep_req(ch); + goto done; +nomem_exit: + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_CRIT, + "%s(%s): MEMORY allocation ERROR\n", + CTCM_FUNTAIL, ch->id); + rc = -ENOMEM; + atomic_dec(&skb->users); + dev_kfree_skb_any(skb); + fsm_event(priv->mpcg->fsm, MPCG_EVENT_INOP, dev); done: - if (do_debug) - ctcm_pr_debug("ctcm exit: %s %s()\n", dev->name, __FUNCTION__); - return 0; + CTCM_PR_DEBUG("Exit %s(%s)\n", __func__, dev->name); + return rc; } /** @@ -888,20 +867,19 @@ done: /* first merge version - leaving both functions separated */ static int ctcm_tx(struct sk_buff *skb, struct net_device *dev) { - int rc = 0; - struct ctcm_priv *priv; - - CTCM_DBF_TEXT(TRACE, 5, __FUNCTION__); - priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; if (skb == NULL) { - ctcm_pr_warn("%s: NULL sk_buff passed\n", dev->name); + CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, + "%s(%s): NULL sk_buff passed", + CTCM_FUNTAIL, dev->name); priv->stats.tx_dropped++; return 0; } if (skb_headroom(skb) < (LL_HEADER_LENGTH + 2)) { - ctcm_pr_warn("%s: Got sk_buff with head room < %ld bytes\n", - dev->name, LL_HEADER_LENGTH + 2); + CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, + "%s(%s): Got sk_buff with head room < %ld bytes", + CTCM_FUNTAIL, dev->name, LL_HEADER_LENGTH + 2); dev_kfree_skb(skb); priv->stats.tx_dropped++; return 0; @@ -925,51 +903,43 @@ static int ctcm_tx(struct sk_buff *skb, struct net_device *dev) dev->trans_start = jiffies; if (ctcm_transmit_skb(priv->channel[WRITE], skb) != 0) - rc = 1; - return rc; + return 1; + return 0; } /* unmerged MPC variant of ctcm_tx */ static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) { int len = 0; - struct ctcm_priv *priv = NULL; - struct mpc_group *grp = NULL; + struct ctcm_priv *priv = dev->ml_priv; + struct mpc_group *grp = priv->mpcg; struct sk_buff *newskb = NULL; - if (do_debug) - ctcm_pr_debug("ctcmpc enter: %s(): skb:%0lx\n", - __FUNCTION__, (unsigned long)skb); - - CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, - "ctcmpc enter: %s(): skb:%0lx\n", - __FUNCTION__, (unsigned long)skb); - - priv = dev->priv; - grp = priv->mpcg; /* * Some sanity checks ... */ if (skb == NULL) { - ctcm_pr_warn("ctcmpc: %s: NULL sk_buff passed\n", dev->name); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): NULL sk_buff passed", + CTCM_FUNTAIL, dev->name); priv->stats.tx_dropped++; goto done; } if (skb_headroom(skb) < (TH_HEADER_LENGTH + PDU_HEADER_LENGTH)) { - CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_WARN, - "%s: Got sk_buff with head room < %ld bytes\n", - dev->name, TH_HEADER_LENGTH + PDU_HEADER_LENGTH); + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ERROR, + "%s(%s): Got sk_buff with head room < %ld bytes", + CTCM_FUNTAIL, dev->name, + TH_HEADER_LENGTH + PDU_HEADER_LENGTH); - if (do_debug_data) - ctcmpc_dump32((char *)skb->data, skb->len); + CTCM_D3_DUMP((char *)skb->data, min_t(int, 32, skb->len)); len = skb->len + TH_HEADER_LENGTH + PDU_HEADER_LENGTH; newskb = __dev_alloc_skb(len, gfp_type() | GFP_DMA); if (!newskb) { - printk(KERN_WARNING "ctcmpc: %s() OUT OF MEMORY-" - "Data Lost\n", - __FUNCTION__); + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ERROR, + "%s: %s: __dev_alloc_skb failed", + __func__, dev->name); dev_kfree_skb_any(skb); priv->stats.tx_dropped++; @@ -993,9 +963,9 @@ static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) if ((fsm_getstate(priv->fsm) != DEV_STATE_RUNNING) || (fsm_getstate(grp->fsm) < MPCG_STATE_XID2INITW)) { dev_kfree_skb_any(skb); - printk(KERN_INFO "ctcmpc: %s() DATA RCVD - MPC GROUP " - "NOT ACTIVE - DROPPED\n", - __FUNCTION__); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): inactive MPCGROUP - dropped", + CTCM_FUNTAIL, dev->name); priv->stats.tx_dropped++; priv->stats.tx_errors++; priv->stats.tx_carrier_errors++; @@ -1003,8 +973,9 @@ static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) } if (ctcm_test_and_set_busy(dev)) { - printk(KERN_WARNING "%s:DEVICE ERR - UNRECOVERABLE DATA LOSS\n", - __FUNCTION__); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): device busy - dropped", + CTCM_FUNTAIL, dev->name); dev_kfree_skb_any(skb); priv->stats.tx_dropped++; priv->stats.tx_errors++; @@ -1015,12 +986,9 @@ static int ctcmpc_tx(struct sk_buff *skb, struct net_device *dev) dev->trans_start = jiffies; if (ctcmpc_transmit_skb(priv->channel[WRITE], skb) != 0) { - printk(KERN_WARNING "ctcmpc: %s() DEVICE ERROR" - ": Data Lost \n", - __FUNCTION__); - printk(KERN_WARNING "ctcmpc: %s() DEVICE ERROR" - " - UNRECOVERABLE DATA LOSS\n", - __FUNCTION__); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): device error - dropped", + CTCM_FUNTAIL, dev->name); dev_kfree_skb_any(skb); priv->stats.tx_dropped++; priv->stats.tx_errors++; @@ -1054,12 +1022,10 @@ static int ctcm_change_mtu(struct net_device *dev, int new_mtu) struct ctcm_priv *priv; int max_bufsize; - CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); - if (new_mtu < 576 || new_mtu > 65527) return -EINVAL; - priv = dev->priv; + priv = dev->ml_priv; max_bufsize = priv->channel[READ]->max_bufsize; if (IS_MPC(priv)) { @@ -1084,22 +1050,7 @@ static int ctcm_change_mtu(struct net_device *dev, int new_mtu) */ static struct net_device_stats *ctcm_stats(struct net_device *dev) { - return &((struct ctcm_priv *)dev->priv)->stats; -} - - -static void ctcm_netdev_unregister(struct net_device *dev) -{ - CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); - if (!dev) - return; - unregister_netdev(dev); -} - -static int ctcm_netdev_register(struct net_device *dev) -{ - CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); - return register_netdev(dev); + return &((struct ctcm_priv *)dev->ml_priv)->stats; } static void ctcm_free_netdevice(struct net_device *dev) @@ -1107,11 +1058,9 @@ static void ctcm_free_netdevice(struct net_device *dev) struct ctcm_priv *priv; struct mpc_group *grp; - CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); - - if (!dev) - return; - priv = dev->priv; + CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, + "%s(%s)", CTCM_FUNTAIL, dev->name); + priv = dev->ml_priv; if (priv) { grp = priv->mpcg; if (grp) { @@ -1171,10 +1120,12 @@ static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv) dev = alloc_netdev(0, CTC_DEVICE_GENE, ctcm_dev_setup); if (!dev) { - ctcm_pr_err("%s: Out of memory\n", __FUNCTION__); + CTCM_DBF_TEXT_(ERROR, CTC_DBF_CRIT, + "%s: MEMORY allocation ERROR", + CTCM_FUNTAIL); return NULL; } - dev->priv = priv; + dev->ml_priv = priv; priv->fsm = init_fsm("ctcmdev", dev_state_names, dev_event_names, CTCM_NR_DEV_STATES, CTCM_NR_DEV_EVENTS, dev_fsm, dev_fsm_len, GFP_KERNEL); @@ -1209,6 +1160,7 @@ static struct net_device *ctcm_init_netdevice(struct ctcm_priv *priv) } CTCMY_DBF_DEV(SETUP, dev, "finished"); + return dev; } @@ -1226,18 +1178,24 @@ static void ctcm_irq_handler(struct ccw_device *cdev, struct net_device *dev; struct ctcm_priv *priv; struct ccwgroup_device *cgdev; + int cstat; + int dstat; + + CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, + "Enter %s(%s)", CTCM_FUNTAIL, &cdev->dev.bus_id); - CTCM_DBF_TEXT(TRACE, CTC_DBF_DEBUG, __FUNCTION__); if (ctcm_check_irb_error(cdev, irb)) return; cgdev = dev_get_drvdata(&cdev->dev); + cstat = irb->scsw.cmd.cstat; + dstat = irb->scsw.cmd.dstat; + /* Check for unsolicited interrupts. */ if (cgdev == NULL) { - ctcm_pr_warn("ctcm: Got unsolicited irq: %s c-%02x d-%02x\n", - cdev->dev.bus_id, irb->scsw.cmd.cstat, - irb->scsw.cmd.dstat); + ctcm_pr_warn("ctcm: Got unsolicited irq: c-%02x d-%02x\n", + cstat, dstat); return; } @@ -1254,26 +1212,22 @@ static void ctcm_irq_handler(struct ccw_device *cdev, return; } - dev = (struct net_device *)(ch->netdev); + dev = ch->netdev; if (dev == NULL) { ctcm_pr_crit("ctcm: %s dev=NULL bus_id=%s, ch=0x%p\n", - __FUNCTION__, cdev->dev.bus_id, ch); + __func__, cdev->dev.bus_id, ch); return; } - if (do_debug) - ctcm_pr_debug("%s: interrupt for device: %s " - "received c-%02x d-%02x\n", - dev->name, - ch->id, - irb->scsw.cmd.cstat, - irb->scsw.cmd.dstat); + CTCM_DBF_TEXT_(TRACE, CTC_DBF_DEBUG, + "%s(%s): int. for %s: cstat=%02x dstat=%02x", + CTCM_FUNTAIL, dev->name, ch->id, cstat, dstat); /* Copy interruption response block. */ memcpy(ch->irb, irb, sizeof(struct irb)); - /* Check for good subchannel return code, otherwise error message */ if (irb->scsw.cmd.cstat) { + /* Check for good subchannel return code, otherwise error message */ fsm_event(ch->fsm, CTC_EVENT_SC_UNKNOWN, ch); ctcm_pr_warn("%s: subchannel check for dev: %s - %02x %02x\n", dev->name, ch->id, irb->scsw.cmd.cstat, @@ -1283,6 +1237,11 @@ static void ctcm_irq_handler(struct ccw_device *cdev, /* Check the reason-code of a unit check */ if (irb->scsw.cmd.dstat & DEV_STAT_UNIT_CHECK) { + if ((irb->ecw[0] & ch->sense_rc) == 0) + /* print it only once */ + CTCM_DBF_TEXT_(TRACE, CTC_DBF_INFO, + "%s(%s): sense=%02x, ds=%02x", + CTCM_FUNTAIL, ch->id, irb->ecw[0], dstat); ccw_unit_check(ch, irb->ecw[0]); return; } @@ -1320,14 +1279,18 @@ static int ctcm_probe_device(struct ccwgroup_device *cgdev) struct ctcm_priv *priv; int rc; - CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, "%s %p", __FUNCTION__, cgdev); + CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, + "%s %p", + __func__, cgdev); if (!get_device(&cgdev->dev)) return -ENODEV; priv = kzalloc(sizeof(struct ctcm_priv), GFP_KERNEL); if (!priv) { - ctcm_pr_err("%s: Out of memory\n", __FUNCTION__); + CTCM_DBF_TEXT_(ERROR, CTC_DBF_ERROR, + "%s: memory allocation failure", + CTCM_FUNTAIL); put_device(&cgdev->dev); return -ENOMEM; } @@ -1364,10 +1327,13 @@ static int add_channel(struct ccw_device *cdev, enum channel_types type, int ccw_num; int rc = 0; - CTCM_DBF_TEXT(TRACE, 2, __FUNCTION__); + CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, + "%s(%s), type %d, proto %d", + __func__, cdev->dev.bus_id, type, priv->protocol); + ch = kzalloc(sizeof(struct channel), GFP_KERNEL); if (ch == NULL) - goto nomem_return; + return -ENOMEM; ch->protocol = priv->protocol; if (IS_MPC(priv)) { @@ -1478,7 +1444,7 @@ static int add_channel(struct ccw_device *cdev, enum channel_types type, if (*c && (!strncmp((*c)->id, ch->id, CTCM_ID_SIZE))) { CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, "%s (%s) already in list, using old entry", - __FUNCTION__, (*c)->id); + __func__, (*c)->id); goto free_return; } @@ -1498,11 +1464,10 @@ static int add_channel(struct ccw_device *cdev, enum channel_types type, return 0; nomem_return: - ctcm_pr_warn("ctcm: Out of memory in %s\n", __FUNCTION__); rc = -ENOMEM; free_return: /* note that all channel pointers are 0 or valid */ - kfree(ch->ccw); /* TODO: check that again */ + kfree(ch->ccw); kfree(ch->discontact_th); kfree_fsm(ch->fsm); kfree(ch->irb); @@ -1540,48 +1505,48 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) enum channel_types type; struct ctcm_priv *priv; struct net_device *dev; + struct ccw_device *cdev0; + struct ccw_device *cdev1; int ret; - CTCM_DBF_TEXT(SETUP, CTC_DBF_INFO, __FUNCTION__); - priv = dev_get_drvdata(&cgdev->dev); if (!priv) return -ENODEV; - type = get_channel_type(&cgdev->cdev[0]->id); + cdev0 = cgdev->cdev[0]; + cdev1 = cgdev->cdev[1]; - snprintf(read_id, CTCM_ID_SIZE, "ch-%s", cgdev->cdev[0]->dev.bus_id); - snprintf(write_id, CTCM_ID_SIZE, "ch-%s", cgdev->cdev[1]->dev.bus_id); + type = get_channel_type(&cdev0->id); - ret = add_channel(cgdev->cdev[0], type, priv); + snprintf(read_id, CTCM_ID_SIZE, "ch-%s", cdev0->dev.bus_id); + snprintf(write_id, CTCM_ID_SIZE, "ch-%s", cdev1->dev.bus_id); + + ret = add_channel(cdev0, type, priv); if (ret) return ret; - ret = add_channel(cgdev->cdev[1], type, priv); + ret = add_channel(cdev1, type, priv); if (ret) return ret; - ret = ccw_device_set_online(cgdev->cdev[0]); + ret = ccw_device_set_online(cdev0); if (ret != 0) { - CTCM_DBF_TEXT(SETUP, CTC_DBF_WARN, - "ccw_device_set_online (cdev[0]) failed "); - ctcm_pr_warn("ccw_device_set_online (cdev[0]) failed " - "with ret = %d\n", ret); + /* may be ok to fail now - can be done later */ + CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, + "%s(%s) set_online rc=%d", + CTCM_FUNTAIL, read_id, ret); } - ret = ccw_device_set_online(cgdev->cdev[1]); + ret = ccw_device_set_online(cdev1); if (ret != 0) { - CTCM_DBF_TEXT(SETUP, CTC_DBF_WARN, - "ccw_device_set_online (cdev[1]) failed "); - ctcm_pr_warn("ccw_device_set_online (cdev[1]) failed " - "with ret = %d\n", ret); + /* may be ok to fail now - can be done later */ + CTCM_DBF_TEXT_(TRACE, CTC_DBF_NOTICE, + "%s(%s) set_online rc=%d", + CTCM_FUNTAIL, write_id, ret); } dev = ctcm_init_netdevice(priv); - - if (dev == NULL) { - ctcm_pr_warn("ctcm_init_netdevice failed\n"); - goto out; - } + if (dev == NULL) + goto out; for (direction = READ; direction <= WRITE; direction++) { priv->channel[direction] = @@ -1590,8 +1555,7 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) if (priv->channel[direction] == NULL) { if (direction == WRITE) channel_free(priv->channel[READ]); - ctcm_free_netdevice(dev); - goto out; + goto out_dev; } priv->channel[direction]->netdev = dev; priv->channel[direction]->protocol = priv->protocol; @@ -1600,26 +1564,24 @@ static int ctcm_new_device(struct ccwgroup_device *cgdev) /* sysfs magic */ SET_NETDEV_DEV(dev, &cgdev->dev); - if (ctcm_netdev_register(dev) != 0) { - ctcm_free_netdevice(dev); - goto out; - } + if (register_netdev(dev)) + goto out_dev; if (ctcm_add_attributes(&cgdev->dev)) { - ctcm_netdev_unregister(dev); -/* dev->priv = NULL; why that ???? */ - ctcm_free_netdevice(dev); - goto out; + unregister_netdev(dev); + goto out_dev; } strlcpy(priv->fsm->name, dev->name, sizeof(priv->fsm->name)); CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, - "setup(%s) ok : r/w = %s / %s, proto : %d", - dev->name, priv->channel[READ]->id, + "setup(%s) OK : r/w = %s/%s, protocol : %d", dev->name, + priv->channel[READ]->id, priv->channel[WRITE]->id, priv->protocol); return 0; +out_dev: + ctcm_free_netdevice(dev); out: ccw_device_set_offline(cgdev->cdev[1]); ccw_device_set_offline(cgdev->cdev[0]); @@ -1658,8 +1620,7 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev) channel_free(priv->channel[WRITE]); if (dev) { - ctcm_netdev_unregister(dev); -/* dev->priv = NULL; why that ??? */ + unregister_netdev(dev); ctcm_free_netdevice(dev); } @@ -1682,13 +1643,16 @@ static int ctcm_shutdown_device(struct ccwgroup_device *cgdev) static void ctcm_remove_device(struct ccwgroup_device *cgdev) { - struct ctcm_priv *priv; + struct ctcm_priv *priv = dev_get_drvdata(&cgdev->dev); - CTCM_DBF_TEXT(SETUP, CTC_DBF_ERROR, __FUNCTION__); + BUG_ON(priv == NULL); + + CTCM_DBF_TEXT_(SETUP, CTC_DBF_INFO, + "removing device %s, r/w = %s/%s, proto : %d", + priv->channel[READ]->netdev->name, + priv->channel[READ]->id, priv->channel[WRITE]->id, + priv->protocol); - priv = dev_get_drvdata(&cgdev->dev); - if (!priv) - return; if (cgdev->state == CCWGROUP_ONLINE) ctcm_shutdown_device(cgdev); ctcm_remove_files(&cgdev->dev); @@ -1748,8 +1712,6 @@ static int __init ctcm_init(void) ret = ctcm_register_dbf_views(); if (ret) { - ctcm_pr_crit("ctcm_init failed with ctcm_register_dbf_views " - "rc = %d\n", ret); return ret; } ret = register_cu3088_discipline(&ctcm_group_driver); diff --git a/drivers/s390/net/ctcm_main.h b/drivers/s390/net/ctcm_main.h index 95b0c0b6ebc..8e10ee86a5e 100644 --- a/drivers/s390/net/ctcm_main.h +++ b/drivers/s390/net/ctcm_main.h @@ -22,9 +22,9 @@ #define CTC_DRIVER_NAME "ctcm" #define CTC_DEVICE_NAME "ctc" -#define CTC_DEVICE_GENE "ctc%d" #define MPC_DEVICE_NAME "mpc" -#define MPC_DEVICE_GENE "mpc%d" +#define CTC_DEVICE_GENE CTC_DEVICE_NAME "%d" +#define MPC_DEVICE_GENE MPC_DEVICE_NAME "%d" #define CHANNEL_FLAGS_READ 0 #define CHANNEL_FLAGS_WRITE 1 @@ -48,6 +48,30 @@ #define ctcm_pr_err(fmt, arg...) printk(KERN_ERR fmt, ##arg) #define ctcm_pr_crit(fmt, arg...) printk(KERN_CRIT fmt, ##arg) +#define CTCM_PR_DEBUG(fmt, arg...) \ + do { \ + if (do_debug) \ + printk(KERN_DEBUG fmt, ##arg); \ + } while (0) + +#define CTCM_PR_DBGDATA(fmt, arg...) \ + do { \ + if (do_debug_data) \ + printk(KERN_DEBUG fmt, ##arg); \ + } while (0) + +#define CTCM_D3_DUMP(buf, len) \ + do { \ + if (do_debug_data) \ + ctcmpc_dumpit(buf, len); \ + } while (0) + +#define CTCM_CCW_DUMP(buf, len) \ + do { \ + if (do_debug_ccw) \ + ctcmpc_dumpit(buf, len); \ + } while (0) + /* * CCW commands, used in this driver. */ @@ -161,8 +185,9 @@ struct channel { fsm_instance *fsm; /* finite state machine of this channel */ struct net_device *netdev; /* corresponding net_device */ struct ctcm_profile prof; - unsigned char *trans_skb_data; + __u8 *trans_skb_data; __u16 logflags; + __u8 sense_rc; /* last unit check sense code report control */ }; struct ctcm_priv { @@ -204,14 +229,14 @@ void ctcm_remove_files(struct device *dev); */ static inline void ctcm_clear_busy_do(struct net_device *dev) { - clear_bit(0, &(((struct ctcm_priv *)dev->priv)->tbusy)); + clear_bit(0, &(((struct ctcm_priv *)dev->ml_priv)->tbusy)); netif_wake_queue(dev); } static inline void ctcm_clear_busy(struct net_device *dev) { struct mpc_group *grp; - grp = ((struct ctcm_priv *)dev->priv)->mpcg; + grp = ((struct ctcm_priv *)dev->ml_priv)->mpcg; if (!(grp && grp->in_sweep)) ctcm_clear_busy_do(dev); @@ -221,7 +246,8 @@ static inline void ctcm_clear_busy(struct net_device *dev) static inline int ctcm_test_and_set_busy(struct net_device *dev) { netif_stop_queue(dev); - return test_and_set_bit(0, &(((struct ctcm_priv *)dev->priv)->tbusy)); + return test_and_set_bit(0, + &(((struct ctcm_priv *)dev->ml_priv)->tbusy)); } extern int loglevel; @@ -267,7 +293,7 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv); #define IS_MPC(p) ((p)->protocol == CTCM_PROTO_MPC) /* test if struct ctcm_priv of struct net_device has MPC protocol setting */ -#define IS_MPCDEV(d) IS_MPC((struct ctcm_priv *)d->priv) +#define IS_MPCDEV(dev) IS_MPC((struct ctcm_priv *)dev->ml_priv) static inline gfp_t gfp_type(void) { diff --git a/drivers/s390/net/ctcm_mpc.c b/drivers/s390/net/ctcm_mpc.c index 044addee64a..cbe470493bf 100644 --- a/drivers/s390/net/ctcm_mpc.c +++ b/drivers/s390/net/ctcm_mpc.c @@ -19,7 +19,6 @@ #undef DEBUGDATA #undef DEBUGCCW -#include <linux/version.h> #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> @@ -149,7 +148,7 @@ void ctcmpc_dumpit(char *buf, int len) for (ct = 0; ct < len; ct++, ptr++, rptr++) { if (sw == 0) { #if (UTS_MACHINE == s390x) - sprintf(addr, "%16.16lx", (unsigned long)rptr); + sprintf(addr, "%16.16lx", (__u64)rptr); #else sprintf(addr, "%8.8X", (__u32)rptr); #endif @@ -164,7 +163,7 @@ void ctcmpc_dumpit(char *buf, int len) strcat(bhex, " "); #if (UTS_MACHINE == s390x) - sprintf(tbuf, "%2.2lX", (unsigned long)*ptr); + sprintf(tbuf, "%2.2lX", (__u64)*ptr); #else sprintf(tbuf, "%2.2X", (__u32)*ptr); #endif @@ -179,24 +178,24 @@ void ctcmpc_dumpit(char *buf, int len) basc[sw+1] = '\0'; sw++; rm--; - if (sw == 16) { - if ((strcmp(duphex, bhex)) != 0) { - if (dup != 0) { - sprintf(tdup, "Duplicate as above " - "to %s", addr); - printk(KERN_INFO " " - " --- %s ---\n", tdup); - } - printk(KERN_INFO " %s (+%s) : %s [%s]\n", + if (sw != 16) + continue; + if ((strcmp(duphex, bhex)) != 0) { + if (dup != 0) { + sprintf(tdup, + "Duplicate as above to %s", addr); + ctcm_pr_debug(" --- %s ---\n", + tdup); + } + ctcm_pr_debug(" %s (+%s) : %s [%s]\n", addr, boff, bhex, basc); - dup = 0; - strcpy(duphex, bhex); - } else - dup++; + dup = 0; + strcpy(duphex, bhex); + } else + dup++; - sw = 0; - rm = 16; - } + sw = 0; + rm = 16; } /* endfor */ if (sw != 0) { @@ -210,19 +209,17 @@ void ctcmpc_dumpit(char *buf, int len) } if (dup != 0) { sprintf(tdup, "Duplicate as above to %s", addr); - printk(KERN_INFO " " - " --- %s ---\n", tdup); + ctcm_pr_debug(" --- %s ---\n", tdup); } - printk(KERN_INFO " %s (+%s) : %s [%s]\n", - addr, boff, bhex, basc); + ctcm_pr_debug(" %s (+%s) : %s [%s]\n", + addr, boff, bhex, basc); } else { if (dup >= 1) { sprintf(tdup, "Duplicate as above to %s", addr); - printk(KERN_INFO " " - " --- %s ---\n", tdup); + ctcm_pr_debug(" --- %s ---\n", tdup); } if (dup != 0) { - printk(KERN_INFO " %s (+%s) : %s [%s]\n", + ctcm_pr_debug(" %s (+%s) : %s [%s]\n", addr, boff, bhex, basc); } } @@ -241,7 +238,7 @@ void ctcmpc_dumpit(char *buf, int len) */ void ctcmpc_dump_skb(struct sk_buff *skb, int offset) { - unsigned char *p = skb->data; + __u8 *p = skb->data; struct th_header *header; struct pdu *pheader; int bl = skb->len; @@ -253,8 +250,8 @@ void ctcmpc_dump_skb(struct sk_buff *skb, int offset) p += offset; header = (struct th_header *)p; - printk(KERN_INFO "dump:\n"); - printk(KERN_INFO "skb len=%d \n", skb->len); + ctcm_pr_debug("dump:\n"); + ctcm_pr_debug("skb len=%d \n", skb->len); if (skb->len > 2) { switch (header->th_ch_flag) { case TH_HAS_PDU: @@ -273,32 +270,64 @@ void ctcmpc_dump_skb(struct sk_buff *skb, int offset) } pheader = (struct pdu *)p; - printk(KERN_INFO "pdu->offset: %d hex: %04x\n", - pheader->pdu_offset, pheader->pdu_offset); - printk(KERN_INFO "pdu->flag : %02x\n", pheader->pdu_flag); - printk(KERN_INFO "pdu->proto : %02x\n", pheader->pdu_proto); - printk(KERN_INFO "pdu->seq : %02x\n", pheader->pdu_seq); + ctcm_pr_debug("pdu->offset: %d hex: %04x\n", + pheader->pdu_offset, pheader->pdu_offset); + ctcm_pr_debug("pdu->flag : %02x\n", pheader->pdu_flag); + ctcm_pr_debug("pdu->proto : %02x\n", pheader->pdu_proto); + ctcm_pr_debug("pdu->seq : %02x\n", pheader->pdu_seq); goto dumpdata; dumpth: - printk(KERN_INFO "th->seg : %02x\n", header->th_seg); - printk(KERN_INFO "th->ch : %02x\n", header->th_ch_flag); - printk(KERN_INFO "th->blk_flag: %02x\n", header->th_blk_flag); - printk(KERN_INFO "th->type : %s\n", - (header->th_is_xid) ? "DATA" : "XID"); - printk(KERN_INFO "th->seqnum : %04x\n", header->th_seq_num); + ctcm_pr_debug("th->seg : %02x\n", header->th_seg); + ctcm_pr_debug("th->ch : %02x\n", header->th_ch_flag); + ctcm_pr_debug("th->blk_flag: %02x\n", header->th_blk_flag); + ctcm_pr_debug("th->type : %s\n", + (header->th_is_xid) ? "DATA" : "XID"); + ctcm_pr_debug("th->seqnum : %04x\n", header->th_seq_num); } dumpdata: if (bl > 32) bl = 32; - printk(KERN_INFO "data: "); + ctcm_pr_debug("data: "); for (i = 0; i < bl; i++) - printk(KERN_INFO "%02x%s", *p++, (i % 16) ? " " : "\n<7>"); - printk(KERN_INFO "\n"); + ctcm_pr_debug("%02x%s", *p++, (i % 16) ? " " : "\n"); + ctcm_pr_debug("\n"); } #endif +static struct net_device *ctcmpc_get_dev(int port_num) +{ + char device[20]; + struct net_device *dev; + struct ctcm_priv *priv; + + sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); + + dev = __dev_get_by_name(&init_net, device); + + if (dev == NULL) { + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s: Device not found by name: %s", + CTCM_FUNTAIL, device); + return NULL; + } + priv = dev->ml_priv; + if (priv == NULL) { + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): dev->ml_priv is NULL", + CTCM_FUNTAIL, device); + return NULL; + } + if (priv->mpcg == NULL) { + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): priv->mpcg is NULL", + CTCM_FUNTAIL, device); + return NULL; + } + return dev; +} + /* * ctc_mpc_alloc_channel * (exported interface) @@ -308,34 +337,23 @@ dumpdata: */ int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int)) { - char device[20]; struct net_device *dev; struct mpc_group *grp; struct ctcm_priv *priv; - ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); - - sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); - dev = __dev_get_by_name(&init_net, device); - - if (dev == NULL) { - printk(KERN_INFO "ctc_mpc_alloc_channel %s dev=NULL\n", device); + dev = ctcmpc_get_dev(port_num); + if (dev == NULL) return 1; - } - - priv = dev->priv; + priv = dev->ml_priv; grp = priv->mpcg; - if (!grp) - return 1; grp->allochanfunc = callback; grp->port_num = port_num; grp->port_persist = 1; - ctcm_pr_debug("ctcmpc: %s called for device %s state=%s\n", - __FUNCTION__, - dev->name, - fsm_getstate_str(grp->fsm)); + CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_INFO, + "%s(%s): state=%s", + CTCM_FUNTAIL, dev->name, fsm_getstate_str(grp->fsm)); switch (fsm_getstate(grp->fsm)) { case MPCG_STATE_INOP: @@ -377,12 +395,8 @@ int ctc_mpc_alloc_channel(int port_num, void (*callback)(int, int)) grp->allocchan_callback_retries = 0; } break; - default: - return 0; - } - ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); return 0; } EXPORT_SYMBOL(ctc_mpc_alloc_channel); @@ -394,31 +408,22 @@ EXPORT_SYMBOL(ctc_mpc_alloc_channel); void ctc_mpc_establish_connectivity(int port_num, void (*callback)(int, int, int)) { - char device[20]; struct net_device *dev; struct mpc_group *grp; struct ctcm_priv *priv; struct channel *rch, *wch; - ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); - - sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); - dev = __dev_get_by_name(&init_net, device); - - if (dev == NULL) { - printk(KERN_INFO "ctc_mpc_establish_connectivity " - "%s dev=NULL\n", device); + dev = ctcmpc_get_dev(port_num); + if (dev == NULL) return; - } - priv = dev->priv; + priv = dev->ml_priv; + grp = priv->mpcg; rch = priv->channel[READ]; wch = priv->channel[WRITE]; - grp = priv->mpcg; - - ctcm_pr_debug("ctcmpc: %s() called for device %s state=%s\n", - __FUNCTION__, dev->name, - fsm_getstate_str(grp->fsm)); + CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_INFO, + "%s(%s): state=%s", + CTCM_FUNTAIL, dev->name, fsm_getstate_str(grp->fsm)); grp->estconnfunc = callback; grp->port_num = port_num; @@ -446,8 +451,10 @@ void ctc_mpc_establish_connectivity(int port_num, case MPCG_STATE_RESET: /* MPC Group is not ready to start XID - min num of */ /* 1 read and 1 write channel have not been acquired*/ - printk(KERN_WARNING "ctcmpc: %s() REJECTED ACTIVE XID Req" - "uest - Channel Pair is not Active\n", __FUNCTION__); + + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): REJECTED - inactive channels", + CTCM_FUNTAIL, dev->name); if (grp->estconnfunc) { grp->estconnfunc(grp->port_num, -1, 0); grp->estconnfunc = NULL; @@ -457,11 +464,12 @@ void ctc_mpc_establish_connectivity(int port_num, /* alloc channel was called but no XID exchange */ /* has occurred. initiate xside XID exchange */ /* make sure yside XID0 processing has not started */ + if ((fsm_getstate(rch->fsm) > CH_XID0_PENDING) || (fsm_getstate(wch->fsm) > CH_XID0_PENDING)) { - printk(KERN_WARNING "mpc: %s() ABORT ACTIVE XID" - " Request- PASSIVE XID in process\n" - , __FUNCTION__); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): ABORT - PASSIVE XID", + CTCM_FUNTAIL, dev->name); break; } grp->send_qllc_disc = 1; @@ -476,9 +484,9 @@ void ctc_mpc_establish_connectivity(int port_num, (fsm_getstate(rch->fsm) == CH_XID0_PENDING)) fsm_event(grp->fsm, MPCG_EVENT_XID0DO, rch); else { - printk(KERN_WARNING "mpc: %s() Unable to start" - " ACTIVE XID0 on read channel\n", - __FUNCTION__); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): RX-%s not ready for ACTIVE XID0", + CTCM_FUNTAIL, dev->name, rch->id); if (grp->estconnfunc) { grp->estconnfunc(grp->port_num, -1, 0); grp->estconnfunc = NULL; @@ -490,9 +498,9 @@ void ctc_mpc_establish_connectivity(int port_num, (fsm_getstate(wch->fsm) == CH_XID0_PENDING)) fsm_event(grp->fsm, MPCG_EVENT_XID0DO, wch); else { - printk(KERN_WARNING "mpc: %s() Unable to start" - " ACTIVE XID0 on write channel\n", - __FUNCTION__); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): WX-%s not ready for ACTIVE XID0", + CTCM_FUNTAIL, dev->name, wch->id); if (grp->estconnfunc) { grp->estconnfunc(grp->port_num, -1, 0); grp->estconnfunc = NULL; @@ -508,7 +516,7 @@ void ctc_mpc_establish_connectivity(int port_num, } done: - ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); + CTCM_PR_DEBUG("Exit %s()\n", __func__); return; } EXPORT_SYMBOL(ctc_mpc_establish_connectivity); @@ -520,40 +528,22 @@ EXPORT_SYMBOL(ctc_mpc_establish_connectivity); void ctc_mpc_dealloc_ch(int port_num) { struct net_device *dev; - char device[20]; struct ctcm_priv *priv; struct mpc_group *grp; - ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); - sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); - dev = __dev_get_by_name(&init_net, device); - - if (dev == NULL) { - printk(KERN_INFO "%s() %s dev=NULL\n", __FUNCTION__, device); - goto done; - } + dev = ctcmpc_get_dev(port_num); + if (dev == NULL) + return; + priv = dev->ml_priv; + grp = priv->mpcg; - ctcm_pr_debug("ctcmpc:%s %s() called for device %s refcount=%d\n", - dev->name, __FUNCTION__, - dev->name, atomic_read(&dev->refcnt)); + CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_DEBUG, + "%s: %s: refcount = %d\n", + CTCM_FUNTAIL, dev->name, atomic_read(&dev->refcnt)); - priv = dev->priv; - if (priv == NULL) { - printk(KERN_INFO "%s() %s priv=NULL\n", - __FUNCTION__, device); - goto done; - } fsm_deltimer(&priv->restart_timer); - - grp = priv->mpcg; - if (grp == NULL) { - printk(KERN_INFO "%s() %s dev=NULL\n", __FUNCTION__, device); - goto done; - } grp->channels_terminating = 0; - fsm_deltimer(&grp->timer); - grp->allochanfunc = NULL; grp->estconnfunc = NULL; grp->port_persist = 0; @@ -561,8 +551,6 @@ void ctc_mpc_dealloc_ch(int port_num) fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); ctcm_close(dev); -done: - ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); return; } EXPORT_SYMBOL(ctc_mpc_dealloc_ch); @@ -573,32 +561,22 @@ EXPORT_SYMBOL(ctc_mpc_dealloc_ch); */ void ctc_mpc_flow_control(int port_num, int flowc) { - char device[20]; struct ctcm_priv *priv; struct mpc_group *grp; struct net_device *dev; struct channel *rch; int mpcg_state; - ctcm_pr_debug("ctcmpc enter: %s() %i\n", __FUNCTION__, flowc); - - sprintf(device, "%s%i", MPC_DEVICE_NAME, port_num); - dev = __dev_get_by_name(&init_net, device); - - if (dev == NULL) { - printk(KERN_INFO "ctc_mpc_flow_control %s dev=NULL\n", device); + dev = ctcmpc_get_dev(port_num); + if (dev == NULL) return; - } + priv = dev->ml_priv; + grp = priv->mpcg; - ctcm_pr_debug("ctcmpc: %s %s called \n", dev->name, __FUNCTION__); + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, + "%s: %s: flowc = %d", + CTCM_FUNTAIL, dev->name, flowc); - priv = dev->priv; - if (priv == NULL) { - printk(KERN_INFO "ctcmpc:%s() %s priv=NULL\n", - __FUNCTION__, device); - return; - } - grp = priv->mpcg; rch = priv->channel[READ]; mpcg_state = fsm_getstate(grp->fsm); @@ -629,7 +607,6 @@ void ctc_mpc_flow_control(int port_num, int flowc) break; } - ctcm_pr_debug("ctcmpc exit: %s() %i\n", __FUNCTION__, flowc); } EXPORT_SYMBOL(ctc_mpc_flow_control); @@ -642,16 +619,12 @@ static void mpc_rcvd_sweep_resp(struct mpcg_info *mpcginfo) { struct channel *rch = mpcginfo->ch; struct net_device *dev = rch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; struct channel *ch = priv->channel[WRITE]; - if (do_debug) - ctcm_pr_debug("ctcmpc enter: %s(): ch=0x%p id=%s\n", - __FUNCTION__, ch, ch->id); - - if (do_debug_data) - ctcmpc_dumpit((char *)mpcginfo->sweep, TH_SWEEP_LENGTH); + CTCM_PR_DEBUG("%s: ch=0x%p id=%s\n", __func__, ch, ch->id); + CTCM_D3_DUMP((char *)mpcginfo->sweep, TH_SWEEP_LENGTH); grp->sweep_rsp_pend_num--; @@ -677,21 +650,20 @@ static void mpc_rcvd_sweep_resp(struct mpcg_info *mpcginfo) static void ctcmpc_send_sweep_resp(struct channel *rch) { struct net_device *dev = rch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; int rc = 0; struct th_sweep *header; struct sk_buff *sweep_skb; struct channel *ch = priv->channel[WRITE]; - if (do_debug) - ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", - __FUNCTION__, rch, rch->id); + CTCM_PR_DEBUG("%s: ch=0x%p id=%s\n", __func__, rch, rch->id); - sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, - GFP_ATOMIC|GFP_DMA); + sweep_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC | GFP_DMA); if (sweep_skb == NULL) { - printk(KERN_INFO "Couldn't alloc sweep_skb\n"); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): sweep_skb allocation ERROR\n", + CTCM_FUNTAIL, rch->id); rc = -ENOMEM; goto done; } @@ -740,13 +712,13 @@ static void mpc_rcvd_sweep_req(struct mpcg_info *mpcginfo) { struct channel *rch = mpcginfo->ch; struct net_device *dev = rch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; struct channel *ch = priv->channel[WRITE]; if (do_debug) CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, - " %s(): ch=0x%p id=%s\n", __FUNCTION__, ch, ch->id); + " %s(): ch=0x%p id=%s\n", __func__, ch, ch->id); if (grp->in_sweep == 0) { grp->in_sweep = 1; @@ -755,8 +727,7 @@ static void mpc_rcvd_sweep_req(struct mpcg_info *mpcginfo) grp->sweep_rsp_pend_num = grp->active_channels[READ]; } - if (do_debug_data) - ctcmpc_dumpit((char *)mpcginfo->sweep, TH_SWEEP_LENGTH); + CTCM_D3_DUMP((char *)mpcginfo->sweep, TH_SWEEP_LENGTH); grp->sweep_req_pend_num--; ctcmpc_send_sweep_resp(ch); @@ -875,25 +846,13 @@ static int mpcg_fsm_len = ARRAY_SIZE(mpcg_fsm); static void mpc_action_go_ready(fsm_instance *fsm, int event, void *arg) { struct net_device *dev = arg; - struct ctcm_priv *priv = NULL; - struct mpc_group *grp = NULL; - - if (dev == NULL) { - printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); - return; - } - - ctcm_pr_debug("ctcmpc enter: %s %s()\n", dev->name, __FUNCTION__); - - priv = dev->priv; - if (priv == NULL) { - printk(KERN_INFO "%s() priv=NULL\n", __FUNCTION__); - return; - } + struct ctcm_priv *priv = dev->ml_priv; + struct mpc_group *grp = priv->mpcg; - grp = priv->mpcg; if (grp == NULL) { - printk(KERN_INFO "%s() grp=NULL\n", __FUNCTION__); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): No MPC group", + CTCM_FUNTAIL, dev->name); return; } @@ -907,7 +866,12 @@ static void mpc_action_go_ready(fsm_instance *fsm, int event, void *arg) grp->estconnfunc = NULL; } else if (grp->allochanfunc) grp->send_qllc_disc = 1; - goto done; + + fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): fails", + CTCM_FUNTAIL, dev->name); + return; } grp->port_persist = 1; @@ -916,14 +880,7 @@ static void mpc_action_go_ready(fsm_instance *fsm, int event, void *arg) tasklet_hi_schedule(&grp->mpc_tasklet2); - ctcm_pr_debug("ctcmpc exit: %s %s()\n", dev->name, __FUNCTION__); return; - -done: - fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); - - - ctcm_pr_info("ctcmpc: %s()failure occurred\n", __FUNCTION__); } /* @@ -933,42 +890,28 @@ done: void mpc_group_ready(unsigned long adev) { struct net_device *dev = (struct net_device *)adev; - struct ctcm_priv *priv = NULL; - struct mpc_group *grp = NULL; + struct ctcm_priv *priv = dev->ml_priv; + struct mpc_group *grp = priv->mpcg; struct channel *ch = NULL; - - ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); - - if (dev == NULL) { - printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); - return; - } - - priv = dev->priv; - if (priv == NULL) { - printk(KERN_INFO "%s() priv=NULL\n", __FUNCTION__); - return; - } - - grp = priv->mpcg; if (grp == NULL) { - printk(KERN_INFO "ctcmpc:%s() grp=NULL\n", __FUNCTION__); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): No MPC group", + CTCM_FUNTAIL, dev->name); return; } - printk(KERN_NOTICE "ctcmpc: %s GROUP TRANSITIONED TO READY" - " maxbuf:%d\n", - dev->name, grp->group_max_buflen); + CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_NOTICE, + "%s: %s: GROUP TRANSITIONED TO READY, maxbuf = %d\n", + CTCM_FUNTAIL, dev->name, grp->group_max_buflen); fsm_newstate(grp->fsm, MPCG_STATE_READY); /* Put up a read on the channel */ ch = priv->channel[READ]; ch->pdu_seq = 0; - if (do_debug_data) - ctcm_pr_debug("ctcmpc: %s() ToDCM_pdu_seq= %08x\n" , - __FUNCTION__, ch->pdu_seq); + CTCM_PR_DBGDATA("ctcmpc: %s() ToDCM_pdu_seq= %08x\n" , + __func__, ch->pdu_seq); ctcmpc_chx_rxidle(ch->fsm, CTC_EVENT_START, ch); /* Put the write channel in idle state */ @@ -980,22 +923,18 @@ void mpc_group_ready(unsigned long adev) spin_unlock(&ch->collect_lock); } ctcm_chx_txidle(ch->fsm, CTC_EVENT_START, ch); - ctcm_clear_busy(dev); if (grp->estconnfunc) { grp->estconnfunc(grp->port_num, 0, grp->group_max_buflen); grp->estconnfunc = NULL; - } else - if (grp->allochanfunc) - grp->allochanfunc(grp->port_num, - grp->group_max_buflen); + } else if (grp->allochanfunc) + grp->allochanfunc(grp->port_num, grp->group_max_buflen); grp->send_qllc_disc = 1; grp->changed_side = 0; - ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); return; } @@ -1004,51 +943,26 @@ void mpc_group_ready(unsigned long adev) * Increment the MPC Group Active Channel Counts * helper of dev_action (called from channel fsm) */ -int mpc_channel_action(struct channel *ch, int direction, int action) +void mpc_channel_action(struct channel *ch, int direction, int action) { - struct net_device *dev = ch->netdev; - struct ctcm_priv *priv; - struct mpc_group *grp = NULL; - int rc = 0; - - if (do_debug) - ctcm_pr_debug("ctcmpc enter: %s(): ch=0x%p id=%s\n", - __FUNCTION__, ch, ch->id); - - if (dev == NULL) { - printk(KERN_INFO "ctcmpc_channel_action %i dev=NULL\n", - action); - rc = 1; - goto done; - } - - priv = dev->priv; - if (priv == NULL) { - printk(KERN_INFO - "ctcmpc_channel_action%i priv=NULL, dev=%s\n", - action, dev->name); - rc = 2; - goto done; - } - - grp = priv->mpcg; + struct net_device *dev = ch->netdev; + struct ctcm_priv *priv = dev->ml_priv; + struct mpc_group *grp = priv->mpcg; if (grp == NULL) { - printk(KERN_INFO "ctcmpc: %s()%i mpcgroup=NULL, dev=%s\n", - __FUNCTION__, action, dev->name); - rc = 3; - goto done; + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): No MPC group", + CTCM_FUNTAIL, dev->name); + return; } - ctcm_pr_info( - "ctcmpc: %s() %i(): Grp:%s total_channel_paths=%i " - "active_channels read=%i, write=%i\n", - __FUNCTION__, - action, - fsm_getstate_str(grp->fsm), - grp->num_channel_paths, - grp->active_channels[READ], - grp->active_channels[WRITE]); + CTCM_PR_DEBUG("enter %s: ch=0x%p id=%s\n", __func__, ch, ch->id); + + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, + "%s: %i / Grp:%s total_channels=%i, active_channels: " + "read=%i, write=%i\n", __func__, action, + fsm_getstate_str(grp->fsm), grp->num_channel_paths, + grp->active_channels[READ], grp->active_channels[WRITE]); if ((action == MPC_CHANNEL_ADD) && (ch->in_mpcgroup == 0)) { grp->num_channel_paths++; @@ -1062,10 +976,11 @@ int mpc_channel_action(struct channel *ch, int direction, int action) ch->xid_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC | GFP_DMA); if (ch->xid_skb == NULL) { - printk(KERN_INFO "ctcmpc: %s()" - "Couldn't alloc ch xid_skb\n", __FUNCTION__); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): Couldn't alloc ch xid_skb\n", + CTCM_FUNTAIL, dev->name); fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); - return 1; + return; } ch->xid_skb_data = ch->xid_skb->data; ch->xid_th = (struct th_header *)ch->xid_skb->data; @@ -1097,8 +1012,9 @@ int mpc_channel_action(struct channel *ch, int direction, int action) (grp->active_channels[WRITE] > 0) && (fsm_getstate(grp->fsm) < MPCG_STATE_XID2INITW)) { fsm_newstate(grp->fsm, MPCG_STATE_XID2INITW); - printk(KERN_NOTICE "ctcmpc: %s MPC GROUP " - "CHANNELS ACTIVE\n", dev->name); + CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_NOTICE, + "%s: %s: MPC GROUP CHANNELS ACTIVE\n", + __func__, dev->name); } } else if ((action == MPC_CHANNEL_REMOVE) && (ch->in_mpcgroup == 1)) { @@ -1119,25 +1035,14 @@ int mpc_channel_action(struct channel *ch, int direction, int action) (grp->active_channels[READ] > 0))) fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); } - done: + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, + "exit %s: %i / Grp:%s total_channels=%i, active_channels: " + "read=%i, write=%i\n", __func__, action, + fsm_getstate_str(grp->fsm), grp->num_channel_paths, + grp->active_channels[READ], grp->active_channels[WRITE]); - if (do_debug) { - ctcm_pr_debug( - "ctcmpc: %s() %i Grp:%s ttl_chan_paths=%i " - "active_chans read=%i, write=%i\n", - __FUNCTION__, - action, - fsm_getstate_str(grp->fsm), - grp->num_channel_paths, - grp->active_channels[READ], - grp->active_channels[WRITE]); - - ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", - __FUNCTION__, ch, ch->id); - } - return rc; - + CTCM_PR_DEBUG("exit %s: ch=0x%p id=%s\n", __func__, ch, ch->id); } /** @@ -1151,7 +1056,7 @@ done: static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) { struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; struct pdu *curr_pdu; struct mpcg_info *mpcginfo; @@ -1163,9 +1068,8 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) int skblen; int sendrc = 0; - if (do_debug) - ctcm_pr_debug("ctcmpc enter: %s() %s cp:%i ch:%s\n", - __FUNCTION__, dev->name, smp_processor_id(), ch->id); + CTCM_PR_DEBUG("ctcmpc enter: %s() %s cp:%i ch:%s\n", + __func__, dev->name, smp_processor_id(), ch->id); header = (struct th_header *)pskb->data; if ((header->th_seg == 0) && @@ -1174,21 +1078,16 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) (header->th_seq_num == 0)) /* nothing for us */ goto done; - if (do_debug_data) { - ctcm_pr_debug("ctcmpc: %s() th_header\n", __FUNCTION__); - ctcmpc_dumpit((char *)header, TH_HEADER_LENGTH); - ctcm_pr_debug("ctcmpc: %s() pskb len: %04x \n", - __FUNCTION__, pskb->len); - } + CTCM_PR_DBGDATA("%s: th_header\n", __func__); + CTCM_D3_DUMP((char *)header, TH_HEADER_LENGTH); + CTCM_PR_DBGDATA("%s: pskb len: %04x \n", __func__, pskb->len); pskb->dev = dev; pskb->ip_summed = CHECKSUM_UNNECESSARY; skb_pull(pskb, TH_HEADER_LENGTH); if (likely(header->th_ch_flag == TH_HAS_PDU)) { - if (do_debug_data) - ctcm_pr_debug("ctcmpc: %s() came into th_has_pdu\n", - __FUNCTION__); + CTCM_PR_DBGDATA("%s: came into th_has_pdu\n", __func__); if ((fsm_getstate(grp->fsm) == MPCG_STATE_FLOWC) || ((fsm_getstate(grp->fsm) == MPCG_STATE_READY) && (header->th_seq_num != ch->th_seq_num + 1) && @@ -1202,33 +1101,29 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) grp->out_of_sequence += 1; __skb_push(pskb, TH_HEADER_LENGTH); skb_queue_tail(&ch->io_queue, pskb); - if (do_debug_data) - ctcm_pr_debug("ctcmpc: %s() th_seq_num " - "expect:%08x got:%08x\n", __FUNCTION__, - ch->th_seq_num + 1, header->th_seq_num); + CTCM_PR_DBGDATA("%s: th_seq_num expect:%08x " + "got:%08x\n", __func__, + ch->th_seq_num + 1, header->th_seq_num); return; } grp->out_of_sequence = 0; ch->th_seq_num = header->th_seq_num; - if (do_debug_data) - ctcm_pr_debug("ctcmpc: %s() FromVTAM_th_seq=%08x\n", - __FUNCTION__, ch->th_seq_num); + CTCM_PR_DBGDATA("ctcmpc: %s() FromVTAM_th_seq=%08x\n", + __func__, ch->th_seq_num); if (unlikely(fsm_getstate(grp->fsm) != MPCG_STATE_READY)) goto done; pdu_last_seen = 0; while ((pskb->len > 0) && !pdu_last_seen) { curr_pdu = (struct pdu *)pskb->data; - if (do_debug_data) { - ctcm_pr_debug("ctcm: %s() pdu_header\n", - __FUNCTION__); - ctcmpc_dumpit((char *)pskb->data, - PDU_HEADER_LENGTH); - ctcm_pr_debug("ctcm: %s() pskb len: %04x \n", - __FUNCTION__, pskb->len); - } + + CTCM_PR_DBGDATA("%s: pdu_header\n", __func__); + CTCM_D3_DUMP((char *)pskb->data, PDU_HEADER_LENGTH); + CTCM_PR_DBGDATA("%s: pskb len: %04x \n", + __func__, pskb->len); + skb_pull(pskb, PDU_HEADER_LENGTH); if (curr_pdu->pdu_flag & PDU_LAST) @@ -1239,46 +1134,39 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) pskb->protocol = htons(ETH_P_SNA_DIX); if ((pskb->len <= 0) || (pskb->len > ch->max_bufsize)) { - printk(KERN_INFO - "%s Illegal packet size %d " - "received " - "dropping\n", dev->name, - pskb->len); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): Dropping packet with " + "illegal siize %d", + CTCM_FUNTAIL, dev->name, pskb->len); + priv->stats.rx_dropped++; priv->stats.rx_length_errors++; goto done; } skb_reset_mac_header(pskb); new_len = curr_pdu->pdu_offset; - if (do_debug_data) - ctcm_pr_debug("ctcmpc: %s() new_len: %04x \n", - __FUNCTION__, new_len); + CTCM_PR_DBGDATA("%s: new_len: %04x \n", + __func__, new_len); if ((new_len == 0) || (new_len > pskb->len)) { /* should never happen */ /* pskb len must be hosed...bail out */ - printk(KERN_INFO - "ctcmpc: %s(): invalid pdu" - " offset of %04x - data may be" - "lost\n", __FUNCTION__, new_len); - goto done; + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): non valid pdu_offset: %04x", + /* "data may be lost", */ + CTCM_FUNTAIL, dev->name, new_len); + goto done; } skb = __dev_alloc_skb(new_len+4, GFP_ATOMIC); if (!skb) { - printk(KERN_INFO - "ctcm: %s Out of memory in " - "%s()- request-len:%04x \n", - dev->name, - __FUNCTION__, - new_len+4); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): MEMORY allocation error", + CTCM_FUNTAIL, dev->name); priv->stats.rx_dropped++; - fsm_event(grp->fsm, - MPCG_EVENT_INOP, dev); + fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); goto done; } - - memcpy(skb_put(skb, new_len), - pskb->data, new_len); + memcpy(skb_put(skb, new_len), pskb->data, new_len); skb_reset_mac_header(skb); skb->dev = pskb->dev; @@ -1287,17 +1175,14 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) *((__u32 *) skb_push(skb, 4)) = ch->pdu_seq; ch->pdu_seq++; - if (do_debug_data) - ctcm_pr_debug("%s: ToDCM_pdu_seq= %08x\n", - __FUNCTION__, ch->pdu_seq); - - ctcm_pr_debug("ctcm: %s() skb:%0lx " - "skb len: %d \n", __FUNCTION__, - (unsigned long)skb, skb->len); if (do_debug_data) { - ctcm_pr_debug("ctcmpc: %s() up to 32 bytes" - " of pdu_data sent\n", - __FUNCTION__); + ctcm_pr_debug("%s: ToDCM_pdu_seq= %08x\n", + __func__, ch->pdu_seq); + ctcm_pr_debug("%s: skb:%0lx " + "skb len: %d \n", __func__, + (unsigned long)skb, skb->len); + ctcm_pr_debug("%s: up to 32 bytes " + "of pdu_data sent\n", __func__); ctcmpc_dump32((char *)skb->data, skb->len); } @@ -1316,8 +1201,8 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) mpcginfo->ch = ch; mpcginfo->th = header; mpcginfo->skb = pskb; - ctcm_pr_debug("ctcmpc: %s() Not PDU - may be control pkt\n", - __FUNCTION__); + CTCM_PR_DEBUG("%s: Not PDU - may be control pkt\n", + __func__); /* it's a sweep? */ sweep = (struct th_sweep *)pskb->data; mpcginfo->sweep = sweep; @@ -1333,8 +1218,9 @@ static void ctcmpc_unpack_skb(struct channel *ch, struct sk_buff *pskb) } else if (header->th_blk_flag == TH_DISCONTACT) fsm_event(grp->fsm, MPCG_EVENT_DISCONC, mpcginfo); else if (header->th_seq_num != 0) { - printk(KERN_INFO "%s unexpected packet" - " expected control pkt\n", dev->name); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): control pkt expected\n", + CTCM_FUNTAIL, dev->name); priv->stats.rx_dropped++; /* mpcginfo only used for non-data transfers */ kfree(mpcginfo); @@ -1347,13 +1233,12 @@ done: dev_kfree_skb_any(pskb); if (sendrc == NET_RX_DROP) { printk(KERN_WARNING "%s %s() NETWORK BACKLOG EXCEEDED" - " - PACKET DROPPED\n", dev->name, __FUNCTION__); + " - PACKET DROPPED\n", dev->name, __func__); fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); } - if (do_debug) - ctcm_pr_debug("ctcmpc exit : %s %s(): ch=0x%p id=%s\n", - dev->name, __FUNCTION__, ch, ch->id); + CTCM_PR_DEBUG("exit %s: %s: ch=0x%p id=%s\n", + __func__, dev->name, ch, ch->id); } /** @@ -1366,15 +1251,14 @@ done: */ void ctcmpc_bh(unsigned long thischan) { - struct channel *ch = (struct channel *)thischan; + struct channel *ch = (struct channel *)thischan; struct sk_buff *skb; - struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; - struct mpc_group *grp = priv->mpcg; + struct net_device *dev = ch->netdev; + struct ctcm_priv *priv = dev->ml_priv; + struct mpc_group *grp = priv->mpcg; - if (do_debug) - ctcm_pr_debug("%s cp:%i enter: %s() %s\n", - dev->name, smp_processor_id(), __FUNCTION__, ch->id); + CTCM_PR_DEBUG("%s cp:%i enter: %s() %s\n", + dev->name, smp_processor_id(), __func__, ch->id); /* caller has requested driver to throttle back */ while ((fsm_getstate(grp->fsm) != MPCG_STATE_FLOWC) && (skb = skb_dequeue(&ch->io_queue))) { @@ -1390,9 +1274,8 @@ void ctcmpc_bh(unsigned long thischan) if (skb == skb_peek(&ch->io_queue)) break; } - if (do_debug) - ctcm_pr_debug("ctcmpc exit : %s %s(): ch=0x%p id=%s\n", - dev->name, __FUNCTION__, ch, ch->id); + CTCM_PR_DEBUG("exit %s: %s: ch=0x%p id=%s\n", + __func__, dev->name, ch, ch->id); return; } @@ -1403,16 +1286,16 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv) { struct mpc_group *grp; - CTCM_DBF_TEXT(MPC_SETUP, 3, __FUNCTION__); + CTCM_DBF_TEXT_(MPC_SETUP, CTC_DBF_INFO, + "Enter %s(%p)", CTCM_FUNTAIL, priv); grp = kzalloc(sizeof(struct mpc_group), GFP_KERNEL); if (grp == NULL) return NULL; - grp->fsm = - init_fsm("mpcg", mpcg_state_names, mpcg_event_names, - MPCG_NR_STATES, MPCG_NR_EVENTS, mpcg_fsm, - mpcg_fsm_len, GFP_KERNEL); + grp->fsm = init_fsm("mpcg", mpcg_state_names, mpcg_event_names, + MPCG_NR_STATES, MPCG_NR_EVENTS, mpcg_fsm, + mpcg_fsm_len, GFP_KERNEL); if (grp->fsm == NULL) { kfree(grp); return NULL; @@ -1424,7 +1307,6 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv) grp->xid_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC | GFP_DMA); if (grp->xid_skb == NULL) { - printk(KERN_INFO "Couldn't alloc MPCgroup xid_skb\n"); kfree_fsm(grp->fsm); kfree(grp); return NULL; @@ -1435,7 +1317,7 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv) memcpy(skb_put(grp->xid_skb, TH_HEADER_LENGTH), &thnorm, TH_HEADER_LENGTH); - grp->xid = (struct xid2 *) skb_tail_pointer(grp->xid_skb); + grp->xid = (struct xid2 *)skb_tail_pointer(grp->xid_skb); memcpy(skb_put(grp->xid_skb, XID2_LENGTH), &init_xid, XID2_LENGTH); grp->xid->xid2_adj_id = jiffies | 0xfff00000; grp->xid->xid2_sender_id = jiffies; @@ -1446,7 +1328,6 @@ struct mpc_group *ctcmpc_init_mpc_group(struct ctcm_priv *priv) grp->rcvd_xid_skb = __dev_alloc_skb(MPC_BUFSIZE_DEFAULT, GFP_ATOMIC|GFP_DMA); if (grp->rcvd_xid_skb == NULL) { - printk(KERN_INFO "Couldn't alloc MPCgroup rcvd_xid_skb\n"); kfree_fsm(grp->fsm); dev_kfree_skb(grp->xid_skb); kfree(grp); @@ -1492,32 +1373,27 @@ static void mpc_action_go_inop(fsm_instance *fi, int event, void *arg) int rc = 0; struct channel *wch, *rch; - if (dev == NULL) { - printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); - return; - } - - ctcm_pr_debug("ctcmpc enter: %s %s()\n", dev->name, __FUNCTION__); + BUG_ON(dev == NULL); + CTCM_PR_DEBUG("Enter %s: %s\n", __func__, dev->name); - priv = dev->priv; + priv = dev->ml_priv; grp = priv->mpcg; grp->flow_off_called = 0; - fsm_deltimer(&grp->timer); - if (grp->channels_terminating) - goto done; + return; grp->channels_terminating = 1; - grp->saved_state = fsm_getstate(grp->fsm); fsm_newstate(grp->fsm, MPCG_STATE_INOP); if (grp->saved_state > MPCG_STATE_XID7INITF) - printk(KERN_NOTICE "%s:MPC GROUP INOPERATIVE\n", dev->name); + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, + "%s(%s): MPC GROUP INOPERATIVE", + CTCM_FUNTAIL, dev->name); if ((grp->saved_state != MPCG_STATE_RESET) || /* dealloc_channel has been called */ - ((grp->saved_state == MPCG_STATE_RESET) && - (grp->port_persist == 0))) + ((grp->saved_state == MPCG_STATE_RESET) && + (grp->port_persist == 0))) fsm_deltimer(&priv->restart_timer); wch = priv->channel[WRITE]; @@ -1567,29 +1443,24 @@ static void mpc_action_go_inop(fsm_instance *fi, int event, void *arg) /* This can result in INOP of VTAM PU due to halting of */ /* outstanding IO which causes a sense to be returned */ /* Only about 3 senses are allowed and then IOS/VTAM will*/ - /* ebcome unreachable without manual intervention */ - if ((grp->port_persist == 1) || (grp->alloc_called)) { + /* become unreachable without manual intervention */ + if ((grp->port_persist == 1) || (grp->alloc_called)) { grp->alloc_called = 0; fsm_deltimer(&priv->restart_timer); - fsm_addtimer(&priv->restart_timer, - 500, - DEV_EVENT_RESTART, - dev); + fsm_addtimer(&priv->restart_timer, 500, DEV_EVENT_RESTART, dev); fsm_newstate(grp->fsm, MPCG_STATE_RESET); if (grp->saved_state > MPCG_STATE_XID7INITF) - printk(KERN_NOTICE "%s:MPC GROUP RECOVERY SCHEDULED\n", - dev->name); + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ALWAYS, + "%s(%s): MPC GROUP RECOVERY SCHEDULED", + CTCM_FUNTAIL, dev->name); } else { fsm_deltimer(&priv->restart_timer); fsm_addtimer(&priv->restart_timer, 500, DEV_EVENT_STOP, dev); fsm_newstate(grp->fsm, MPCG_STATE_RESET); - printk(KERN_NOTICE "%s:MPC GROUP RECOVERY NOT ATTEMPTED\n", - dev->name); + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_ALWAYS, + "%s(%s): NO MPC GROUP RECOVERY ATTEMPTED", + CTCM_FUNTAIL, dev->name); } - -done: - ctcm_pr_debug("ctcmpc exit:%s %s()\n", dev->name, __FUNCTION__); - return; } /** @@ -1609,14 +1480,9 @@ static void mpc_action_timeout(fsm_instance *fi, int event, void *arg) struct channel *wch; struct channel *rch; - CTCM_DBF_TEXT(MPC_TRACE, 6, __FUNCTION__); + BUG_ON(dev == NULL); - if (dev == NULL) { - CTCM_DBF_TEXT_(MPC_ERROR, 4, "%s: dev=NULL\n", __FUNCTION__); - return; - } - - priv = dev->priv; + priv = dev->ml_priv; grp = priv->mpcg; wch = priv->channel[WRITE]; rch = priv->channel[READ]; @@ -1633,8 +1499,9 @@ static void mpc_action_timeout(fsm_instance *fi, int event, void *arg) fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); } - CTCM_DBF_TEXT_(MPC_TRACE, 6, "%s: dev=%s exit", - __FUNCTION__, dev->name); + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_DEBUG, + "%s: dev=%s exit", + CTCM_FUNTAIL, dev->name); return; } @@ -1646,25 +1513,25 @@ void mpc_action_discontact(fsm_instance *fi, int event, void *arg) { struct mpcg_info *mpcginfo = arg; struct channel *ch = mpcginfo->ch; - struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; - struct mpc_group *grp = priv->mpcg; + struct net_device *dev; + struct ctcm_priv *priv; + struct mpc_group *grp; - if (ch == NULL) { - printk(KERN_INFO "%s() ch=NULL\n", __FUNCTION__); - return; - } - if (ch->netdev == NULL) { - printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); - return; + if (ch) { + dev = ch->netdev; + if (dev) { + priv = dev->ml_priv; + if (priv) { + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, + "%s: %s: %s\n", + CTCM_FUNTAIL, dev->name, ch->id); + grp = priv->mpcg; + grp->send_qllc_disc = 1; + fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); + } + } } - ctcm_pr_debug("ctcmpc enter: %s %s()\n", dev->name, __FUNCTION__); - - grp->send_qllc_disc = 1; - fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); - - ctcm_pr_debug("ctcmpc exit: %s %s()\n", dev->name, __FUNCTION__); return; } @@ -1675,26 +1542,9 @@ void mpc_action_discontact(fsm_instance *fi, int event, void *arg) */ void mpc_action_send_discontact(unsigned long thischan) { - struct channel *ch; - struct net_device *dev; - struct ctcm_priv *priv; - struct mpc_group *grp; - int rc = 0; - unsigned long saveflags; - - ch = (struct channel *)thischan; - dev = ch->netdev; - priv = dev->priv; - grp = priv->mpcg; - - ctcm_pr_info("ctcmpc: %s cp:%i enter: %s() GrpState:%s ChState:%s\n", - dev->name, - smp_processor_id(), - __FUNCTION__, - fsm_getstate_str(grp->fsm), - fsm_getstate_str(ch->fsm)); - saveflags = 0; /* avoids compiler warning with - spin_unlock_irqrestore */ + int rc; + struct channel *ch = (struct channel *)thischan; + unsigned long saveflags = 0; spin_lock_irqsave(get_ccwdev_lock(ch->cdev), saveflags); rc = ccw_device_start(ch->cdev, &ch->ccw[15], @@ -1702,16 +1552,9 @@ void mpc_action_send_discontact(unsigned long thischan) spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); if (rc != 0) { - ctcm_pr_info("ctcmpc: %s() ch:%s IO failed \n", - __FUNCTION__, - ch->id); - ctcm_ccw_check_rc(ch, rc, "send discontact"); - /* Not checking return code value here */ - /* Making best effort to notify partner*/ - /* that MPC Group is going down */ + ctcm_ccw_check_rc(ch, rc, (char *)__func__); } - ctcm_pr_debug("ctcmpc exit: %s %s()\n", dev->name, __FUNCTION__); return; } @@ -1723,49 +1566,50 @@ void mpc_action_send_discontact(unsigned long thischan) */ static int mpc_validate_xid(struct mpcg_info *mpcginfo) { - struct channel *ch = mpcginfo->ch; - struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct channel *ch = mpcginfo->ch; + struct net_device *dev = ch->netdev; + struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; - struct xid2 *xid = mpcginfo->xid; - int failed = 0; - int rc = 0; - __u64 our_id, their_id = 0; - int len; + struct xid2 *xid = mpcginfo->xid; + int rc = 0; + __u64 our_id = 0; + __u64 their_id = 0; + int len = TH_HEADER_LENGTH + PDU_HEADER_LENGTH; - len = TH_HEADER_LENGTH + PDU_HEADER_LENGTH; + CTCM_PR_DEBUG("Enter %s: xid=%p\n", __func__, xid); - ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); - - if (mpcginfo->xid == NULL) { - printk(KERN_INFO "%s() xid=NULL\n", __FUNCTION__); + if (xid == NULL) { rc = 1; - goto done; + /* XID REJECTED: xid == NULL */ + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): xid = NULL", + CTCM_FUNTAIL, ch->id); + goto done; } - ctcm_pr_debug("ctcmpc : %s xid received()\n", __FUNCTION__); - ctcmpc_dumpit((char *)mpcginfo->xid, XID2_LENGTH); + CTCM_D3_DUMP((char *)xid, XID2_LENGTH); /*the received direction should be the opposite of ours */ if (((CHANNEL_DIRECTION(ch->flags) == READ) ? XID2_WRITE_SIDE : XID2_READ_SIDE) != xid->xid2_dlc_type) { - failed = 1; - printk(KERN_INFO "ctcmpc:%s() XID REJECTED - READ-WRITE CH " - "Pairing Invalid \n", __FUNCTION__); + rc = 2; + /* XID REJECTED: r/w channel pairing mismatch */ + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): r/w channel pairing mismatch", + CTCM_FUNTAIL, ch->id); + goto done; } if (xid->xid2_dlc_type == XID2_READ_SIDE) { - ctcm_pr_debug("ctcmpc: %s(): grpmaxbuf:%d xid2buflen:%d\n", - __FUNCTION__, grp->group_max_buflen, - xid->xid2_buf_len); + CTCM_PR_DEBUG("%s: grpmaxbuf:%d xid2buflen:%d\n", __func__, + grp->group_max_buflen, xid->xid2_buf_len); - if (grp->group_max_buflen == 0 || - grp->group_max_buflen > xid->xid2_buf_len - len) + if (grp->group_max_buflen == 0 || grp->group_max_buflen > + xid->xid2_buf_len - len) grp->group_max_buflen = xid->xid2_buf_len - len; } - - if (grp->saved_xid2 == NULL) { + if (grp->saved_xid2 == NULL) { grp->saved_xid2 = (struct xid2 *)skb_tail_pointer(grp->rcvd_xid_skb); @@ -1786,49 +1630,54 @@ static int mpc_validate_xid(struct mpcg_info *mpcginfo) /* lower id assume the xside role */ if (our_id < their_id) { grp->roll = XSIDE; - ctcm_pr_debug("ctcmpc :%s() WE HAVE LOW ID-" - "TAKE XSIDE\n", __FUNCTION__); + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, + "%s(%s): WE HAVE LOW ID - TAKE XSIDE", + CTCM_FUNTAIL, ch->id); } else { grp->roll = YSIDE; - ctcm_pr_debug("ctcmpc :%s() WE HAVE HIGH ID-" - "TAKE YSIDE\n", __FUNCTION__); + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_NOTICE, + "%s(%s): WE HAVE HIGH ID - TAKE YSIDE", + CTCM_FUNTAIL, ch->id); } } else { if (xid->xid2_flag4 != grp->saved_xid2->xid2_flag4) { - failed = 1; - printk(KERN_INFO "%s XID REJECTED - XID Flag Byte4\n", - __FUNCTION__); + rc = 3; + /* XID REJECTED: xid flag byte4 mismatch */ + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): xid flag byte4 mismatch", + CTCM_FUNTAIL, ch->id); } if (xid->xid2_flag2 == 0x40) { - failed = 1; - printk(KERN_INFO "%s XID REJECTED - XID NOGOOD\n", - __FUNCTION__); + rc = 4; + /* XID REJECTED - xid NOGOOD */ + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): xid NOGOOD", + CTCM_FUNTAIL, ch->id); } if (xid->xid2_adj_id != grp->saved_xid2->xid2_adj_id) { - failed = 1; - printk(KERN_INFO "%s XID REJECTED - " - "Adjacent Station ID Mismatch\n", - __FUNCTION__); + rc = 5; + /* XID REJECTED - Adjacent Station ID Mismatch */ + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): Adjacent Station ID Mismatch", + CTCM_FUNTAIL, ch->id); } if (xid->xid2_sender_id != grp->saved_xid2->xid2_sender_id) { - failed = 1; - printk(KERN_INFO "%s XID REJECTED - " - "Sender Address Mismatch\n", __FUNCTION__); - + rc = 6; + /* XID REJECTED - Sender Address Mismatch */ + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): Sender Address Mismatch", + CTCM_FUNTAIL, ch->id); } } - if (failed) { +done: + if (rc) { ctcm_pr_info("ctcmpc : %s() failed\n", __FUNCTION__); priv->xid->xid2_flag2 = 0x40; grp->saved_xid2->xid2_flag2 = 0x40; - rc = 1; } -done: - - ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); return rc; } @@ -1839,46 +1688,20 @@ done: static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) { struct channel *ch = arg; - struct ctcm_priv *priv; - struct mpc_group *grp = NULL; - struct net_device *dev = NULL; int rc = 0; int gotlock = 0; unsigned long saveflags = 0; /* avoids compiler warning with - spin_unlock_irqrestore */ + spin_unlock_irqrestore */ - if (ch == NULL) { - printk(KERN_INFO "%s ch=NULL\n", __FUNCTION__); - goto done; - } - - if (do_debug) - ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", - __FUNCTION__, smp_processor_id(), ch, ch->id); - - dev = ch->netdev; - if (dev == NULL) { - printk(KERN_INFO "%s dev=NULL\n", __FUNCTION__); - goto done; - } - - priv = dev->priv; - if (priv == NULL) { - printk(KERN_INFO "%s priv=NULL\n", __FUNCTION__); - goto done; - } - - grp = priv->mpcg; - if (grp == NULL) { - printk(KERN_INFO "%s grp=NULL\n", __FUNCTION__); - goto done; - } + CTCM_PR_DEBUG("Enter %s: cp=%i ch=0x%p id=%s\n", + __func__, smp_processor_id(), ch, ch->id); if (ctcm_checkalloc_buffer(ch)) goto done; - /* skb data-buffer referencing: */ - + /* + * skb data-buffer referencing: + */ ch->trans_skb->data = ch->trans_skb_data; skb_reset_tail_pointer(ch->trans_skb); ch->trans_skb->len = 0; @@ -1911,22 +1734,22 @@ static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) ch->ccw[8].count = 0; ch->ccw[8].cda = 0x00; + if (!(ch->xid_th && ch->xid && ch->xid_id)) + CTCM_DBF_TEXT_(MPC_TRACE, CTC_DBF_INFO, + "%s(%s): xid_th=%p, xid=%p, xid_id=%p", + CTCM_FUNTAIL, ch->id, ch->xid_th, ch->xid, ch->xid_id); + if (side == XSIDE) { /* mpc_action_xside_xid */ - if (ch->xid_th == NULL) { - printk(KERN_INFO "%s ch->xid_th=NULL\n", __FUNCTION__); - goto done; - } + if (ch->xid_th == NULL) + goto done; ch->ccw[9].cmd_code = CCW_CMD_WRITE; ch->ccw[9].flags = CCW_FLAG_SLI | CCW_FLAG_CC; ch->ccw[9].count = TH_HEADER_LENGTH; ch->ccw[9].cda = virt_to_phys(ch->xid_th); - if (ch->xid == NULL) { - printk(KERN_INFO "%s ch->xid=NULL\n", __FUNCTION__); - goto done; - } - + if (ch->xid == NULL) + goto done; ch->ccw[10].cmd_code = CCW_CMD_WRITE; ch->ccw[10].flags = CCW_FLAG_SLI | CCW_FLAG_CC; ch->ccw[10].count = XID2_LENGTH; @@ -1956,28 +1779,22 @@ static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) ch->ccw[10].count = XID2_LENGTH; ch->ccw[10].cda = virt_to_phys(ch->rcvd_xid); - if (ch->xid_th == NULL) { - printk(KERN_INFO "%s ch->xid_th=NULL\n", __FUNCTION__); - goto done; - } + if (ch->xid_th == NULL) + goto done; ch->ccw[11].cmd_code = CCW_CMD_WRITE; ch->ccw[11].flags = CCW_FLAG_SLI | CCW_FLAG_CC; ch->ccw[11].count = TH_HEADER_LENGTH; ch->ccw[11].cda = virt_to_phys(ch->xid_th); - if (ch->xid == NULL) { - printk(KERN_INFO "%s ch->xid=NULL\n", __FUNCTION__); - goto done; - } + if (ch->xid == NULL) + goto done; ch->ccw[12].cmd_code = CCW_CMD_WRITE; ch->ccw[12].flags = CCW_FLAG_SLI | CCW_FLAG_CC; ch->ccw[12].count = XID2_LENGTH; ch->ccw[12].cda = virt_to_phys(ch->xid); - if (ch->xid_id == NULL) { - printk(KERN_INFO "%s ch->xid_id=NULL\n", __FUNCTION__); - goto done; - } + if (ch->xid_id == NULL) + goto done; ch->ccw[13].cmd_code = CCW_CMD_WRITE; ch->ccw[13].cda = virt_to_phys(ch->xid_id); @@ -1990,12 +1807,11 @@ static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) ch->ccw[14].count = 0; ch->ccw[14].cda = 0; - if (do_debug_ccw) - ctcmpc_dumpit((char *)&ch->ccw[8], sizeof(struct ccw1) * 7); + CTCM_CCW_DUMP((char *)&ch->ccw[8], sizeof(struct ccw1) * 7); + CTCM_D3_DUMP((char *)ch->xid_th, TH_HEADER_LENGTH); + CTCM_D3_DUMP((char *)ch->xid, XID2_LENGTH); + CTCM_D3_DUMP((char *)ch->xid_id, 4); - ctcmpc_dumpit((char *)ch->xid_th, TH_HEADER_LENGTH); - ctcmpc_dumpit((char *)ch->xid, XID2_LENGTH); - ctcmpc_dumpit((char *)ch->xid_id, 4); if (!in_irq()) { /* Such conditional locking is a known problem for * sparse because its static undeterministic. @@ -2012,16 +1828,13 @@ static void mpc_action_side_xid(fsm_instance *fsm, void *arg, int side) spin_unlock_irqrestore(get_ccwdev_lock(ch->cdev), saveflags); if (rc != 0) { - ctcm_pr_info("ctcmpc: %s() ch:%s IO failed \n", - __FUNCTION__, ch->id); ctcm_ccw_check_rc(ch, rc, (side == XSIDE) ? "x-side XID" : "y-side XID"); } done: - if (do_debug) - ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", - __FUNCTION__, ch, ch->id); + CTCM_PR_DEBUG("Exit %s: ch=0x%p id=%s\n", + __func__, ch, ch->id); return; } @@ -2050,41 +1863,19 @@ static void mpc_action_yside_xid(fsm_instance *fsm, int event, void *arg) */ static void mpc_action_doxid0(fsm_instance *fsm, int event, void *arg) { - struct channel *ch = arg; - struct ctcm_priv *priv; - struct mpc_group *grp = NULL; - struct net_device *dev = NULL; - - if (do_debug) - ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", - __FUNCTION__, smp_processor_id(), ch, ch->id); - - if (ch == NULL) { - printk(KERN_WARNING "%s ch=NULL\n", __FUNCTION__); - goto done; - } + struct channel *ch = arg; + struct net_device *dev = ch->netdev; + struct ctcm_priv *priv = dev->ml_priv; + struct mpc_group *grp = priv->mpcg; - dev = ch->netdev; - if (dev == NULL) { - printk(KERN_WARNING "%s dev=NULL\n", __FUNCTION__); - goto done; - } - - priv = dev->priv; - if (priv == NULL) { - printk(KERN_WARNING "%s priv=NULL\n", __FUNCTION__); - goto done; - } - - grp = priv->mpcg; - if (grp == NULL) { - printk(KERN_WARNING "%s grp=NULL\n", __FUNCTION__); - goto done; - } + CTCM_PR_DEBUG("Enter %s: cp=%i ch=0x%p id=%s\n", + __func__, smp_processor_id(), ch, ch->id); if (ch->xid == NULL) { - printk(KERN_WARNING "%s ch-xid=NULL\n", __FUNCTION__); - goto done; + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): ch->xid == NULL", + CTCM_FUNTAIL, dev->name); + return; } fsm_newstate(ch->fsm, CH_XID0_INPROGRESS); @@ -2104,12 +1895,7 @@ static void mpc_action_doxid0(fsm_instance *fsm, int event, void *arg) fsm_event(grp->fsm, MPCG_EVENT_DOIO, ch); -done: - if (do_debug) - ctcm_pr_debug("ctcmpc exit : %s(): ch=0x%p id=%s\n", - __FUNCTION__, ch, ch->id); return; - } /* @@ -2119,32 +1905,16 @@ done: static void mpc_action_doxid7(fsm_instance *fsm, int event, void *arg) { struct net_device *dev = arg; - struct ctcm_priv *priv = NULL; - struct mpc_group *grp = NULL; + struct ctcm_priv *priv = dev->ml_priv; + struct mpc_group *grp = NULL; int direction; - int rc = 0; int send = 0; - ctcm_pr_debug("ctcmpc enter: %s() \n", __FUNCTION__); - - if (dev == NULL) { - printk(KERN_INFO "%s dev=NULL \n", __FUNCTION__); - rc = 1; - goto done; - } - - priv = dev->priv; - if (priv == NULL) { - printk(KERN_INFO "%s priv=NULL \n", __FUNCTION__); - rc = 1; - goto done; - } - - grp = priv->mpcg; + if (priv) + grp = priv->mpcg; if (grp == NULL) { - printk(KERN_INFO "%s grp=NULL \n", __FUNCTION__); - rc = 1; - goto done; + fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); + return; } for (direction = READ; direction <= WRITE; direction++) { @@ -2199,11 +1969,6 @@ static void mpc_action_doxid7(fsm_instance *fsm, int event, void *arg) fsm_event(grp->fsm, MPCG_EVENT_DOIO, ch); } -done: - - if (rc != 0) - fsm_event(grp->fsm, MPCG_EVENT_INOP, dev); - return; } @@ -2214,24 +1979,15 @@ done: static void mpc_action_rcvd_xid0(fsm_instance *fsm, int event, void *arg) { - struct mpcg_info *mpcginfo = arg; - struct channel *ch = mpcginfo->ch; - struct net_device *dev = ch->netdev; - struct ctcm_priv *priv; - struct mpc_group *grp; - - if (do_debug) - ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", - __FUNCTION__, smp_processor_id(), ch, ch->id); - - priv = dev->priv; - grp = priv->mpcg; + struct mpcg_info *mpcginfo = arg; + struct channel *ch = mpcginfo->ch; + struct net_device *dev = ch->netdev; + struct ctcm_priv *priv = dev->ml_priv; + struct mpc_group *grp = priv->mpcg; - ctcm_pr_debug("ctcmpc in:%s() %s xid2:%i xid7:%i xidt_p2:%i \n", - __FUNCTION__, ch->id, - grp->outstanding_xid2, - grp->outstanding_xid7, - grp->outstanding_xid7_p2); + CTCM_PR_DEBUG("%s: ch-id:%s xid2:%i xid7:%i xidt_p2:%i \n", + __func__, ch->id, grp->outstanding_xid2, + grp->outstanding_xid7, grp->outstanding_xid7_p2); if (fsm_getstate(ch->fsm) < CH_XID7_PENDING) fsm_newstate(ch->fsm, CH_XID7_PENDING); @@ -2268,17 +2024,12 @@ static void mpc_action_rcvd_xid0(fsm_instance *fsm, int event, void *arg) } kfree(mpcginfo); - if (do_debug) { - ctcm_pr_debug("ctcmpc:%s() %s xid2:%i xid7:%i xidt_p2:%i \n", - __FUNCTION__, ch->id, - grp->outstanding_xid2, - grp->outstanding_xid7, - grp->outstanding_xid7_p2); - ctcm_pr_debug("ctcmpc:%s() %s grpstate: %s chanstate: %s \n", - __FUNCTION__, ch->id, - fsm_getstate_str(grp->fsm), - fsm_getstate_str(ch->fsm)); - } + CTCM_PR_DEBUG("ctcmpc:%s() %s xid2:%i xid7:%i xidt_p2:%i \n", + __func__, ch->id, grp->outstanding_xid2, + grp->outstanding_xid7, grp->outstanding_xid7_p2); + CTCM_PR_DEBUG("ctcmpc:%s() %s grpstate: %s chanstate: %s \n", + __func__, ch->id, + fsm_getstate_str(grp->fsm), fsm_getstate_str(ch->fsm)); return; } @@ -2293,18 +2044,13 @@ static void mpc_action_rcvd_xid7(fsm_instance *fsm, int event, void *arg) struct mpcg_info *mpcginfo = arg; struct channel *ch = mpcginfo->ch; struct net_device *dev = ch->netdev; - struct ctcm_priv *priv = dev->priv; + struct ctcm_priv *priv = dev->ml_priv; struct mpc_group *grp = priv->mpcg; - if (do_debug) { - ctcm_pr_debug("ctcmpc enter: %s(): cp=%i ch=0x%p id=%s\n", - __FUNCTION__, smp_processor_id(), ch, ch->id); - - ctcm_pr_debug("ctcmpc: outstanding_xid7: %i, " - " outstanding_xid7_p2: %i\n", - grp->outstanding_xid7, - grp->outstanding_xid7_p2); - } + CTCM_PR_DEBUG("Enter %s: cp=%i ch=0x%p id=%s\n", + __func__, smp_processor_id(), ch, ch->id); + CTCM_PR_DEBUG("%s: outstanding_xid7: %i, outstanding_xid7_p2: %i\n", + __func__, grp->outstanding_xid7, grp->outstanding_xid7_p2); grp->outstanding_xid7--; ch->xid_skb->data = ch->xid_skb_data; @@ -2337,14 +2083,8 @@ static void mpc_action_rcvd_xid7(fsm_instance *fsm, int event, void *arg) mpc_validate_xid(mpcginfo); break; } - kfree(mpcginfo); - - if (do_debug) - ctcm_pr_debug("ctcmpc exit: %s(): cp=%i ch=0x%p id=%s\n", - __FUNCTION__, smp_processor_id(), ch, ch->id); return; - } /* @@ -2353,36 +2093,14 @@ static void mpc_action_rcvd_xid7(fsm_instance *fsm, int event, void *arg) */ static int mpc_send_qllc_discontact(struct net_device *dev) { - int rc = 0; __u32 new_len = 0; struct sk_buff *skb; struct qllc *qllcptr; - struct ctcm_priv *priv; - struct mpc_group *grp; - - ctcm_pr_debug("ctcmpc enter: %s()\n", __FUNCTION__); - - if (dev == NULL) { - printk(KERN_INFO "%s() dev=NULL\n", __FUNCTION__); - rc = 1; - goto done; - } - - priv = dev->priv; - if (priv == NULL) { - printk(KERN_INFO "%s() priv=NULL\n", __FUNCTION__); - rc = 1; - goto done; - } + struct ctcm_priv *priv = dev->ml_priv; + struct mpc_group *grp = priv->mpcg; - grp = priv->mpcg; - if (grp == NULL) { - printk(KERN_INFO "%s() grp=NULL\n", __FUNCTION__); - rc = 1; - goto done; - } - ctcm_pr_info("ctcmpc: %s() GROUP STATE: %s\n", __FUNCTION__, - mpcg_state_names[grp->saved_state]); + CTCM_PR_DEBUG("%s: GROUP STATE: %s\n", + __func__, mpcg_state_names[grp->saved_state]); switch (grp->saved_state) { /* @@ -2408,11 +2126,10 @@ static int mpc_send_qllc_discontact(struct net_device *dev) new_len = sizeof(struct qllc); qllcptr = kzalloc(new_len, gfp_type() | GFP_DMA); if (qllcptr == NULL) { - printk(KERN_INFO - "ctcmpc: Out of memory in %s()\n", - dev->name); - rc = 1; - goto done; + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): qllcptr allocation error", + CTCM_FUNTAIL, dev->name); + return -ENOMEM; } qllcptr->qllc_address = 0xcc; @@ -2421,31 +2138,29 @@ static int mpc_send_qllc_discontact(struct net_device *dev) skb = __dev_alloc_skb(new_len, GFP_ATOMIC); if (skb == NULL) { - printk(KERN_INFO "%s Out of memory in mpc_send_qllc\n", - dev->name); + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): skb allocation error", + CTCM_FUNTAIL, dev->name); priv->stats.rx_dropped++; - rc = 1; kfree(qllcptr); - goto done; + return -ENOMEM; } memcpy(skb_put(skb, new_len), qllcptr, new_len); kfree(qllcptr); if (skb_headroom(skb) < 4) { - printk(KERN_INFO "ctcmpc: %s() Unable to" - " build discontact for %s\n", - __FUNCTION__, dev->name); - rc = 1; + CTCM_DBF_TEXT_(MPC_ERROR, CTC_DBF_ERROR, + "%s(%s): skb_headroom error", + CTCM_FUNTAIL, dev->name); dev_kfree_skb_any(skb); - goto done; + return -ENOMEM; } *((__u32 *)skb_push(skb, 4)) = priv->channel[READ]->pdu_seq; priv->channel[READ]->pdu_seq++; - if (do_debug_data) - ctcm_pr_debug("ctcmpc: %s ToDCM_pdu_seq= %08x\n", - __FUNCTION__, priv->channel[READ]->pdu_seq); + CTCM_PR_DBGDATA("ctcmpc: %s ToDCM_pdu_seq= %08x\n", + __func__, priv->channel[READ]->pdu_seq); /* receipt of CC03 resets anticipated sequence number on receiving side */ @@ -2455,7 +2170,7 @@ static int mpc_send_qllc_discontact(struct net_device *dev) skb->protocol = htons(ETH_P_SNAP); skb->ip_summed = CHECKSUM_UNNECESSARY; - ctcmpc_dumpit((char *)skb->data, (sizeof(struct qllc) + 4)); + CTCM_D3_DUMP(skb->data, (sizeof(struct qllc) + 4)); netif_rx(skb); break; @@ -2464,9 +2179,7 @@ static int mpc_send_qllc_discontact(struct net_device *dev) } -done: - ctcm_pr_debug("ctcmpc exit: %s()\n", __FUNCTION__); - return rc; + return 0; } /* --- This is the END my friend --- */ diff --git a/drivers/s390/net/ctcm_mpc.h b/drivers/s390/net/ctcm_mpc.h index f99686069a9..5336120cddf 100644 --- a/drivers/s390/net/ctcm_mpc.h +++ b/drivers/s390/net/ctcm_mpc.h @@ -231,7 +231,7 @@ static inline void ctcmpc_dump32(char *buf, int len) int ctcmpc_open(struct net_device *); void ctcm_ccw_check_rc(struct channel *, int, char *); void mpc_group_ready(unsigned long adev); -int mpc_channel_action(struct channel *ch, int direction, int action); +void mpc_channel_action(struct channel *ch, int direction, int action); void mpc_action_send_discontact(unsigned long thischan); void mpc_action_discontact(fsm_instance *fi, int event, void *arg); void ctcmpc_bh(unsigned long thischan); diff --git a/drivers/s390/net/lcs.c b/drivers/s390/net/lcs.c index 6de28385b35..9bcfa04d863 100644 --- a/drivers/s390/net/lcs.c +++ b/drivers/s390/net/lcs.c @@ -1412,7 +1412,8 @@ lcs_irq(struct ccw_device *cdev, unsigned long intparm, struct irb *irb) } /* How far in the ccw chain have we processed? */ if ((channel->state != LCS_CH_STATE_INIT) && - (irb->scsw.cmd.fctl & SCSW_FCTL_START_FUNC)) { + (irb->scsw.cmd.fctl & SCSW_FCTL_START_FUNC) && + (irb->scsw.cmd.cpa != 0)) { index = (struct ccw1 *) __va((addr_t) irb->scsw.cmd.cpa) - channel->ccws; if ((irb->scsw.cmd.actl & SCSW_ACTL_SUSPENDED) || diff --git a/drivers/s390/net/qeth_core.h b/drivers/s390/net/qeth_core.h index 1895dbb553c..bf8a75c92f2 100644 --- a/drivers/s390/net/qeth_core.h +++ b/drivers/s390/net/qeth_core.h @@ -419,6 +419,7 @@ struct qeth_qdio_out_buffer { int next_element_to_fill; struct sk_buff_head skb_list; struct list_head ctx_list; + int is_header[16]; }; struct qeth_card; @@ -688,6 +689,7 @@ struct qeth_mc_mac { struct list_head list; __u8 mc_addr[MAX_ADDR_LEN]; unsigned char mc_addrlen; + int is_vmac; }; struct qeth_card { @@ -785,7 +787,7 @@ void qeth_core_remove_osn_attributes(struct device *); /* exports for qeth discipline device drivers */ extern struct qeth_card_list_struct qeth_core_card_list; - +extern struct kmem_cache *qeth_core_header_cache; extern struct qeth_dbf_info qeth_dbf[QETH_DBF_INFOS]; void qeth_set_allowed_threads(struct qeth_card *, unsigned long , int); @@ -843,7 +845,7 @@ int qeth_get_priority_queue(struct qeth_card *, struct sk_buff *, int, int); int qeth_get_elements_no(struct qeth_card *, void *, struct sk_buff *, int); int qeth_do_send_packet_fast(struct qeth_card *, struct qeth_qdio_out_q *, struct sk_buff *, struct qeth_hdr *, int, - struct qeth_eddp_context *); + struct qeth_eddp_context *, int, int); int qeth_do_send_packet(struct qeth_card *, struct qeth_qdio_out_q *, struct sk_buff *, struct qeth_hdr *, int, struct qeth_eddp_context *); diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c index c3ad89e302b..c7ab1b86451 100644 --- a/drivers/s390/net/qeth_core_main.c +++ b/drivers/s390/net/qeth_core_main.c @@ -19,8 +19,8 @@ #include <linux/mii.h> #include <linux/kthread.h> -#include <asm-s390/ebcdic.h> -#include <asm-s390/io.h> +#include <asm/ebcdic.h> +#include <asm/io.h> #include <asm/s390_rdev.h> #include "qeth_core.h" @@ -48,6 +48,8 @@ EXPORT_SYMBOL_GPL(qeth_dbf); struct qeth_card_list_struct qeth_core_card_list; EXPORT_SYMBOL_GPL(qeth_core_card_list); +struct kmem_cache *qeth_core_header_cache; +EXPORT_SYMBOL_GPL(qeth_core_header_cache); static struct device *qeth_core_root_dev; static unsigned int known_devices[][10] = QETH_MODELLIST_ARRAY; @@ -933,6 +935,10 @@ static void qeth_clear_output_buffer(struct qeth_qdio_out_q *queue, } qeth_eddp_buf_release_contexts(buf); for (i = 0; i < QETH_MAX_BUFFER_ELEMENTS(queue->card); ++i) { + if (buf->buffer->element[i].addr && buf->is_header[i]) + kmem_cache_free(qeth_core_header_cache, + buf->buffer->element[i].addr); + buf->is_header[i] = 0; buf->buffer->element[i].length = 0; buf->buffer->element[i].addr = NULL; buf->buffer->element[i].flags = 0; @@ -3002,8 +3008,8 @@ int qeth_get_elements_no(struct qeth_card *card, void *hdr, if (skb_shinfo(skb)->nr_frags > 0) elements_needed = (skb_shinfo(skb)->nr_frags + 1); if (elements_needed == 0) - elements_needed = 1 + (((((unsigned long) hdr) % PAGE_SIZE) - + skb->len) >> PAGE_SHIFT); + elements_needed = 1 + (((((unsigned long) skb->data) % + PAGE_SIZE) + skb->len) >> PAGE_SHIFT); if ((elements_needed + elems) > QETH_MAX_BUFFER_ELEMENTS(card)) { QETH_DBF_MESSAGE(2, "Invalid size of IP packet " "(Number=%d / Length=%d). Discarded.\n", @@ -3015,9 +3021,10 @@ int qeth_get_elements_no(struct qeth_card *card, void *hdr, EXPORT_SYMBOL_GPL(qeth_get_elements_no); static inline void __qeth_fill_buffer(struct sk_buff *skb, - struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill) + struct qdio_buffer *buffer, int is_tso, int *next_element_to_fill, + int offset) { - int length = skb->len; + int length = skb->len - offset; int length_here; int element; char *data; @@ -3027,6 +3034,11 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb, data = skb->data; first_lap = (is_tso == 0 ? 1 : 0); + if (offset >= 0) { + data = skb->data + offset; + first_lap = 0; + } + while (length > 0) { /* length_here is the remaining amount of data in this page */ length_here = PAGE_SIZE - ((unsigned long) data % PAGE_SIZE); @@ -3058,22 +3070,22 @@ static inline void __qeth_fill_buffer(struct sk_buff *skb, } static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue, - struct qeth_qdio_out_buffer *buf, struct sk_buff *skb) + struct qeth_qdio_out_buffer *buf, struct sk_buff *skb, + struct qeth_hdr *hdr, int offset, int hd_len) { struct qdio_buffer *buffer; - struct qeth_hdr_tso *hdr; int flush_cnt = 0, hdr_len, large_send = 0; buffer = buf->buffer; atomic_inc(&skb->users); skb_queue_tail(&buf->skb_list, skb); - hdr = (struct qeth_hdr_tso *) skb->data; /*check first on TSO ....*/ - if (hdr->hdr.hdr.l3.id == QETH_HEADER_TYPE_TSO) { + if (hdr->hdr.l3.id == QETH_HEADER_TYPE_TSO) { int element = buf->next_element_to_fill; - hdr_len = sizeof(struct qeth_hdr_tso) + hdr->ext.dg_hdr_len; + hdr_len = sizeof(struct qeth_hdr_tso) + + ((struct qeth_hdr_tso *)hdr)->ext.dg_hdr_len; /*fill first buffer entry only with header information */ buffer->element[element].addr = skb->data; buffer->element[element].length = hdr_len; @@ -3083,9 +3095,20 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue, skb->len -= hdr_len; large_send = 1; } + + if (offset >= 0) { + int element = buf->next_element_to_fill; + buffer->element[element].addr = hdr; + buffer->element[element].length = sizeof(struct qeth_hdr) + + hd_len; + buffer->element[element].flags = SBAL_FLAGS_FIRST_FRAG; + buf->is_header[element] = 1; + buf->next_element_to_fill++; + } + if (skb_shinfo(skb)->nr_frags == 0) __qeth_fill_buffer(skb, buffer, large_send, - (int *)&buf->next_element_to_fill); + (int *)&buf->next_element_to_fill, offset); else __qeth_fill_buffer_frag(skb, buffer, large_send, (int *)&buf->next_element_to_fill); @@ -3115,7 +3138,7 @@ static inline int qeth_fill_buffer(struct qeth_qdio_out_q *queue, int qeth_do_send_packet_fast(struct qeth_card *card, struct qeth_qdio_out_q *queue, struct sk_buff *skb, struct qeth_hdr *hdr, int elements_needed, - struct qeth_eddp_context *ctx) + struct qeth_eddp_context *ctx, int offset, int hd_len) { struct qeth_qdio_out_buffer *buffer; int buffers_needed = 0; @@ -3148,7 +3171,7 @@ int qeth_do_send_packet_fast(struct qeth_card *card, } atomic_set(&queue->state, QETH_OUT_Q_UNLOCKED); if (ctx == NULL) { - qeth_fill_buffer(queue, buffer, skb); + qeth_fill_buffer(queue, buffer, skb, hdr, offset, hd_len); qeth_flush_buffers(queue, index, 1); } else { flush_cnt = qeth_eddp_fill_buffer(queue, ctx, index); @@ -3224,7 +3247,7 @@ int qeth_do_send_packet(struct qeth_card *card, struct qeth_qdio_out_q *queue, } } if (ctx == NULL) - tmp = qeth_fill_buffer(queue, buffer, skb); + tmp = qeth_fill_buffer(queue, buffer, skb, hdr, -1, 0); else { tmp = qeth_eddp_fill_buffer(queue, ctx, queue->next_buf_to_fill); @@ -3321,7 +3344,7 @@ int qeth_change_mtu(struct net_device *dev, int new_mtu) struct qeth_card *card; char dbf_text[15]; - card = netdev_priv(dev); + card = dev->ml_priv; QETH_DBF_TEXT(TRACE, 4, "chgmtu"); sprintf(dbf_text, "%8x", new_mtu); @@ -3343,7 +3366,7 @@ struct net_device_stats *qeth_get_stats(struct net_device *dev) { struct qeth_card *card; - card = netdev_priv(dev); + card = dev->ml_priv; QETH_DBF_TEXT(TRACE, 5, "getstat"); @@ -3395,7 +3418,7 @@ void qeth_tx_timeout(struct net_device *dev) { struct qeth_card *card; - card = netdev_priv(dev); + card = dev->ml_priv; card->stats.tx_errors++; qeth_schedule_recovery(card); } @@ -3403,7 +3426,7 @@ EXPORT_SYMBOL_GPL(qeth_tx_timeout); int qeth_mdio_read(struct net_device *dev, int phy_id, int regnum) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; int rc = 0; switch (regnum) { @@ -4253,7 +4276,7 @@ EXPORT_SYMBOL_GPL(qeth_core_get_stats_count); void qeth_core_get_ethtool_stats(struct net_device *dev, struct ethtool_stats *stats, u64 *data) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; data[0] = card->stats.rx_packets - card->perf_stats.initial_rx_packets; data[1] = card->perf_stats.bufs_rec; @@ -4313,7 +4336,7 @@ EXPORT_SYMBOL_GPL(qeth_core_get_strings); void qeth_core_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; if (card->options.layer2) strcpy(info->driver, "qeth_l2"); else @@ -4331,7 +4354,7 @@ EXPORT_SYMBOL_GPL(qeth_core_get_drvinfo); int qeth_core_ethtool_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) { - struct qeth_card *card = netdev_priv(netdev); + struct qeth_card *card = netdev->ml_priv; enum qeth_link_types link_type; if ((card->info.type == QETH_CARD_TYPE_IQD) || (card->info.guestlan)) @@ -4443,8 +4466,17 @@ static int __init qeth_core_init(void) rc = IS_ERR(qeth_core_root_dev) ? PTR_ERR(qeth_core_root_dev) : 0; if (rc) goto register_err; - return 0; + qeth_core_header_cache = kmem_cache_create("qeth_hdr", + sizeof(struct qeth_hdr) + ETH_HLEN, 64, 0, NULL); + if (!qeth_core_header_cache) { + rc = -ENOMEM; + goto slab_err; + } + + return 0; +slab_err: + s390_root_dev_unregister(qeth_core_root_dev); register_err: driver_remove_file(&qeth_core_ccwgroup_driver.driver, &driver_attr_group); @@ -4466,6 +4498,7 @@ static void __exit qeth_core_exit(void) &driver_attr_group); ccwgroup_driver_unregister(&qeth_core_ccwgroup_driver); ccw_driver_unregister(&qeth_ccw_driver); + kmem_cache_destroy(qeth_core_header_cache); qeth_unregister_dbf_views(); PRINT_INFO("core functions removed\n"); } diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c index 3fbc3bdec0c..3ac3cc1e03c 100644 --- a/drivers/s390/net/qeth_l2_main.c +++ b/drivers/s390/net/qeth_l2_main.c @@ -35,7 +35,7 @@ static int qeth_l2_recover(void *); static int qeth_l2_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; struct mii_ioctl_data *mii_data; int rc = 0; @@ -177,9 +177,10 @@ static int qeth_l2_send_delgroupmac(struct qeth_card *card, __u8 *mac) qeth_l2_send_delgroupmac_cb); } -static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac) +static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac, int vmac) { struct qeth_mc_mac *mc; + int rc; mc = kmalloc(sizeof(struct qeth_mc_mac), GFP_ATOMIC); @@ -188,8 +189,16 @@ static void qeth_l2_add_mc(struct qeth_card *card, __u8 *mac) memcpy(mc->mc_addr, mac, OSA_ADDR_LEN); mc->mc_addrlen = OSA_ADDR_LEN; + mc->is_vmac = vmac; + + if (vmac) { + rc = qeth_l2_send_setdelmac(card, mac, IPA_CMD_SETVMAC, + NULL); + } else { + rc = qeth_l2_send_setgroupmac(card, mac); + } - if (!qeth_l2_send_setgroupmac(card, mac)) + if (!rc) list_add_tail(&mc->list, &card->mc_list); else kfree(mc); @@ -201,7 +210,11 @@ static void qeth_l2_del_all_mc(struct qeth_card *card) spin_lock_bh(&card->mclock); list_for_each_entry_safe(mc, tmp, &card->mc_list, list) { - qeth_l2_send_delgroupmac(card, mc->mc_addr); + if (mc->is_vmac) + qeth_l2_send_setdelmac(card, mc->mc_addr, + IPA_CMD_DELVMAC, NULL); + else + qeth_l2_send_delgroupmac(card, mc->mc_addr); list_del(&mc->list); kfree(mc); } @@ -243,8 +256,7 @@ static void qeth_l2_get_packet_type(struct qeth_card *card, static void qeth_l2_fill_header(struct qeth_card *card, struct qeth_hdr *hdr, struct sk_buff *skb, int ipv, int cast_type) { - struct vlan_ethhdr *veth = (struct vlan_ethhdr *)((skb->data) + - QETH_HEADER_SIZE); + struct vlan_ethhdr *veth = (struct vlan_ethhdr *)skb_mac_header(skb); memset(hdr, 0, sizeof(struct qeth_hdr)); hdr->hdr.l2.id = QETH_HEADER_TYPE_LAYER2; @@ -317,7 +329,7 @@ static void qeth_l2_process_vlans(struct qeth_card *card, int clear) static void qeth_l2_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; struct qeth_vlan_vid *id; QETH_DBF_TEXT_(TRACE, 4, "aid:%d", vid); @@ -334,7 +346,7 @@ static void qeth_l2_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) static void qeth_l2_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) { struct qeth_vlan_vid *id, *tmpid = NULL; - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; QETH_DBF_TEXT_(TRACE, 4, "kid:%d", vid); spin_lock_bh(&card->vlanlock); @@ -566,7 +578,7 @@ static int qeth_l2_request_initial_mac(struct qeth_card *card) static int qeth_l2_set_mac_address(struct net_device *dev, void *p) { struct sockaddr *addr = p; - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; int rc = 0; QETH_DBF_TEXT(TRACE, 3, "setmac"); @@ -590,8 +602,8 @@ static int qeth_l2_set_mac_address(struct net_device *dev, void *p) static void qeth_l2_set_multicast_list(struct net_device *dev) { - struct qeth_card *card = netdev_priv(dev); - struct dev_mc_list *dm; + struct qeth_card *card = dev->ml_priv; + struct dev_addr_list *dm; if (card->info.type == QETH_CARD_TYPE_OSN) return ; @@ -600,7 +612,11 @@ static void qeth_l2_set_multicast_list(struct net_device *dev) qeth_l2_del_all_mc(card); spin_lock_bh(&card->mclock); for (dm = dev->mc_list; dm; dm = dm->next) - qeth_l2_add_mc(card, dm->dmi_addr); + qeth_l2_add_mc(card, dm->da_addr, 0); + + for (dm = dev->uc_list; dm; dm = dm->next) + qeth_l2_add_mc(card, dm->da_addr, 1); + spin_unlock_bh(&card->mclock); if (!qeth_adp_supported(card, IPA_SETADP_SET_PROMISC_MODE)) return; @@ -612,7 +628,7 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) int rc; struct qeth_hdr *hdr = NULL; int elements = 0; - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; struct sk_buff *new_skb = skb; int ipv = qeth_get_ip_version(skb); int cast_type = qeth_get_cast_type(card, skb); @@ -621,6 +637,9 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) int tx_bytes = skb->len; enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; struct qeth_eddp_context *ctx = NULL; + int data_offset = -1; + int elements_needed = 0; + int hd_len = 0; if ((card->state != CARD_STATE_UP) || !card->lan_online) { card->stats.tx_carrier_errors++; @@ -643,13 +662,32 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) if (card->info.type == QETH_CARD_TYPE_OSN) hdr = (struct qeth_hdr *)skb->data; else { - /* create a clone with writeable headroom */ - new_skb = skb_realloc_headroom(skb, sizeof(struct qeth_hdr)); - if (!new_skb) - goto tx_drop; - hdr = (struct qeth_hdr *)skb_push(new_skb, + if ((card->info.type == QETH_CARD_TYPE_IQD) && (!large_send) && + (skb_shinfo(skb)->nr_frags == 0)) { + new_skb = skb; + data_offset = ETH_HLEN; + hd_len = ETH_HLEN; + hdr = kmem_cache_alloc(qeth_core_header_cache, + GFP_ATOMIC); + if (!hdr) + goto tx_drop; + elements_needed++; + skb_reset_mac_header(new_skb); + qeth_l2_fill_header(card, hdr, new_skb, ipv, cast_type); + hdr->hdr.l2.pkt_length = new_skb->len; + memcpy(((char *)hdr) + sizeof(struct qeth_hdr), + skb_mac_header(new_skb), ETH_HLEN); + } else { + /* create a clone with writeable headroom */ + new_skb = skb_realloc_headroom(skb, + sizeof(struct qeth_hdr)); + if (!new_skb) + goto tx_drop; + hdr = (struct qeth_hdr *)skb_push(new_skb, sizeof(struct qeth_hdr)); - qeth_l2_fill_header(card, hdr, new_skb, ipv, cast_type); + skb_set_mac_header(new_skb, sizeof(struct qeth_hdr)); + qeth_l2_fill_header(card, hdr, new_skb, ipv, cast_type); + } } if (large_send == QETH_LARGE_SEND_EDDP) { @@ -660,9 +698,13 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) goto tx_drop; } } else { - elements = qeth_get_elements_no(card, (void *)hdr, new_skb, 0); - if (!elements) + elements = qeth_get_elements_no(card, (void *)hdr, new_skb, + elements_needed); + if (!elements) { + if (data_offset >= 0) + kmem_cache_free(qeth_core_header_cache, hdr); goto tx_drop; + } } if ((large_send == QETH_LARGE_SEND_NO) && @@ -674,7 +716,7 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) elements, ctx); else rc = qeth_do_send_packet_fast(card, queue, new_skb, hdr, - elements, ctx); + elements, ctx, data_offset, hd_len); if (!rc) { card->stats.tx_packets++; card->stats.tx_bytes += tx_bytes; @@ -701,6 +743,9 @@ static int qeth_l2_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) if (ctx != NULL) qeth_eddp_put_context(ctx); + if (data_offset >= 0) + kmem_cache_free(qeth_core_header_cache, hdr); + if (rc == -EBUSY) { if (new_skb != skb) dev_kfree_skb_any(new_skb); @@ -767,7 +812,7 @@ static void qeth_l2_qdio_input_handler(struct ccw_device *ccwdev, static int qeth_l2_open(struct net_device *dev) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; QETH_DBF_TEXT(TRACE, 4, "qethopen"); if (card->state != CARD_STATE_SOFTSETUP) @@ -791,7 +836,7 @@ static int qeth_l2_open(struct net_device *dev) static int qeth_l2_stop(struct net_device *dev) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; QETH_DBF_TEXT(TRACE, 4, "qethstop"); netif_tx_disable(dev); @@ -838,7 +883,7 @@ static void qeth_l2_remove_device(struct ccwgroup_device *cgdev) static int qeth_l2_ethtool_set_tso(struct net_device *dev, u32 data) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; if (data) { if (card->options.large_send == QETH_LARGE_SEND_NO) { @@ -894,7 +939,7 @@ static int qeth_l2_setup_netdev(struct qeth_card *card) if (!card->dev) return -ENODEV; - card->dev->priv = card; + card->dev->ml_priv = card; card->dev->tx_timeout = &qeth_tx_timeout; card->dev->watchdog_timeo = QETH_TX_TIMEOUT; card->dev->open = qeth_l2_open; @@ -1178,7 +1223,7 @@ int qeth_osn_assist(struct net_device *dev, void *data, int data_len) QETH_DBF_TEXT(TRACE, 2, "osnsdmc"); if (!dev) return -ENODEV; - card = netdev_priv(dev); + card = dev->ml_priv; if (!card) return -ENODEV; if ((card->state != CARD_STATE_UP) && @@ -1201,7 +1246,7 @@ int qeth_osn_register(unsigned char *read_dev_no, struct net_device **dev, *dev = qeth_l2_netdev_by_devno(read_dev_no); if (*dev == NULL) return -ENODEV; - card = netdev_priv(*dev); + card = (*dev)->ml_priv; if (!card) return -ENODEV; if ((assist_cb == NULL) || (data_cb == NULL)) @@ -1219,7 +1264,7 @@ void qeth_osn_deregister(struct net_device *dev) QETH_DBF_TEXT(TRACE, 2, "osndereg"); if (!dev) return; - card = netdev_priv(dev); + card = dev->ml_priv; if (!card) return; card->osn_info.assist_cb = NULL; diff --git a/drivers/s390/net/qeth_l3_main.c b/drivers/s390/net/qeth_l3_main.c index 22f64aa6dd1..dd72c3c2016 100644 --- a/drivers/s390/net/qeth_l3_main.c +++ b/drivers/s390/net/qeth_l3_main.c @@ -1813,7 +1813,7 @@ static void qeth_l3_free_vlan_addresses(struct qeth_card *card, static void qeth_l3_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; unsigned long flags; QETH_DBF_TEXT(TRACE, 4, "vlanreg"); @@ -1825,7 +1825,7 @@ static void qeth_l3_vlan_rx_register(struct net_device *dev, static void qeth_l3_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) { struct net_device *vlandev; - struct qeth_card *card = (struct qeth_card *) dev->priv; + struct qeth_card *card = dev->ml_priv; struct in_device *in_dev; if (card->info.type == QETH_CARD_TYPE_IQD) @@ -1851,7 +1851,7 @@ static void qeth_l3_vlan_rx_add_vid(struct net_device *dev, unsigned short vid) static void qeth_l3_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; unsigned long flags; QETH_DBF_TEXT_(TRACE, 4, "kid:%d", vid); @@ -2013,7 +2013,7 @@ static int qeth_l3_verify_vlan_dev(struct net_device *dev, } } - if (rc && !(netdev_priv(vlan_dev_info(dev)->real_dev) == (void *)card)) + if (rc && !(vlan_dev_real_dev(dev)->ml_priv == (void *)card)) return 0; return rc; @@ -2047,9 +2047,9 @@ static struct qeth_card *qeth_l3_get_card_from_dev(struct net_device *dev) rc = qeth_l3_verify_dev(dev); if (rc == QETH_REAL_CARD) - card = netdev_priv(dev); + card = dev->ml_priv; else if (rc == QETH_VLAN_CARD) - card = netdev_priv(vlan_dev_info(dev)->real_dev); + card = vlan_dev_real_dev(dev)->ml_priv; if (card && card->options.layer2) card = NULL; QETH_DBF_TEXT_(TRACE, 4, "%d", rc); @@ -2110,7 +2110,7 @@ static int qeth_l3_stop_card(struct qeth_card *card, int recovery_mode) static void qeth_l3_set_multicast_list(struct net_device *dev) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; QETH_DBF_TEXT(TRACE, 3, "setmulti"); qeth_l3_delete_mc_addresses(card); @@ -2438,7 +2438,7 @@ static int qeth_l3_arp_flush_cache(struct qeth_card *card) static int qeth_l3_do_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; struct qeth_arp_cache_entry arp_entry; struct mii_ioctl_data *mii_data; int rc = 0; @@ -2595,7 +2595,7 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) u16 *tag; struct qeth_hdr *hdr = NULL; int elements_needed = 0; - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; struct sk_buff *new_skb = NULL; int ipv = qeth_get_ip_version(skb); int cast_type = qeth_get_cast_type(card, skb); @@ -2604,6 +2604,7 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) int tx_bytes = skb->len; enum qeth_large_send_types large_send = QETH_LARGE_SEND_NO; struct qeth_eddp_context *ctx = NULL; + int data_offset = -1; if ((card->info.type == QETH_CARD_TYPE_IQD) && (skb->protocol != htons(ETH_P_IPV6)) && @@ -2624,14 +2625,28 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) card->perf_stats.outbound_start_time = qeth_get_micros(); } - /* create a clone with writeable headroom */ - new_skb = skb_realloc_headroom(skb, sizeof(struct qeth_hdr_tso) + - VLAN_HLEN); - if (!new_skb) - goto tx_drop; + if (skb_is_gso(skb)) + large_send = card->options.large_send; + + if ((card->info.type == QETH_CARD_TYPE_IQD) && (!large_send) && + (skb_shinfo(skb)->nr_frags == 0)) { + new_skb = skb; + data_offset = ETH_HLEN; + hdr = kmem_cache_alloc(qeth_core_header_cache, GFP_ATOMIC); + if (!hdr) + goto tx_drop; + elements_needed++; + } else { + /* create a clone with writeable headroom */ + new_skb = skb_realloc_headroom(skb, sizeof(struct qeth_hdr_tso) + + VLAN_HLEN); + if (!new_skb) + goto tx_drop; + } if (card->info.type == QETH_CARD_TYPE_IQD) { - skb_pull(new_skb, ETH_HLEN); + if (data_offset < 0) + skb_pull(new_skb, ETH_HLEN); } else { if (new_skb->protocol == htons(ETH_P_IP)) { if (card->dev->type == ARPHRD_IEEE802_TR) @@ -2651,15 +2666,12 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) tag = (u16 *)(new_skb->data + 12); *tag = __constant_htons(ETH_P_8021Q); *(tag + 1) = htons(vlan_tx_tag_get(new_skb)); - VLAN_TX_SKB_CB(new_skb)->magic = 0; + new_skb->vlan_tci = 0; } } netif_stop_queue(dev); - if (skb_is_gso(new_skb)) - large_send = card->options.large_send; - /* fix hardware limitation: as long as we do not have sbal * chaining we can not send long frag lists so we temporary * switch to EDDP @@ -2677,9 +2689,16 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) qeth_tso_fill_header(card, hdr, new_skb); elements_needed++; } else { - hdr = (struct qeth_hdr *)skb_push(new_skb, + if (data_offset < 0) { + hdr = (struct qeth_hdr *)skb_push(new_skb, sizeof(struct qeth_hdr)); - qeth_l3_fill_header(card, hdr, new_skb, ipv, cast_type); + qeth_l3_fill_header(card, hdr, new_skb, ipv, + cast_type); + } else { + qeth_l3_fill_header(card, hdr, new_skb, ipv, + cast_type); + hdr->hdr.l3.length = new_skb->len - data_offset; + } } if (large_send == QETH_LARGE_SEND_EDDP) { @@ -2695,8 +2714,11 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) } else { int elems = qeth_get_elements_no(card, (void *)hdr, new_skb, elements_needed); - if (!elems) + if (!elems) { + if (data_offset >= 0) + kmem_cache_free(qeth_core_header_cache, hdr); goto tx_drop; + } elements_needed += elems; } @@ -2709,7 +2731,7 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) elements_needed, ctx); else rc = qeth_do_send_packet_fast(card, queue, new_skb, hdr, - elements_needed, ctx); + elements_needed, ctx, data_offset, 0); if (!rc) { card->stats.tx_packets++; @@ -2737,6 +2759,9 @@ static int qeth_l3_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) if (ctx != NULL) qeth_eddp_put_context(ctx); + if (data_offset >= 0) + kmem_cache_free(qeth_core_header_cache, hdr); + if (rc == -EBUSY) { if (new_skb != skb) dev_kfree_skb_any(new_skb); @@ -2763,7 +2788,7 @@ tx_drop: static int qeth_l3_open(struct net_device *dev) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; QETH_DBF_TEXT(TRACE, 4, "qethopen"); if (card->state != CARD_STATE_SOFTSETUP) @@ -2780,7 +2805,7 @@ static int qeth_l3_open(struct net_device *dev) static int qeth_l3_stop(struct net_device *dev) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; QETH_DBF_TEXT(TRACE, 4, "qethstop"); netif_tx_disable(dev); @@ -2792,14 +2817,14 @@ static int qeth_l3_stop(struct net_device *dev) static u32 qeth_l3_ethtool_get_rx_csum(struct net_device *dev) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; return (card->options.checksum_type == HW_CHECKSUMMING); } static int qeth_l3_ethtool_set_rx_csum(struct net_device *dev, u32 data) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; enum qeth_card_states old_state; enum qeth_checksum_types csum_type; @@ -2825,7 +2850,7 @@ static int qeth_l3_ethtool_set_rx_csum(struct net_device *dev, u32 data) static int qeth_l3_ethtool_set_tso(struct net_device *dev, u32 data) { - struct qeth_card *card = netdev_priv(dev); + struct qeth_card *card = dev->ml_priv; if (data) { if (card->options.large_send == QETH_LARGE_SEND_NO) { @@ -2915,7 +2940,7 @@ static int qeth_l3_setup_netdev(struct qeth_card *card) return -ENODEV; card->dev->hard_start_xmit = qeth_l3_hard_start_xmit; - card->dev->priv = card; + card->dev->ml_priv = card; card->dev->tx_timeout = &qeth_tx_timeout; card->dev->watchdog_timeo = QETH_TX_TIMEOUT; card->dev->open = qeth_l3_open; diff --git a/drivers/s390/net/qeth_l3_sys.c b/drivers/s390/net/qeth_l3_sys.c index ac1993708ae..210ddb63974 100644 --- a/drivers/s390/net/qeth_l3_sys.c +++ b/drivers/s390/net/qeth_l3_sys.c @@ -136,7 +136,7 @@ static ssize_t qeth_l3_dev_route6_store(struct device *dev, return -EINVAL; if (!qeth_is_supported(card, IPA_IPV6)) { - return -ENOTSUPP; + return -EOPNOTSUPP; } return qeth_l3_dev_route_store(card, &card->options.route6, diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c index 391dd29749f..51b6a05f4d1 100644 --- a/drivers/s390/scsi/zfcp_ccw.c +++ b/drivers/s390/scsi/zfcp_ccw.c @@ -152,10 +152,8 @@ static int zfcp_ccw_set_offline(struct ccw_device *ccw_device) */ static int zfcp_ccw_notify(struct ccw_device *ccw_device, int event) { - struct zfcp_adapter *adapter; + struct zfcp_adapter *adapter = dev_get_drvdata(&ccw_device->dev); - down(&zfcp_data.config_sema); - adapter = dev_get_drvdata(&ccw_device->dev); switch (event) { case CIO_GONE: dev_warn(&adapter->ccw_device->dev, "device gone\n"); @@ -174,8 +172,6 @@ static int zfcp_ccw_notify(struct ccw_device *ccw_device, int event) 89, NULL); break; } - zfcp_erp_wait(adapter); - up(&zfcp_data.config_sema); return 1; } diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c index e984469bb98..56196c98c07 100644 --- a/drivers/s390/scsi/zfcp_fc.c +++ b/drivers/s390/scsi/zfcp_fc.c @@ -39,18 +39,6 @@ struct zfcp_gpn_ft { struct scatterlist sg_resp[ZFCP_GPN_FT_BUFFERS]; }; -static struct zfcp_port *zfcp_get_port_by_did(struct zfcp_adapter *adapter, - u32 d_id) -{ - struct zfcp_port *port; - - list_for_each_entry(port, &adapter->port_list_head, list) - if ((port->d_id == d_id) && - !atomic_test_mask(ZFCP_STATUS_COMMON_REMOVE, &port->status)) - return port; - return NULL; -} - static void _zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req, u32 range, struct fcp_rscn_element *elem) { @@ -341,12 +329,13 @@ void zfcp_test_link(struct zfcp_port *port) zfcp_port_get(port); retval = zfcp_fc_adisc(port); - if (retval == 0 || retval == -EBUSY) + if (retval == 0) return; /* send of ADISC was not possible */ zfcp_port_put(port); - zfcp_erp_port_forced_reopen(port, 0, 65, NULL); + if (retval != -EBUSY) + zfcp_erp_port_forced_reopen(port, 0, 65, NULL); } static int zfcp_scan_get_nameserver(struct zfcp_adapter *adapter) @@ -363,7 +352,6 @@ static int zfcp_scan_get_nameserver(struct zfcp_adapter *adapter) if (ret) return ret; zfcp_erp_wait(adapter); - zfcp_port_put(adapter->nameserver_port); } return !atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, &adapter->nameserver_port->status); @@ -475,7 +463,7 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft) struct zfcp_adapter *adapter = ct->port->adapter; struct zfcp_port *port, *tmp; u32 d_id; - int ret = 0, x; + int ret = 0, x, last = 0; if (ct->status) return -EIO; @@ -492,19 +480,24 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft) down(&zfcp_data.config_sema); /* first entry is the header */ - for (x = 1; x < ZFCP_GPN_FT_MAX_ENTRIES; x++) { + for (x = 1; x < ZFCP_GPN_FT_MAX_ENTRIES && !last; x++) { if (x % (ZFCP_GPN_FT_ENTRIES + 1)) acc++; else acc = sg_virt(++sg); + last = acc->control & 0x80; d_id = acc->port_id[0] << 16 | acc->port_id[1] << 8 | acc->port_id[2]; /* skip the adapter's port and known remote ports */ - if (acc->wwpn == fc_host_port_name(adapter->scsi_host) || - zfcp_get_port_by_did(adapter, d_id)) + if (acc->wwpn == fc_host_port_name(adapter->scsi_host)) + continue; + port = zfcp_get_port_by_wwpn(adapter, acc->wwpn); + if (port) { + zfcp_port_get(port); continue; + } port = zfcp_port_enqueue(adapter, acc->wwpn, ZFCP_STATUS_PORT_DID_DID | @@ -513,8 +506,6 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft) ret = PTR_ERR(port); else zfcp_erp_port_reopen(port, 0, 149, NULL); - if (acc->control & 0x80) /* last entry */ - break; } zfcp_erp_wait(adapter); diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 19c1ca91387..49dbeb754e5 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c @@ -710,10 +710,10 @@ static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req) static int zfcp_fsf_sbal_check(struct zfcp_qdio_queue *queue) { - spin_lock(&queue->lock); + spin_lock_bh(&queue->lock); if (atomic_read(&queue->count)) return 1; - spin_unlock(&queue->lock); + spin_unlock_bh(&queue->lock); return 0; } @@ -722,13 +722,13 @@ static int zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter) long ret; struct zfcp_qdio_queue *req_q = &adapter->req_q; - spin_unlock(&req_q->lock); + spin_unlock_bh(&req_q->lock); ret = wait_event_interruptible_timeout(adapter->request_wq, zfcp_fsf_sbal_check(req_q), 5 * HZ); if (ret > 0) return 0; - spin_lock(&req_q->lock); + spin_lock_bh(&req_q->lock); return -EIO; } @@ -870,14 +870,14 @@ int zfcp_fsf_status_read(struct zfcp_adapter *adapter) volatile struct qdio_buffer_element *sbale; int retval = -EIO; - spin_lock(&adapter->req_q.lock); + spin_lock_bh(&adapter->req_q.lock); if (zfcp_fsf_req_sbal_get(adapter)) goto out; req = zfcp_fsf_req_create(adapter, FSF_QTCB_UNSOLICITED_STATUS, ZFCP_REQ_NO_QTCB, adapter->pool.fsf_req_status_read); - if (unlikely(IS_ERR(req))) { + if (IS_ERR(req)) { retval = PTR_ERR(req); goto out; } @@ -910,7 +910,7 @@ failed_buf: zfcp_fsf_req_free(req); zfcp_hba_dbf_event_fsf_unsol("fail", adapter, NULL); out: - spin_unlock(&adapter->req_q.lock); + spin_unlock_bh(&adapter->req_q.lock); return retval; } @@ -988,7 +988,7 @@ struct zfcp_fsf_req *zfcp_fsf_abort_fcp_command(unsigned long old_req_id, goto out; req = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND, req_flags, adapter->pool.fsf_req_abort); - if (unlikely(IS_ERR(req))) + if (IS_ERR(req)) goto out; if (unlikely(!(atomic_read(&unit->status) & @@ -1106,13 +1106,13 @@ int zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool, struct zfcp_fsf_req *req; int ret = -EIO; - spin_lock(&adapter->req_q.lock); + spin_lock_bh(&adapter->req_q.lock); if (zfcp_fsf_req_sbal_get(adapter)) goto out; req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_GENERIC, ZFCP_REQ_AUTO_CLEANUP, pool); - if (unlikely(IS_ERR(req))) { + if (IS_ERR(req)) { ret = PTR_ERR(req); goto out; } @@ -1148,7 +1148,7 @@ failed_send: if (erp_action) erp_action->fsf_req = NULL; out: - spin_unlock(&adapter->req_q.lock); + spin_unlock_bh(&adapter->req_q.lock); return ret; } @@ -1223,7 +1223,7 @@ int zfcp_fsf_send_els(struct zfcp_send_els *els) goto out; req = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS, ZFCP_REQ_AUTO_CLEANUP, NULL); - if (unlikely(IS_ERR(req))) { + if (IS_ERR(req)) { ret = PTR_ERR(req); goto out; } @@ -1263,14 +1263,14 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action) struct zfcp_adapter *adapter = erp_action->adapter; int retval = -EIO; - spin_lock(&adapter->req_q.lock); + spin_lock_bh(&adapter->req_q.lock); if (!atomic_read(&adapter->req_q.count)) goto out; req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_CONFIG_DATA, ZFCP_REQ_AUTO_CLEANUP, adapter->pool.fsf_req_erp); - if (unlikely(IS_ERR(req))) { + if (IS_ERR(req)) { retval = PTR_ERR(req); goto out; } @@ -1295,7 +1295,7 @@ int zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action) erp_action->fsf_req = NULL; } out: - spin_unlock(&adapter->req_q.lock); + spin_unlock_bh(&adapter->req_q.lock); return retval; } @@ -1306,13 +1306,13 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter, struct zfcp_fsf_req *req = NULL; int retval = -EIO; - spin_lock(&adapter->req_q.lock); + spin_lock_bh(&adapter->req_q.lock); if (zfcp_fsf_req_sbal_get(adapter)) goto out; req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_CONFIG_DATA, 0, NULL); - if (unlikely(IS_ERR(req))) { + if (IS_ERR(req)) { retval = PTR_ERR(req); goto out; } @@ -1334,7 +1334,7 @@ int zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter, zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); retval = zfcp_fsf_req_send(req); out: - spin_unlock(&adapter->req_q.lock); + spin_unlock_bh(&adapter->req_q.lock); if (!retval) wait_event(req->completion_wq, req->status & ZFCP_STATUS_FSFREQ_COMPLETED); @@ -1359,13 +1359,13 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action) if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) return -EOPNOTSUPP; - spin_lock(&adapter->req_q.lock); + spin_lock_bh(&adapter->req_q.lock); if (!atomic_read(&adapter->req_q.count)) goto out; req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, ZFCP_REQ_AUTO_CLEANUP, adapter->pool.fsf_req_erp); - if (unlikely(IS_ERR(req))) { + if (IS_ERR(req)) { retval = PTR_ERR(req); goto out; } @@ -1385,7 +1385,7 @@ int zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action) erp_action->fsf_req = NULL; } out: - spin_unlock(&adapter->req_q.lock); + spin_unlock_bh(&adapter->req_q.lock); return retval; } @@ -1405,13 +1405,13 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter, if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) return -EOPNOTSUPP; - spin_lock(&adapter->req_q.lock); + spin_lock_bh(&adapter->req_q.lock); if (!atomic_read(&adapter->req_q.count)) goto out; req = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, 0, NULL); - if (unlikely(IS_ERR(req))) { + if (IS_ERR(req)) { retval = PTR_ERR(req); goto out; } @@ -1427,7 +1427,7 @@ int zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter, zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); retval = zfcp_fsf_req_send(req); out: - spin_unlock(&adapter->req_q.lock); + spin_unlock_bh(&adapter->req_q.lock); if (!retval) wait_event(req->completion_wq, req->status & ZFCP_STATUS_FSFREQ_COMPLETED); @@ -1531,7 +1531,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) struct zfcp_fsf_req *req; int retval = -EIO; - spin_lock(&adapter->req_q.lock); + spin_lock_bh(&adapter->req_q.lock); if (zfcp_fsf_req_sbal_get(adapter)) goto out; @@ -1539,7 +1539,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) FSF_QTCB_OPEN_PORT_WITH_DID, ZFCP_REQ_AUTO_CLEANUP, adapter->pool.fsf_req_erp); - if (unlikely(IS_ERR(req))) { + if (IS_ERR(req)) { retval = PTR_ERR(req); goto out; } @@ -1562,7 +1562,7 @@ int zfcp_fsf_open_port(struct zfcp_erp_action *erp_action) erp_action->fsf_req = NULL; } out: - spin_unlock(&adapter->req_q.lock); + spin_unlock_bh(&adapter->req_q.lock); return retval; } @@ -1603,14 +1603,14 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action) struct zfcp_fsf_req *req; int retval = -EIO; - spin_lock(&adapter->req_q.lock); + spin_lock_bh(&adapter->req_q.lock); if (zfcp_fsf_req_sbal_get(adapter)) goto out; req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_PORT, ZFCP_REQ_AUTO_CLEANUP, adapter->pool.fsf_req_erp); - if (unlikely(IS_ERR(req))) { + if (IS_ERR(req)) { retval = PTR_ERR(req); goto out; } @@ -1633,7 +1633,7 @@ int zfcp_fsf_close_port(struct zfcp_erp_action *erp_action) erp_action->fsf_req = NULL; } out: - spin_unlock(&adapter->req_q.lock); + spin_unlock_bh(&adapter->req_q.lock); return retval; } @@ -1700,14 +1700,14 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action) struct zfcp_fsf_req *req; int retval = -EIO; - spin_lock(&adapter->req_q.lock); + spin_lock_bh(&adapter->req_q.lock); if (zfcp_fsf_req_sbal_get(adapter)) goto out; req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_PHYSICAL_PORT, ZFCP_REQ_AUTO_CLEANUP, adapter->pool.fsf_req_erp); - if (unlikely(IS_ERR(req))) { + if (IS_ERR(req)) { retval = PTR_ERR(req); goto out; } @@ -1731,7 +1731,7 @@ int zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action) erp_action->fsf_req = NULL; } out: - spin_unlock(&adapter->req_q.lock); + spin_unlock_bh(&adapter->req_q.lock); return retval; } @@ -1875,14 +1875,14 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action) struct zfcp_fsf_req *req; int retval = -EIO; - spin_lock(&adapter->req_q.lock); + spin_lock_bh(&adapter->req_q.lock); if (zfcp_fsf_req_sbal_get(adapter)) goto out; req = zfcp_fsf_req_create(adapter, FSF_QTCB_OPEN_LUN, ZFCP_REQ_AUTO_CLEANUP, adapter->pool.fsf_req_erp); - if (unlikely(IS_ERR(req))) { + if (IS_ERR(req)) { retval = PTR_ERR(req); goto out; } @@ -1910,7 +1910,7 @@ int zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action) erp_action->fsf_req = NULL; } out: - spin_unlock(&adapter->req_q.lock); + spin_unlock_bh(&adapter->req_q.lock); return retval; } @@ -1965,13 +1965,13 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action) struct zfcp_fsf_req *req; int retval = -EIO; - spin_lock(&adapter->req_q.lock); + spin_lock_bh(&adapter->req_q.lock); if (zfcp_fsf_req_sbal_get(adapter)) goto out; req = zfcp_fsf_req_create(adapter, FSF_QTCB_CLOSE_LUN, ZFCP_REQ_AUTO_CLEANUP, adapter->pool.fsf_req_erp); - if (unlikely(IS_ERR(req))) { + if (IS_ERR(req)) { retval = PTR_ERR(req); goto out; } @@ -1995,7 +1995,7 @@ int zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action) erp_action->fsf_req = NULL; } out: - spin_unlock(&adapter->req_q.lock); + spin_unlock_bh(&adapter->req_q.lock); return retval; } @@ -2228,7 +2228,7 @@ int zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter, goto out; req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, adapter->pool.fsf_req_scsi); - if (unlikely(IS_ERR(req))) { + if (IS_ERR(req)) { retval = PTR_ERR(req); goto out; } @@ -2351,7 +2351,7 @@ struct zfcp_fsf_req *zfcp_fsf_send_fcp_ctm(struct zfcp_adapter *adapter, goto out; req = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, adapter->pool.fsf_req_scsi); - if (unlikely(IS_ERR(req))) + if (IS_ERR(req)) goto out; req->status |= ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT; @@ -2417,12 +2417,12 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter, return ERR_PTR(-EINVAL); } - spin_lock(&adapter->req_q.lock); + spin_lock_bh(&adapter->req_q.lock); if (zfcp_fsf_req_sbal_get(adapter)) goto out; req = zfcp_fsf_req_create(adapter, fsf_cfdc->command, 0, NULL); - if (unlikely(IS_ERR(req))) { + if (IS_ERR(req)) { retval = -EPERM; goto out; } @@ -2447,7 +2447,7 @@ struct zfcp_fsf_req *zfcp_fsf_control_file(struct zfcp_adapter *adapter, zfcp_fsf_start_timer(req, ZFCP_FSF_REQUEST_TIMEOUT); retval = zfcp_fsf_req_send(req); out: - spin_unlock(&adapter->req_q.lock); + spin_unlock_bh(&adapter->req_q.lock); if (!retval) { wait_event(req->completion_wq, diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c index d6dbd653fde..69d632d851d 100644 --- a/drivers/s390/scsi/zfcp_qdio.c +++ b/drivers/s390/scsi/zfcp_qdio.c @@ -423,9 +423,9 @@ void zfcp_qdio_close(struct zfcp_adapter *adapter) /* clear QDIOUP flag, thus do_QDIO is not called during qdio_shutdown */ req_q = &adapter->req_q; - spin_lock(&req_q->lock); + spin_lock_bh(&req_q->lock); atomic_clear_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status); - spin_unlock(&req_q->lock); + spin_unlock_bh(&req_q->lock); qdio_shutdown(adapter->ccw_device, QDIO_FLAG_CLEANUP_USING_CLEAR); |