Skip to contentSkip to conversation

s390: zfcp host adapter.

PATCH New Martin Schwidefsky 1 participant 1 message Jun 30, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390: zfcp host adapter.

[PATCH] s390: zfcp host adapter.

From: Heiko Carstens <[email protected]>
From: Andreas Herrmann <[email protected]>
From: Maxim Shchetynin <[email protected]>

zfcp host adapter changes:
- Exploit FC transport class and autoselect SCSI_FC_ATTRS for zfcp.
- Fix acl download to zfcp controller.
- Change message loglevels to make zfcp less noisy.
- Don't wait for SBAL to finish for command aborts after a timeout and for logical unit or target resets.
- Force reopen of port if link test failed.
- Fix race between qdio_shutdown and do_QDIO.

diffstat:

 arch/s390/defconfig           |    2 
 drivers/s390/scsi/zfcp_aux.c  |   13 ++++--
 drivers/s390/scsi/zfcp_def.h  |   20 +++++----
 drivers/s390/scsi/zfcp_erp.c  |   87 +++++++++++++++++-------------------------
 drivers/s390/scsi/zfcp_ext.h  |    4 +
 drivers/s390/scsi/zfcp_fsf.c  |   23 +++++++----
 drivers/s390/scsi/zfcp_scsi.c |   51 +++++++++++++++++++++---
 drivers/scsi/Kconfig          |    1 
 8 files changed, 123 insertions(+), 78 deletions(-)
arch/s390/defconfig +1 -1
diff -urN linux-2.6/arch/s390/defconfig linux-2.6-s390/arch/s390/defconfig
@@ -124,7 +124,7 @@
 # SCSI Transport Attributes
 #
 # CONFIG_SCSI_SPI_ATTRS is not set
-# CONFIG_SCSI_FC_ATTRS is not set
+CONFIG_SCSI_FC_ATTRS=y
 
 #
 # SCSI low-level drivers
drivers/s390/scsi/zfcp_aux.c +10 -3
diff -urN linux-2.6/drivers/s390/scsi/zfcp_aux.c linux-2.6-s390/drivers/s390/scsi/zfcp_aux.c
@@ -29,7 +29,7 @@
  */
 
 /* this drivers version (do not edit !!! generated and updated by cvs) */
-#define ZFCP_AUX_REVISION "$Revision: 1.108 $"
+#define ZFCP_AUX_REVISION "$Revision: 1.114 $"
 
 #include "zfcp_ext.h"
 
@@ -310,6 +310,10 @@
 	/* initialize adapters to be removed list head */
 	INIT_LIST_HEAD(&zfcp_data.adapter_remove_lh);
 
+	zfcp_transport_template = fc_attach_transport(&zfcp_transport_functions);
+	if (!zfcp_transport_template)
+		return -ENODEV;
+
 #ifdef CONFIG_S390_SUPPORT
 	retval = register_ioctl32_conversion(zfcp_ioctl_trans.cmd,
 					     zfcp_ioctl_trans.handler);
@@ -414,7 +418,7 @@
 		retval = -ENOMEM;
 		goto out;
 	}
-	sg_list->count = 0;
+	memset(sg_list, 0, sizeof(*sg_list));
 
 	if (command != ZFCP_CFDC_IOC) {
 		ZFCP_LOG_INFO("IOC request code 0x%x invalid\n", command);
@@ -599,6 +603,7 @@
 	sg_list->sg = kmalloc(sg_list->count * sizeof(struct scatterlist),
 			      GFP_KERNEL);
 	if (sg_list->sg == NULL) {
+		sg_list->count = 0;
 		retval = -ENOMEM;
 		goto out;
 	}
@@ -635,11 +640,13 @@
 	unsigned int i;
 	int retval = 0;
 
-	BUG_ON((sg_list->sg == NULL) || (sg_list == NULL));
+	BUG_ON(sg_list == NULL);
 
 	for (i = 0, sg = sg_list->sg; i < sg_list->count; i++, sg++)
 		__free_pages(sg->page, 0);
 
+	kfree(sg_list->sg);
+
 	return retval;
 }
 
drivers/s390/scsi/zfcp_def.h +11 -9
diff -urN linux-2.6/drivers/s390/scsi/zfcp_def.h linux-2.6-s390/drivers/s390/scsi/zfcp_def.h
@@ -33,7 +33,7 @@
 #define ZFCP_DEF_H
 
 /* this drivers version (do not edit !!! generated and updated by cvs) */
-#define ZFCP_DEF_REVISION "$Revision: 1.73 $"
+#define ZFCP_DEF_REVISION "$Revision: 1.75 $"
 
 /*************************** INCLUDES *****************************************/
 
@@ -47,6 +47,8 @@
 #include <scsi/scsi_cmnd.h>
 #include <scsi/scsi_device.h>
 #include <scsi/scsi_host.h>
+#include <scsi/scsi_transport.h>
+#include <scsi/scsi_transport_fc.h>
 #include "../../fc4/fc.h"
 #include "zfcp_fsf.h"
 #include <asm/ccwdev.h>
