s390 (7/12): zfcp host adapter.
Subsystems (2)
PATCH 1/1 s390 (7/12): zfcp host adapter.
[PATCH] s390: zfcp host adapter.
From: Andreas Herrmann <[email protected]>
zfcp host adapter change:
- Return -EIO if wait_event_interruptible_timeout was interrupted.
- Reduce stack uage of zfcp_cfdc_dev_ioctl.
- Make zfcp_sg_list_[alloc,free] more consistent.
- Store driver version to zfcp_data structure.
- Add missing FSF states and make corresponding log messages consistent.
- Always wait for completion in zfcp_scsi_command_sync.
- Add Andreas to authors list.
- Add timeout for cfdc upload/download.
- Add support for temporary units (units not registered to the scsi stack).
- Allow sending of ELS commands to ports by their d_id.
- Increase port refcount while link test is running.
diffstat:
drivers/s390/scsi/zfcp_aux.c | 67 +++++----- drivers/s390/scsi/zfcp_ccw.c | 3 drivers/s390/scsi/zfcp_def.h | 15 +- drivers/s390/scsi/zfcp_erp.c | 30 +++- drivers/s390/scsi/zfcp_ext.h | 3 drivers/s390/scsi/zfcp_fsf.c | 202 ++++++++++++++++++++++----------- drivers/s390/scsi/zfcp_fsf.h | 3 drivers/s390/scsi/zfcp_qdio.c | 3 drivers/s390/scsi/zfcp_scsi.c | 10 - drivers/s390/scsi/zfcp_sysfs_adapter.c | 3 drivers/s390/scsi/zfcp_sysfs_driver.c | 5 drivers/s390/scsi/zfcp_sysfs_port.c | 3 drivers/s390/scsi/zfcp_sysfs_unit.c | 3 13 files changed, 225 insertions(+), 125 deletions(-)
drivers/s390/scsi/zfcp_aux.c +35 -32
@@ -12,6 +12,7 @@* Wolfgang Taphorn * Stefan Bader <[email protected]> * Heiko Carstens <[email protected]> +* Andreas Herrmann <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -29,7 +30,7 @@*/ /* this drivers version (do not edit !!! generated and updated by cvs) */ -#define ZFCP_AUX_REVISION "$Revision: 1.129 $" +#define ZFCP_AUX_REVISION "$Revision: 1.135 $"#include "zfcp_ext.h"
@@ -80,6 +81,7 @@module_init (zfcp_module_init);MODULE_AUTHOR ("Heiko Carstens <[email protected]>, " +"Andreas Herrman <[email protected]>, " "Martin Peschke <[email protected]>, " "Raimund Schroeder <[email protected]>, " "Wolfgang Taphorn <[email protected]>, "
@@ -379,7 +381,7 @@ zfcp_cfdc_dev_ioctl(struct inode *inode, struct file *file, unsigned int command, unsigned long buffer) { - struct zfcp_cfdc_sense_data sense_data, __user *sense_data_user; + struct zfcp_cfdc_sense_data *sense_data, __user *sense_data_user;struct zfcp_adapter *adapter =NULL ;struct zfcp_fsf_req *fsf_req =NULL ;struct zfcp_sg_list *sg_list =NULL ;
@@ -387,6 +389,12 @@char *bus_id =NULL ;int retval =0 ; + sense_data =kmalloc (sizeof (struct zfcp_cfdc_sense_data ),GFP_KERNEL ); +if (sense_data ==NULL ) { + retval = -ENOMEM ; + goto out; + } + sg_list =kmalloc (sizeof (struct zfcp_sg_list ),GFP_KERNEL );if (sg_list ==NULL ) { retval = -ENOMEM ;
@@ -406,21 +414,21 @@ goto out; } - retval =copy_from_user (&sense_data, sense_data_user, + retval =copy_from_user (sense_data, sense_data_user,sizeof (struct zfcp_cfdc_sense_data ));if (retval) { retval = -EFAULT ; goto out; } -if (sense_data.signature !=ZFCP_CFDC_SIGNATURE ) { +if (sense_data->signature !=ZFCP_CFDC_SIGNATURE ) {ZFCP_LOG_INFO ("invalid sense data request signature 0x%08x\n" ,ZFCP_CFDC_SIGNATURE ); retval = -EINVAL ; goto out; } -switch (sense_data.command) { +switch (sense_data->command) {case ZFCP_CFDC_CMND_DOWNLOAD_NORMAL : fsf_command =FSF_QTCB_DOWNLOAD_CONTROL_FILE ;
@@ -449,7 +457,7 @@default :ZFCP_LOG_INFO ("invalid command code 0x%08x\n" , - sense_data.command); + sense_data->command); retval = -EINVAL ; goto out; }
@@ -460,9 +468,9 @@ goto out; }snprintf (bus_id,BUS_ID_SIZE ,"%d.%d.%04x" , - (sense_data.devno >>24 ), - (sense_data.devno >>16 ) &0xFF , - (sense_data.devno &0xFFFF )); + (sense_data->devno >>24 ), + (sense_data->devno >>16 ) &0xFF , + (sense_data->devno &0xFFFF ));read_lock_irq (&zfcp_data.config_lock); adapter =zfcp_get_adapter_by_busid (bus_id);
@@ -478,7 +486,7 @@ goto out; } -if (sense_data.command &ZFCP_CFDC_WITH_CONTROL_FILE ) { +if (sense_data->command &ZFCP_CFDC_WITH_CONTROL_FILE ) { retval =zfcp_sg_list_alloc (sg_list,ZFCP_CFDC_MAX_CONTROL_FILE_SIZE );if (retval) {
@@ -487,8 +495,8 @@ } } -if ((sense_data.command &ZFCP_CFDC_DOWNLOAD ) && - (sense_data.command &ZFCP_CFDC_WITH_CONTROL_FILE )) { +if ((sense_data->command &ZFCP_CFDC_DOWNLOAD ) && + (sense_data->command &ZFCP_CFDC_WITH_CONTROL_FILE )) { retval =zfcp_sg_list_copy_from_user ( sg_list, &sense_data_user->control_file,ZFCP_CFDC_MAX_CONTROL_FILE_SIZE );
@@ -498,19 +506,10 @@ } } - retval =zfcp_fsf_control_file ( - adapter, &fsf_req, fsf_command, option, sg_list); -if (retval == -EOPNOTSUPP ) { -ZFCP_LOG_INFO ("adapter does not support cfdc\n" ); - goto out; - }else if (retval !=0 ) { -ZFCP_LOG_INFO ("initiation of cfdc up/download failed\n" ); - retval = -EPERM ; + retval =zfcp_fsf_control_file (adapter, &fsf_req, fsf_command, + option, sg_list); +if (retval) goto out; - } - -wait_event (fsf_req->completion_wq, - fsf_req->status &ZFCP_STATUS_FSFREQ_COMPLETED );if ((fsf_req->qtcb->prefix.prot_status !=FSF_PROT_GOOD ) && (fsf_req->qtcb->prefix.prot_status !=FSF_PROT_FSF_STATUS_PRESENTED )) {
@@ -518,20 +517,20 @@ goto out; } - sense_data.fsf_status = fsf_req->qtcb->header.fsf_status; -memcpy (&sense_data.fsf_status_qual, + sense_data->fsf_status = fsf_req->qtcb->header.fsf_status; +memcpy (&sense_data->fsf_status_qual, &fsf_req->qtcb->header.fsf_status_qual,sizeof (union fsf_status_qual )); -memcpy (&sense_data.payloads, &fsf_req->qtcb->bottom.support.els,256 ); +memcpy (&sense_data->payloads, &fsf_req->qtcb->bottom.support.els,256 ); - retval =copy_to_user (sense_data_user, &sense_data, + retval =copy_to_user (sense_data_user, sense_data,sizeof (struct zfcp_cfdc_sense_data ));if (retval) { retval = -EFAULT ; goto out; } -if (sense_data.command &ZFCP_CFDC_UPLOAD ) { +if (sense_data->command &ZFCP_CFDC_UPLOAD ) { retval =zfcp_sg_list_copy_to_user ( &sense_data_user->control_file, sg_list,ZFCP_CFDC_MAX_CONTROL_FILE_SIZE );
@@ -553,6 +552,9 @@kfree (sg_list); } +if (sense_data !=NULL ) +kfree (sense_data); +return retval; }
@@ -588,18 +590,19 @@ retval = -ENOMEM ; goto out; } +memset (sg_list->sg, sg_list->count *sizeof (struct scatterlist ),0 );for (i =0 , sg = sg_list->sg; i < sg_list->count; i++, sg++) { sg->length =min (size,PAGE_SIZE ); sg->offset =0 ; address = (void *)get_zeroed_page (GFP_KERNEL ); -zfcp_address_to_sg (address, sg); -if (sg->page ==NULL ) { +if (address ==NULL ) { sg_list->count = i;zfcp_sg_list_free (sg_list); retval = -ENOMEM ; goto out; } +zfcp_address_to_sg (address, sg); size -= sg->length; }
@@ -624,7 +627,7 @@BUG_ON (sg_list ==NULL );for (i =0 , sg = sg_list->sg; i < sg_list->count; i++, sg++) -__free_pages (sg->page,0 ); +free_page ((unsigned long )zfcp_sg_to_address (sg)); sg_list->count =0 ;kfree (sg_list->sg);
drivers/s390/scsi/zfcp_ccw.c +2 -1
@@ -10,6 +10,7 @@* Authors: * Martin Peschke <[email protected]> * Heiko Carstens <[email protected]> +* Andreas Herrmann <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -26,7 +27,7 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define ZFCP_CCW_C_REVISION "$Revision: 1.56 $" +#define ZFCP_CCW_C_REVISION "$Revision: 1.57 $"#include "zfcp_ext.h"
drivers/s390/scsi/zfcp_def.h +10 -5
@@ -12,6 +12,7 @@* Wolfgang Taphorn * Stefan Bader <[email protected]> * Heiko Carstens <[email protected]> +* Andreas Herrmann <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -33,7 +34,7 @@#define ZFCP_DEF_H /* this drivers version (do not edit !!! generated and updated by cvs) */ -#define ZFCP_DEF_REVISION "$Revision: 1.91 $" +#define ZFCP_DEF_REVISION "$Revision: 1.98 $"/*************************** INCLUDES *****************************************/
@@ -71,7 +72,7 @@/********************* GENERAL DEFINES *********************************/ /* zfcp version number, it consists of major, minor, and patch-level number */ -#define ZFCP_VERSION "4.1.3" +#define ZFCP_VERSION "4.1.4"/** * zfcp_sg_to_address - determine kernel address from struct scatterlist
@@ -597,7 +598,8 @@ ZFCP_STATUS_PORT_NO_SCSI_ID)/* logical unit status */ -#define ZFCP_STATUS_UNIT_NOTSUPPUNITRESET 0x00000001 +#define ZFCP_STATUS_UNIT_NOTSUPPUNITRESET 0x00000001 +#define ZFCP_STATUS_UNIT_TEMPORARY 0x00000010/* FSF request status (this does not have a common part) */
@@ -817,7 +819,8 @@/** * struct zfcp_send_els - used to pass parameters to function zfcp_fsf_send_els -* @port: port where the request is sent to +* @adapter: adapter where request is sent from +* @d_id: destiniation id of port where request is sent to * @req: scatter-gather list for request * @resp: scatter-gather list for response * @req_count: number of elements in request scatter-gather list
@@ -830,7 +833,8 @@* @status: used to pass error status to calling function */ struct zfcp_send_els { -struct zfcp_port *port; +struct zfcp_adapter *adapter; +fc_id_t d_id;struct scatterlist *req;struct scatterlist *resp;unsigned int req_count;
@@ -1055,6 +1059,7 @@char init_busid[BUS_ID_SIZE ];wwn_t init_wwpn;fcp_lun_t init_fcp_lun; +char *driver_version; };/**
drivers/s390/scsi/zfcp_erp.c +20 -10
@@ -12,6 +12,7 @@* Wolfgang Taphorn * Stefan Bader <[email protected]> * Heiko Carstens <[email protected]> +* Andreas Herrmann <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -31,7 +32,7 @@#define ZFCP_LOG_AREA ZFCP_LOG_AREA_ERP/* this drivers version (do not edit !!! generated and updated by cvs) */ -#define ZFCP_ERP_REVISION "$Revision: 1.65 $" +#define ZFCP_ERP_REVISION "$Revision: 1.69 $"#include "zfcp_ext.h"
@@ -336,7 +337,8 @@ send_els->req->offset =0 ; send_els->resp->offset =PAGE_SIZE >>1 ; - send_els->port = port; + send_els->adapter = port->adapter; + send_els->d_id = port->d_id; send_els->ls_code = ls_code; send_els->handler = zfcp_els_handler; send_els->handler_data = (unsigned long )send_els;
@@ -441,7 +443,7 @@ zfcp_els_handler(unsigned long data) {struct zfcp_send_els *send_els = (struct zfcp_send_els *)data; -struct zfcp_port *port = send_els->port; +struct zfcp_port *port;struct zfcp_ls_rtv_acc *rtv;struct zfcp_ls_rls_acc *rls;struct zfcp_ls_pdisc_acc *pdisc;
@@ -449,6 +451,12 @@void *req, *resp;u8 req_code; +read_lock (&zfcp_data.config_lock); + port =zfcp_get_port_by_did (send_els->adapter, send_els->d_id); +read_unlock (&zfcp_data.config_lock); + +BUG_ON (port ==NULL ); +/* request rejected or timed out */ if (send_els->status !=0 ) { ZFCP_LOG_NORMAL("ELS request timed out, force physical port "
@@ -521,6 +529,7 @@ } out: +zfcp_port_put (port);__free_pages (send_els->req->page,0 );kfree (send_els->req);kfree (send_els->resp);
@@ -541,8 +550,10 @@ {int retval; +zfcp_port_get (port); retval =zfcp_els (port,ZFCP_LS_ADISC );if (retval !=0 ) { +zfcp_port_put (port);ZFCP_LOG_NORMAL ("reopen needed for port 0x%016Lx " "on adapter %s\n " , port->wwpn,zfcp_get_busid_by_port (port));
@@ -3445,21 +3456,20 @@/** * zfcp_erp_action_cleanup * -* registers unit with scsi stack if appropiate and fixes reference counts +* Register unit with scsi stack if appropiate and fix reference counts. +* Note: Temporary units are not registered with scsi stack. */ -static void zfcp_erp_action_cleanup (int action,struct zfcp_adapter *adapter,struct zfcp_port *port,struct zfcp_unit *unit,int result) { -if ((action ==ZFCP_ERP_ACTION_REOPEN_UNIT ) - && (result ==ZFCP_ERP_SUCCEEDED ) - && (!unit->device)) { -zfcp_erp_schedule_work (unit); - }switch (action) {case ZFCP_ERP_ACTION_REOPEN_UNIT : +if ((result ==ZFCP_ERP_SUCCEEDED ) + && (!atomic_test_mask (ZFCP_STATUS_UNIT_TEMPORARY , &unit->status)) + && (!unit->device)) +zfcp_erp_schedule_work (unit);zfcp_unit_put (unit);break ;case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED :
drivers/s390/scsi/zfcp_ext.h +2 -1
@@ -12,6 +12,7 @@* Wolfgang Taphorn * Stefan Bader <[email protected]> * Heiko Carstens <[email protected]> +* Andreas Herrmann <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -31,7 +32,7 @@#ifndef ZFCP_EXT_H #define ZFCP_EXT_H /* this drivers version (do not edit !!! generated and updated by cvs) */ -#define ZFCP_EXT_REVISION "$Revision: 1.57 $" +#define ZFCP_EXT_REVISION "$Revision: 1.58 $"#include "zfcp_def.h"
drivers/s390/scsi/zfcp_fsf.c +136 -66
415 lines not on this page · raw message
drivers/s390/scsi/zfcp_fsf.h +3 -0
@@ -12,6 +12,7 @@* Wolfgang Taphorn * Stefan Bader <[email protected]> * Heiko Carstens <[email protected]> +* Andreas Herrmann <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -105,6 +106,8 @@#define FSF_PAYLOAD_SIZE_MISMATCH 0x00000060#define FSF_REQUEST_SIZE_TOO_LARGE 0x00000061#define FSF_RESPONSE_SIZE_TOO_LARGE 0x00000062 +#define FSF_SBAL_MISMATCH 0x00000063 +#define FSF_OPEN_PORT_WITHOUT_PRLI 0x00000064#define FSF_ADAPTER_STATUS_AVAILABLE 0x000000AD#define FSF_FCP_RSP_AVAILABLE 0x000000AF#define FSF_UNKNOWN_COMMAND 0x000000E2
drivers/s390/scsi/zfcp_qdio.c +2 -1
@@ -12,6 +12,7 @@* Raimund Schroeder <[email protected]> * Wolfgang Taphorn * Heiko Carstens <[email protected]> +* Andreas Herrmann <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -28,7 +29,7 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define ZFCP_QDIO_C_REVISION "$Revision: 1.19 $" +#define ZFCP_QDIO_C_REVISION "$Revision: 1.20 $"#include "zfcp_ext.h"
drivers/s390/scsi/zfcp_scsi.c +6 -4
@@ -12,6 +12,7 @@* Wolfgang Taphorn * Stefan Bader <[email protected]> * Heiko Carstens <[email protected]> +* Andreas Herrmann <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -31,7 +32,7 @@#define ZFCP_LOG_AREA ZFCP_LOG_AREA_SCSI/* this drivers version (do not edit !!! generated and updated by cvs) */ -#define ZFCP_SCSI_REVISION "$Revision: 1.68 $" +#define ZFCP_SCSI_REVISION "$Revision: 1.71 $"#include "zfcp_ext.h"
@@ -79,7 +80,8 @@ unchecked_isa_dma: 0, use_clustering: 1, sdev_attrs: zfcp_sysfs_sdev_attrs, - } + }, + .driver_version = ZFCP_VERSION, /* rest initialised with zeros */ };
@@ -331,8 +333,8 @@ scpnt->SCp.ptr = (void *) &wait;/* silent re-use */ scpnt->scsi_done = zfcp_scsi_command_sync_handler; ret =zfcp_scsi_command_async (unit->port->adapter, unit, scpnt, timer); -if ((ret ==0 ) && (scpnt->result ==0 )) -wait_for_completion (&wait); +if (ret ==0 ) +wait_for_completion (&wait); scpnt->SCp.ptr =NULL ;
drivers/s390/scsi/zfcp_sysfs_adapter.c +2 -1
@@ -10,6 +10,7 @@* Authors: * Martin Peschke <[email protected]> * Heiko Carstens <[email protected]> +* Andreas Herrmann <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -26,7 +27,7 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define ZFCP_SYSFS_ADAPTER_C_REVISION "$Revision: 1.37 $" +#define ZFCP_SYSFS_ADAPTER_C_REVISION "$Revision: 1.38 $"#include "zfcp_ext.h"
drivers/s390/scsi/zfcp_sysfs_driver.c +3 -2
@@ -10,6 +10,7 @@* Authors: * Martin Peschke <[email protected]> * Heiko Carstens <[email protected]> +* Andreas Herrmann <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -26,7 +27,7 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define ZFCP_SYSFS_DRIVER_C_REVISION "$Revision: 1.15 $" +#define ZFCP_SYSFS_DRIVER_C_REVISION "$Revision: 1.17 $"#include "zfcp_ext.h"
@@ -85,7 +86,7 @@static ssize_t zfcp_sysfs_version_show (struct device_driver *dev,char *buf) { -return sprintf (buf,"%s\n" ,ZFCP_VERSION ); +return sprintf (buf,"%s\n" , zfcp_data.driver_version); } static DRIVER_ATTR(version, S_IRUGO, zfcp_sysfs_version_show, NULL);
drivers/s390/scsi/zfcp_sysfs_port.c +2 -1
@@ -10,6 +10,7 @@* Authors: * Martin Peschke <[email protected]> * Heiko Carstens <[email protected]> +* Andreas Herrmann <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -26,7 +27,7 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define ZFCP_SYSFS_PORT_C_REVISION "$Revision: 1.44 $" +#define ZFCP_SYSFS_PORT_C_REVISION "$Revision: 1.46 $"#include "zfcp_ext.h"
drivers/s390/scsi/zfcp_sysfs_unit.c +2 -1
@@ -10,6 +10,7 @@* Authors: * Martin Peschke <[email protected]> * Heiko Carstens <[email protected]> +* Andreas Herrmann <[email protected]> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by
@@ -26,7 +27,7 @@* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#define ZFCP_SYSFS_UNIT_C_REVISION "$Revision: 1.27 $" +#define ZFCP_SYSFS_UNIT_C_REVISION "$Revision: 1.29 $"#include "zfcp_ext.h"