@@ -509,14 +511,14 @@
 
 /* all log-level defaults are combined to generate initial log-level */
 #define ZFCP_LOG_LEVEL_DEFAULTS \
-	(ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_INFO, ZFCP_LOG_AREA_OTHER) | \
-	 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_INFO, ZFCP_LOG_AREA_SCSI) | \
-	 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_INFO, ZFCP_LOG_AREA_FSF) | \
-	 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_INFO, ZFCP_LOG_AREA_CONFIG) | \
-	 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_INFO, ZFCP_LOG_AREA_CIO) | \
-	 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_INFO, ZFCP_LOG_AREA_QDIO) | \
-	 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_INFO, ZFCP_LOG_AREA_ERP) | \
-	 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_INFO, ZFCP_LOG_AREA_FC))
+	(ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_OTHER) | \
+	 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_SCSI) | \
+	 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_FSF) | \
+	 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_CONFIG) | \
+	 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_CIO) | \
+	 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_QDIO) | \
+	 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_ERP) | \
+	 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_FC))
 
 /* check whether we have the right level for logging */
 #define ZFCP_LOG_CHECK(level) \
drivers/s390/scsi/zfcp_erp.c +36 -51

141 lines not on this page · raw message

drivers/s390/scsi/zfcp_ext.h +3 -1
diff -urN linux-2.6/drivers/s390/scsi/zfcp_ext.h linux-2.6-s390/drivers/s390/scsi/zfcp_ext.h
@@ -31,7 +31,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.50 $"
+#define ZFCP_EXT_REVISION "$Revision: 1.51 $"
 
 #include "zfcp_def.h"
 
@@ -136,6 +136,8 @@
 				   struct scsi_cmnd *scsi_cmnd);
 extern int zfcp_scsi_command_sync(struct zfcp_unit *unit,
 				  struct scsi_cmnd *scsi_cmnd);
+extern struct scsi_transport_template *zfcp_transport_template;
+extern struct fc_function_template zfcp_transport_functions;
 
 /******************************** ERP ****************************************/
 extern void zfcp_erp_modify_adapter_status(struct zfcp_adapter *, u32, int);
drivers/s390/scsi/zfcp_fsf.c +16 -7
diff -urN linux-2.6/drivers/s390/scsi/zfcp_fsf.c linux-2.6-s390/drivers/s390/scsi/zfcp_fsf.c
@@ -29,7 +29,7 @@
  */
 
 /* this drivers version (do not edit !!! generated and updated by cvs) */
-#define ZFCP_FSF_C_REVISION "$Revision: 1.47 $"
+#define ZFCP_FSF_C_REVISION "$Revision: 1.49 $"
 
 #include "zfcp_ext.h"
 
@@ -3997,15 +3997,14 @@
 	scpnt->result |= fcp_rsp_iu->scsi_status;
 	if (unlikely(fcp_rsp_iu->scsi_status)) {
 		/* DEBUG */
-		ZFCP_LOG_NORMAL("status for SCSI Command:\n");
-		ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL,
+		ZFCP_LOG_DEBUG("status for SCSI Command:\n");
+		ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
 			      scpnt->cmnd, scpnt->cmd_len);
-
-		ZFCP_LOG_NORMAL("SCSI status code 0x%x\n",
+		ZFCP_LOG_DEBUG("SCSI status code 0x%x\n",
 				fcp_rsp_iu->scsi_status);
-		ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL,
+		ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
 			      (void *) fcp_rsp_iu, sizeof (struct fcp_rsp_iu));
-		ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL,
+		ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
 			      zfcp_get_fcp_sns_info_ptr(fcp_rsp_iu),
 			      fcp_rsp_iu->fcp_sns_len);
 	}
@@ -4782,6 +4781,16 @@
                 goto failed_sbals;
 	}
 
+	/*
+	 * We hold queue_lock here. Check if QDIOUP is set and let request fail
+	 * if it is not set (see also *_open_qdio and *_close_qdio).
+	 */
+
+	if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_QDIOUP, &adapter->status)) {
+		write_unlock_irqrestore(&req_queue->queue_lock, *lock_flags);
+		goto failed_sbals;
+	}
+
 	fsf_req->adapter = adapter;	/* pointer to "parent" adapter */
 	fsf_req->fsf_command = fsf_cmd;
 	fsf_req->sbal_number = 1;
drivers/s390/scsi/zfcp_scsi.c +45 -6

93 lines not on this page · raw message

drivers/scsi/Kconfig +1 -0
diff -urN linux-2.6/drivers/scsi/Kconfig linux-2.6-s390/drivers/scsi/Kconfig
@@ -1738,6 +1738,7 @@
 config ZFCP
 	tristate "FCP host bus adapter driver for IBM eServer zSeries"
 	depends on ARCH_S390 && SCSI
+	select SCSI_FC_ATTRS
 	help
           If you want to access SCSI devices attached to your IBM eServer
           zSeries by means of Fibre Channel interfaces say Y.