aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/s390/scsi/Makefile2
-rw-r--r--drivers/s390/scsi/zfcp_aux.c75
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c41
-rw-r--r--drivers/s390/scsi/zfcp_def.h124
-rw-r--r--drivers/s390/scsi/zfcp_erp.c293
-rw-r--r--drivers/s390/scsi/zfcp_ext.h20
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c1557
-rw-r--r--drivers/s390/scsi/zfcp_fsf.h20
-rw-r--r--drivers/s390/scsi/zfcp_scsi.c64
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_adapter.c23
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_driver.c106
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_port.c23
-rw-r--r--drivers/s390/scsi/zfcp_sysfs_unit.c23
13 files changed, 396 insertions, 1975 deletions
diff --git a/drivers/s390/scsi/Makefile b/drivers/s390/scsi/Makefile
index c0fa8ffe5448..1aa46500f650 100644
--- a/drivers/s390/scsi/Makefile
+++ b/drivers/s390/scsi/Makefile
@@ -4,6 +4,6 @@
4 4
5zfcp-objs := zfcp_aux.o zfcp_ccw.o zfcp_scsi.o zfcp_erp.o zfcp_qdio.o \ 5zfcp-objs := zfcp_aux.o zfcp_ccw.o zfcp_scsi.o zfcp_erp.o zfcp_qdio.o \
6 zfcp_fsf.o zfcp_dbf.o zfcp_sysfs_adapter.o zfcp_sysfs_port.o \ 6 zfcp_fsf.o zfcp_dbf.o zfcp_sysfs_adapter.o zfcp_sysfs_port.o \
7 zfcp_sysfs_unit.o zfcp_sysfs_driver.o zfcp_fc.o zfcp_cfdc.o 7 zfcp_sysfs_unit.o zfcp_fc.o zfcp_cfdc.o
8 8
9obj-$(CONFIG_ZFCP) += zfcp.o 9obj-$(CONFIG_ZFCP) += zfcp.o
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index 7084a6ae1096..47739f4f6709 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -1,22 +1,9 @@
1/* 1/*
2 * This file is part of the zfcp device driver for 2 * zfcp device driver
3 * FCP adapters for IBM System z9 and zSeries.
4 * 3 *
5 * (C) Copyright IBM Corp. 2002, 2006 4 * Module interface and handling of zfcp data structures.
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * Copyright IBM Corporation 2002, 2008
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22/* 9/*
@@ -31,13 +18,16 @@
31 * Maxim Shchetynin 18 * Maxim Shchetynin
32 * Volker Sameske 19 * Volker Sameske
33 * Ralph Wuerthner 20 * Ralph Wuerthner
21 * Michael Loehr
22 * Swen Schillig
23 * Christof Schmitt
24 * Martin Petermann
25 * Sven Schuetz
34 */ 26 */
35 27
36#include <linux/miscdevice.h> 28#include <linux/miscdevice.h>
37#include "zfcp_ext.h" 29#include "zfcp_ext.h"
38 30
39/* accumulated log level (module parameter) */
40static u32 loglevel = ZFCP_LOG_LEVEL_DEFAULTS;
41static char *device; 31static char *device;
42/*********************** FUNCTION PROTOTYPES *********************************/ 32/*********************** FUNCTION PROTOTYPES *********************************/
43 33
@@ -57,12 +47,6 @@ MODULE_LICENSE("GPL");
57module_param(device, charp, 0400); 47module_param(device, charp, 0400);
58MODULE_PARM_DESC(device, "specify initial device"); 48MODULE_PARM_DESC(device, "specify initial device");
59 49
60module_param(loglevel, uint, 0400);
61MODULE_PARM_DESC(loglevel,
62 "log levels, 8 nibbles: "
63 "FC ERP QDIO CIO Config FSF SCSI Other, "
64 "levels: 0=none 1=normal 2=devel 3=trace");
65
66/****************************************************************/ 50/****************************************************************/
67/************** Functions without logging ***********************/ 51/************** Functions without logging ***********************/
68/****************************************************************/ 52/****************************************************************/
@@ -87,8 +71,6 @@ _zfcp_hex_dump(char *addr, int count)
87/****** Functions to handle the request ID hash table ********/ 71/****** Functions to handle the request ID hash table ********/
88/****************************************************************/ 72/****************************************************************/
89 73
90#define ZFCP_LOG_AREA ZFCP_LOG_AREA_FSF
91
92static int zfcp_reqlist_alloc(struct zfcp_adapter *adapter) 74static int zfcp_reqlist_alloc(struct zfcp_adapter *adapter)
93{ 75{
94 int idx; 76 int idx;
@@ -118,14 +100,10 @@ int zfcp_reqlist_isempty(struct zfcp_adapter *adapter)
118 return 1; 100 return 1;
119} 101}
120 102
121#undef ZFCP_LOG_AREA
122
123/****************************************************************/ 103/****************************************************************/
124/************** Uncategorised Functions *************************/ 104/************** Uncategorised Functions *************************/
125/****************************************************************/ 105/****************************************************************/
126 106
127#define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER
128
129/** 107/**
130 * zfcp_device_setup - setup function 108 * zfcp_device_setup - setup function
131 * @str: pointer to parameter string 109 * @str: pointer to parameter string
@@ -143,8 +121,11 @@ zfcp_device_setup(char *devstr)
143 121
144 len = strlen(devstr) + 1; 122 len = strlen(devstr) + 1;
145 str = kmalloc(len, GFP_KERNEL); 123 str = kmalloc(len, GFP_KERNEL);
146 if (!str) 124 if (!str) {
147 goto err_out; 125 pr_err("zfcp: Could not allocate memory for "
126 "device parameter string, device not attached.\n");
127 return 0;
128 }
148 memcpy(str, devstr, len); 129 memcpy(str, devstr, len);
149 130
150 tmp = strchr(str, ','); 131 tmp = strchr(str, ',');
@@ -167,7 +148,8 @@ zfcp_device_setup(char *devstr)
167 return 1; 148 return 1;
168 149
169 err_out: 150 err_out:
170 ZFCP_LOG_NORMAL("Parse error for device parameter string %s\n", str); 151 pr_err("zfcp: Parse error for device parameter string %s, "
152 "device not attached.\n", str);
171 kfree(str); 153 kfree(str);
172 return 0; 154 return 0;
173} 155}
@@ -248,8 +230,6 @@ zfcp_module_init(void)
248 if (!zfcp_data.gid_pn_cache) 230 if (!zfcp_data.gid_pn_cache)
249 goto out_gid_cache; 231 goto out_gid_cache;
250 232
251 atomic_set(&zfcp_data.loglevel, loglevel);
252
253 /* initialize adapter list */ 233 /* initialize adapter list */
254 INIT_LIST_HEAD(&zfcp_data.adapter_list_head); 234 INIT_LIST_HEAD(&zfcp_data.adapter_list_head);
255 235
@@ -263,8 +243,7 @@ zfcp_module_init(void)
263 243
264 retval = misc_register(&zfcp_cfdc_misc); 244 retval = misc_register(&zfcp_cfdc_misc);
265 if (retval != 0) { 245 if (retval != 0) {
266 ZFCP_LOG_INFO("registration of misc device " 246 pr_err("zfcp: registration of misc device zfcp_cfdc failed\n");
267 "zfcp_cfdc failed\n");
268 goto out_misc; 247 goto out_misc;
269 } 248 }
270 249
@@ -277,7 +256,7 @@ zfcp_module_init(void)
277 /* setup dynamic I/O */ 256 /* setup dynamic I/O */
278 retval = zfcp_ccw_register(); 257 retval = zfcp_ccw_register();
279 if (retval) { 258 if (retval) {
280 ZFCP_LOG_NORMAL("registration with common I/O layer failed\n"); 259 pr_err("zfcp: Registration with common I/O layer failed.\n");
281 goto out_ccw_register; 260 goto out_ccw_register;
282 } 261 }
283 262
@@ -300,14 +279,10 @@ zfcp_module_init(void)
300 return retval; 279 return retval;
301} 280}
302 281
303#undef ZFCP_LOG_AREA
304
305/****************************************************************/ 282/****************************************************************/
306/****** Functions for configuration/set-up of structures ********/ 283/****** Functions for configuration/set-up of structures ********/
307/****************************************************************/ 284/****************************************************************/
308 285
309#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
310
311/** 286/**
312 * zfcp_get_unit_by_lun - find unit in unit list of port by FCP LUN 287 * zfcp_get_unit_by_lun - find unit in unit list of port by FCP LUN
313 * @port: pointer to port to search for unit 288 * @port: pointer to port to search for unit
@@ -598,6 +573,8 @@ static void _zfcp_status_read_scheduler(struct work_struct *work)
598 * All adapter internal structures are set up. 573 * All adapter internal structures are set up.
599 * Proc-fs entries are also created. 574 * Proc-fs entries are also created.
600 * 575 *
576 * FIXME: Use -ENOMEM as return code for allocation failures
577 *
601 * returns: 0 if a new adapter was successfully enqueued 578 * returns: 0 if a new adapter was successfully enqueued
602 * ZFCP_KNOWN if an adapter with this devno was already present 579 * ZFCP_KNOWN if an adapter with this devno was already present
603 * -ENOMEM if alloc failed 580 * -ENOMEM if alloc failed
@@ -615,11 +592,8 @@ zfcp_adapter_enqueue(struct ccw_device *ccw_device)
615 592
616 /* try to allocate new adapter data structure (zeroed) */ 593 /* try to allocate new adapter data structure (zeroed) */
617 adapter = kzalloc(sizeof (struct zfcp_adapter), GFP_KERNEL); 594 adapter = kzalloc(sizeof (struct zfcp_adapter), GFP_KERNEL);
618 if (!adapter) { 595 if (!adapter)
619 ZFCP_LOG_INFO("error: allocation of base adapter "
620 "structure failed\n");
621 goto out; 596 goto out;
622 }
623 597
624 ccw_device->handler = NULL; 598 ccw_device->handler = NULL;
625 599
@@ -760,7 +734,6 @@ zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
760 zfcp_reqlist_free(adapter); 734 zfcp_reqlist_free(adapter);
761 kfree(adapter->fc_stats); 735 kfree(adapter->fc_stats);
762 kfree(adapter->stats_reset_data); 736 kfree(adapter->stats_reset_data);
763 ZFCP_LOG_TRACE("freeing adapter structure\n");
764 kfree(adapter); 737 kfree(adapter);
765 out: 738 out:
766 return; 739 return;
@@ -908,12 +881,8 @@ zfcp_nameserver_enqueue(struct zfcp_adapter *adapter)
908 881
909 port = zfcp_port_enqueue(adapter, 0, ZFCP_STATUS_PORT_WKA, 882 port = zfcp_port_enqueue(adapter, 0, ZFCP_STATUS_PORT_WKA,
910 ZFCP_DID_DIRECTORY_SERVICE); 883 ZFCP_DID_DIRECTORY_SERVICE);
911 if (!port) { 884 if (!port)
912 ZFCP_LOG_INFO("error: enqueue of nameserver port for "
913 "adapter %s failed\n",
914 zfcp_get_busid_by_adapter(adapter));
915 return -ENXIO; 885 return -ENXIO;
916 }
917 zfcp_port_put(port); 886 zfcp_port_put(port);
918 887
919 return 0; 888 return 0;
@@ -946,5 +915,3 @@ int zfcp_sg_setup_table(struct scatterlist *sg, int count)
946 } 915 }
947 return 0; 916 return 0;
948} 917}
949
950#undef ZFCP_LOG_AREA
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index c47c23a01c7f..7c72f502eb0f 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -1,22 +1,9 @@
1/* 1/*
2 * This file is part of the zfcp device driver for 2 * zfcp device driver
3 * FCP adapters for IBM System z9 and zSeries.
4 * 3 *
5 * (C) Copyright IBM Corp. 2002, 2006 4 * Debug traces for zfcp.
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * Copyright IBM Corporation 2002, 2008
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#include <linux/ctype.h> 9#include <linux/ctype.h>
@@ -29,8 +16,6 @@ module_param(dbfsize, uint, 0400);
29MODULE_PARM_DESC(dbfsize, 16MODULE_PARM_DESC(dbfsize,
30 "number of pages for each debug feature area (default 4)"); 17 "number of pages for each debug feature area (default 4)");
31 18
32#define ZFCP_LOG_AREA ZFCP_LOG_AREA_OTHER
33
34static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len, 19static void zfcp_dbf_hexdump(debug_info_t *dbf, void *to, int to_len,
35 int level, char *from, int from_len) 20 int level, char *from, int from_len)
36{ 21{
@@ -515,13 +500,13 @@ static const char *zfcp_rec_dbf_ids[] = {
515 [52] = "port boxed close unit", 500 [52] = "port boxed close unit",
516 [53] = "port boxed fcp", 501 [53] = "port boxed fcp",
517 [54] = "unit boxed fcp", 502 [54] = "unit boxed fcp",
518 [55] = "port access denied ct", 503 [55] = "port access denied",
519 [56] = "port access denied els", 504 [56] = "",
520 [57] = "port access denied open port", 505 [57] = "",
521 [58] = "port access denied close physical", 506 [58] = "",
522 [59] = "unit access denied open unit", 507 [59] = "unit access denied",
523 [60] = "shared unit access denied open unit", 508 [60] = "shared unit access denied open unit",
524 [61] = "unit access denied fcp", 509 [61] = "",
525 [62] = "request timeout", 510 [62] = "request timeout",
526 [63] = "adisc link test reject or timeout", 511 [63] = "adisc link test reject or timeout",
527 [64] = "adisc link test d_id changed", 512 [64] = "adisc link test d_id changed",
@@ -586,8 +571,8 @@ static const char *zfcp_rec_dbf_ids[] = {
586 [120] = "unknown fsf command", 571 [120] = "unknown fsf command",
587 [121] = "no recommendation for status qualifier", 572 [121] = "no recommendation for status qualifier",
588 [122] = "status read physical port closed in error", 573 [122] = "status read physical port closed in error",
589 [123] = "fc service class not supported ct", 574 [123] = "fc service class not supported",
590 [124] = "fc service class not supported els", 575 [124] = "",
591 [125] = "need newer zfcp", 576 [125] = "need newer zfcp",
592 [126] = "need newer microcode", 577 [126] = "need newer microcode",
593 [127] = "arbitrated loop not supported", 578 [127] = "arbitrated loop not supported",
@@ -595,7 +580,7 @@ static const char *zfcp_rec_dbf_ids[] = {
595 [129] = "qtcb size mismatch", 580 [129] = "qtcb size mismatch",
596 [130] = "unknown fsf status ecd", 581 [130] = "unknown fsf status ecd",
597 [131] = "fcp request too big", 582 [131] = "fcp request too big",
598 [132] = "fc service class not supported fcp", 583 [132] = "",
599 [133] = "data direction not valid fcp", 584 [133] = "data direction not valid fcp",
600 [134] = "command length not valid fcp", 585 [134] = "command length not valid fcp",
601 [135] = "status read act update", 586 [135] = "status read act update",
@@ -1291,5 +1276,3 @@ void zfcp_adapter_debug_unregister(struct zfcp_adapter *adapter)
1291 adapter->hba_dbf = NULL; 1276 adapter->hba_dbf = NULL;
1292 adapter->rec_dbf = NULL; 1277 adapter->rec_dbf = NULL;
1293} 1278}
1294
1295#undef ZFCP_LOG_AREA
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index 5fcb555e1484..73425dbb2be8 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -1,22 +1,9 @@
1/* 1/*
2 * This file is part of the zfcp device driver for 2 * zfcp device driver
3 * FCP adapters for IBM System z9 and zSeries.
4 * 3 *
5 * (C) Copyright IBM Corp. 2002, 2006 4 * Global definitions for the zfcp device driver.
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * Copyright IBM Corporation 2002, 2008
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#ifndef ZFCP_DEF_H 9#ifndef ZFCP_DEF_H
@@ -52,9 +39,6 @@
52 39
53/********************* GENERAL DEFINES *********************************/ 40/********************* GENERAL DEFINES *********************************/
54 41
55/* zfcp version number, it consists of major, minor, and patch-level number */
56#define ZFCP_VERSION "4.8.0"
57
58/** 42/**
59 * zfcp_sg_to_address - determine kernel address from struct scatterlist 43 * zfcp_sg_to_address - determine kernel address from struct scatterlist
60 * @list: struct scatterlist 44 * @list: struct scatterlist
@@ -308,107 +292,6 @@ struct zfcp_rc_entry {
308 */ 292 */
309#define ZFCP_CT_TIMEOUT (3 * R_A_TOV) 293#define ZFCP_CT_TIMEOUT (3 * R_A_TOV)
310 294
311/******************** LOGGING MACROS AND DEFINES *****************************/
312
313/*
314 * Logging may be applied on certain kinds of driver operations
315 * independently. Additionally, different log-levels are supported for
316 * each of these areas.
317 */
318
319#define ZFCP_NAME "zfcp"
320
321/* independent log areas */
322#define ZFCP_LOG_AREA_OTHER 0
323#define ZFCP_LOG_AREA_SCSI 1
324#define ZFCP_LOG_AREA_FSF 2
325#define ZFCP_LOG_AREA_CONFIG 3
326#define ZFCP_LOG_AREA_CIO 4
327#define ZFCP_LOG_AREA_QDIO 5
328#define ZFCP_LOG_AREA_ERP 6
329#define ZFCP_LOG_AREA_FC 7
330
331/* log level values*/
332#define ZFCP_LOG_LEVEL_NORMAL 0
333#define ZFCP_LOG_LEVEL_INFO 1
334#define ZFCP_LOG_LEVEL_DEBUG 2
335#define ZFCP_LOG_LEVEL_TRACE 3
336
337/*
338 * this allows removal of logging code by the preprocessor
339 * (the most detailed log level still to be compiled in is specified,
340 * higher log levels are removed)
341 */
342#define ZFCP_LOG_LEVEL_LIMIT ZFCP_LOG_LEVEL_TRACE
343
344/* get "loglevel" nibble assignment */
345#define ZFCP_GET_LOG_VALUE(zfcp_lognibble) \
346 ((atomic_read(&zfcp_data.loglevel) >> (zfcp_lognibble<<2)) & 0xF)
347
348/* set "loglevel" nibble */
349#define ZFCP_SET_LOG_NIBBLE(value, zfcp_lognibble) \
350 (value << (zfcp_lognibble << 2))
351
352/* all log-level defaults are combined to generate initial log-level */
353#define ZFCP_LOG_LEVEL_DEFAULTS \
354 (ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_OTHER) | \
355 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_SCSI) | \
356 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_FSF) | \
357 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_CONFIG) | \
358 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_CIO) | \
359 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_QDIO) | \
360 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_ERP) | \
361 ZFCP_SET_LOG_NIBBLE(ZFCP_LOG_LEVEL_NORMAL, ZFCP_LOG_AREA_FC))
362
363/* check whether we have the right level for logging */
364#define ZFCP_LOG_CHECK(level) \
365 ((ZFCP_GET_LOG_VALUE(ZFCP_LOG_AREA)) >= level)
366
367/* logging routine for zfcp */
368#define _ZFCP_LOG(fmt, args...) \
369 printk(KERN_ERR ZFCP_NAME": %s(%d): " fmt, __func__, \
370 __LINE__ , ##args)
371
372#define ZFCP_LOG(level, fmt, args...) \
373do { \
374 if (ZFCP_LOG_CHECK(level)) \
375 _ZFCP_LOG(fmt, ##args); \
376} while (0)
377
378#if ZFCP_LOG_LEVEL_LIMIT < ZFCP_LOG_LEVEL_NORMAL
379# define ZFCP_LOG_NORMAL(fmt, args...) do { } while (0)
380#else
381# define ZFCP_LOG_NORMAL(fmt, args...) \
382do { \
383 if (ZFCP_LOG_CHECK(ZFCP_LOG_LEVEL_NORMAL)) \
384 printk(KERN_ERR ZFCP_NAME": " fmt, ##args); \
385} while (0)
386#endif
387
388#if ZFCP_LOG_LEVEL_LIMIT < ZFCP_LOG_LEVEL_INFO
389# define ZFCP_LOG_INFO(fmt, args...) do { } while (0)
390#else
391# define ZFCP_LOG_INFO(fmt, args...) \
392do { \
393 if (ZFCP_LOG_CHECK(ZFCP_LOG_LEVEL_INFO)) \
394 printk(KERN_ERR ZFCP_NAME": " fmt, ##args); \
395} while (0)
396#endif
397
398#if ZFCP_LOG_LEVEL_LIMIT < ZFCP_LOG_LEVEL_DEBUG
399# define ZFCP_LOG_DEBUG(fmt, args...) do { } while (0)
400#else
401# define ZFCP_LOG_DEBUG(fmt, args...) \
402 ZFCP_LOG(ZFCP_LOG_LEVEL_DEBUG, fmt , ##args)
403#endif
404
405#if ZFCP_LOG_LEVEL_LIMIT < ZFCP_LOG_LEVEL_TRACE
406# define ZFCP_LOG_TRACE(fmt, args...) do { } while (0)
407#else
408# define ZFCP_LOG_TRACE(fmt, args...) \
409 ZFCP_LOG(ZFCP_LOG_LEVEL_TRACE, fmt , ##args)
410#endif
411
412/*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/ 295/*************** ADAPTER/PORT/UNIT AND FSF_REQ STATUS FLAGS ******************/
413 296
414/* 297/*
@@ -846,7 +729,6 @@ struct zfcp_data {
846 char init_busid[BUS_ID_SIZE]; 729 char init_busid[BUS_ID_SIZE];
847 wwn_t init_wwpn; 730 wwn_t init_wwpn;
848 fcp_lun_t init_fcp_lun; 731 fcp_lun_t init_fcp_lun;
849 char *driver_version;
850 struct kmem_cache *fsf_req_qtcb_cache; 732 struct kmem_cache *fsf_req_qtcb_cache;
851 struct kmem_cache *sr_buffer_cache; 733 struct kmem_cache *sr_buffer_cache;
852 struct kmem_cache *gid_pn_cache; 734 struct kmem_cache *gid_pn_cache;
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 4a6d08363d4b..c06156b288ea 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -1,26 +1,11 @@
1/* 1/*
2 * This file is part of the zfcp device driver for 2 * zfcp device driver
3 * FCP adapters for IBM System z9 and zSeries.
4 * 3 *
5 * (C) Copyright IBM Corp. 2002, 2006 4 * Error Recovery Procedures (ERP).
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * Copyright IBM Corporation 2002, 2008
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#define ZFCP_LOG_AREA ZFCP_LOG_AREA_ERP
23
24#include "zfcp_ext.h" 9#include "zfcp_ext.h"
25 10
26static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *, int, u8, 11static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *, int, u8,
@@ -171,14 +156,9 @@ static int zfcp_erp_adapter_reopen_internal(struct zfcp_adapter *adapter,
171{ 156{
172 int retval; 157 int retval;
173 158
174 ZFCP_LOG_DEBUG("reopen adapter %s\n",
175 zfcp_get_busid_by_adapter(adapter));
176
177 zfcp_erp_adapter_block(adapter, clear_mask); 159 zfcp_erp_adapter_block(adapter, clear_mask);
178 160
179 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &adapter->status)) { 161 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &adapter->status)) {
180 ZFCP_LOG_DEBUG("skipped reopen of failed adapter %s\n",
181 zfcp_get_busid_by_adapter(adapter));
182 /* ensure propagation of failed status to new devices */ 162 /* ensure propagation of failed status to new devices */
183 zfcp_erp_adapter_failed(adapter, 13, NULL); 163 zfcp_erp_adapter_failed(adapter, 13, NULL);
184 retval = -EIO; 164 retval = -EIO;
@@ -270,15 +250,9 @@ static int zfcp_erp_port_forced_reopen_internal(struct zfcp_port *port,
270{ 250{
271 int retval; 251 int retval;
272 252
273 ZFCP_LOG_DEBUG("forced reopen of port 0x%016Lx on adapter %s\n",
274 port->wwpn, zfcp_get_busid_by_port(port));
275
276 zfcp_erp_port_block(port, clear_mask); 253 zfcp_erp_port_block(port, clear_mask);
277 254
278 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &port->status)) { 255 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &port->status)) {
279 ZFCP_LOG_DEBUG("skipped forced reopen of failed port 0x%016Lx "
280 "on adapter %s\n", port->wwpn,
281 zfcp_get_busid_by_port(port));
282 retval = -EIO; 256 retval = -EIO;
283 goto out; 257 goto out;
284 } 258 }
@@ -332,15 +306,9 @@ static int zfcp_erp_port_reopen_internal(struct zfcp_port *port, int clear_mask,
332{ 306{
333 int retval; 307 int retval;
334 308
335 ZFCP_LOG_DEBUG("reopen of port 0x%016Lx on adapter %s\n",
336 port->wwpn, zfcp_get_busid_by_port(port));
337
338 zfcp_erp_port_block(port, clear_mask); 309 zfcp_erp_port_block(port, clear_mask);
339 310
340 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &port->status)) { 311 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &port->status)) {
341 ZFCP_LOG_DEBUG("skipped reopen of failed port 0x%016Lx "
342 "on adapter %s\n", port->wwpn,
343 zfcp_get_busid_by_port(port));
344 /* ensure propagation of failed status to new devices */ 312 /* ensure propagation of failed status to new devices */
345 zfcp_erp_port_failed(port, 14, NULL); 313 zfcp_erp_port_failed(port, 14, NULL);
346 retval = -EIO; 314 retval = -EIO;
@@ -396,17 +364,9 @@ static int zfcp_erp_unit_reopen_internal(struct zfcp_unit *unit, int clear_mask,
396 int retval; 364 int retval;
397 struct zfcp_adapter *adapter = unit->port->adapter; 365 struct zfcp_adapter *adapter = unit->port->adapter;
398 366
399 ZFCP_LOG_DEBUG("reopen of unit 0x%016Lx on port 0x%016Lx "
400 "on adapter %s\n", unit->fcp_lun,
401 unit->port->wwpn, zfcp_get_busid_by_unit(unit));
402
403 zfcp_erp_unit_block(unit, clear_mask); 367 zfcp_erp_unit_block(unit, clear_mask);
404 368
405 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &unit->status)) { 369 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &unit->status)) {
406 ZFCP_LOG_DEBUG("skipped reopen of failed unit 0x%016Lx "
407 "on port 0x%016Lx on adapter %s\n",
408 unit->fcp_lun, unit->port->wwpn,
409 zfcp_get_busid_by_unit(unit));
410 retval = -EIO; 370 retval = -EIO;
411 goto out; 371 goto out;
412 } 372 }
@@ -631,13 +591,8 @@ zfcp_erp_strategy_check_fsfreq(struct zfcp_erp_action *erp_action)
631 ZFCP_STATUS_FSFREQ_DISMISSED; 591 ZFCP_STATUS_FSFREQ_DISMISSED;
632 zfcp_rec_dbf_event_action(142, erp_action); 592 zfcp_rec_dbf_event_action(142, erp_action);
633 } 593 }
634 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { 594 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT)
635 zfcp_rec_dbf_event_action(143, erp_action); 595 zfcp_rec_dbf_event_action(143, erp_action);
636 ZFCP_LOG_NORMAL("error: erp step timed out "
637 "(action=%d, fsf_req=%p)\n ",
638 erp_action->action,
639 erp_action->fsf_req);
640 }
641 /* 596 /*
642 * If fsf_req is neither dismissed nor completed 597 * If fsf_req is neither dismissed nor completed
643 * then keep it running asynchronously and don't mess 598 * then keep it running asynchronously and don't mess
@@ -740,11 +695,10 @@ zfcp_erp_thread_setup(struct zfcp_adapter *adapter)
740 atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status); 695 atomic_clear_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, &adapter->status);
741 696
742 retval = kernel_thread(zfcp_erp_thread, adapter, SIGCHLD); 697 retval = kernel_thread(zfcp_erp_thread, adapter, SIGCHLD);
743 if (retval < 0) { 698 if (retval < 0)
744 ZFCP_LOG_NORMAL("error: creation of erp thread failed for " 699 dev_err(&adapter->ccw_device->dev,
745 "adapter %s\n", 700 "Creation of ERP thread failed.\n");
746 zfcp_get_busid_by_adapter(adapter)); 701 else {
747 } else {
748 wait_event(adapter->erp_thread_wqh, 702 wait_event(adapter->erp_thread_wqh,
749 atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP, 703 atomic_test_mask(ZFCP_STATUS_ADAPTER_ERP_THREAD_UP,
750 &adapter->status)); 704 &adapter->status));
@@ -919,15 +873,10 @@ zfcp_erp_strategy(struct zfcp_erp_action *erp_action)
919 This might happen if an erp_action that used a memory pool 873 This might happen if an erp_action that used a memory pool
920 element was timed out. 874 element was timed out.
921 */ 875 */
922 if (adapter->erp_total_count == adapter->erp_low_mem_count) { 876 if (adapter->erp_total_count == adapter->erp_low_mem_count)
923 ZFCP_LOG_NORMAL("error: no mempool elements available, "
924 "restarting I/O on adapter %s "
925 "to free mempool\n",
926 zfcp_get_busid_by_adapter(adapter));
927 zfcp_erp_adapter_reopen_internal(adapter, 0, 66, NULL); 877 zfcp_erp_adapter_reopen_internal(adapter, 0, 66, NULL);
928 } else { 878 else
929 retval = zfcp_erp_strategy_memwait(erp_action); 879 retval = zfcp_erp_strategy_memwait(erp_action);
930 }
931 goto unlock; 880 goto unlock;
932 case ZFCP_ERP_CONTINUES: 881 case ZFCP_ERP_CONTINUES:
933 /* leave since this action runs asynchronously */ 882 /* leave since this action runs asynchronously */
@@ -1039,12 +988,6 @@ zfcp_erp_strategy_do_action(struct zfcp_erp_action *erp_action)
1039 case ZFCP_ERP_ACTION_REOPEN_UNIT: 988 case ZFCP_ERP_ACTION_REOPEN_UNIT:
1040 retval = zfcp_erp_unit_strategy(erp_action); 989 retval = zfcp_erp_unit_strategy(erp_action);
1041 break; 990 break;
1042
1043 default:
1044 ZFCP_LOG_NORMAL("bug: unknown erp action requested on "
1045 "adapter %s (action=%d)\n",
1046 zfcp_get_busid_by_adapter(erp_action->adapter),
1047 erp_action->action);
1048 } 991 }
1049 992
1050 return retval; 993 return retval;
@@ -1083,8 +1026,7 @@ zfcp_erp_adapter_failed(struct zfcp_adapter *adapter, u8 id, void *ref)
1083{ 1026{
1084 zfcp_erp_modify_adapter_status(adapter, id, ref, 1027 zfcp_erp_modify_adapter_status(adapter, id, ref,
1085 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); 1028 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET);
1086 ZFCP_LOG_NORMAL("adapter erp failed on adapter %s\n", 1029 dev_err(&adapter->ccw_device->dev, "Adapter ERP failed.\n");
1087 zfcp_get_busid_by_adapter(adapter));
1088} 1030}
1089 1031
1090/* 1032/*
@@ -1100,12 +1042,13 @@ zfcp_erp_port_failed(struct zfcp_port *port, u8 id, void *ref)
1100 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); 1042 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET);
1101 1043
1102 if (atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status)) 1044 if (atomic_test_mask(ZFCP_STATUS_PORT_WKA, &port->status))
1103 ZFCP_LOG_NORMAL("port erp failed (adapter %s, " 1045 dev_err(&port->adapter->ccw_device->dev,
1104 "port d_id=0x%06x)\n", 1046 "Port ERP failed for WKA port d_id=0x%06x.\n",
1105 zfcp_get_busid_by_port(port), port->d_id); 1047 port->d_id);
1106 else 1048 else
1107 ZFCP_LOG_NORMAL("port erp failed (adapter %s, wwpn=0x%016Lx)\n", 1049 dev_err(&port->adapter->ccw_device->dev,
1108 zfcp_get_busid_by_port(port), port->wwpn); 1050 "Port ERP failed for port wwpn=0x%016Lx.\n",
1051 port->wwpn);
1109} 1052}
1110 1053
1111/* 1054/*
@@ -1120,9 +1063,9 @@ zfcp_erp_unit_failed(struct zfcp_unit *unit, u8 id, void *ref)
1120 zfcp_erp_modify_unit_status(unit, id, ref, 1063 zfcp_erp_modify_unit_status(unit, id, ref,
1121 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET); 1064 ZFCP_STATUS_COMMON_ERP_FAILED, ZFCP_SET);
1122 1065
1123 ZFCP_LOG_NORMAL("unit erp failed on unit 0x%016Lx on port 0x%016Lx " 1066 dev_err(&unit->port->adapter->ccw_device->dev,
1124 " on adapter %s\n", unit->fcp_lun, 1067 "Unit ERP failed for unit 0x%016Lx on port 0x%016Lx.\n",
1125 unit->port->wwpn, zfcp_get_busid_by_unit(unit)); 1068 unit->fcp_lun, unit->port->wwpn);
1126} 1069}
1127 1070
1128/* 1071/*
@@ -1336,13 +1279,10 @@ zfcp_erp_schedule_work(struct zfcp_unit *unit)
1336 1279
1337 p = kzalloc(sizeof(*p), GFP_KERNEL); 1280 p = kzalloc(sizeof(*p), GFP_KERNEL);
1338 if (!p) { 1281 if (!p) {
1339 ZFCP_LOG_NORMAL("error: Out of resources. Could not register " 1282 dev_err(&unit->port->adapter->ccw_device->dev,
1340 "the FCP-LUN 0x%Lx connected to " 1283 "Out of resources. Could not register unit 0x%016Lx "
1341 "the port with WWPN 0x%Lx connected to " 1284 "on port 0x%016Lx with SCSI stack.\n",
1342 "the adapter %s with the SCSI stack.\n", 1285 unit->fcp_lun, unit->port->wwpn);
1343 unit->fcp_lun,
1344 unit->port->wwpn,
1345 zfcp_get_busid_by_unit(unit));
1346 return; 1286 return;
1347 } 1287 }
1348 1288
@@ -1585,7 +1525,6 @@ static int
1585zfcp_erp_adapter_strategy(struct zfcp_erp_action *erp_action) 1525zfcp_erp_adapter_strategy(struct zfcp_erp_action *erp_action)
1586{ 1526{
1587 int retval; 1527 int retval;
1588 struct zfcp_adapter *adapter = erp_action->adapter;
1589 1528
1590 retval = zfcp_erp_adapter_strategy_close(erp_action); 1529 retval = zfcp_erp_adapter_strategy_close(erp_action);
1591 if (erp_action->status & ZFCP_STATUS_ERP_CLOSE_ONLY) 1530 if (erp_action->status & ZFCP_STATUS_ERP_CLOSE_ONLY)
@@ -1593,12 +1532,8 @@ zfcp_erp_adapter_strategy(struct zfcp_erp_action *erp_action)
1593 else 1532 else
1594 retval = zfcp_erp_adapter_strategy_open(erp_action); 1533 retval = zfcp_erp_adapter_strategy_open(erp_action);
1595 1534
1596 if (retval == ZFCP_ERP_FAILED) { 1535 if (retval == ZFCP_ERP_FAILED)
1597 ZFCP_LOG_INFO("Waiting to allow the adapter %s "
1598 "to recover itself\n",
1599 zfcp_get_busid_by_adapter(adapter));
1600 ssleep(ZFCP_TYPE2_RECOVERY_TIME); 1536 ssleep(ZFCP_TYPE2_RECOVERY_TIME);
1601 }
1602 1537
1603 return retval; 1538 return retval;
1604} 1539}
@@ -1743,19 +1678,13 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
1743 for (retries = ZFCP_EXCHANGE_CONFIG_DATA_RETRIES; retries; retries--) { 1678 for (retries = ZFCP_EXCHANGE_CONFIG_DATA_RETRIES; retries; retries--) {
1744 atomic_clear_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT, 1679 atomic_clear_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT,
1745 &adapter->status); 1680 &adapter->status);
1746 ZFCP_LOG_DEBUG("Doing exchange config data\n");
1747 write_lock_irq(&adapter->erp_lock); 1681 write_lock_irq(&adapter->erp_lock);
1748 zfcp_erp_action_to_running(erp_action); 1682 zfcp_erp_action_to_running(erp_action);
1749 write_unlock_irq(&adapter->erp_lock); 1683 write_unlock_irq(&adapter->erp_lock);
1750 if (zfcp_fsf_exchange_config_data(erp_action)) { 1684 if (zfcp_fsf_exchange_config_data(erp_action)) {
1751 retval = ZFCP_ERP_FAILED; 1685 retval = ZFCP_ERP_FAILED;
1752 ZFCP_LOG_INFO("error: initiation of exchange of "
1753 "configuration data failed for "
1754 "adapter %s\n",
1755 zfcp_get_busid_by_adapter(adapter));
1756 break; 1686 break;
1757 } 1687 }
1758 ZFCP_LOG_DEBUG("Xchange underway\n");
1759 1688
1760 /* 1689 /*
1761 * Why this works: 1690 * Why this works:
@@ -1773,19 +1702,13 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
1773 zfcp_rec_dbf_event_thread_lock(6, adapter); 1702 zfcp_rec_dbf_event_thread_lock(6, adapter);
1774 down(&adapter->erp_ready_sem); 1703 down(&adapter->erp_ready_sem);
1775 zfcp_rec_dbf_event_thread_lock(7, adapter); 1704 zfcp_rec_dbf_event_thread_lock(7, adapter);
1776 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { 1705 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT)
1777 ZFCP_LOG_INFO("error: exchange of configuration data "
1778 "for adapter %s timed out\n",
1779 zfcp_get_busid_by_adapter(adapter));
1780 break; 1706 break;
1781 }
1782 1707
1783 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT, 1708 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_HOST_CON_INIT,
1784 &adapter->status)) 1709 &adapter->status))
1785 break; 1710 break;
1786 1711
1787 ZFCP_LOG_DEBUG("host connection still initialising... "
1788 "waiting and retrying...\n");
1789 /* sleep a little bit before retry */ 1712 /* sleep a little bit before retry */
1790 ssleep(sleep); 1713 ssleep(sleep);
1791 sleep *= 2; 1714 sleep *= 2;
@@ -1795,12 +1718,8 @@ zfcp_erp_adapter_strategy_open_fsf_xconfig(struct zfcp_erp_action *erp_action)
1795 &adapter->status); 1718 &adapter->status);
1796 1719
1797 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK, 1720 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XCONFIG_OK,
1798 &adapter->status)) { 1721 &adapter->status))
1799 ZFCP_LOG_INFO("error: exchange of configuration data for "
1800 "adapter %s failed\n",
1801 zfcp_get_busid_by_adapter(adapter));
1802 retval = ZFCP_ERP_FAILED; 1722 retval = ZFCP_ERP_FAILED;
1803 }
1804 1723
1805 return retval; 1724 return retval;
1806} 1725}
@@ -1829,16 +1748,8 @@ zfcp_erp_adapter_strategy_open_fsf_xport(struct zfcp_erp_action *erp_action)
1829 zfcp_rec_dbf_event_thread_lock(8, adapter); 1748 zfcp_rec_dbf_event_thread_lock(8, adapter);
1830 down(&adapter->erp_ready_sem); 1749 down(&adapter->erp_ready_sem);
1831 zfcp_rec_dbf_event_thread_lock(9, adapter); 1750 zfcp_rec_dbf_event_thread_lock(9, adapter);
1832 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT) { 1751 if (erp_action->status & ZFCP_STATUS_ERP_TIMEDOUT)
1833 ZFCP_LOG_INFO("error: exchange port data timed out (adapter "
1834 "%s)\n", zfcp_get_busid_by_adapter(adapter));
1835 ret = ZFCP_ERP_FAILED; 1752 ret = ZFCP_ERP_FAILED;
1836 }
1837
1838 /* don't treat as error for the sake of compatibility */
1839 if (!atomic_test_mask(ZFCP_STATUS_ADAPTER_XPORT_OK, &adapter->status))
1840 ZFCP_LOG_INFO("warning: exchange port data failed (adapter "
1841 "%s\n", zfcp_get_busid_by_adapter(adapter));
1842 1753
1843 return ret; 1754 return ret;
1844} 1755}
@@ -1884,8 +1795,6 @@ zfcp_erp_port_forced_strategy(struct zfcp_erp_action *erp_action)
1884 if (atomic_test_mask((ZFCP_STATUS_PORT_PHYS_OPEN | 1795 if (atomic_test_mask((ZFCP_STATUS_PORT_PHYS_OPEN |
1885 ZFCP_STATUS_COMMON_OPEN), 1796 ZFCP_STATUS_COMMON_OPEN),
1886 &port->status)) { 1797 &port->status)) {
1887 ZFCP_LOG_DEBUG("port 0x%016Lx is open -> trying "
1888 "close physical\n", port->wwpn);
1889 retval = 1798 retval =
1890 zfcp_erp_port_forced_strategy_close(erp_action); 1799 zfcp_erp_port_forced_strategy_close(erp_action);
1891 } else 1800 } else
@@ -1895,8 +1804,6 @@ zfcp_erp_port_forced_strategy(struct zfcp_erp_action *erp_action)
1895 case ZFCP_ERP_STEP_PHYS_PORT_CLOSING: 1804 case ZFCP_ERP_STEP_PHYS_PORT_CLOSING:
1896 if (atomic_test_mask(ZFCP_STATUS_PORT_PHYS_OPEN, 1805 if (atomic_test_mask(ZFCP_STATUS_PORT_PHYS_OPEN,
1897 &port->status)) { 1806 &port->status)) {
1898 ZFCP_LOG_DEBUG("close physical failed for port "
1899 "0x%016Lx\n", port->wwpn);
1900 retval = ZFCP_ERP_FAILED; 1807 retval = ZFCP_ERP_FAILED;
1901 } else 1808 } else
1902 retval = ZFCP_ERP_SUCCEEDED; 1809 retval = ZFCP_ERP_SUCCEEDED;
@@ -1930,8 +1837,6 @@ zfcp_erp_port_strategy(struct zfcp_erp_action *erp_action)
1930 case ZFCP_ERP_STEP_UNINITIALIZED: 1837 case ZFCP_ERP_STEP_UNINITIALIZED:
1931 zfcp_erp_port_strategy_clearstati(port); 1838 zfcp_erp_port_strategy_clearstati(port);
1932 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status)) { 1839 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status)) {
1933 ZFCP_LOG_DEBUG("port 0x%016Lx is open -> trying "
1934 "close\n", port->wwpn);
1935 retval = zfcp_erp_port_strategy_close(erp_action); 1840 retval = zfcp_erp_port_strategy_close(erp_action);
1936 goto out; 1841 goto out;
1937 } /* else it's already closed, open it */ 1842 } /* else it's already closed, open it */
@@ -1939,8 +1844,6 @@ zfcp_erp_port_strategy(struct zfcp_erp_action *erp_action)
1939 1844
1940 case ZFCP_ERP_STEP_PORT_CLOSING: 1845 case ZFCP_ERP_STEP_PORT_CLOSING:
1941 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status)) { 1846 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status)) {
1942 ZFCP_LOG_DEBUG("close failed for port 0x%016Lx\n",
1943 port->wwpn);
1944 retval = ZFCP_ERP_FAILED; 1847 retval = ZFCP_ERP_FAILED;
1945 goto out; 1848 goto out;
1946 } /* else it's closed now, open it */ 1849 } /* else it's closed now, open it */
@@ -1983,12 +1886,10 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action)
1983 case ZFCP_ERP_STEP_PORT_CLOSING: 1886 case ZFCP_ERP_STEP_PORT_CLOSING:
1984 if (fc_host_port_type(adapter->scsi_host) == FC_PORTTYPE_PTP) { 1887 if (fc_host_port_type(adapter->scsi_host) == FC_PORTTYPE_PTP) {
1985 if (port->wwpn != adapter->peer_wwpn) { 1888 if (port->wwpn != adapter->peer_wwpn) {
1986 ZFCP_LOG_NORMAL("Failed to open port 0x%016Lx " 1889 dev_err(&adapter->ccw_device->dev,
1987 "on adapter %s.\nPeer WWPN " 1890 "Failed to open port 0x%016Lx, "
1988 "0x%016Lx does not match\n", 1891 "Peer WWPN 0x%016Lx does not match.\n",
1989 port->wwpn, 1892 port->wwpn, adapter->peer_wwpn);
1990 zfcp_get_busid_by_adapter(adapter),
1991 adapter->peer_wwpn);
1992 zfcp_erp_port_failed(port, 25, NULL); 1893 zfcp_erp_port_failed(port, 25, NULL);
1993 retval = ZFCP_ERP_FAILED; 1894 retval = ZFCP_ERP_FAILED;
1994 break; 1895 break;
@@ -2001,17 +1902,14 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action)
2001 if (!(adapter->nameserver_port)) { 1902 if (!(adapter->nameserver_port)) {
2002 retval = zfcp_nameserver_enqueue(adapter); 1903 retval = zfcp_nameserver_enqueue(adapter);
2003 if (retval != 0) { 1904 if (retval != 0) {
2004 ZFCP_LOG_NORMAL("error: nameserver port " 1905 dev_err(&adapter->ccw_device->dev,
2005 "unavailable for adapter %s\n", 1906 "Nameserver port unavailable.\n");
2006 zfcp_get_busid_by_adapter(adapter));
2007 retval = ZFCP_ERP_FAILED; 1907 retval = ZFCP_ERP_FAILED;
2008 break; 1908 break;
2009 } 1909 }
2010 } 1910 }
2011 if (!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, 1911 if (!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED,
2012 &adapter->nameserver_port->status)) { 1912 &adapter->nameserver_port->status)) {
2013 ZFCP_LOG_DEBUG("nameserver port is not open -> open "
2014 "nameserver port\n");
2015 /* nameserver port may live again */ 1913 /* nameserver port may live again */
2016 atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING, 1914 atomic_set_mask(ZFCP_STATUS_COMMON_RUNNING,
2017 &adapter->nameserver_port->status); 1915 &adapter->nameserver_port->status);
@@ -2027,57 +1925,37 @@ zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *erp_action)
2027 /* else nameserver port is already open, fall through */ 1925 /* else nameserver port is already open, fall through */
2028 case ZFCP_ERP_STEP_NAMESERVER_OPEN: 1926 case ZFCP_ERP_STEP_NAMESERVER_OPEN:
2029 if (!atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, 1927 if (!atomic_test_mask(ZFCP_STATUS_COMMON_OPEN,
2030 &adapter->nameserver_port->status)) { 1928 &adapter->nameserver_port->status))
2031 ZFCP_LOG_DEBUG("open failed for nameserver port\n");
2032 retval = ZFCP_ERP_FAILED; 1929 retval = ZFCP_ERP_FAILED;
2033 } else { 1930 else
2034 ZFCP_LOG_DEBUG("nameserver port is open -> "
2035 "nameserver look-up for port 0x%016Lx\n",
2036 port->wwpn);
2037 retval = zfcp_erp_port_strategy_open_common_lookup 1931 retval = zfcp_erp_port_strategy_open_common_lookup
2038 (erp_action); 1932 (erp_action);
2039 }
2040 break; 1933 break;
2041 1934
2042 case ZFCP_ERP_STEP_NAMESERVER_LOOKUP: 1935 case ZFCP_ERP_STEP_NAMESERVER_LOOKUP:
2043 if (!atomic_test_mask(ZFCP_STATUS_PORT_DID_DID, &port->status)) { 1936 if (!atomic_test_mask(ZFCP_STATUS_PORT_DID_DID, &port->status)) {
2044 if (atomic_test_mask 1937 if (atomic_test_mask
2045 (ZFCP_STATUS_PORT_INVALID_WWPN, &port->status)) { 1938 (ZFCP_STATUS_PORT_INVALID_WWPN, &port->status)) {
2046 ZFCP_LOG_DEBUG("nameserver look-up failed "
2047 "for port 0x%016Lx "
2048 "(misconfigured WWPN?)\n",
2049 port->wwpn);
2050 zfcp_erp_port_failed(port, 26, NULL); 1939 zfcp_erp_port_failed(port, 26, NULL);
2051 retval = ZFCP_ERP_EXIT; 1940 retval = ZFCP_ERP_EXIT;
2052 } else { 1941 } else
2053 ZFCP_LOG_DEBUG("nameserver look-up failed for "
2054 "port 0x%016Lx\n", port->wwpn);
2055 retval = ZFCP_ERP_FAILED; 1942 retval = ZFCP_ERP_FAILED;
2056 } 1943 } else
2057 } else {
2058 ZFCP_LOG_DEBUG("port 0x%016Lx has d_id=0x%06x -> "
2059 "trying open\n", port->wwpn, port->d_id);
2060 retval = zfcp_erp_port_strategy_open_port(erp_action); 1944 retval = zfcp_erp_port_strategy_open_port(erp_action);
2061 }
2062 break; 1945 break;
2063 1946
2064 case ZFCP_ERP_STEP_PORT_OPENING: 1947 case ZFCP_ERP_STEP_PORT_OPENING:
2065 /* D_ID might have changed during open */ 1948 /* D_ID might have changed during open */
2066 if (atomic_test_mask((ZFCP_STATUS_COMMON_OPEN | 1949 if (atomic_test_mask((ZFCP_STATUS_COMMON_OPEN |
2067 ZFCP_STATUS_PORT_DID_DID), 1950 ZFCP_STATUS_PORT_DID_DID),
2068 &port->status)) { 1951 &port->status))
2069 ZFCP_LOG_DEBUG("port 0x%016Lx is open\n", port->wwpn);
2070 retval = ZFCP_ERP_SUCCEEDED; 1952 retval = ZFCP_ERP_SUCCEEDED;
2071 } else { 1953 else
2072 ZFCP_LOG_DEBUG("open failed for port 0x%016Lx\n",
2073 port->wwpn);
2074 retval = ZFCP_ERP_FAILED; 1954 retval = ZFCP_ERP_FAILED;
2075 }
2076 break; 1955 break;
2077 1956
2078 default: 1957 default:
2079 ZFCP_LOG_NORMAL("bug: unknown erp step 0x%08x\n", 1958 /* unknown erp step */
2080 erp_action->step);
2081 retval = ZFCP_ERP_FAILED; 1959 retval = ZFCP_ERP_FAILED;
2082 } 1960 }
2083 1961
@@ -2095,27 +1973,20 @@ zfcp_erp_port_strategy_open_nameserver(struct zfcp_erp_action *erp_action)
2095 case ZFCP_ERP_STEP_UNINITIALIZED: 1973 case ZFCP_ERP_STEP_UNINITIALIZED:
2096 case ZFCP_ERP_STEP_PHYS_PORT_CLOSING: 1974 case ZFCP_ERP_STEP_PHYS_PORT_CLOSING:
2097 case ZFCP_ERP_STEP_PORT_CLOSING: 1975 case ZFCP_ERP_STEP_PORT_CLOSING:
2098 ZFCP_LOG_DEBUG("port 0x%016Lx has d_id=0x%06x -> trying open\n",
2099 port->wwpn, port->d_id);
2100 retval = zfcp_erp_port_strategy_open_port(erp_action); 1976 retval = zfcp_erp_port_strategy_open_port(erp_action);
2101 break; 1977 break;
2102 1978
2103 case ZFCP_ERP_STEP_PORT_OPENING: 1979 case ZFCP_ERP_STEP_PORT_OPENING:
2104 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status)) { 1980 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &port->status))
2105 ZFCP_LOG_DEBUG("WKA port is open\n");
2106 retval = ZFCP_ERP_SUCCEEDED; 1981 retval = ZFCP_ERP_SUCCEEDED;
2107 } else { 1982 else
2108 ZFCP_LOG_DEBUG("open failed for WKA port\n");
2109 retval = ZFCP_ERP_FAILED; 1983 retval = ZFCP_ERP_FAILED;
2110 }
2111 /* this is needed anyway (dont care for retval of wakeup) */ 1984 /* this is needed anyway (dont care for retval of wakeup) */
2112 ZFCP_LOG_DEBUG("continue other open port operations\n");
2113 zfcp_erp_port_strategy_open_nameserver_wakeup(erp_action); 1985 zfcp_erp_port_strategy_open_nameserver_wakeup(erp_action);
2114 break; 1986 break;
2115 1987
2116 default: 1988 default:
2117 ZFCP_LOG_NORMAL("bug: unknown erp step 0x%08x\n", 1989 /* unknown erp step */
2118 erp_action->step);
2119 retval = ZFCP_ERP_FAILED; 1990 retval = ZFCP_ERP_FAILED;
2120 } 1991 }
2121 1992
@@ -2313,39 +2184,26 @@ zfcp_erp_unit_strategy(struct zfcp_erp_action *erp_action)
2313 case ZFCP_ERP_STEP_UNINITIALIZED: 2184 case ZFCP_ERP_STEP_UNINITIALIZED:
2314 zfcp_erp_unit_strategy_clearstati(unit); 2185 zfcp_erp_unit_strategy_clearstati(unit);
2315 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status)) { 2186 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status)) {
2316 ZFCP_LOG_DEBUG("unit 0x%016Lx is open -> "
2317 "trying close\n", unit->fcp_lun);
2318 retval = zfcp_erp_unit_strategy_close(erp_action); 2187 retval = zfcp_erp_unit_strategy_close(erp_action);
2319 break; 2188 break;
2320 } 2189 }
2321 /* else it's already closed, fall through */ 2190 /* else it's already closed, fall through */
2322 case ZFCP_ERP_STEP_UNIT_CLOSING: 2191 case ZFCP_ERP_STEP_UNIT_CLOSING:
2323 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status)) { 2192 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status))
2324 ZFCP_LOG_DEBUG("close failed for unit 0x%016Lx\n",
2325 unit->fcp_lun);
2326 retval = ZFCP_ERP_FAILED; 2193 retval = ZFCP_ERP_FAILED;
2327 } else { 2194 else
2328 if (erp_action->status & ZFCP_STATUS_ERP_CLOSE_ONLY) 2195 if (erp_action->status & ZFCP_STATUS_ERP_CLOSE_ONLY)
2329 retval = ZFCP_ERP_EXIT; 2196 retval = ZFCP_ERP_EXIT;
2330 else { 2197 else
2331 ZFCP_LOG_DEBUG("unit 0x%016Lx is not open -> "
2332 "trying open\n", unit->fcp_lun);
2333 retval = 2198 retval =
2334 zfcp_erp_unit_strategy_open(erp_action); 2199 zfcp_erp_unit_strategy_open(erp_action);
2335 }
2336 }
2337 break; 2200 break;
2338 2201
2339 case ZFCP_ERP_STEP_UNIT_OPENING: 2202 case ZFCP_ERP_STEP_UNIT_OPENING:
2340 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status)) { 2203 if (atomic_test_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status))
2341 ZFCP_LOG_DEBUG("unit 0x%016Lx is open\n",
2342 unit->fcp_lun);
2343 retval = ZFCP_ERP_SUCCEEDED; 2204 retval = ZFCP_ERP_SUCCEEDED;
2344 } else { 2205 else
2345 ZFCP_LOG_DEBUG("open failed for unit 0x%016Lx\n",
2346 unit->fcp_lun);
2347 retval = ZFCP_ERP_FAILED; 2206 retval = ZFCP_ERP_FAILED;
2348 }
2349 break; 2207 break;
2350 } 2208 }
2351 2209
@@ -2493,16 +2351,8 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
2493 2351
2494 case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED: 2352 case ZFCP_ERP_ACTION_REOPEN_PORT_FORCED:
2495 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_INUSE, 2353 if (atomic_test_mask(ZFCP_STATUS_COMMON_ERP_INUSE,
2496 &port->status)) { 2354 &port->status))
2497 if (port->erp_action.action !=
2498 ZFCP_ERP_ACTION_REOPEN_PORT_FORCED) {
2499 ZFCP_LOG_INFO("dropped erp action %i (port "
2500 "0x%016Lx, action in use: %i)\n",
2501 want, port->wwpn,
2502 port->erp_action.action);
2503 }
2504 goto out; 2355 goto out;
2505 }
2506 if (!atomic_test_mask 2356 if (!atomic_test_mask
2507 (ZFCP_STATUS_COMMON_RUNNING, &adapter->status) || 2357 (ZFCP_STATUS_COMMON_RUNNING, &adapter->status) ||
2508 atomic_test_mask 2358 atomic_test_mask
@@ -2522,19 +2372,10 @@ static int zfcp_erp_action_enqueue(int want, struct zfcp_adapter *adapter,
2522 break; 2372 break;
2523 2373
2524 default: 2374 default:
2525 ZFCP_LOG_NORMAL("bug: unknown erp action requested " 2375 /* unknown erp action */
2526 "on adapter %s (action=%d)\n",
2527 zfcp_get_busid_by_adapter(adapter), want);
2528 goto out; 2376 goto out;
2529 } 2377 }
2530 2378
2531 /* check whether we need something stronger first */
2532 if (need) {
2533 ZFCP_LOG_DEBUG("stronger erp action %d needed before "
2534 "erp action %d on adapter %s\n",
2535 need, want, zfcp_get_busid_by_adapter(adapter));
2536 }
2537
2538 /* mark adapter to have some error recovery pending */ 2379 /* mark adapter to have some error recovery pending */
2539 atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status); 2380 atomic_set_mask(ZFCP_STATUS_ADAPTER_ERP_PENDING, &adapter->status);
2540 2381
@@ -2672,10 +2513,9 @@ zfcp_erp_action_cleanup(int action, struct zfcp_adapter *adapter,
2672 port->rport = 2513 port->rport =
2673 fc_remote_port_add(adapter->scsi_host, 0, &ids); 2514 fc_remote_port_add(adapter->scsi_host, 0, &ids);
2674 if (!port->rport) 2515 if (!port->rport)
2675 ZFCP_LOG_NORMAL("failed registration of rport" 2516 dev_err(&adapter->ccw_device->dev,
2676 "(adapter %s, wwpn=0x%016Lx)\n", 2517 "Failed registration of rport "
2677 zfcp_get_busid_by_port(port), 2518 "0x%016Lx.\n", port->wwpn);
2678 port->wwpn);
2679 else { 2519 else {
2680 scsi_target_unblock(&port->rport->dev); 2520 scsi_target_unblock(&port->rport->dev);
2681 port->rport->maxframe_size = port->maxframe_size; 2521 port->rport->maxframe_size = port->maxframe_size;
@@ -2803,7 +2643,6 @@ void zfcp_erp_adapter_access_changed(struct zfcp_adapter *adapter, u8 id,
2803 2643
2804void zfcp_erp_port_access_changed(struct zfcp_port *port, u8 id, void *ref) 2644void zfcp_erp_port_access_changed(struct zfcp_port *port, u8 id, void *ref)
2805{ 2645{
2806 struct zfcp_adapter *adapter = port->adapter;
2807 struct zfcp_unit *unit; 2646 struct zfcp_unit *unit;
2808 2647
2809 if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, 2648 if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED,
@@ -2816,34 +2655,16 @@ void zfcp_erp_port_access_changed(struct zfcp_port *port, u8 id, void *ref)
2816 return; 2655 return;
2817 } 2656 }
2818 2657
2819 ZFCP_LOG_NORMAL("reopen of port 0x%016Lx on adapter %s " 2658 zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
2820 "(due to ACT update)\n",
2821 port->wwpn, zfcp_get_busid_by_adapter(adapter));
2822 if (zfcp_erp_port_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref))
2823 ZFCP_LOG_NORMAL("failed reopen of port"
2824 "(adapter %s, wwpn=0x%016Lx)\n",
2825 zfcp_get_busid_by_adapter(adapter), port->wwpn);
2826} 2659}
2827 2660
2828void zfcp_erp_unit_access_changed(struct zfcp_unit *unit, u8 id, void *ref) 2661void zfcp_erp_unit_access_changed(struct zfcp_unit *unit, u8 id, void *ref)
2829{ 2662{
2830 struct zfcp_adapter *adapter = unit->port->adapter;
2831
2832 if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED, 2663 if (!atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_DENIED,
2833 &unit->status) && 2664 &unit->status) &&
2834 !atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_BOXED, 2665 !atomic_test_mask(ZFCP_STATUS_COMMON_ACCESS_BOXED,
2835 &unit->status)) 2666 &unit->status))
2836 return; 2667 return;
2837 2668
2838 ZFCP_LOG_NORMAL("reopen of unit 0x%016Lx on port 0x%016Lx " 2669 zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref);
2839 " on adapter %s (due to ACT update)\n",
2840 unit->fcp_lun, unit->port->wwpn,
2841 zfcp_get_busid_by_adapter(adapter));
2842 if (zfcp_erp_unit_reopen(unit, ZFCP_STATUS_COMMON_ERP_FAILED, id, ref))
2843 ZFCP_LOG_NORMAL("failed reopen of unit (adapter %s, "
2844 "wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n",
2845 zfcp_get_busid_by_adapter(adapter),
2846 unit->port->wwpn, unit->fcp_lun);
2847} 2670}
2848
2849#undef ZFCP_LOG_AREA
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h
index 6ffe2068ba8a..9aa412bd6637 100644
--- a/drivers/s390/scsi/zfcp_ext.h
+++ b/drivers/s390/scsi/zfcp_ext.h
@@ -1,22 +1,9 @@
1/* 1/*
2 * This file is part of the zfcp device driver for 2 * zfcp device driver
3 * FCP adapters for IBM System z9 and zSeries.
4 * 3 *
5 * (C) Copyright IBM Corp. 2002, 2006 4 * External function declarations.
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * Copyright IBM Corporation 2002, 2008
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#ifndef ZFCP_EXT_H 9#ifndef ZFCP_EXT_H
@@ -27,7 +14,6 @@
27extern struct zfcp_data zfcp_data; 14extern struct zfcp_data zfcp_data;
28 15
29/******************************** SYSFS *************************************/ 16/******************************** SYSFS *************************************/
30extern struct attribute_group *zfcp_driver_attr_groups[];
31extern int zfcp_sysfs_adapter_create_files(struct device *); 17extern int zfcp_sysfs_adapter_create_files(struct device *);
32extern void zfcp_sysfs_adapter_remove_files(struct device *); 18extern void zfcp_sysfs_adapter_remove_files(struct device *);
33extern int zfcp_sysfs_port_create_files(struct device *, u32); 19extern int zfcp_sysfs_port_create_files(struct device *, u32);
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index cc48a6462e6c..01ed5fb46c44 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -1,22 +1,9 @@
1/* 1/*
2 * This file is part of the zfcp device driver for 2 * zfcp device driver
3 * FCP adapters for IBM System z9 and zSeries.
4 * 3 *
5 * (C) Copyright IBM Corp. 2002, 2006 4 * Implementation of FSF commands.
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * Copyright IBM Corporation 2002, 2008
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#include "zfcp_ext.h" 9#include "zfcp_ext.h"
@@ -71,12 +58,58 @@ static const char zfcp_act_subtable_type[5][8] = {
71 "unknown", "OS", "WWPN", "DID", "LUN" 58 "unknown", "OS", "WWPN", "DID", "LUN"
72}; 59};
73 60
61static void zfcp_act_eval_err(struct zfcp_adapter *adapter, u32 table)
62{
63 u16 subtable = (table & 0xffff0000) >> 16;
64 u16 rule = table & 0xffff;
65
66 if (subtable > 0 &&
67 subtable < ARRAY_SIZE(zfcp_act_subtable_type)) {
68 dev_warn(&adapter->ccw_device->dev,
69 "Access denied in subtable %s, rule %d.\n",
70 zfcp_act_subtable_type[subtable], rule);
71 }
72}
73
74static void zfcp_fsf_access_denied_port(struct zfcp_fsf_req *req,
75 struct zfcp_port *port)
76{
77 struct fsf_qtcb_header *header = &req->qtcb->header;
78 dev_warn(&req->adapter->ccw_device->dev,
79 "Access denied, cannot send command to port 0x%016Lx.\n",
80 port->wwpn);
81 zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[0]);
82 zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[1]);
83 zfcp_erp_port_access_denied(port, 55, req);
84 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
85}
86
87static void zfcp_fsf_access_denied_unit(struct zfcp_fsf_req *req,
88 struct zfcp_unit *unit)
89{
90 struct fsf_qtcb_header *header = &req->qtcb->header;
91 dev_warn(&req->adapter->ccw_device->dev,
92 "Access denied for unit 0x%016Lx on port 0x%016Lx.\n",
93 unit->fcp_lun, unit->port->wwpn);
94 zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[0]);
95 zfcp_act_eval_err(req->adapter, header->fsf_status_qual.halfword[1]);
96 zfcp_erp_unit_access_denied(unit, 59, req);
97 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
98}
99
100static void zfcp_fsf_class_not_supp(struct zfcp_fsf_req *req)
101{
102 dev_err(&req->adapter->ccw_device->dev,
103 "Required FC class not supported by adapter, "
104 "shutting down adapter.\n");
105 zfcp_erp_adapter_shutdown(req->adapter, 0, 123, req);
106 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
107}
108
74/****************************************************************/ 109/****************************************************************/
75/*************** FSF related Functions *************************/ 110/*************** FSF related Functions *************************/
76/****************************************************************/ 111/****************************************************************/
77 112
78#define ZFCP_LOG_AREA ZFCP_LOG_AREA_FSF
79
80/* 113/*
81 * function: zfcp_fsf_req_alloc 114 * function: zfcp_fsf_req_alloc
82 * 115 *
@@ -200,7 +233,6 @@ zfcp_fsf_req_complete(struct zfcp_fsf_req *fsf_req)
200 int cleanup; 233 int cleanup;
201 234
202 if (unlikely(fsf_req->fsf_command == FSF_QTCB_UNSOLICITED_STATUS)) { 235 if (unlikely(fsf_req->fsf_command == FSF_QTCB_UNSOLICITED_STATUS)) {
203 ZFCP_LOG_DEBUG("Status read response received\n");
204 /* 236 /*
205 * Note: all cleanup handling is done in the callchain of 237 * Note: all cleanup handling is done in the callchain of
206 * the function call-chain below. 238 * the function call-chain below.
@@ -225,7 +257,6 @@ zfcp_fsf_req_complete(struct zfcp_fsf_req *fsf_req)
225 257
226 /* cleanup request if requested by initiator */ 258 /* cleanup request if requested by initiator */
227 if (likely(cleanup)) { 259 if (likely(cleanup)) {
228 ZFCP_LOG_TRACE("removing FSF request %p\n", fsf_req);
229 /* 260 /*
230 * lock must not be held here since it will be 261 * lock must not be held here since it will be
231 * grabed by the called routine, too 262 * grabed by the called routine, too
@@ -233,7 +264,6 @@ zfcp_fsf_req_complete(struct zfcp_fsf_req *fsf_req)
233 zfcp_fsf_req_free(fsf_req); 264 zfcp_fsf_req_free(fsf_req);
234 } else { 265 } else {
235 /* notify initiator waiting for the requests completion */ 266 /* notify initiator waiting for the requests completion */
236 ZFCP_LOG_TRACE("waking initiator of FSF request %p\n",fsf_req);
237 /* 267 /*
238 * FIXME: Race! We must not access fsf_req here as it might have been 268 * FIXME: Race! We must not access fsf_req here as it might have been
239 * cleaned up already due to the set ZFCP_STATUS_FSFREQ_COMPLETED 269 * cleaned up already due to the set ZFCP_STATUS_FSFREQ_COMPLETED
@@ -276,8 +306,6 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
276 zfcp_hba_dbf_event_fsf_response(fsf_req); 306 zfcp_hba_dbf_event_fsf_response(fsf_req);
277 307
278 if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) { 308 if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) {
279 ZFCP_LOG_DEBUG("fsf_req 0x%lx has been dismissed\n",
280 (unsigned long) fsf_req);
281 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 309 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
282 ZFCP_STATUS_FSFREQ_RETRY; /* only for SCSI cmnds. */ 310 ZFCP_STATUS_FSFREQ_RETRY; /* only for SCSI cmnds. */
283 goto skip_protstatus; 311 goto skip_protstatus;
@@ -291,34 +319,26 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
291 break; 319 break;
292 320
293 case FSF_PROT_QTCB_VERSION_ERROR: 321 case FSF_PROT_QTCB_VERSION_ERROR:
294 ZFCP_LOG_NORMAL("error: The adapter %s contains " 322 dev_err(&adapter->ccw_device->dev,
295 "microcode of version 0x%x, the device driver " 323 "The QTCB version requested by zfcp (0x%x) is not "
296 "only supports 0x%x. Aborting.\n", 324 "supported by the FCP adapter (lowest supported 0x%x, "
297 zfcp_get_busid_by_adapter(adapter), 325 "highest supported 0x%x).\n",
298 prot_status_qual->version_error.fsf_version, 326 ZFCP_QTCB_VERSION, prot_status_qual->word[0],
299 ZFCP_QTCB_VERSION); 327 prot_status_qual->word[1]);
300 zfcp_erp_adapter_shutdown(adapter, 0, 117, fsf_req); 328 zfcp_erp_adapter_shutdown(adapter, 0, 117, fsf_req);
301 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 329 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
302 break; 330 break;
303 331
304 case FSF_PROT_SEQ_NUMB_ERROR: 332 case FSF_PROT_SEQ_NUMB_ERROR:
305 ZFCP_LOG_NORMAL("bug: Sequence number mismatch between "
306 "driver (0x%x) and adapter %s (0x%x). "
307 "Restarting all operations on this adapter.\n",
308 qtcb->prefix.req_seq_no,
309 zfcp_get_busid_by_adapter(adapter),
310 prot_status_qual->sequence_error.exp_req_seq_no);
311 zfcp_erp_adapter_reopen(adapter, 0, 98, fsf_req); 333 zfcp_erp_adapter_reopen(adapter, 0, 98, fsf_req);
312 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY; 334 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY;
313 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 335 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
314 break; 336 break;
315 337
316 case FSF_PROT_UNSUPP_QTCB_TYPE: 338 case FSF_PROT_UNSUPP_QTCB_TYPE:
317 ZFCP_LOG_NORMAL("error: Packet header type used by the " 339 dev_err(&adapter->ccw_device->dev,
318 "device driver is incompatible with " 340 "Packet header type used by the device driver is "
319 "that used on adapter %s. " 341 "incompatible with that used on the adapter.\n");
320 "Stopping all operations on this adapter.\n",
321 zfcp_get_busid_by_adapter(adapter));
322 zfcp_erp_adapter_shutdown(adapter, 0, 118, fsf_req); 342 zfcp_erp_adapter_shutdown(adapter, 0, 118, fsf_req);
323 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 343 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
324 break; 344 break;
@@ -330,12 +350,9 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
330 break; 350 break;
331 351
332 case FSF_PROT_DUPLICATE_REQUEST_ID: 352 case FSF_PROT_DUPLICATE_REQUEST_ID:
333 ZFCP_LOG_NORMAL("bug: The request identifier 0x%Lx " 353 dev_err(&adapter->ccw_device->dev,
334 "to the adapter %s is ambiguous. " 354 "The request identifier 0x%Lx is ambiguous.\n",
335 "Stopping all operations on this adapter.\n", 355 (unsigned long long)qtcb->bottom.support.req_handle);
336 *(unsigned long long*)
337 (&qtcb->bottom.support.req_handle),
338 zfcp_get_busid_by_adapter(adapter));
339 zfcp_erp_adapter_shutdown(adapter, 0, 78, fsf_req); 356 zfcp_erp_adapter_shutdown(adapter, 0, 78, fsf_req);
340 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 357 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
341 break; 358 break;
@@ -349,10 +366,6 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
349 break; 366 break;
350 367
351 case FSF_PROT_REEST_QUEUE: 368 case FSF_PROT_REEST_QUEUE:
352 ZFCP_LOG_NORMAL("The local link to adapter with "
353 "%s was re-plugged. "
354 "Re-starting operations on this adapter.\n",
355 zfcp_get_busid_by_adapter(adapter));
356 /* All ports should be marked as ready to run again */ 369 /* All ports should be marked as ready to run again */
357 zfcp_erp_modify_adapter_status(adapter, 28, NULL, 370 zfcp_erp_modify_adapter_status(adapter, 28, NULL,
358 ZFCP_STATUS_COMMON_RUNNING, 371 ZFCP_STATUS_COMMON_RUNNING,
@@ -365,24 +378,17 @@ zfcp_fsf_protstatus_eval(struct zfcp_fsf_req *fsf_req)
365 break; 378 break;
366 379
367 case FSF_PROT_ERROR_STATE: 380 case FSF_PROT_ERROR_STATE:
368 ZFCP_LOG_NORMAL("error: The adapter %s "
369 "has entered the error state. "
370 "Restarting all operations on this "
371 "adapter.\n",
372 zfcp_get_busid_by_adapter(adapter));
373 zfcp_erp_adapter_reopen(adapter, 0, 100, fsf_req); 381 zfcp_erp_adapter_reopen(adapter, 0, 100, fsf_req);
374 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY; 382 fsf_req->status |= ZFCP_STATUS_FSFREQ_RETRY;
375 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 383 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
376 break; 384 break;
377 385
378 default: 386 default:
379 ZFCP_LOG_NORMAL("bug: Transfer protocol status information " 387 dev_err(&adapter->ccw_device->dev,
380 "provided by the adapter %s " 388 "Transfer protocol status information"
381 "is not compatible with the device driver. " 389 "provided by the adapter (0x%x) "
382 "Stopping all operations on this adapter. " 390 "is not compatible with the device driver.\n",
383 "(debug info 0x%x).\n", 391 qtcb->prefix.prot_status);
384 zfcp_get_busid_by_adapter(adapter),
385 qtcb->prefix.prot_status);
386 zfcp_erp_adapter_shutdown(adapter, 0, 119, fsf_req); 392 zfcp_erp_adapter_shutdown(adapter, 0, 119, fsf_req);
387 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 393 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
388 } 394 }
@@ -416,21 +422,14 @@ zfcp_fsf_fsfstatus_eval(struct zfcp_fsf_req *fsf_req)
416 /* evaluate FSF Status */ 422 /* evaluate FSF Status */
417 switch (fsf_req->qtcb->header.fsf_status) { 423 switch (fsf_req->qtcb->header.fsf_status) {
418 case FSF_UNKNOWN_COMMAND: 424 case FSF_UNKNOWN_COMMAND:
419 ZFCP_LOG_NORMAL("bug: Command issued by the device driver is " 425 dev_err(&fsf_req->adapter->ccw_device->dev,
420 "not known by the adapter %s " 426 "Command issued by the device driver (0x%x) is "
421 "Stopping all operations on this adapter. " 427 "not known by the adapter.\n",
422 "(debug info 0x%x).\n", 428 fsf_req->qtcb->header.fsf_command);
423 zfcp_get_busid_by_adapter(fsf_req->adapter),
424 fsf_req->qtcb->header.fsf_command);
425 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0, 120, fsf_req); 429 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0, 120, fsf_req);
426 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 430 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
427 break; 431 break;
428 432
429 case FSF_FCP_RSP_AVAILABLE:
430 ZFCP_LOG_DEBUG("FCP Sense data will be presented to the "
431 "SCSI stack.\n");
432 break;
433
434 case FSF_ADAPTER_STATUS_AVAILABLE: 433 case FSF_ADAPTER_STATUS_AVAILABLE:
435 zfcp_fsf_fsfstatus_qual_eval(fsf_req); 434 zfcp_fsf_fsfstatus_qual_eval(fsf_req);
436 break; 435 break;
@@ -472,17 +471,13 @@ zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *fsf_req)
472 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 471 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
473 break; 472 break;
474 case FSF_SQ_NO_RECOM: 473 case FSF_SQ_NO_RECOM:
475 ZFCP_LOG_NORMAL("bug: No recommendation could be given for a " 474 dev_err(&fsf_req->adapter->ccw_device->dev,
476 "problem on the adapter %s " 475 "No recommendation could be given for a "
477 "Stopping all operations on this adapter. ", 476 "problem on the adapter.\n");
478 zfcp_get_busid_by_adapter(fsf_req->adapter));
479 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0, 121, fsf_req); 477 zfcp_erp_adapter_shutdown(fsf_req->adapter, 0, 121, fsf_req);
480 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 478 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
481 break; 479 break;
482 case FSF_SQ_ULP_PROGRAMMING_ERROR: 480 case FSF_SQ_ULP_PROGRAMMING_ERROR:
483 ZFCP_LOG_NORMAL("error: not enough SBALs for data transfer "
484 "(adapter %s)\n",
485 zfcp_get_busid_by_adapter(fsf_req->adapter));
486 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 481 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
487 break; 482 break;
488 case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: 483 case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE:
@@ -491,11 +486,6 @@ zfcp_fsf_fsfstatus_qual_eval(struct zfcp_fsf_req *fsf_req)
491 /* dealt with in the respective functions */ 486 /* dealt with in the respective functions */
492 break; 487 break;
493 default: 488 default:
494 ZFCP_LOG_NORMAL("bug: Additional status info could "
495 "not be interpreted properly.\n");
496 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL,
497 (char *) &fsf_req->qtcb->header.fsf_status_qual,
498 sizeof (union fsf_status_qual));
499 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 489 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
500 break; 490 break;
501 } 491 }
@@ -523,84 +513,67 @@ zfcp_fsf_link_down_info_eval(struct zfcp_fsf_req *fsf_req, u8 id,
523 513
524 switch (link_down->error_code) { 514 switch (link_down->error_code) {
525 case FSF_PSQ_LINK_NO_LIGHT: 515 case FSF_PSQ_LINK_NO_LIGHT:
526 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 516 dev_warn(&fsf_req->adapter->ccw_device->dev,
527 "(no light detected)\n", 517 "The local link is down: "
528 zfcp_get_busid_by_adapter(adapter)); 518 "no light detected.\n");
529 break; 519 break;
530 case FSF_PSQ_LINK_WRAP_PLUG: 520 case FSF_PSQ_LINK_WRAP_PLUG:
531 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 521 dev_warn(&fsf_req->adapter->ccw_device->dev,
532 "(wrap plug detected)\n", 522 "The local link is down: "
533 zfcp_get_busid_by_adapter(adapter)); 523 "wrap plug detected.\n");
534 break; 524 break;
535 case FSF_PSQ_LINK_NO_FCP: 525 case FSF_PSQ_LINK_NO_FCP:
536 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 526 dev_warn(&fsf_req->adapter->ccw_device->dev,
537 "(adjacent node on link does not support FCP)\n", 527 "The local link is down: "
538 zfcp_get_busid_by_adapter(adapter)); 528 "adjacent node on link does not support FCP.\n");
539 break; 529 break;
540 case FSF_PSQ_LINK_FIRMWARE_UPDATE: 530 case FSF_PSQ_LINK_FIRMWARE_UPDATE:
541 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 531 dev_warn(&fsf_req->adapter->ccw_device->dev,
542 "(firmware update in progress)\n", 532 "The local link is down: "
543 zfcp_get_busid_by_adapter(adapter)); 533 "firmware update in progress.\n");
544 break; 534 break;
545 case FSF_PSQ_LINK_INVALID_WWPN: 535 case FSF_PSQ_LINK_INVALID_WWPN:
546 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 536 dev_warn(&fsf_req->adapter->ccw_device->dev,
547 "(duplicate or invalid WWPN detected)\n", 537 "The local link is down: "
548 zfcp_get_busid_by_adapter(adapter)); 538 "duplicate or invalid WWPN detected.\n");
549 break; 539 break;
550 case FSF_PSQ_LINK_NO_NPIV_SUPPORT: 540 case FSF_PSQ_LINK_NO_NPIV_SUPPORT:
551 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 541 dev_warn(&fsf_req->adapter->ccw_device->dev,
552 "(no support for NPIV by Fabric)\n", 542 "The local link is down: "
553 zfcp_get_busid_by_adapter(adapter)); 543 "no support for NPIV by Fabric.\n");
554 break; 544 break;
555 case FSF_PSQ_LINK_NO_FCP_RESOURCES: 545 case FSF_PSQ_LINK_NO_FCP_RESOURCES:
556 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 546 dev_warn(&fsf_req->adapter->ccw_device->dev,
557 "(out of resource in FCP daughtercard)\n", 547 "The local link is down: "
558 zfcp_get_busid_by_adapter(adapter)); 548 "out of resource in FCP daughtercard.\n");
559 break; 549 break;
560 case FSF_PSQ_LINK_NO_FABRIC_RESOURCES: 550 case FSF_PSQ_LINK_NO_FABRIC_RESOURCES:
561 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 551 dev_warn(&fsf_req->adapter->ccw_device->dev,
562 "(out of resource in Fabric)\n", 552 "The local link is down: "
563 zfcp_get_busid_by_adapter(adapter)); 553 "out of resource in Fabric.\n");
564 break; 554 break;
565 case FSF_PSQ_LINK_FABRIC_LOGIN_UNABLE: 555 case FSF_PSQ_LINK_FABRIC_LOGIN_UNABLE:
566 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 556 dev_warn(&fsf_req->adapter->ccw_device->dev,
567 "(unable to Fabric login)\n", 557 "The local link is down: "
568 zfcp_get_busid_by_adapter(adapter)); 558 "unable to login to Fabric.\n");
569 break; 559 break;
570 case FSF_PSQ_LINK_WWPN_ASSIGNMENT_CORRUPTED: 560 case FSF_PSQ_LINK_WWPN_ASSIGNMENT_CORRUPTED:
571 ZFCP_LOG_NORMAL("WWPN assignment file corrupted on adapter %s\n", 561 dev_warn(&fsf_req->adapter->ccw_device->dev,
572 zfcp_get_busid_by_adapter(adapter)); 562 "WWPN assignment file corrupted on adapter.\n");
573 break; 563 break;
574 case FSF_PSQ_LINK_MODE_TABLE_CURRUPTED: 564 case FSF_PSQ_LINK_MODE_TABLE_CURRUPTED:
575 ZFCP_LOG_NORMAL("Mode table corrupted on adapter %s\n", 565 dev_warn(&fsf_req->adapter->ccw_device->dev,
576 zfcp_get_busid_by_adapter(adapter)); 566 "Mode table corrupted on adapter.\n");
577 break; 567 break;
578 case FSF_PSQ_LINK_NO_WWPN_ASSIGNMENT: 568 case FSF_PSQ_LINK_NO_WWPN_ASSIGNMENT:
579 ZFCP_LOG_NORMAL("No WWPN for assignment table on adapter %s\n", 569 dev_warn(&fsf_req->adapter->ccw_device->dev,
580 zfcp_get_busid_by_adapter(adapter)); 570 "No WWPN for assignment table on adapter.\n");
581 break; 571 break;
582 default: 572 default:
583 ZFCP_LOG_NORMAL("The local link to adapter %s is down " 573 dev_warn(&fsf_req->adapter->ccw_device->dev,
584 "(warning: unknown reason code %d)\n", 574 "The local link to adapter is down.\n");
585 zfcp_get_busid_by_adapter(adapter),
586 link_down->error_code);
587 } 575 }
588 576
589 if (adapter->connection_features & FSF_FEATURE_NPIV_MODE)
590 ZFCP_LOG_DEBUG("Debug information to link down: "
591 "primary_status=0x%02x "
592 "ioerr_code=0x%02x "
593 "action_code=0x%02x "
594 "reason_code=0x%02x "
595 "explanation_code=0x%02x "
596 "vendor_specific_code=0x%02x\n",
597 link_down->primary_status,
598 link_down->ioerr_code,
599 link_down->action_code,
600 link_down->reason_code,
601 link_down->explanation_code,
602 link_down->vendor_specific_code);
603
604 out: 577 out:
605 zfcp_erp_adapter_failed(adapter, id, fsf_req); 578 zfcp_erp_adapter_failed(adapter, id, fsf_req);
606} 579}
@@ -616,7 +589,6 @@ static int
616zfcp_fsf_req_dispatch(struct zfcp_fsf_req *fsf_req) 589zfcp_fsf_req_dispatch(struct zfcp_fsf_req *fsf_req)
617{ 590{
618 struct zfcp_erp_action *erp_action = fsf_req->erp_action; 591 struct zfcp_erp_action *erp_action = fsf_req->erp_action;
619 struct zfcp_adapter *adapter = fsf_req->adapter;
620 int retval = 0; 592 int retval = 0;
621 593
622 594
@@ -673,20 +645,6 @@ zfcp_fsf_req_dispatch(struct zfcp_fsf_req *fsf_req)
673 case FSF_QTCB_UPLOAD_CONTROL_FILE: 645 case FSF_QTCB_UPLOAD_CONTROL_FILE:
674 zfcp_fsf_control_file_handler(fsf_req); 646 zfcp_fsf_control_file_handler(fsf_req);
675 break; 647 break;
676
677 default:
678 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
679 ZFCP_LOG_NORMAL("bug: Command issued by the device driver is "
680 "not supported by the adapter %s\n",
681 zfcp_get_busid_by_adapter(adapter));
682 if (fsf_req->fsf_command != fsf_req->qtcb->header.fsf_command)
683 ZFCP_LOG_NORMAL
684 ("bug: Command issued by the device driver differs "
685 "from the command returned by the adapter %s "
686 "(debug info 0x%x, 0x%x).\n",
687 zfcp_get_busid_by_adapter(adapter),
688 fsf_req->fsf_command,
689 fsf_req->qtcb->header.fsf_command);
690 } 648 }
691 649
692 if (!erp_action) 650 if (!erp_action)
@@ -718,12 +676,8 @@ zfcp_fsf_status_read(struct zfcp_adapter *adapter, int req_flags)
718 req_flags | ZFCP_REQ_NO_QTCB, 676 req_flags | ZFCP_REQ_NO_QTCB,
719 adapter->pool.fsf_req_status_read, 677 adapter->pool.fsf_req_status_read,
720 &lock_flags, &fsf_req); 678 &lock_flags, &fsf_req);
721 if (retval < 0) { 679 if (retval < 0)
722 ZFCP_LOG_INFO("error: Could not create unsolicited status "
723 "buffer for adapter %s.\n",
724 zfcp_get_busid_by_adapter(adapter));
725 goto failed_req_create; 680 goto failed_req_create;
726 }
727 681
728 sbale = zfcp_qdio_sbale_req(fsf_req); 682 sbale = zfcp_qdio_sbale_req(fsf_req);
729 sbale[0].flags |= SBAL_FLAGS0_TYPE_STATUS; 683 sbale[0].flags |= SBAL_FLAGS0_TYPE_STATUS;
@@ -744,14 +698,9 @@ zfcp_fsf_status_read(struct zfcp_adapter *adapter, int req_flags)
744 sbale->length = sizeof(struct fsf_status_read_buffer); 698 sbale->length = sizeof(struct fsf_status_read_buffer);
745 699
746 retval = zfcp_fsf_req_send(fsf_req); 700 retval = zfcp_fsf_req_send(fsf_req);
747 if (retval) { 701 if (retval)
748 ZFCP_LOG_DEBUG("error: Could not set-up unsolicited status "
749 "environment.\n");
750 goto failed_req_send; 702 goto failed_req_send;
751 }
752 703
753 ZFCP_LOG_TRACE("Status Read request initiated (adapter%s)\n",
754 zfcp_get_busid_by_adapter(adapter));
755 goto out; 704 goto out;
756 705
757 failed_req_send: 706 failed_req_send:
@@ -783,14 +732,8 @@ zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *fsf_req)
783 break; 732 break;
784 read_unlock_irqrestore(&zfcp_data.config_lock, flags); 733 read_unlock_irqrestore(&zfcp_data.config_lock, flags);
785 734
786 if (!port || (port->d_id != (status_buffer->d_id & ZFCP_DID_MASK))) { 735 if (!port || (port->d_id != (status_buffer->d_id & ZFCP_DID_MASK)))
787 ZFCP_LOG_NORMAL("bug: Reopen port indication received for "
788 "nonexisting port with d_id 0x%06x on "
789 "adapter %s. Ignored.\n",
790 status_buffer->d_id & ZFCP_DID_MASK,
791 zfcp_get_busid_by_adapter(adapter));
792 goto out; 736 goto out;
793 }
794 737
795 switch (status_buffer->status_subtype) { 738 switch (status_buffer->status_subtype) {
796 739
@@ -801,20 +744,48 @@ zfcp_fsf_status_read_port_closed(struct zfcp_fsf_req *fsf_req)
801 case FSF_STATUS_READ_SUB_ERROR_PORT: 744 case FSF_STATUS_READ_SUB_ERROR_PORT:
802 zfcp_erp_port_shutdown(port, 0, 122, fsf_req); 745 zfcp_erp_port_shutdown(port, 0, 122, fsf_req);
803 break; 746 break;
804
805 default:
806 ZFCP_LOG_NORMAL("bug: Undefined status subtype received "
807 "for a reopen indication on port with "
808 "d_id 0x%06x on the adapter %s. "
809 "Ignored. (debug info 0x%x)\n",
810 status_buffer->d_id,
811 zfcp_get_busid_by_adapter(adapter),
812 status_buffer->status_subtype);
813 } 747 }
814 out: 748 out:
815 return 0; 749 return 0;
816} 750}
817 751
752static void zfcp_fsf_bit_error_threshold(struct zfcp_fsf_req *req)
753{
754 struct zfcp_adapter *adapter = req->adapter;
755 struct fsf_status_read_buffer *buf =
756 (struct fsf_status_read_buffer *) req->data;
757 struct fsf_bit_error_payload *err =
758 (struct fsf_bit_error_payload *) buf->payload;
759 dev_warn(&adapter->ccw_device->dev,
760 "Warning: bit error threshold data "
761 "received for the adapter: "
762 "link failures = %i, loss of sync errors = %i, "
763 "loss of signal errors = %i, "
764 "primitive sequence errors = %i, "
765 "invalid transmission word errors = %i, "
766 "CRC errors = %i).\n",
767 err->link_failure_error_count,
768 err->loss_of_sync_error_count,
769 err->loss_of_signal_error_count,
770 err->primitive_sequence_error_count,
771 err->invalid_transmission_word_error_count,
772 err->crc_error_count);
773 dev_warn(&adapter->ccw_device->dev,
774 "Additional bit error threshold data of the adapter: "
775 "primitive sequence event time-outs = %i, "
776 "elastic buffer overrun errors = %i, "
777 "advertised receive buffer-to-buffer credit = %i, "
778 "current receice buffer-to-buffer credit = %i, "
779 "advertised transmit buffer-to-buffer credit = %i, "
780 "current transmit buffer-to-buffer credit = %i).\n",
781 err->primitive_sequence_event_timeout_count,
782 err->elastic_buffer_overrun_error_count,
783 err->advertised_receive_b2b_credit,
784 err->current_receive_b2b_credit,
785 err->advertised_transmit_b2b_credit,
786 err->current_transmit_b2b_credit);
787}
788
818/* 789/*
819 * function: zfcp_fsf_status_read_handler 790 * function: zfcp_fsf_status_read_handler
820 * 791 *
@@ -829,7 +800,6 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req)
829 struct zfcp_adapter *adapter = fsf_req->adapter; 800 struct zfcp_adapter *adapter = fsf_req->adapter;
830 struct fsf_status_read_buffer *status_buffer = 801 struct fsf_status_read_buffer *status_buffer =
831 (struct fsf_status_read_buffer *) fsf_req->data; 802 (struct fsf_status_read_buffer *) fsf_req->data;
832 struct fsf_bit_error_payload *fsf_bit_error;
833 803
834 if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) { 804 if (fsf_req->status & ZFCP_STATUS_FSFREQ_DISMISSED) {
835 zfcp_hba_dbf_event_fsf_unsol("dism", adapter, status_buffer); 805 zfcp_hba_dbf_event_fsf_unsol("dism", adapter, status_buffer);
@@ -851,79 +821,45 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req)
851 break; 821 break;
852 822
853 case FSF_STATUS_READ_SENSE_DATA_AVAIL: 823 case FSF_STATUS_READ_SENSE_DATA_AVAIL:
854 ZFCP_LOG_INFO("unsolicited sense data received (adapter %s)\n",
855 zfcp_get_busid_by_adapter(adapter));
856 break; 824 break;
857 825
858 case FSF_STATUS_READ_BIT_ERROR_THRESHOLD: 826 case FSF_STATUS_READ_BIT_ERROR_THRESHOLD:
859 fsf_bit_error = (struct fsf_bit_error_payload *) 827 zfcp_fsf_bit_error_threshold(fsf_req);
860 status_buffer->payload;
861 ZFCP_LOG_NORMAL("Warning: bit error threshold data "
862 "received (adapter %s, "
863 "link failures = %i, loss of sync errors = %i, "
864 "loss of signal errors = %i, "
865 "primitive sequence errors = %i, "
866 "invalid transmission word errors = %i, "
867 "CRC errors = %i)\n",
868 zfcp_get_busid_by_adapter(adapter),
869 fsf_bit_error->link_failure_error_count,
870 fsf_bit_error->loss_of_sync_error_count,
871 fsf_bit_error->loss_of_signal_error_count,
872 fsf_bit_error->primitive_sequence_error_count,
873 fsf_bit_error->invalid_transmission_word_error_count,
874 fsf_bit_error->crc_error_count);
875 ZFCP_LOG_INFO("Additional bit error threshold data "
876 "(adapter %s, "
877 "primitive sequence event time-outs = %i, "
878 "elastic buffer overrun errors = %i, "
879 "advertised receive buffer-to-buffer credit = %i, "
880 "current receice buffer-to-buffer credit = %i, "
881 "advertised transmit buffer-to-buffer credit = %i, "
882 "current transmit buffer-to-buffer credit = %i)\n",
883 zfcp_get_busid_by_adapter(adapter),
884 fsf_bit_error->primitive_sequence_event_timeout_count,
885 fsf_bit_error->elastic_buffer_overrun_error_count,
886 fsf_bit_error->advertised_receive_b2b_credit,
887 fsf_bit_error->current_receive_b2b_credit,
888 fsf_bit_error->advertised_transmit_b2b_credit,
889 fsf_bit_error->current_transmit_b2b_credit);
890 break; 828 break;
891 829
892 case FSF_STATUS_READ_LINK_DOWN: 830 case FSF_STATUS_READ_LINK_DOWN:
893 switch (status_buffer->status_subtype) { 831 switch (status_buffer->status_subtype) {
894 case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK: 832 case FSF_STATUS_READ_SUB_NO_PHYSICAL_LINK:
895 ZFCP_LOG_INFO("Physical link to adapter %s is down\n", 833 dev_warn(&adapter->ccw_device->dev,
896 zfcp_get_busid_by_adapter(adapter)); 834 "Physical link is down.\n");
897 zfcp_fsf_link_down_info_eval(fsf_req, 38, 835 zfcp_fsf_link_down_info_eval(fsf_req, 38,
898 (struct fsf_link_down_info *) 836 (struct fsf_link_down_info *)
899 &status_buffer->payload); 837 &status_buffer->payload);
900 break; 838 break;
901 case FSF_STATUS_READ_SUB_FDISC_FAILED: 839 case FSF_STATUS_READ_SUB_FDISC_FAILED:
902 ZFCP_LOG_INFO("Local link to adapter %s is down " 840 dev_warn(&adapter->ccw_device->dev,
903 "due to failed FDISC login\n", 841 "Local link is down "
904 zfcp_get_busid_by_adapter(adapter)); 842 "due to failed FDISC login.\n");
905 zfcp_fsf_link_down_info_eval(fsf_req, 39, 843 zfcp_fsf_link_down_info_eval(fsf_req, 39,
906 (struct fsf_link_down_info *) 844 (struct fsf_link_down_info *)
907 &status_buffer->payload); 845 &status_buffer->payload);
908 break; 846 break;
909 case FSF_STATUS_READ_SUB_FIRMWARE_UPDATE: 847 case FSF_STATUS_READ_SUB_FIRMWARE_UPDATE:
910 ZFCP_LOG_INFO("Local link to adapter %s is down " 848 dev_warn(&adapter->ccw_device->dev,
911 "due to firmware update on adapter\n", 849 "Local link is down "
912 zfcp_get_busid_by_adapter(adapter)); 850 "due to firmware update on adapter.\n");
913 zfcp_fsf_link_down_info_eval(fsf_req, 40, NULL); 851 zfcp_fsf_link_down_info_eval(fsf_req, 40, NULL);
914 break; 852 break;
915 default: 853 default:
916 ZFCP_LOG_INFO("Local link to adapter %s is down " 854 dev_warn(&adapter->ccw_device->dev,
917 "due to unknown reason\n", 855 "Local link is down.\n");
918 zfcp_get_busid_by_adapter(adapter));
919 zfcp_fsf_link_down_info_eval(fsf_req, 41, NULL); 856 zfcp_fsf_link_down_info_eval(fsf_req, 41, NULL);
920 }; 857 };
921 break; 858 break;
922 859
923 case FSF_STATUS_READ_LINK_UP: 860 case FSF_STATUS_READ_LINK_UP:
924 ZFCP_LOG_NORMAL("Local link to adapter %s was replugged. " 861 dev_info(&adapter->ccw_device->dev,
925 "Restarting operations on this adapter\n", 862 "Local link was replugged.\n");
926 zfcp_get_busid_by_adapter(adapter));
927 /* All ports should be marked as ready to run again */ 863 /* All ports should be marked as ready to run again */
928 zfcp_erp_modify_adapter_status(adapter, 30, NULL, 864 zfcp_erp_modify_adapter_status(adapter, 30, NULL,
929 ZFCP_STATUS_COMMON_RUNNING, 865 ZFCP_STATUS_COMMON_RUNNING,
@@ -935,81 +871,18 @@ zfcp_fsf_status_read_handler(struct zfcp_fsf_req *fsf_req)
935 break; 871 break;
936 872
937 case FSF_STATUS_READ_NOTIFICATION_LOST: 873 case FSF_STATUS_READ_NOTIFICATION_LOST:
938 ZFCP_LOG_NORMAL("Unsolicited status notification(s) lost: "
939 "adapter %s%s%s%s%s%s%s%s%s\n",
940 zfcp_get_busid_by_adapter(adapter),
941 (status_buffer->status_subtype &
942 FSF_STATUS_READ_SUB_INCOMING_ELS) ?
943 ", incoming ELS" : "",
944 (status_buffer->status_subtype &
945 FSF_STATUS_READ_SUB_SENSE_DATA) ?
946 ", sense data" : "",
947 (status_buffer->status_subtype &
948 FSF_STATUS_READ_SUB_LINK_STATUS) ?
949 ", link status change" : "",
950 (status_buffer->status_subtype &
951 FSF_STATUS_READ_SUB_PORT_CLOSED) ?
952 ", port close" : "",
953 (status_buffer->status_subtype &
954 FSF_STATUS_READ_SUB_BIT_ERROR_THRESHOLD) ?
955 ", bit error exception" : "",
956 (status_buffer->status_subtype &
957 FSF_STATUS_READ_SUB_ACT_UPDATED) ?
958 ", ACT update" : "",
959 (status_buffer->status_subtype &
960 FSF_STATUS_READ_SUB_ACT_HARDENED) ?
961 ", ACT hardening" : "",
962 (status_buffer->status_subtype &
963 FSF_STATUS_READ_SUB_FEATURE_UPDATE_ALERT) ?
964 ", adapter feature change" : "");
965
966 if (status_buffer->status_subtype & 874 if (status_buffer->status_subtype &
967 FSF_STATUS_READ_SUB_ACT_UPDATED) 875 FSF_STATUS_READ_SUB_ACT_UPDATED)
968 zfcp_erp_adapter_access_changed(adapter, 135, fsf_req); 876 zfcp_erp_adapter_access_changed(adapter, 135, fsf_req);
969 break; 877 break;
970 878
971 case FSF_STATUS_READ_CFDC_UPDATED: 879 case FSF_STATUS_READ_CFDC_UPDATED:
972 ZFCP_LOG_NORMAL("CFDC has been updated on the adapter %s\n",
973 zfcp_get_busid_by_adapter(adapter));
974 zfcp_erp_adapter_access_changed(adapter, 136, fsf_req); 880 zfcp_erp_adapter_access_changed(adapter, 136, fsf_req);
975 break; 881 break;
976 882
977 case FSF_STATUS_READ_CFDC_HARDENED:
978 switch (status_buffer->status_subtype) {
979 case FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE:
980 ZFCP_LOG_NORMAL("CFDC of adapter %s saved on SE\n",
981 zfcp_get_busid_by_adapter(adapter));
982 break;
983 case FSF_STATUS_READ_SUB_CFDC_HARDENED_ON_SE2:
984 ZFCP_LOG_NORMAL("CFDC of adapter %s has been copied "
985 "to the secondary SE\n",
986 zfcp_get_busid_by_adapter(adapter));
987 break;
988 default:
989 ZFCP_LOG_NORMAL("CFDC of adapter %s has been hardened\n",
990 zfcp_get_busid_by_adapter(adapter));
991 }
992 break;
993
994 case FSF_STATUS_READ_FEATURE_UPDATE_ALERT: 883 case FSF_STATUS_READ_FEATURE_UPDATE_ALERT:
995 ZFCP_LOG_INFO("List of supported features on adapter %s has "
996 "been changed from 0x%08X to 0x%08X\n",
997 zfcp_get_busid_by_adapter(adapter),
998 *(u32*) (status_buffer->payload + 4),
999 *(u32*) (status_buffer->payload));
1000 adapter->adapter_features = *(u32*) status_buffer->payload; 884 adapter->adapter_features = *(u32*) status_buffer->payload;
1001 break; 885 break;
1002
1003 default:
1004 ZFCP_LOG_NORMAL("warning: An unsolicited status packet of unknown "
1005 "type was received (debug info 0x%x)\n",
1006 status_buffer->status_type);
1007 ZFCP_LOG_DEBUG("Dump of status_read_buffer %p:\n",
1008 status_buffer);
1009 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
1010 (char *) status_buffer,
1011 sizeof (struct fsf_status_read_buffer));
1012 break;
1013 } 886 }
1014 mempool_free(status_buffer, adapter->pool.data_status_read); 887 mempool_free(status_buffer, adapter->pool.data_status_read);
1015 zfcp_fsf_req_free(fsf_req); 888 zfcp_fsf_req_free(fsf_req);
@@ -1060,15 +933,8 @@ zfcp_fsf_abort_fcp_command(unsigned long old_req_id,
1060 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND, 933 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_ABORT_FCP_CMND,
1061 req_flags, adapter->pool.fsf_req_abort, 934 req_flags, adapter->pool.fsf_req_abort,
1062 &lock_flags, &fsf_req); 935 &lock_flags, &fsf_req);
1063 if (retval < 0) { 936 if (retval < 0)
1064 ZFCP_LOG_INFO("error: Failed to create an abort command "
1065 "request for lun 0x%016Lx on port 0x%016Lx "
1066 "on adapter %s.\n",
1067 unit->fcp_lun,
1068 unit->port->wwpn,
1069 zfcp_get_busid_by_adapter(adapter));
1070 goto out; 937 goto out;
1071 }
1072 938
1073 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, 939 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED,
1074 &unit->status))) 940 &unit->status)))
@@ -1134,17 +1000,6 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req)
1134 * fine. 1000 * fine.
1135 */ 1001 */
1136 } else { 1002 } else {
1137 ZFCP_LOG_INFO("Temporary port identifier 0x%x for "
1138 "port 0x%016Lx on adapter %s invalid. "
1139 "This may happen occasionally.\n",
1140 unit->port->handle,
1141 unit->port->wwpn,
1142 zfcp_get_busid_by_unit(unit));
1143 ZFCP_LOG_INFO("status qualifier:\n");
1144 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO,
1145 (char *) &new_fsf_req->qtcb->header.
1146 fsf_status_qual,
1147 sizeof (union fsf_status_qual));
1148 /* Let's hope this sorts out the mess */ 1003 /* Let's hope this sorts out the mess */
1149 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 104, 1004 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 104,
1150 new_fsf_req); 1005 new_fsf_req);
@@ -1160,20 +1015,6 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req)
1160 * This is fine. 1015 * This is fine.
1161 */ 1016 */
1162 } else { 1017 } else {
1163 ZFCP_LOG_INFO
1164 ("Warning: Temporary LUN identifier 0x%x of LUN "
1165 "0x%016Lx on port 0x%016Lx on adapter %s is "
1166 "invalid. This may happen in rare cases. "
1167 "Trying to re-establish link.\n",
1168 unit->handle,
1169 unit->fcp_lun,
1170 unit->port->wwpn,
1171 zfcp_get_busid_by_unit(unit));
1172 ZFCP_LOG_DEBUG("Status qualifier data:\n");
1173 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
1174 (char *) &new_fsf_req->qtcb->header.
1175 fsf_status_qual,
1176 sizeof (union fsf_status_qual));
1177 /* Let's hope this sorts out the mess */ 1018 /* Let's hope this sorts out the mess */
1178 zfcp_erp_port_reopen(unit->port, 0, 105, new_fsf_req); 1019 zfcp_erp_port_reopen(unit->port, 0, 105, new_fsf_req);
1179 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1020 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
@@ -1186,20 +1027,12 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req)
1186 break; 1027 break;
1187 1028
1188 case FSF_PORT_BOXED: 1029 case FSF_PORT_BOXED:
1189 ZFCP_LOG_INFO("Remote port 0x%016Lx on adapter %s needs to "
1190 "be reopened\n", unit->port->wwpn,
1191 zfcp_get_busid_by_unit(unit));
1192 zfcp_erp_port_boxed(unit->port, 47, new_fsf_req); 1030 zfcp_erp_port_boxed(unit->port, 47, new_fsf_req);
1193 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR 1031 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR
1194 | ZFCP_STATUS_FSFREQ_RETRY; 1032 | ZFCP_STATUS_FSFREQ_RETRY;
1195 break; 1033 break;
1196 1034
1197 case FSF_LUN_BOXED: 1035 case FSF_LUN_BOXED:
1198 ZFCP_LOG_INFO(
1199 "unit 0x%016Lx on port 0x%016Lx on adapter %s needs "
1200 "to be reopened\n",
1201 unit->fcp_lun, unit->port->wwpn,
1202 zfcp_get_busid_by_unit(unit));
1203 zfcp_erp_unit_boxed(unit, 48, new_fsf_req); 1036 zfcp_erp_unit_boxed(unit, 48, new_fsf_req);
1204 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR 1037 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR
1205 | ZFCP_STATUS_FSFREQ_RETRY; 1038 | ZFCP_STATUS_FSFREQ_RETRY;
@@ -1215,11 +1048,6 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req)
1215 /* SCSI stack will escalate */ 1048 /* SCSI stack will escalate */
1216 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1049 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1217 break; 1050 break;
1218 default:
1219 ZFCP_LOG_NORMAL
1220 ("bug: Wrong status qualifier 0x%x arrived.\n",
1221 new_fsf_req->qtcb->header.fsf_status_qual.word[0]);
1222 break;
1223 } 1051 }
1224 break; 1052 break;
1225 1053
@@ -1227,12 +1055,6 @@ zfcp_fsf_abort_fcp_command_handler(struct zfcp_fsf_req *new_fsf_req)
1227 retval = 0; 1055 retval = 0;
1228 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED; 1056 new_fsf_req->status |= ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED;
1229 break; 1057 break;
1230
1231 default:
1232 ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "
1233 "(debug info 0x%x)\n",
1234 new_fsf_req->qtcb->header.fsf_status);
1235 break;
1236 } 1058 }
1237 skip_fsfstatus: 1059 skip_fsfstatus:
1238 return retval; 1060 return retval;
@@ -1287,12 +1109,8 @@ zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1287 ret = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_GENERIC, 1109 ret = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_GENERIC,
1288 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP, 1110 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP,
1289 pool, &lock_flags, &fsf_req); 1111 pool, &lock_flags, &fsf_req);
1290 if (ret < 0) { 1112 if (ret < 0)
1291 ZFCP_LOG_INFO("error: Could not create CT request (FC-GS) for "
1292 "adapter: %s\n",
1293 zfcp_get_busid_by_adapter(adapter));
1294 goto failed_req; 1113 goto failed_req;
1295 }
1296 1114
1297 sbale = zfcp_qdio_sbale_req(fsf_req); 1115 sbale = zfcp_qdio_sbale_req(fsf_req);
1298 if (zfcp_use_one_sbal(ct->req, ct->req_count, 1116 if (zfcp_use_one_sbal(ct->req, ct->req_count,
@@ -1313,9 +1131,6 @@ zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1313 ct->req, 1131 ct->req,
1314 ZFCP_MAX_SBALS_PER_CT_REQ); 1132 ZFCP_MAX_SBALS_PER_CT_REQ);
1315 if (bytes <= 0) { 1133 if (bytes <= 0) {
1316 ZFCP_LOG_INFO("error: creation of CT request failed "
1317 "on adapter %s\n",
1318 zfcp_get_busid_by_adapter(adapter));
1319 if (bytes == 0) 1134 if (bytes == 0)
1320 ret = -ENOMEM; 1135 ret = -ENOMEM;
1321 else 1136 else
@@ -1330,9 +1145,6 @@ zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1330 ct->resp, 1145 ct->resp,
1331 ZFCP_MAX_SBALS_PER_CT_REQ); 1146 ZFCP_MAX_SBALS_PER_CT_REQ);
1332 if (bytes <= 0) { 1147 if (bytes <= 0) {
1333 ZFCP_LOG_INFO("error: creation of CT request failed "
1334 "on adapter %s\n",
1335 zfcp_get_busid_by_adapter(adapter));
1336 if (bytes == 0) 1148 if (bytes == 0)
1337 ret = -ENOMEM; 1149 ret = -ENOMEM;
1338 else 1150 else
@@ -1343,10 +1155,6 @@ zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1343 fsf_req->qtcb->bottom.support.resp_buf_length = bytes; 1155 fsf_req->qtcb->bottom.support.resp_buf_length = bytes;
1344 } else { 1156 } else {
1345 /* reject send generic request */ 1157 /* reject send generic request */
1346 ZFCP_LOG_INFO(
1347 "error: microcode does not support chained SBALs,"
1348 "CT request too big (adapter %s)\n",
1349 zfcp_get_busid_by_adapter(adapter));
1350 ret = -EOPNOTSUPP; 1158 ret = -EOPNOTSUPP;
1351 goto failed_send; 1159 goto failed_send;
1352 } 1160 }
@@ -1368,15 +1176,9 @@ zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1368 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT); 1176 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT);
1369 1177
1370 ret = zfcp_fsf_req_send(fsf_req); 1178 ret = zfcp_fsf_req_send(fsf_req);
1371 if (ret) { 1179 if (ret)
1372 ZFCP_LOG_DEBUG("error: initiation of CT request failed "
1373 "(adapter %s, port 0x%016Lx)\n",
1374 zfcp_get_busid_by_adapter(adapter), port->wwpn);
1375 goto failed_send; 1180 goto failed_send;
1376 }
1377 1181
1378 ZFCP_LOG_DEBUG("CT request initiated (adapter %s, port 0x%016Lx)\n",
1379 zfcp_get_busid_by_adapter(adapter), port->wwpn);
1380 goto out; 1182 goto out;
1381 1183
1382 failed_send: 1184 failed_send:
@@ -1408,7 +1210,6 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
1408 struct fsf_qtcb_header *header; 1210 struct fsf_qtcb_header *header;
1409 struct fsf_qtcb_bottom_support *bottom; 1211 struct fsf_qtcb_bottom_support *bottom;
1410 int retval = -EINVAL; 1212 int retval = -EINVAL;
1411 u16 subtable, rule, counter;
1412 1213
1413 adapter = fsf_req->adapter; 1214 adapter = fsf_req->adapter;
1414 send_ct = (struct zfcp_send_ct *) fsf_req->data; 1215 send_ct = (struct zfcp_send_ct *) fsf_req->data;
@@ -1428,13 +1229,7 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
1428 break; 1229 break;
1429 1230
1430 case FSF_SERVICE_CLASS_NOT_SUPPORTED: 1231 case FSF_SERVICE_CLASS_NOT_SUPPORTED:
1431 ZFCP_LOG_INFO("error: adapter %s does not support fc " 1232 zfcp_fsf_class_not_supp(fsf_req);
1432 "class %d.\n",
1433 zfcp_get_busid_by_port(port),
1434 ZFCP_FC_SERVICE_CLASS_DEFAULT);
1435 /* stop operation for this adapter */
1436 zfcp_erp_adapter_shutdown(adapter, 0, 123, fsf_req);
1437 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1438 break; 1233 break;
1439 1234
1440 case FSF_ADAPTER_STATUS_AVAILABLE: 1235 case FSF_ADAPTER_STATUS_AVAILABLE:
@@ -1448,63 +1243,23 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
1448 /* ERP strategy will escalate */ 1243 /* ERP strategy will escalate */
1449 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1244 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1450 break; 1245 break;
1451 default:
1452 ZFCP_LOG_INFO("bug: Wrong status qualifier 0x%x "
1453 "arrived.\n",
1454 header->fsf_status_qual.word[0]);
1455 break;
1456 } 1246 }
1457 break; 1247 break;
1458 1248
1459 case FSF_ACCESS_DENIED: 1249 case FSF_ACCESS_DENIED:
1460 ZFCP_LOG_NORMAL("access denied, cannot send generic service " 1250 zfcp_fsf_access_denied_port(fsf_req, port);
1461 "command (adapter %s, port d_id=0x%06x)\n",
1462 zfcp_get_busid_by_port(port), port->d_id);
1463 for (counter = 0; counter < 2; counter++) {
1464 subtable = header->fsf_status_qual.halfword[counter * 2];
1465 rule = header->fsf_status_qual.halfword[counter * 2 + 1];
1466 switch (subtable) {
1467 case FSF_SQ_CFDC_SUBTABLE_OS:
1468 case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:
1469 case FSF_SQ_CFDC_SUBTABLE_PORT_DID:
1470 case FSF_SQ_CFDC_SUBTABLE_LUN:
1471 ZFCP_LOG_INFO("Access denied (%s rule %d)\n",
1472 zfcp_act_subtable_type[subtable], rule);
1473 break;
1474 }
1475 }
1476 zfcp_erp_port_access_denied(port, 55, fsf_req);
1477 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1478 break; 1251 break;
1479 1252
1480 case FSF_GENERIC_COMMAND_REJECTED: 1253 case FSF_GENERIC_COMMAND_REJECTED:
1481 ZFCP_LOG_INFO("generic service command rejected "
1482 "(adapter %s, port d_id=0x%06x)\n",
1483 zfcp_get_busid_by_port(port), port->d_id);
1484 ZFCP_LOG_INFO("status qualifier:\n");
1485 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO,
1486 (char *) &header->fsf_status_qual,
1487 sizeof (union fsf_status_qual));
1488 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1254 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1489 break; 1255 break;
1490 1256
1491 case FSF_PORT_HANDLE_NOT_VALID: 1257 case FSF_PORT_HANDLE_NOT_VALID:
1492 ZFCP_LOG_DEBUG("Temporary port identifier 0x%x for port "
1493 "0x%016Lx on adapter %s invalid. This may "
1494 "happen occasionally.\n", port->handle,
1495 port->wwpn, zfcp_get_busid_by_port(port));
1496 ZFCP_LOG_INFO("status qualifier:\n");
1497 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO,
1498 (char *) &header->fsf_status_qual,
1499 sizeof (union fsf_status_qual));
1500 zfcp_erp_adapter_reopen(adapter, 0, 106, fsf_req); 1258 zfcp_erp_adapter_reopen(adapter, 0, 106, fsf_req);
1501 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1259 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1502 break; 1260 break;
1503 1261
1504 case FSF_PORT_BOXED: 1262 case FSF_PORT_BOXED:
1505 ZFCP_LOG_INFO("port needs to be reopened "
1506 "(adapter %s, port d_id=0x%06x)\n",
1507 zfcp_get_busid_by_port(port), port->d_id);
1508 zfcp_erp_port_boxed(port, 49, fsf_req); 1263 zfcp_erp_port_boxed(port, 49, fsf_req);
1509 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR 1264 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR
1510 | ZFCP_STATUS_FSFREQ_RETRY; 1265 | ZFCP_STATUS_FSFREQ_RETRY;
@@ -1513,37 +1268,13 @@ zfcp_fsf_send_ct_handler(struct zfcp_fsf_req *fsf_req)
1513 /* following states should never occure, all cases avoided 1268 /* following states should never occure, all cases avoided
1514 in zfcp_fsf_send_ct - but who knows ... */ 1269 in zfcp_fsf_send_ct - but who knows ... */
1515 case FSF_PAYLOAD_SIZE_MISMATCH: 1270 case FSF_PAYLOAD_SIZE_MISMATCH:
1516 ZFCP_LOG_INFO("payload size mismatch (adapter: %s, "
1517 "req_buf_length=%d, resp_buf_length=%d)\n",
1518 zfcp_get_busid_by_adapter(adapter),
1519 bottom->req_buf_length, bottom->resp_buf_length);
1520 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1521 break;
1522 case FSF_REQUEST_SIZE_TOO_LARGE: 1271 case FSF_REQUEST_SIZE_TOO_LARGE:
1523 ZFCP_LOG_INFO("request size too large (adapter: %s, "
1524 "req_buf_length=%d)\n",
1525 zfcp_get_busid_by_adapter(adapter),
1526 bottom->req_buf_length);
1527 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1528 break;
1529 case FSF_RESPONSE_SIZE_TOO_LARGE: 1272 case FSF_RESPONSE_SIZE_TOO_LARGE:
1530 ZFCP_LOG_INFO("response size too large (adapter: %s, "
1531 "resp_buf_length=%d)\n",
1532 zfcp_get_busid_by_adapter(adapter),
1533 bottom->resp_buf_length);
1534 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1535 break;
1536 case FSF_SBAL_MISMATCH: 1273 case FSF_SBAL_MISMATCH:
1537 ZFCP_LOG_INFO("SBAL mismatch (adapter: %s, req_buf_length=%d, "
1538 "resp_buf_length=%d)\n",
1539 zfcp_get_busid_by_adapter(adapter),
1540 bottom->req_buf_length, bottom->resp_buf_length);
1541 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1274 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1542 break; 1275 break;
1543 1276
1544 default: 1277 default:
1545 ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "
1546 "(debug info 0x%x)\n", header->fsf_status);
1547 break; 1278 break;
1548 } 1279 }
1549 1280
@@ -1578,12 +1309,8 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
1578 ret = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS, 1309 ret = zfcp_fsf_req_create(adapter, FSF_QTCB_SEND_ELS,
1579 ZFCP_REQ_AUTO_CLEANUP, 1310 ZFCP_REQ_AUTO_CLEANUP,
1580 NULL, &lock_flags, &fsf_req); 1311 NULL, &lock_flags, &fsf_req);
1581 if (ret < 0) { 1312 if (ret < 0)
1582 ZFCP_LOG_INFO("error: creation of ELS request failed "
1583 "(adapter %s, port d_id: 0x%06x)\n",
1584 zfcp_get_busid_by_adapter(adapter), d_id);
1585 goto failed_req; 1313 goto failed_req;
1586 }
1587 1314
1588 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, 1315 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED,
1589 &els->port->status))) { 1316 &els->port->status))) {
@@ -1610,9 +1337,6 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
1610 els->req, 1337 els->req,
1611 ZFCP_MAX_SBALS_PER_ELS_REQ); 1338 ZFCP_MAX_SBALS_PER_ELS_REQ);
1612 if (bytes <= 0) { 1339 if (bytes <= 0) {
1613 ZFCP_LOG_INFO("error: creation of ELS request failed "
1614 "(adapter %s, port d_id: 0x%06x)\n",
1615 zfcp_get_busid_by_adapter(adapter), d_id);
1616 if (bytes == 0) { 1340 if (bytes == 0) {
1617 ret = -ENOMEM; 1341 ret = -ENOMEM;
1618 } else { 1342 } else {
@@ -1627,9 +1351,6 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
1627 els->resp, 1351 els->resp,
1628 ZFCP_MAX_SBALS_PER_ELS_REQ); 1352 ZFCP_MAX_SBALS_PER_ELS_REQ);
1629 if (bytes <= 0) { 1353 if (bytes <= 0) {
1630 ZFCP_LOG_INFO("error: creation of ELS request failed "
1631 "(adapter %s, port d_id: 0x%06x)\n",
1632 zfcp_get_busid_by_adapter(adapter), d_id);
1633 if (bytes == 0) { 1354 if (bytes == 0) {
1634 ret = -ENOMEM; 1355 ret = -ENOMEM;
1635 } else { 1356 } else {
@@ -1640,10 +1361,6 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
1640 fsf_req->qtcb->bottom.support.resp_buf_length = bytes; 1361 fsf_req->qtcb->bottom.support.resp_buf_length = bytes;
1641 } else { 1362 } else {
1642 /* reject request */ 1363 /* reject request */
1643 ZFCP_LOG_INFO("error: microcode does not support chained SBALs"
1644 ", ELS request too big (adapter %s, "
1645 "port d_id: 0x%06x)\n",
1646 zfcp_get_busid_by_adapter(adapter), d_id);
1647 ret = -EOPNOTSUPP; 1364 ret = -EOPNOTSUPP;
1648 goto failed_send; 1365 goto failed_send;
1649 } 1366 }
@@ -1661,15 +1378,9 @@ zfcp_fsf_send_els(struct zfcp_send_els *els)
1661 1378
1662 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT); 1379 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT);
1663 ret = zfcp_fsf_req_send(fsf_req); 1380 ret = zfcp_fsf_req_send(fsf_req);
1664 if (ret) { 1381 if (ret)
1665 ZFCP_LOG_DEBUG("error: initiation of ELS request failed "
1666 "(adapter %s, port d_id: 0x%06x)\n",
1667 zfcp_get_busid_by_adapter(adapter), d_id);
1668 goto failed_send; 1382 goto failed_send;
1669 }
1670 1383
1671 ZFCP_LOG_DEBUG("ELS request initiated (adapter %s, port d_id: "
1672 "0x%06x)\n", zfcp_get_busid_by_adapter(adapter), d_id);
1673 goto out; 1384 goto out;
1674 1385
1675 port_blocked: 1386 port_blocked:
@@ -1701,7 +1412,6 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req)
1701 struct fsf_qtcb_bottom_support *bottom; 1412 struct fsf_qtcb_bottom_support *bottom;
1702 struct zfcp_send_els *send_els; 1413 struct zfcp_send_els *send_els;
1703 int retval = -EINVAL; 1414 int retval = -EINVAL;
1704 u16 subtable, rule, counter;
1705 1415
1706 send_els = (struct zfcp_send_els *) fsf_req->data; 1416 send_els = (struct zfcp_send_els *) fsf_req->data;
1707 adapter = send_els->adapter; 1417 adapter = send_els->adapter;
@@ -1721,13 +1431,7 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req)
1721 break; 1431 break;
1722 1432
1723 case FSF_SERVICE_CLASS_NOT_SUPPORTED: 1433 case FSF_SERVICE_CLASS_NOT_SUPPORTED:
1724 ZFCP_LOG_INFO("error: adapter %s does not support fc " 1434 zfcp_fsf_class_not_supp(fsf_req);
1725 "class %d.\n",
1726 zfcp_get_busid_by_adapter(adapter),
1727 ZFCP_FC_SERVICE_CLASS_DEFAULT);
1728 /* stop operation for this adapter */
1729 zfcp_erp_adapter_shutdown(adapter, 0, 124, fsf_req);
1730 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1731 break; 1435 break;
1732 1436
1733 case FSF_ADAPTER_STATUS_AVAILABLE: 1437 case FSF_ADAPTER_STATUS_AVAILABLE:
@@ -1743,91 +1447,25 @@ static int zfcp_fsf_send_els_handler(struct zfcp_fsf_req *fsf_req)
1743 case FSF_SQ_RETRY_IF_POSSIBLE: 1447 case FSF_SQ_RETRY_IF_POSSIBLE:
1744 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1448 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1745 break; 1449 break;
1746 default:
1747 ZFCP_LOG_INFO("bug: Wrong status qualifier 0x%x\n",
1748 header->fsf_status_qual.word[0]);
1749 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_INFO,
1750 (char*)header->fsf_status_qual.word, 16);
1751 } 1450 }
1752 break; 1451 break;
1753 1452
1754 case FSF_ELS_COMMAND_REJECTED: 1453 case FSF_ELS_COMMAND_REJECTED:
1755 ZFCP_LOG_INFO("ELS has been rejected because command filter "
1756 "prohibited sending "
1757 "(adapter: %s, port d_id: 0x%06x)\n",
1758 zfcp_get_busid_by_adapter(adapter), d_id);
1759
1760 break;
1761
1762 case FSF_PAYLOAD_SIZE_MISMATCH: 1454 case FSF_PAYLOAD_SIZE_MISMATCH:
1763 ZFCP_LOG_INFO(
1764 "ELS request size and ELS response size must be either "
1765 "both 0, or both greater than 0 "
1766 "(adapter: %s, req_buf_length=%d resp_buf_length=%d)\n",
1767 zfcp_get_busid_by_adapter(adapter),
1768 bottom->req_buf_length,
1769 bottom->resp_buf_length);
1770 break;
1771
1772 case FSF_REQUEST_SIZE_TOO_LARGE: 1455 case FSF_REQUEST_SIZE_TOO_LARGE:
1773 ZFCP_LOG_INFO(
1774 "Length of the ELS request buffer, "
1775 "specified in QTCB bottom, "
1776 "exceeds the size of the buffers "
1777 "that have been allocated for ELS request data "
1778 "(adapter: %s, req_buf_length=%d)\n",
1779 zfcp_get_busid_by_adapter(adapter),
1780 bottom->req_buf_length);
1781 break;
1782
1783 case FSF_RESPONSE_SIZE_TOO_LARGE: 1456 case FSF_RESPONSE_SIZE_TOO_LARGE:
1784 ZFCP_LOG_INFO(
1785 "Length of the ELS response buffer, "
1786 "specified in QTCB bottom, "
1787 "exceeds the size of the buffers "
1788 "that have been allocated for ELS response data "
1789 "(adapter: %s, resp_buf_length=%d)\n",
1790 zfcp_get_busid_by_adapter(adapter),
1791 bottom->resp_buf_length);
1792 break; 1457 break;
1793 1458
1794 case FSF_SBAL_MISMATCH: 1459 case FSF_SBAL_MISMATCH:
1795 /* should never occure, avoided in zfcp_fsf_send_els */ 1460 /* should never occure, avoided in zfcp_fsf_send_els */
1796 ZFCP_LOG_INFO("SBAL mismatch (adapter: %s, req_buf_length=%d, "
1797 "resp_buf_length=%d)\n",
1798 zfcp_get_busid_by_adapter(adapter),
1799 bottom->req_buf_length, bottom->resp_buf_length);
1800 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1461 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1801 break; 1462 break;
1802 1463
1803 case FSF_ACCESS_DENIED: 1464 case FSF_ACCESS_DENIED:
1804 ZFCP_LOG_NORMAL("access denied, cannot send ELS command " 1465 zfcp_fsf_access_denied_port(fsf_req, port);
1805 "(adapter %s, port d_id=0x%06x)\n",
1806 zfcp_get_busid_by_adapter(adapter), d_id);
1807 for (counter = 0; counter < 2; counter++) {
1808 subtable = header->fsf_status_qual.halfword[counter * 2];
1809 rule = header->fsf_status_qual.halfword[counter * 2 + 1];
1810 switch (subtable) {
1811 case FSF_SQ_CFDC_SUBTABLE_OS:
1812 case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:
1813 case FSF_SQ_CFDC_SUBTABLE_PORT_DID:
1814 case FSF_SQ_CFDC_SUBTABLE_LUN:
1815 ZFCP_LOG_INFO("Access denied (%s rule %d)\n",
1816 zfcp_act_subtable_type[subtable], rule);
1817 break;
1818 }
1819 }
1820 if (port != NULL)
1821 zfcp_erp_port_access_denied(port, 56, fsf_req);
1822 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1823 break; 1466 break;
1824 1467
1825 default: 1468 default:
1826 ZFCP_LOG_NORMAL(
1827 "bug: An unknown FSF Status was presented "
1828 "(adapter: %s, fsf_status=0x%08x)\n",
1829 zfcp_get_busid_by_adapter(adapter),
1830 header->fsf_status);
1831 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1469 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1832 break; 1470 break;
1833 } 1471 }
@@ -1857,9 +1495,6 @@ zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1857 adapter->pool.fsf_req_erp, 1495 adapter->pool.fsf_req_erp,
1858 &lock_flags, &fsf_req); 1496 &lock_flags, &fsf_req);
1859 if (retval) { 1497 if (retval) {
1860 ZFCP_LOG_INFO("error: Could not create exchange configuration "
1861 "data request for adapter %s.\n",
1862 zfcp_get_busid_by_adapter(adapter));
1863 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1498 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
1864 return retval; 1499 return retval;
1865 } 1500 }
@@ -1880,16 +1515,9 @@ zfcp_fsf_exchange_config_data(struct zfcp_erp_action *erp_action)
1880 retval = zfcp_fsf_req_send(fsf_req); 1515 retval = zfcp_fsf_req_send(fsf_req);
1881 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1516 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
1882 if (retval) { 1517 if (retval) {
1883 ZFCP_LOG_INFO("error: Could not send exchange configuration "
1884 "data command on the adapter %s\n",
1885 zfcp_get_busid_by_adapter(adapter));
1886 zfcp_fsf_req_free(fsf_req); 1518 zfcp_fsf_req_free(fsf_req);
1887 erp_action->fsf_req = NULL; 1519 erp_action->fsf_req = NULL;
1888 } 1520 }
1889 else
1890 ZFCP_LOG_DEBUG("exchange configuration data request initiated "
1891 "(adapter %s)\n",
1892 zfcp_get_busid_by_adapter(adapter));
1893 1521
1894 return retval; 1522 return retval;
1895} 1523}
@@ -1908,9 +1536,6 @@ zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter,
1908 ZFCP_WAIT_FOR_SBAL, NULL, &lock_flags, 1536 ZFCP_WAIT_FOR_SBAL, NULL, &lock_flags,
1909 &fsf_req); 1537 &fsf_req);
1910 if (retval) { 1538 if (retval) {
1911 ZFCP_LOG_INFO("error: Could not create exchange configuration "
1912 "data request for adapter %s.\n",
1913 zfcp_get_busid_by_adapter(adapter));
1914 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1539 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
1915 return retval; 1540 return retval;
1916 } 1541 }
@@ -1931,11 +1556,7 @@ zfcp_fsf_exchange_config_data_sync(struct zfcp_adapter *adapter,
1931 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT); 1556 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT);
1932 retval = zfcp_fsf_req_send(fsf_req); 1557 retval = zfcp_fsf_req_send(fsf_req);
1933 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1558 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
1934 if (retval) 1559 if (!retval)
1935 ZFCP_LOG_INFO("error: Could not send exchange configuration "
1936 "data command on the adapter %s\n",
1937 zfcp_get_busid_by_adapter(adapter));
1938 else
1939 wait_event(fsf_req->completion_wq, 1560 wait_event(fsf_req->completion_wq,
1940 fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED); 1561 fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
1941 1562
@@ -1959,8 +1580,6 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
1959 struct Scsi_Host *shost = adapter->scsi_host; 1580 struct Scsi_Host *shost = adapter->scsi_host;
1960 1581
1961 bottom = &fsf_req->qtcb->bottom.config; 1582 bottom = &fsf_req->qtcb->bottom.config;
1962 ZFCP_LOG_DEBUG("low/high QTCB version 0x%x/0x%x of FSF\n",
1963 bottom->low_qtcb_version, bottom->high_qtcb_version);
1964 adapter->fsf_lic_version = bottom->lic_version; 1583 adapter->fsf_lic_version = bottom->lic_version;
1965 adapter->adapter_features = bottom->adapter_features; 1584 adapter->adapter_features = bottom->adapter_features;
1966 adapter->connection_features = bottom->connection_features; 1585 adapter->connection_features = bottom->connection_features;
@@ -2013,36 +1632,17 @@ zfcp_fsf_exchange_config_evaluate(struct zfcp_fsf_req *fsf_req, int xchg_ok)
2013 min(FC_SERIAL_NUMBER_SIZE, 17)); 1632 min(FC_SERIAL_NUMBER_SIZE, 17));
2014 } 1633 }
2015 1634
2016 if (fsf_req->erp_action)
2017 ZFCP_LOG_NORMAL("The adapter %s reported the following "
2018 "characteristics:\n"
2019 "WWNN 0x%016Lx, WWPN 0x%016Lx, "
2020 "S_ID 0x%06x,\n"
2021 "adapter version 0x%x, "
2022 "LIC version 0x%x, "
2023 "FC link speed %d Gb/s\n",
2024 zfcp_get_busid_by_adapter(adapter),
2025 (wwn_t) fc_host_node_name(shost),
2026 (wwn_t) fc_host_port_name(shost),
2027 fc_host_port_id(shost),
2028 adapter->hydra_version,
2029 adapter->fsf_lic_version,
2030 fc_host_speed(shost));
2031 if (ZFCP_QTCB_VERSION < bottom->low_qtcb_version) { 1635 if (ZFCP_QTCB_VERSION < bottom->low_qtcb_version) {
2032 ZFCP_LOG_NORMAL("error: the adapter %s " 1636 dev_err(&adapter->ccw_device->dev,
2033 "only supports newer control block " 1637 "The adapter only supports newer control block "
2034 "versions in comparison to this device " 1638 "versions, try updated device driver.\n");
2035 "driver (try updated device driver)\n",
2036 zfcp_get_busid_by_adapter(adapter));
2037 zfcp_erp_adapter_shutdown(adapter, 0, 125, fsf_req); 1639 zfcp_erp_adapter_shutdown(adapter, 0, 125, fsf_req);
2038 return -EIO; 1640 return -EIO;
2039 } 1641 }
2040 if (ZFCP_QTCB_VERSION > bottom->high_qtcb_version) { 1642 if (ZFCP_QTCB_VERSION > bottom->high_qtcb_version) {
2041 ZFCP_LOG_NORMAL("error: the adapter %s " 1643 dev_err(&adapter->ccw_device->dev,
2042 "only supports older control block " 1644 "The adapter only supports older control block "
2043 "versions than this device driver uses" 1645 "versions, consider a microcode upgrade.\n");
2044 "(consider a microcode upgrade)\n",
2045 zfcp_get_busid_by_adapter(adapter));
2046 zfcp_erp_adapter_shutdown(adapter, 0, 126, fsf_req); 1646 zfcp_erp_adapter_shutdown(adapter, 0, 126, fsf_req);
2047 return -EIO; 1647 return -EIO;
2048 } 1648 }
@@ -2074,50 +1674,38 @@ zfcp_fsf_exchange_config_data_handler(struct zfcp_fsf_req *fsf_req)
2074 1674
2075 switch (fc_host_port_type(adapter->scsi_host)) { 1675 switch (fc_host_port_type(adapter->scsi_host)) {
2076 case FC_PORTTYPE_PTP: 1676 case FC_PORTTYPE_PTP:
2077 ZFCP_LOG_NORMAL("Point-to-Point fibrechannel " 1677 if (fsf_req->erp_action)
2078 "configuration detected at adapter %s\n" 1678 dev_info(&adapter->ccw_device->dev,
2079 "Peer WWNN 0x%016llx, " 1679 "Point-to-Point fibrechannel "
2080 "peer WWPN 0x%016llx, " 1680 "configuration detected.\n");
2081 "peer d_id 0x%06x\n",
2082 zfcp_get_busid_by_adapter(adapter),
2083 adapter->peer_wwnn,
2084 adapter->peer_wwpn,
2085 adapter->peer_d_id);
2086 break; 1681 break;
2087 case FC_PORTTYPE_NLPORT: 1682 case FC_PORTTYPE_NLPORT:
2088 ZFCP_LOG_NORMAL("error: Arbitrated loop fibrechannel " 1683 dev_err(&adapter->ccw_device->dev,
2089 "topology detected at adapter %s " 1684 "Unsupported arbitrated loop fibrechannel "
2090 "unsupported, shutting down adapter\n", 1685 "topology detected, shutting down adapter\n");
2091 zfcp_get_busid_by_adapter(adapter));
2092 zfcp_erp_adapter_shutdown(adapter, 0, 127, fsf_req); 1686 zfcp_erp_adapter_shutdown(adapter, 0, 127, fsf_req);
2093 return -EIO; 1687 return -EIO;
2094 case FC_PORTTYPE_NPORT: 1688 case FC_PORTTYPE_NPORT:
2095 if (fsf_req->erp_action) 1689 if (fsf_req->erp_action)
2096 ZFCP_LOG_NORMAL("Switched fabric fibrechannel " 1690 dev_info(&adapter->ccw_device->dev,
2097 "network detected at adapter " 1691 "Switched fabric fibrechannel "
2098 "%s.\n", 1692 "network detected.\n");
2099 zfcp_get_busid_by_adapter(adapter));
2100 break; 1693 break;
2101 default: 1694 default:
2102 ZFCP_LOG_NORMAL("bug: The fibrechannel topology " 1695 dev_err(&adapter->ccw_device->dev,
2103 "reported by the exchange " 1696 "The fibrechannel topology reported by the "
2104 "configuration command for " 1697 "adapter is not known by the zfcp driver, "
2105 "the adapter %s is not " 1698 "shutting down adapter.\n");
2106 "of a type known to the zfcp "
2107 "driver, shutting down adapter\n",
2108 zfcp_get_busid_by_adapter(adapter));
2109 zfcp_erp_adapter_shutdown(adapter, 0, 128, fsf_req); 1699 zfcp_erp_adapter_shutdown(adapter, 0, 128, fsf_req);
2110 return -EIO; 1700 return -EIO;
2111 } 1701 }
2112 bottom = &qtcb->bottom.config; 1702 bottom = &qtcb->bottom.config;
2113 if (bottom->max_qtcb_size < sizeof(struct fsf_qtcb)) { 1703 if (bottom->max_qtcb_size < sizeof(struct fsf_qtcb)) {
2114 ZFCP_LOG_NORMAL("bug: Maximum QTCB size (%d bytes) " 1704 dev_err(&adapter->ccw_device->dev,
2115 "allowed by the adapter %s " 1705 "Maximum QTCB size (%d bytes) allowed by "
2116 "is lower than the minimum " 1706 "the adapter is lower than the minimum "
2117 "required by the driver (%ld bytes).\n", 1707 "required by the driver (%ld bytes).\n",
2118 bottom->max_qtcb_size, 1708 bottom->max_qtcb_size, sizeof(struct fsf_qtcb));
2119 zfcp_get_busid_by_adapter(adapter),
2120 sizeof(struct fsf_qtcb));
2121 zfcp_erp_adapter_shutdown(adapter, 0, 129, fsf_req); 1709 zfcp_erp_adapter_shutdown(adapter, 0, 129, fsf_req);
2122 return -EIO; 1710 return -EIO;
2123 } 1711 }
@@ -2154,12 +1742,8 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
2154 unsigned long lock_flags; 1742 unsigned long lock_flags;
2155 int retval; 1743 int retval;
2156 1744
2157 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) { 1745 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT))
2158 ZFCP_LOG_INFO("error: exchange port data "
2159 "command not supported by adapter %s\n",
2160 zfcp_get_busid_by_adapter(adapter));
2161 return -EOPNOTSUPP; 1746 return -EOPNOTSUPP;
2162 }
2163 1747
2164 /* setup new FSF request */ 1748 /* setup new FSF request */
2165 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, 1749 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA,
@@ -2167,10 +1751,6 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
2167 adapter->pool.fsf_req_erp, 1751 adapter->pool.fsf_req_erp,
2168 &lock_flags, &fsf_req); 1752 &lock_flags, &fsf_req);
2169 if (retval) { 1753 if (retval) {
2170 ZFCP_LOG_INFO("error: Out of resources. Could not create an "
2171 "exchange port data request for "
2172 "the adapter %s.\n",
2173 zfcp_get_busid_by_adapter(adapter));
2174 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1754 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
2175 return retval; 1755 return retval;
2176 } 1756 }
@@ -2187,16 +1767,9 @@ zfcp_fsf_exchange_port_data(struct zfcp_erp_action *erp_action)
2187 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1767 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
2188 1768
2189 if (retval) { 1769 if (retval) {
2190 ZFCP_LOG_INFO("error: Could not send an exchange port data "
2191 "command on the adapter %s\n",
2192 zfcp_get_busid_by_adapter(adapter));
2193 zfcp_fsf_req_free(fsf_req); 1770 zfcp_fsf_req_free(fsf_req);
2194 erp_action->fsf_req = NULL; 1771 erp_action->fsf_req = NULL;
2195 } 1772 }
2196 else
2197 ZFCP_LOG_DEBUG("exchange port data request initiated "
2198 "(adapter %s)\n",
2199 zfcp_get_busid_by_adapter(adapter));
2200 return retval; 1773 return retval;
2201} 1774}
2202 1775
@@ -2214,21 +1787,13 @@ zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter,
2214 unsigned long lock_flags; 1787 unsigned long lock_flags;
2215 int retval; 1788 int retval;
2216 1789
2217 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT)) { 1790 if (!(adapter->adapter_features & FSF_FEATURE_HBAAPI_MANAGEMENT))
2218 ZFCP_LOG_INFO("error: exchange port data "
2219 "command not supported by adapter %s\n",
2220 zfcp_get_busid_by_adapter(adapter));
2221 return -EOPNOTSUPP; 1791 return -EOPNOTSUPP;
2222 }
2223 1792
2224 /* setup new FSF request */ 1793 /* setup new FSF request */
2225 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA, 1794 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_EXCHANGE_PORT_DATA,
2226 0, NULL, &lock_flags, &fsf_req); 1795 0, NULL, &lock_flags, &fsf_req);
2227 if (retval) { 1796 if (retval) {
2228 ZFCP_LOG_INFO("error: Out of resources. Could not create an "
2229 "exchange port data request for "
2230 "the adapter %s.\n",
2231 zfcp_get_busid_by_adapter(adapter));
2232 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1797 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
2233 return retval; 1798 return retval;
2234 } 1799 }
@@ -2244,11 +1809,7 @@ zfcp_fsf_exchange_port_data_sync(struct zfcp_adapter *adapter,
2244 retval = zfcp_fsf_req_send(fsf_req); 1809 retval = zfcp_fsf_req_send(fsf_req);
2245 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags); 1810 write_unlock_irqrestore(&adapter->req_q.lock, lock_flags);
2246 1811
2247 if (retval) 1812 if (!retval)
2248 ZFCP_LOG_INFO("error: Could not send an exchange port data "
2249 "command on the adapter %s\n",
2250 zfcp_get_busid_by_adapter(adapter));
2251 else
2252 wait_event(fsf_req->completion_wq, 1813 wait_event(fsf_req->completion_wq,
2253 fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED); 1814 fsf_req->status & ZFCP_STATUS_FSFREQ_COMPLETED);
2254 1815
@@ -2338,13 +1899,8 @@ zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
2338 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP, 1899 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP,
2339 erp_action->adapter->pool.fsf_req_erp, 1900 erp_action->adapter->pool.fsf_req_erp,
2340 &lock_flags, &fsf_req); 1901 &lock_flags, &fsf_req);
2341 if (retval < 0) { 1902 if (retval < 0)
2342 ZFCP_LOG_INFO("error: Could not create open port request "
2343 "for port 0x%016Lx on adapter %s.\n",
2344 erp_action->port->wwpn,
2345 zfcp_get_busid_by_adapter(erp_action->adapter));
2346 goto out; 1903 goto out;
2347 }
2348 1904
2349 sbale = zfcp_qdio_sbale_req(fsf_req); 1905 sbale = zfcp_qdio_sbale_req(fsf_req);
2350 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 1906 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
@@ -2359,19 +1915,11 @@ zfcp_fsf_open_port(struct zfcp_erp_action *erp_action)
2359 zfcp_erp_start_timer(fsf_req); 1915 zfcp_erp_start_timer(fsf_req);
2360 retval = zfcp_fsf_req_send(fsf_req); 1916 retval = zfcp_fsf_req_send(fsf_req);
2361 if (retval) { 1917 if (retval) {
2362 ZFCP_LOG_INFO("error: Could not send open port request for "
2363 "port 0x%016Lx on adapter %s.\n",
2364 erp_action->port->wwpn,
2365 zfcp_get_busid_by_adapter(erp_action->adapter));
2366 zfcp_fsf_req_free(fsf_req); 1918 zfcp_fsf_req_free(fsf_req);
2367 erp_action->fsf_req = NULL; 1919 erp_action->fsf_req = NULL;
2368 goto out; 1920 goto out;
2369 } 1921 }
2370 1922
2371 ZFCP_LOG_DEBUG("open port request initiated "
2372 "(adapter %s, port 0x%016Lx)\n",
2373 zfcp_get_busid_by_adapter(erp_action->adapter),
2374 erp_action->port->wwpn);
2375 out: 1923 out:
2376 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags); 1924 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags);
2377 return retval; 1925 return retval;
@@ -2391,7 +1939,6 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2391 struct zfcp_port *port; 1939 struct zfcp_port *port;
2392 struct fsf_plogi *plogi; 1940 struct fsf_plogi *plogi;
2393 struct fsf_qtcb_header *header; 1941 struct fsf_qtcb_header *header;
2394 u16 subtable, rule, counter;
2395 1942
2396 port = (struct zfcp_port *) fsf_req->data; 1943 port = (struct zfcp_port *) fsf_req->data;
2397 header = &fsf_req->qtcb->header; 1944 header = &fsf_req->qtcb->header;
@@ -2405,9 +1952,6 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2405 switch (header->fsf_status) { 1952 switch (header->fsf_status) {
2406 1953
2407 case FSF_PORT_ALREADY_OPEN: 1954 case FSF_PORT_ALREADY_OPEN:
2408 ZFCP_LOG_NORMAL("bug: remote port 0x%016Lx on adapter %s "
2409 "is already open.\n",
2410 port->wwpn, zfcp_get_busid_by_port(port));
2411 /* 1955 /*
2412 * This is a bug, however operation should continue normally 1956 * This is a bug, however operation should continue normally
2413 * if it is simply ignored 1957 * if it is simply ignored
@@ -2415,31 +1959,14 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2415 break; 1959 break;
2416 1960
2417 case FSF_ACCESS_DENIED: 1961 case FSF_ACCESS_DENIED:
2418 ZFCP_LOG_NORMAL("Access denied, cannot open port 0x%016Lx " 1962 zfcp_fsf_access_denied_port(fsf_req, port);
2419 "on adapter %s\n",
2420 port->wwpn, zfcp_get_busid_by_port(port));
2421 for (counter = 0; counter < 2; counter++) {
2422 subtable = header->fsf_status_qual.halfword[counter * 2];
2423 rule = header->fsf_status_qual.halfword[counter * 2 + 1];
2424 switch (subtable) {
2425 case FSF_SQ_CFDC_SUBTABLE_OS:
2426 case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:
2427 case FSF_SQ_CFDC_SUBTABLE_PORT_DID:
2428 case FSF_SQ_CFDC_SUBTABLE_LUN:
2429 ZFCP_LOG_INFO("Access denied (%s rule %d)\n",
2430 zfcp_act_subtable_type[subtable], rule);
2431 break;
2432 }
2433 }
2434 zfcp_erp_port_access_denied(port, 57, fsf_req);
2435 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2436 break; 1963 break;
2437 1964
2438 case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED: 1965 case FSF_MAXIMUM_NUMBER_OF_PORTS_EXCEEDED:
2439 ZFCP_LOG_INFO("error: The FSF adapter is out of resources. " 1966 dev_warn(&fsf_req->adapter->ccw_device->dev,
2440 "The remote port 0x%016Lx on adapter %s " 1967 "The adapter is out of resources. The remote port "
2441 "could not be opened. Disabling it.\n", 1968 "0x%016Lx could not be opened, disabling it.\n",
2442 port->wwpn, zfcp_get_busid_by_port(port)); 1969 port->wwpn);
2443 zfcp_erp_port_failed(port, 31, fsf_req); 1970 zfcp_erp_port_failed(port, 31, fsf_req);
2444 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1971 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2445 break; 1972 break;
@@ -2455,18 +1982,13 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2455 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1982 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2456 break; 1983 break;
2457 case FSF_SQ_NO_RETRY_POSSIBLE: 1984 case FSF_SQ_NO_RETRY_POSSIBLE:
2458 ZFCP_LOG_NORMAL("The remote port 0x%016Lx on " 1985 dev_warn(&fsf_req->adapter->ccw_device->dev,
2459 "adapter %s could not be opened. " 1986 "The remote port 0x%016Lx could not be "
2460 "Disabling it.\n", 1987 "opened. Disabling it.\n", port->wwpn);
2461 port->wwpn,
2462 zfcp_get_busid_by_port(port));
2463 zfcp_erp_port_failed(port, 32, fsf_req); 1988 zfcp_erp_port_failed(port, 32, fsf_req);
2464 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1989 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2465 break; 1990 break;
2466 default: 1991 default:
2467 ZFCP_LOG_NORMAL
2468 ("bug: Wrong status qualifier 0x%x arrived.\n",
2469 header->fsf_status_qual.word[0]);
2470 break; 1992 break;
2471 } 1993 }
2472 break; 1994 break;
@@ -2474,10 +1996,6 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2474 case FSF_GOOD: 1996 case FSF_GOOD:
2475 /* save port handle assigned by FSF */ 1997 /* save port handle assigned by FSF */
2476 port->handle = header->port_handle; 1998 port->handle = header->port_handle;
2477 ZFCP_LOG_INFO("The remote port 0x%016Lx via adapter %s "
2478 "was opened, it's port handle is 0x%x\n",
2479 port->wwpn, zfcp_get_busid_by_port(port),
2480 port->handle);
2481 /* mark port as open */ 1999 /* mark port as open */
2482 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN | 2000 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN |
2483 ZFCP_STATUS_PORT_PHYS_OPEN, &port->status); 2001 ZFCP_STATUS_PORT_PHYS_OPEN, &port->status);
@@ -2505,16 +2023,9 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2505 { 2023 {
2506 if (fsf_req->qtcb->bottom.support.els1_length < 2024 if (fsf_req->qtcb->bottom.support.els1_length <
2507 sizeof (struct fsf_plogi)) { 2025 sizeof (struct fsf_plogi)) {
2508 ZFCP_LOG_INFO(
2509 "warning: insufficient length of "
2510 "PLOGI payload (%i)\n",
2511 fsf_req->qtcb->bottom.support.els1_length);
2512 /* skip sanity check and assume wwpn is ok */ 2026 /* skip sanity check and assume wwpn is ok */
2513 } else { 2027 } else {
2514 if (plogi->serv_param.wwpn != port->wwpn) { 2028 if (plogi->serv_param.wwpn != port->wwpn) {
2515 ZFCP_LOG_INFO("warning: d_id of port "
2516 "0x%016Lx changed during "
2517 "open\n", port->wwpn);
2518 atomic_clear_mask( 2029 atomic_clear_mask(
2519 ZFCP_STATUS_PORT_DID_DID, 2030 ZFCP_STATUS_PORT_DID_DID,
2520 &port->status); 2031 &port->status);
@@ -2528,17 +2039,10 @@ zfcp_fsf_open_port_handler(struct zfcp_fsf_req *fsf_req)
2528 2039
2529 case FSF_UNKNOWN_OP_SUBTYPE: 2040 case FSF_UNKNOWN_OP_SUBTYPE:
2530 /* should never occure, subtype not set in zfcp_fsf_open_port */ 2041 /* should never occure, subtype not set in zfcp_fsf_open_port */
2531 ZFCP_LOG_INFO("unknown operation subtype (adapter: %s, "
2532 "op_subtype=0x%x)\n",
2533 zfcp_get_busid_by_port(port),
2534 fsf_req->qtcb->bottom.support.operation_subtype);
2535 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2042 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2536 break; 2043 break;
2537 2044
2538 default: 2045 default:
2539 ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "
2540 "(debug info 0x%x)\n",
2541 header->fsf_status);
2542 break; 2046 break;
2543 } 2047 }
2544 2048
@@ -2569,13 +2073,8 @@ zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
2569 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP, 2073 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP,
2570 erp_action->adapter->pool.fsf_req_erp, 2074 erp_action->adapter->pool.fsf_req_erp,
2571 &lock_flags, &fsf_req); 2075 &lock_flags, &fsf_req);
2572 if (retval < 0) { 2076 if (retval < 0)
2573 ZFCP_LOG_INFO("error: Could not create a close port request "
2574 "for port 0x%016Lx on adapter %s.\n",
2575 erp_action->port->wwpn,
2576 zfcp_get_busid_by_adapter(erp_action->adapter));
2577 goto out; 2077 goto out;
2578 }
2579 2078
2580 sbale = zfcp_qdio_sbale_req(fsf_req); 2079 sbale = zfcp_qdio_sbale_req(fsf_req);
2581 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 2080 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
@@ -2591,19 +2090,11 @@ zfcp_fsf_close_port(struct zfcp_erp_action *erp_action)
2591 zfcp_erp_start_timer(fsf_req); 2090 zfcp_erp_start_timer(fsf_req);
2592 retval = zfcp_fsf_req_send(fsf_req); 2091 retval = zfcp_fsf_req_send(fsf_req);
2593 if (retval) { 2092 if (retval) {
2594 ZFCP_LOG_INFO("error: Could not send a close port request for "
2595 "port 0x%016Lx on adapter %s.\n",
2596 erp_action->port->wwpn,
2597 zfcp_get_busid_by_adapter(erp_action->adapter));
2598 zfcp_fsf_req_free(fsf_req); 2093 zfcp_fsf_req_free(fsf_req);
2599 erp_action->fsf_req = NULL; 2094 erp_action->fsf_req = NULL;
2600 goto out; 2095 goto out;
2601 } 2096 }
2602 2097
2603 ZFCP_LOG_TRACE("close port request initiated "
2604 "(adapter %s, port 0x%016Lx)\n",
2605 zfcp_get_busid_by_adapter(erp_action->adapter),
2606 erp_action->port->wwpn);
2607 out: 2098 out:
2608 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags); 2099 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags);
2609 return retval; 2100 return retval;
@@ -2633,14 +2124,6 @@ zfcp_fsf_close_port_handler(struct zfcp_fsf_req *fsf_req)
2633 switch (fsf_req->qtcb->header.fsf_status) { 2124 switch (fsf_req->qtcb->header.fsf_status) {
2634 2125
2635 case FSF_PORT_HANDLE_NOT_VALID: 2126 case FSF_PORT_HANDLE_NOT_VALID:
2636 ZFCP_LOG_INFO("Temporary port identifier 0x%x for port "
2637 "0x%016Lx on adapter %s invalid. This may happen "
2638 "occasionally.\n", port->handle,
2639 port->wwpn, zfcp_get_busid_by_port(port));
2640 ZFCP_LOG_DEBUG("status qualifier:\n");
2641 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
2642 (char *) &fsf_req->qtcb->header.fsf_status_qual,
2643 sizeof (union fsf_status_qual));
2644 zfcp_erp_adapter_reopen(port->adapter, 0, 107, fsf_req); 2127 zfcp_erp_adapter_reopen(port->adapter, 0, 107, fsf_req);
2645 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2128 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2646 break; 2129 break;
@@ -2653,20 +2136,11 @@ zfcp_fsf_close_port_handler(struct zfcp_fsf_req *fsf_req)
2653 break; 2136 break;
2654 2137
2655 case FSF_GOOD: 2138 case FSF_GOOD:
2656 ZFCP_LOG_TRACE("remote port 0x016%Lx on adapter %s closed, "
2657 "port handle 0x%x\n", port->wwpn,
2658 zfcp_get_busid_by_port(port), port->handle);
2659 zfcp_erp_modify_port_status(port, 33, fsf_req, 2139 zfcp_erp_modify_port_status(port, 33, fsf_req,
2660 ZFCP_STATUS_COMMON_OPEN, 2140 ZFCP_STATUS_COMMON_OPEN,
2661 ZFCP_CLEAR); 2141 ZFCP_CLEAR);
2662 retval = 0; 2142 retval = 0;
2663 break; 2143 break;
2664
2665 default:
2666 ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "
2667 "(debug info 0x%x)\n",
2668 fsf_req->qtcb->header.fsf_status);
2669 break;
2670 } 2144 }
2671 2145
2672 skip_fsfstatus: 2146 skip_fsfstatus:
@@ -2696,14 +2170,8 @@ zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
2696 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP, 2170 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP,
2697 erp_action->adapter->pool.fsf_req_erp, 2171 erp_action->adapter->pool.fsf_req_erp,
2698 &lock_flags, &fsf_req); 2172 &lock_flags, &fsf_req);
2699 if (retval < 0) { 2173 if (retval < 0)
2700 ZFCP_LOG_INFO("error: Could not create close physical port "
2701 "request (adapter %s, port 0x%016Lx)\n",
2702 zfcp_get_busid_by_adapter(erp_action->adapter),
2703 erp_action->port->wwpn);
2704
2705 goto out; 2174 goto out;
2706 }
2707 2175
2708 sbale = zfcp_qdio_sbale_req(fsf_req); 2176 sbale = zfcp_qdio_sbale_req(fsf_req);
2709 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 2177 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
@@ -2721,19 +2189,11 @@ zfcp_fsf_close_physical_port(struct zfcp_erp_action *erp_action)
2721 zfcp_erp_start_timer(fsf_req); 2189 zfcp_erp_start_timer(fsf_req);
2722 retval = zfcp_fsf_req_send(fsf_req); 2190 retval = zfcp_fsf_req_send(fsf_req);
2723 if (retval) { 2191 if (retval) {
2724 ZFCP_LOG_INFO("error: Could not send close physical port "
2725 "request (adapter %s, port 0x%016Lx)\n",
2726 zfcp_get_busid_by_adapter(erp_action->adapter),
2727 erp_action->port->wwpn);
2728 zfcp_fsf_req_free(fsf_req); 2192 zfcp_fsf_req_free(fsf_req);
2729 erp_action->fsf_req = NULL; 2193 erp_action->fsf_req = NULL;
2730 goto out; 2194 goto out;
2731 } 2195 }
2732 2196
2733 ZFCP_LOG_TRACE("close physical port request initiated "
2734 "(adapter %s, port 0x%016Lx)\n",
2735 zfcp_get_busid_by_adapter(erp_action->adapter),
2736 erp_action->port->wwpn);
2737 out: 2197 out:
2738 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags); 2198 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags);
2739 return retval; 2199 return retval;
@@ -2753,7 +2213,6 @@ zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *fsf_req)
2753 struct zfcp_port *port; 2213 struct zfcp_port *port;
2754 struct zfcp_unit *unit; 2214 struct zfcp_unit *unit;
2755 struct fsf_qtcb_header *header; 2215 struct fsf_qtcb_header *header;
2756 u16 subtable, rule, counter;
2757 2216
2758 port = (struct zfcp_port *) fsf_req->data; 2217 port = (struct zfcp_port *) fsf_req->data;
2759 header = &fsf_req->qtcb->header; 2218 header = &fsf_req->qtcb->header;
@@ -2767,47 +2226,15 @@ zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *fsf_req)
2767 switch (header->fsf_status) { 2226 switch (header->fsf_status) {
2768 2227
2769 case FSF_PORT_HANDLE_NOT_VALID: 2228 case FSF_PORT_HANDLE_NOT_VALID:
2770 ZFCP_LOG_INFO("Temporary port identifier 0x%x invalid"
2771 "(adapter %s, port 0x%016Lx). "
2772 "This may happen occasionally.\n",
2773 port->handle,
2774 zfcp_get_busid_by_port(port),
2775 port->wwpn);
2776 ZFCP_LOG_DEBUG("status qualifier:\n");
2777 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
2778 (char *) &header->fsf_status_qual,
2779 sizeof (union fsf_status_qual));
2780 zfcp_erp_adapter_reopen(port->adapter, 0, 108, fsf_req); 2229 zfcp_erp_adapter_reopen(port->adapter, 0, 108, fsf_req);
2781 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2230 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2782 break; 2231 break;
2783 2232
2784 case FSF_ACCESS_DENIED: 2233 case FSF_ACCESS_DENIED:
2785 ZFCP_LOG_NORMAL("Access denied, cannot close " 2234 zfcp_fsf_access_denied_port(fsf_req, port);
2786 "physical port 0x%016Lx on adapter %s\n",
2787 port->wwpn, zfcp_get_busid_by_port(port));
2788 for (counter = 0; counter < 2; counter++) {
2789 subtable = header->fsf_status_qual.halfword[counter * 2];
2790 rule = header->fsf_status_qual.halfword[counter * 2 + 1];
2791 switch (subtable) {
2792 case FSF_SQ_CFDC_SUBTABLE_OS:
2793 case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:
2794 case FSF_SQ_CFDC_SUBTABLE_PORT_DID:
2795 case FSF_SQ_CFDC_SUBTABLE_LUN:
2796 ZFCP_LOG_INFO("Access denied (%s rule %d)\n",
2797 zfcp_act_subtable_type[subtable], rule);
2798 break;
2799 }
2800 }
2801 zfcp_erp_port_access_denied(port, 58, fsf_req);
2802 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2803 break; 2235 break;
2804 2236
2805 case FSF_PORT_BOXED: 2237 case FSF_PORT_BOXED:
2806 ZFCP_LOG_DEBUG("The remote port 0x%016Lx on adapter "
2807 "%s needs to be reopened but it was attempted "
2808 "to close it physically.\n",
2809 port->wwpn,
2810 zfcp_get_busid_by_port(port));
2811 zfcp_erp_port_boxed(port, 50, fsf_req); 2238 zfcp_erp_port_boxed(port, 50, fsf_req);
2812 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 2239 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
2813 ZFCP_STATUS_FSFREQ_RETRY; 2240 ZFCP_STATUS_FSFREQ_RETRY;
@@ -2830,19 +2257,10 @@ zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *fsf_req)
2830 /* ERP strategy will escalate */ 2257 /* ERP strategy will escalate */
2831 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2258 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2832 break; 2259 break;
2833 default:
2834 ZFCP_LOG_NORMAL
2835 ("bug: Wrong status qualifier 0x%x arrived.\n",
2836 header->fsf_status_qual.word[0]);
2837 break;
2838 } 2260 }
2839 break; 2261 break;
2840 2262
2841 case FSF_GOOD: 2263 case FSF_GOOD:
2842 ZFCP_LOG_DEBUG("Remote port 0x%016Lx via adapter %s "
2843 "physically closed, port handle 0x%x\n",
2844 port->wwpn,
2845 zfcp_get_busid_by_port(port), port->handle);
2846 /* can't use generic zfcp_erp_modify_port_status because 2264 /* can't use generic zfcp_erp_modify_port_status because
2847 * ZFCP_STATUS_COMMON_OPEN must not be reset for the port 2265 * ZFCP_STATUS_COMMON_OPEN must not be reset for the port
2848 */ 2266 */
@@ -2851,12 +2269,6 @@ zfcp_fsf_close_physical_port_handler(struct zfcp_fsf_req *fsf_req)
2851 atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status); 2269 atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status);
2852 retval = 0; 2270 retval = 0;
2853 break; 2271 break;
2854
2855 default:
2856 ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "
2857 "(debug info 0x%x)\n",
2858 header->fsf_status);
2859 break;
2860 } 2272 }
2861 2273
2862 skip_fsfstatus: 2274 skip_fsfstatus:
@@ -2890,14 +2302,8 @@ zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
2890 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP, 2302 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP,
2891 erp_action->adapter->pool.fsf_req_erp, 2303 erp_action->adapter->pool.fsf_req_erp,
2892 &lock_flags, &fsf_req); 2304 &lock_flags, &fsf_req);
2893 if (retval < 0) { 2305 if (retval < 0)
2894 ZFCP_LOG_INFO("error: Could not create open unit request for "
2895 "unit 0x%016Lx on port 0x%016Lx on adapter %s.\n",
2896 erp_action->unit->fcp_lun,
2897 erp_action->unit->port->wwpn,
2898 zfcp_get_busid_by_adapter(erp_action->adapter));
2899 goto out; 2306 goto out;
2900 }
2901 2307
2902 sbale = zfcp_qdio_sbale_req(fsf_req); 2308 sbale = zfcp_qdio_sbale_req(fsf_req);
2903 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 2309 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
@@ -2916,21 +2322,10 @@ zfcp_fsf_open_unit(struct zfcp_erp_action *erp_action)
2916 zfcp_erp_start_timer(fsf_req); 2322 zfcp_erp_start_timer(fsf_req);
2917 retval = zfcp_fsf_req_send(erp_action->fsf_req); 2323 retval = zfcp_fsf_req_send(erp_action->fsf_req);
2918 if (retval) { 2324 if (retval) {
2919 ZFCP_LOG_INFO("error: Could not send an open unit request "
2920 "on the adapter %s, port 0x%016Lx for "
2921 "unit 0x%016Lx\n",
2922 zfcp_get_busid_by_adapter(erp_action->adapter),
2923 erp_action->port->wwpn,
2924 erp_action->unit->fcp_lun);
2925 zfcp_fsf_req_free(fsf_req); 2325 zfcp_fsf_req_free(fsf_req);
2926 erp_action->fsf_req = NULL; 2326 erp_action->fsf_req = NULL;
2927 goto out; 2327 goto out;
2928 } 2328 }
2929
2930 ZFCP_LOG_TRACE("Open LUN request initiated (adapter %s, "
2931 "port 0x%016Lx, unit 0x%016Lx)\n",
2932 zfcp_get_busid_by_adapter(erp_action->adapter),
2933 erp_action->port->wwpn, erp_action->unit->fcp_lun);
2934 out: 2329 out:
2935 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags); 2330 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags);
2936 return retval; 2331 return retval;
@@ -2952,7 +2347,6 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
2952 struct fsf_qtcb_header *header; 2347 struct fsf_qtcb_header *header;
2953 struct fsf_qtcb_bottom_support *bottom; 2348 struct fsf_qtcb_bottom_support *bottom;
2954 struct fsf_queue_designator *queue_designator; 2349 struct fsf_queue_designator *queue_designator;
2955 u16 subtable, rule, counter;
2956 int exclusive, readwrite; 2350 int exclusive, readwrite;
2957 2351
2958 unit = (struct zfcp_unit *) fsf_req->data; 2352 unit = (struct zfcp_unit *) fsf_req->data;
@@ -2977,55 +2371,21 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
2977 switch (header->fsf_status) { 2371 switch (header->fsf_status) {
2978 2372
2979 case FSF_PORT_HANDLE_NOT_VALID: 2373 case FSF_PORT_HANDLE_NOT_VALID:
2980 ZFCP_LOG_INFO("Temporary port identifier 0x%x "
2981 "for port 0x%016Lx on adapter %s invalid "
2982 "This may happen occasionally\n",
2983 unit->port->handle,
2984 unit->port->wwpn, zfcp_get_busid_by_unit(unit));
2985 ZFCP_LOG_DEBUG("status qualifier:\n");
2986 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
2987 (char *) &header->fsf_status_qual,
2988 sizeof (union fsf_status_qual));
2989 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 109, fsf_req); 2374 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 109, fsf_req);
2990 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2375 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2991 break; 2376 break;
2992 2377
2993 case FSF_LUN_ALREADY_OPEN: 2378 case FSF_LUN_ALREADY_OPEN:
2994 ZFCP_LOG_NORMAL("bug: Attempted to open unit 0x%016Lx on "
2995 "remote port 0x%016Lx on adapter %s twice.\n",
2996 unit->fcp_lun,
2997 unit->port->wwpn, zfcp_get_busid_by_unit(unit));
2998 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2379 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
2999 break; 2380 break;
3000 2381
3001 case FSF_ACCESS_DENIED: 2382 case FSF_ACCESS_DENIED:
3002 ZFCP_LOG_NORMAL("Access denied, cannot open unit 0x%016Lx on " 2383 zfcp_fsf_access_denied_unit(fsf_req, unit);
3003 "remote port 0x%016Lx on adapter %s\n",
3004 unit->fcp_lun, unit->port->wwpn,
3005 zfcp_get_busid_by_unit(unit));
3006 for (counter = 0; counter < 2; counter++) {
3007 subtable = header->fsf_status_qual.halfword[counter * 2];
3008 rule = header->fsf_status_qual.halfword[counter * 2 + 1];
3009 switch (subtable) {
3010 case FSF_SQ_CFDC_SUBTABLE_OS:
3011 case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:
3012 case FSF_SQ_CFDC_SUBTABLE_PORT_DID:
3013 case FSF_SQ_CFDC_SUBTABLE_LUN:
3014 ZFCP_LOG_INFO("Access denied (%s rule %d)\n",
3015 zfcp_act_subtable_type[subtable], rule);
3016 break;
3017 }
3018 }
3019 zfcp_erp_unit_access_denied(unit, 59, fsf_req);
3020 atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status); 2384 atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status);
3021 atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status); 2385 atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status);
3022 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3023 break; 2386 break;
3024 2387
3025 case FSF_PORT_BOXED: 2388 case FSF_PORT_BOXED:
3026 ZFCP_LOG_DEBUG("The remote port 0x%016Lx on adapter %s "
3027 "needs to be reopened\n",
3028 unit->port->wwpn, zfcp_get_busid_by_unit(unit));
3029 zfcp_erp_port_boxed(unit->port, 51, fsf_req); 2389 zfcp_erp_port_boxed(unit->port, 51, fsf_req);
3030 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 2390 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
3031 ZFCP_STATUS_FSFREQ_RETRY; 2391 ZFCP_STATUS_FSFREQ_RETRY;
@@ -3033,39 +2393,18 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
3033 2393
3034 case FSF_LUN_SHARING_VIOLATION: 2394 case FSF_LUN_SHARING_VIOLATION:
3035 if (header->fsf_status_qual.word[0] != 0) { 2395 if (header->fsf_status_qual.word[0] != 0) {
3036 ZFCP_LOG_NORMAL("FCP-LUN 0x%Lx at the remote port " 2396 dev_warn(&adapter->ccw_device->dev,
3037 "with WWPN 0x%Lx " 2397 "FCP-LUN 0x%Lx at the remote port "
3038 "connected to the adapter %s " 2398 "with WWPN 0x%Lx "
3039 "is already in use in LPAR%d, CSS%d\n", 2399 "connected to the adapter "
3040 unit->fcp_lun, 2400 "is already in use in LPAR%d, CSS%d.\n",
3041 unit->port->wwpn, 2401 unit->fcp_lun,
3042 zfcp_get_busid_by_unit(unit), 2402 unit->port->wwpn,
3043 queue_designator->hla, 2403 queue_designator->hla,
3044 queue_designator->cssid); 2404 queue_designator->cssid);
3045 } else { 2405 } else
3046 subtable = header->fsf_status_qual.halfword[4]; 2406 zfcp_act_eval_err(adapter,
3047 rule = header->fsf_status_qual.halfword[5]; 2407 header->fsf_status_qual.word[2]);
3048 switch (subtable) {
3049 case FSF_SQ_CFDC_SUBTABLE_OS:
3050 case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:
3051 case FSF_SQ_CFDC_SUBTABLE_PORT_DID:
3052 case FSF_SQ_CFDC_SUBTABLE_LUN:
3053 ZFCP_LOG_NORMAL("Access to FCP-LUN 0x%Lx at the "
3054 "remote port with WWPN 0x%Lx "
3055 "connected to the adapter %s "
3056 "is denied (%s rule %d)\n",
3057 unit->fcp_lun,
3058 unit->port->wwpn,
3059 zfcp_get_busid_by_unit(unit),
3060 zfcp_act_subtable_type[subtable],
3061 rule);
3062 break;
3063 }
3064 }
3065 ZFCP_LOG_DEBUG("status qualifier:\n");
3066 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3067 (char *) &header->fsf_status_qual,
3068 sizeof (union fsf_status_qual));
3069 zfcp_erp_unit_access_denied(unit, 60, fsf_req); 2408 zfcp_erp_unit_access_denied(unit, 60, fsf_req);
3070 atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status); 2409 atomic_clear_mask(ZFCP_STATUS_UNIT_SHARED, &unit->status);
3071 atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status); 2410 atomic_clear_mask(ZFCP_STATUS_UNIT_READONLY, &unit->status);
@@ -3073,13 +2412,10 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
3073 break; 2412 break;
3074 2413
3075 case FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED: 2414 case FSF_MAXIMUM_NUMBER_OF_LUNS_EXCEEDED:
3076 ZFCP_LOG_INFO("error: The adapter ran out of resources. " 2415 dev_warn(&fsf_req->adapter->ccw_device->dev,
3077 "There is no handle (temporary port identifier) " 2416 "The adapter ran out of resources. There is no "
3078 "available for unit 0x%016Lx on port 0x%016Lx " 2417 "handle available for unit 0x%016Lx on port 0x%016Lx.",
3079 "on adapter %s\n", 2418 unit->fcp_lun, unit->port->wwpn);
3080 unit->fcp_lun,
3081 unit->port->wwpn,
3082 zfcp_get_busid_by_unit(unit));
3083 zfcp_erp_unit_failed(unit, 34, fsf_req); 2419 zfcp_erp_unit_failed(unit, 34, fsf_req);
3084 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2420 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3085 break; 2421 break;
@@ -3095,19 +2431,10 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
3095 /* ERP strategy will escalate */ 2431 /* ERP strategy will escalate */
3096 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2432 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3097 break; 2433 break;
3098 default:
3099 ZFCP_LOG_NORMAL
3100 ("bug: Wrong status qualifier 0x%x arrived.\n",
3101 header->fsf_status_qual.word[0]);
3102 } 2434 }
3103 break; 2435 break;
3104 2436
3105 case FSF_INVALID_COMMAND_OPTION: 2437 case FSF_INVALID_COMMAND_OPTION:
3106 ZFCP_LOG_NORMAL(
3107 "Invalid option 0x%x has been specified "
3108 "in QTCB bottom sent to the adapter %s\n",
3109 bottom->option,
3110 zfcp_get_busid_by_adapter(adapter));
3111 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2438 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3112 retval = -EINVAL; 2439 retval = -EINVAL;
3113 break; 2440 break;
@@ -3115,12 +2442,6 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
3115 case FSF_GOOD: 2442 case FSF_GOOD:
3116 /* save LUN handle assigned by FSF */ 2443 /* save LUN handle assigned by FSF */
3117 unit->handle = header->lun_handle; 2444 unit->handle = header->lun_handle;
3118 ZFCP_LOG_TRACE("unit 0x%016Lx on remote port 0x%016Lx on "
3119 "adapter %s opened, port handle 0x%x\n",
3120 unit->fcp_lun,
3121 unit->port->wwpn,
3122 zfcp_get_busid_by_unit(unit),
3123 unit->handle);
3124 /* mark unit as open */ 2445 /* mark unit as open */
3125 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status); 2446 atomic_set_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status);
3126 2447
@@ -3139,23 +2460,27 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
3139 if (!readwrite) { 2460 if (!readwrite) {
3140 atomic_set_mask(ZFCP_STATUS_UNIT_READONLY, 2461 atomic_set_mask(ZFCP_STATUS_UNIT_READONLY,
3141 &unit->status); 2462 &unit->status);
3142 ZFCP_LOG_NORMAL("read-only access for unit " 2463 dev_info(&fsf_req->adapter->ccw_device->dev,
3143 "(adapter %s, wwpn=0x%016Lx, " 2464 "Read-only access for unit 0x%016Lx "
3144 "fcp_lun=0x%016Lx)\n", 2465 "on port 0x%016Lx.\n",
3145 zfcp_get_busid_by_unit(unit), 2466 unit->fcp_lun, unit->port->wwpn);
3146 unit->port->wwpn,
3147 unit->fcp_lun);
3148 } 2467 }
3149 2468
3150 if (exclusive && !readwrite) { 2469 if (exclusive && !readwrite) {
3151 ZFCP_LOG_NORMAL("exclusive access of read-only " 2470 dev_err(&fsf_req->adapter->ccw_device->dev,
3152 "unit not supported\n"); 2471 "Exclusive access of read-only unit "
2472 "0x%016Lx on port 0x%016Lx not "
2473 "supported, disabling unit.\n",
2474 unit->fcp_lun, unit->port->wwpn);
3153 zfcp_erp_unit_failed(unit, 35, fsf_req); 2475 zfcp_erp_unit_failed(unit, 35, fsf_req);
3154 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2476 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3155 zfcp_erp_unit_shutdown(unit, 0, 80, fsf_req); 2477 zfcp_erp_unit_shutdown(unit, 0, 80, fsf_req);
3156 } else if (!exclusive && readwrite) { 2478 } else if (!exclusive && readwrite) {
3157 ZFCP_LOG_NORMAL("shared access of read-write " 2479 dev_err(&fsf_req->adapter->ccw_device->dev,
3158 "unit not supported\n"); 2480 "Shared access of read-write unit "
2481 "0x%016Lx on port 0x%016Lx not "
2482 "supported, disabling unit.\n",
2483 unit->fcp_lun, unit->port->wwpn);
3159 zfcp_erp_unit_failed(unit, 36, fsf_req); 2484 zfcp_erp_unit_failed(unit, 36, fsf_req);
3160 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2485 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3161 zfcp_erp_unit_shutdown(unit, 0, 81, fsf_req); 2486 zfcp_erp_unit_shutdown(unit, 0, 81, fsf_req);
@@ -3164,12 +2489,6 @@ zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *fsf_req)
3164 2489
3165 retval = 0; 2490 retval = 0;
3166 break; 2491 break;
3167
3168 default:
3169 ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "
3170 "(debug info 0x%x)\n",
3171 header->fsf_status);
3172 break;
3173 } 2492 }
3174 2493
3175 skip_fsfstatus: 2494 skip_fsfstatus:
@@ -3204,14 +2523,8 @@ zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
3204 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP, 2523 ZFCP_WAIT_FOR_SBAL | ZFCP_REQ_AUTO_CLEANUP,
3205 erp_action->adapter->pool.fsf_req_erp, 2524 erp_action->adapter->pool.fsf_req_erp,
3206 &lock_flags, &fsf_req); 2525 &lock_flags, &fsf_req);
3207 if (retval < 0) { 2526 if (retval < 0)
3208 ZFCP_LOG_INFO("error: Could not create close unit request for "
3209 "unit 0x%016Lx on port 0x%016Lx on adapter %s.\n",
3210 erp_action->unit->fcp_lun,
3211 erp_action->port->wwpn,
3212 zfcp_get_busid_by_adapter(erp_action->adapter));
3213 goto out; 2527 goto out;
3214 }
3215 2528
3216 sbale = zfcp_qdio_sbale_req(fsf_req); 2529 sbale = zfcp_qdio_sbale_req(fsf_req);
3217 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ; 2530 sbale[0].flags |= SBAL_FLAGS0_TYPE_READ;
@@ -3227,20 +2540,11 @@ zfcp_fsf_close_unit(struct zfcp_erp_action *erp_action)
3227 zfcp_erp_start_timer(fsf_req); 2540 zfcp_erp_start_timer(fsf_req);
3228 retval = zfcp_fsf_req_send(erp_action->fsf_req); 2541 retval = zfcp_fsf_req_send(erp_action->fsf_req);
3229 if (retval) { 2542 if (retval) {
3230 ZFCP_LOG_INFO("error: Could not send a close unit request for "
3231 "unit 0x%016Lx on port 0x%016Lx onadapter %s.\n",
3232 erp_action->unit->fcp_lun,
3233 erp_action->port->wwpn,
3234 zfcp_get_busid_by_adapter(erp_action->adapter));
3235 zfcp_fsf_req_free(fsf_req); 2543 zfcp_fsf_req_free(fsf_req);
3236 erp_action->fsf_req = NULL; 2544 erp_action->fsf_req = NULL;
3237 goto out; 2545 goto out;
3238 } 2546 }
3239 2547
3240 ZFCP_LOG_TRACE("Close LUN request initiated (adapter %s, "
3241 "port 0x%016Lx, unit 0x%016Lx)\n",
3242 zfcp_get_busid_by_adapter(erp_action->adapter),
3243 erp_action->port->wwpn, erp_action->unit->fcp_lun);
3244 out: 2548 out:
3245 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags); 2549 write_unlock_irqrestore(&erp_action->adapter->req_q.lock, lock_flags);
3246 return retval; 2550 return retval;
@@ -3270,41 +2574,16 @@ zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *fsf_req)
3270 switch (fsf_req->qtcb->header.fsf_status) { 2574 switch (fsf_req->qtcb->header.fsf_status) {
3271 2575
3272 case FSF_PORT_HANDLE_NOT_VALID: 2576 case FSF_PORT_HANDLE_NOT_VALID:
3273 ZFCP_LOG_INFO("Temporary port identifier 0x%x for port "
3274 "0x%016Lx on adapter %s invalid. This may "
3275 "happen in rare circumstances\n",
3276 unit->port->handle,
3277 unit->port->wwpn,
3278 zfcp_get_busid_by_unit(unit));
3279 ZFCP_LOG_DEBUG("status qualifier:\n");
3280 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3281 (char *) &fsf_req->qtcb->header.fsf_status_qual,
3282 sizeof (union fsf_status_qual));
3283 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 110, fsf_req); 2577 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 110, fsf_req);
3284 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2578 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3285 break; 2579 break;
3286 2580
3287 case FSF_LUN_HANDLE_NOT_VALID: 2581 case FSF_LUN_HANDLE_NOT_VALID:
3288 ZFCP_LOG_INFO("Temporary LUN identifier 0x%x of unit "
3289 "0x%016Lx on port 0x%016Lx on adapter %s is "
3290 "invalid. This may happen occasionally.\n",
3291 unit->handle,
3292 unit->fcp_lun,
3293 unit->port->wwpn,
3294 zfcp_get_busid_by_unit(unit));
3295 ZFCP_LOG_DEBUG("Status qualifier data:\n");
3296 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3297 (char *) &fsf_req->qtcb->header.fsf_status_qual,
3298 sizeof (union fsf_status_qual));
3299 zfcp_erp_port_reopen(unit->port, 0, 111, fsf_req); 2582 zfcp_erp_port_reopen(unit->port, 0, 111, fsf_req);
3300 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2583 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3301 break; 2584 break;
3302 2585
3303 case FSF_PORT_BOXED: 2586 case FSF_PORT_BOXED:
3304 ZFCP_LOG_DEBUG("The remote port 0x%016Lx on adapter %s "
3305 "needs to be reopened\n",
3306 unit->port->wwpn,
3307 zfcp_get_busid_by_unit(unit));
3308 zfcp_erp_port_boxed(unit->port, 52, fsf_req); 2587 zfcp_erp_port_boxed(unit->port, 52, fsf_req);
3309 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 2588 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
3310 ZFCP_STATUS_FSFREQ_RETRY; 2589 ZFCP_STATUS_FSFREQ_RETRY;
@@ -3322,30 +2601,15 @@ zfcp_fsf_close_unit_handler(struct zfcp_fsf_req *fsf_req)
3322 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2601 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3323 break; 2602 break;
3324 default: 2603 default:
3325 ZFCP_LOG_NORMAL
3326 ("bug: Wrong status qualifier 0x%x arrived.\n",
3327 fsf_req->qtcb->header.fsf_status_qual.word[0]);
3328 break; 2604 break;
3329 } 2605 }
3330 break; 2606 break;
3331 2607
3332 case FSF_GOOD: 2608 case FSF_GOOD:
3333 ZFCP_LOG_TRACE("unit 0x%016Lx on port 0x%016Lx on adapter %s "
3334 "closed, port handle 0x%x\n",
3335 unit->fcp_lun,
3336 unit->port->wwpn,
3337 zfcp_get_busid_by_unit(unit),
3338 unit->handle);
3339 /* mark unit as closed */ 2609 /* mark unit as closed */
3340 atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status); 2610 atomic_clear_mask(ZFCP_STATUS_COMMON_OPEN, &unit->status);
3341 retval = 0; 2611 retval = 0;
3342 break; 2612 break;
3343
3344 default:
3345 ZFCP_LOG_NORMAL("bug: An unknown FSF Status was presented "
3346 "(debug info 0x%x)\n",
3347 fsf_req->qtcb->header.fsf_status);
3348 break;
3349 } 2613 }
3350 2614
3351 skip_fsfstatus: 2615 skip_fsfstatus:
@@ -3379,15 +2643,8 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
3379 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, 2643 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags,
3380 adapter->pool.fsf_req_scsi, 2644 adapter->pool.fsf_req_scsi,
3381 &lock_flags, &fsf_req); 2645 &lock_flags, &fsf_req);
3382 if (unlikely(retval < 0)) { 2646 if (unlikely(retval < 0))
3383 ZFCP_LOG_DEBUG("error: Could not create FCP command request "
3384 "for unit 0x%016Lx on port 0x%016Lx on "
3385 "adapter %s\n",
3386 unit->fcp_lun,
3387 unit->port->wwpn,
3388 zfcp_get_busid_by_adapter(adapter));
3389 goto failed_req_create; 2647 goto failed_req_create;
3390 }
3391 2648
3392 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, 2649 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED,
3393 &unit->status))) { 2650 &unit->status))) {
@@ -3463,15 +2720,9 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
3463 fcp_cmnd_iu->task_attribute = UNTAGGED; 2720 fcp_cmnd_iu->task_attribute = UNTAGGED;
3464 2721
3465 /* set additional length of FCP_CDB in FCP_CMND IU in QTCB, if needed */ 2722 /* set additional length of FCP_CDB in FCP_CMND IU in QTCB, if needed */
3466 if (unlikely(scsi_cmnd->cmd_len > FCP_CDB_LENGTH)) { 2723 if (unlikely(scsi_cmnd->cmd_len > FCP_CDB_LENGTH))
3467 fcp_cmnd_iu->add_fcp_cdb_length 2724 fcp_cmnd_iu->add_fcp_cdb_length
3468 = (scsi_cmnd->cmd_len - FCP_CDB_LENGTH) >> 2; 2725 = (scsi_cmnd->cmd_len - FCP_CDB_LENGTH) >> 2;
3469 ZFCP_LOG_TRACE("SCSI CDB length is 0x%x, "
3470 "additional FCP_CDB length is 0x%x "
3471 "(shifted right 2 bits)\n",
3472 scsi_cmnd->cmd_len,
3473 fcp_cmnd_iu->add_fcp_cdb_length);
3474 }
3475 /* 2726 /*
3476 * copy SCSI CDB (including additional length, if any) to 2727 * copy SCSI CDB (including additional length, if any) to
3477 * FCP_CDB in FCP_CMND IU in QTCB 2728 * FCP_CDB in FCP_CMND IU in QTCB
@@ -3488,19 +2739,14 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
3488 scsi_sglist(scsi_cmnd), 2739 scsi_sglist(scsi_cmnd),
3489 ZFCP_MAX_SBALS_PER_REQ); 2740 ZFCP_MAX_SBALS_PER_REQ);
3490 if (unlikely(real_bytes < 0)) { 2741 if (unlikely(real_bytes < 0)) {
3491 if (fsf_req->sbal_number < ZFCP_MAX_SBALS_PER_REQ) { 2742 if (fsf_req->sbal_number < ZFCP_MAX_SBALS_PER_REQ)
3492 ZFCP_LOG_DEBUG(
3493 "Data did not fit into available buffer(s), "
3494 "waiting for more...\n");
3495 retval = -EIO; 2743 retval = -EIO;
3496 } else { 2744 else {
3497 ZFCP_LOG_NORMAL("error: No truncation implemented but " 2745 dev_err(&adapter->ccw_device->dev,
3498 "required. Shutting down unit " 2746 "SCSI request too large. "
3499 "(adapter %s, port 0x%016Lx, " 2747 "Shutting down unit 0x%016Lx on port "
3500 "unit 0x%016Lx)\n", 2748 "0x%016Lx.\n", unit->fcp_lun,
3501 zfcp_get_busid_by_unit(unit), 2749 unit->port->wwpn);
3502 unit->port->wwpn,
3503 unit->fcp_lun);
3504 zfcp_erp_unit_shutdown(unit, 0, 131, fsf_req); 2750 zfcp_erp_unit_shutdown(unit, 0, 131, fsf_req);
3505 retval = -EINVAL; 2751 retval = -EINVAL;
3506 } 2752 }
@@ -3510,28 +2756,13 @@ zfcp_fsf_send_fcp_command_task(struct zfcp_adapter *adapter,
3510 /* set length of FCP data length in FCP_CMND IU in QTCB */ 2756 /* set length of FCP data length in FCP_CMND IU in QTCB */
3511 zfcp_set_fcp_dl(fcp_cmnd_iu, real_bytes); 2757 zfcp_set_fcp_dl(fcp_cmnd_iu, real_bytes);
3512 2758
3513 ZFCP_LOG_DEBUG("Sending SCSI command:\n");
3514 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3515 (char *) scsi_cmnd->cmnd, scsi_cmnd->cmd_len);
3516
3517 if (use_timer) 2759 if (use_timer)
3518 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT); 2760 zfcp_fsf_start_timer(fsf_req, ZFCP_FSF_REQUEST_TIMEOUT);
3519 2761
3520 retval = zfcp_fsf_req_send(fsf_req); 2762 retval = zfcp_fsf_req_send(fsf_req);
3521 if (unlikely(retval < 0)) { 2763 if (unlikely(retval < 0))
3522 ZFCP_LOG_INFO("error: Could not send FCP command request "
3523 "on adapter %s, port 0x%016Lx, unit 0x%016Lx\n",
3524 zfcp_get_busid_by_adapter(adapter),
3525 unit->port->wwpn,
3526 unit->fcp_lun);
3527 goto send_failed; 2764 goto send_failed;
3528 }
3529 2765
3530 ZFCP_LOG_TRACE("Send FCP Command initiated (adapter %s, "
3531 "port 0x%016Lx, unit 0x%016Lx)\n",
3532 zfcp_get_busid_by_adapter(adapter),
3533 unit->port->wwpn,
3534 unit->fcp_lun);
3535 goto success; 2766 goto success;
3536 2767
3537 send_failed: 2768 send_failed:
@@ -3563,14 +2794,8 @@ zfcp_fsf_send_fcp_command_task_management(struct zfcp_adapter *adapter,
3563 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags, 2794 retval = zfcp_fsf_req_create(adapter, FSF_QTCB_FCP_CMND, req_flags,
3564 adapter->pool.fsf_req_scsi, 2795 adapter->pool.fsf_req_scsi,
3565 &lock_flags, &fsf_req); 2796 &lock_flags, &fsf_req);
3566 if (retval < 0) { 2797 if (retval < 0)
3567 ZFCP_LOG_INFO("error: Could not create FCP command (task "
3568 "management) request for adapter %s, port "
3569 " 0x%016Lx, unit 0x%016Lx.\n",
3570 zfcp_get_busid_by_adapter(adapter),
3571 unit->port->wwpn, unit->fcp_lun);
3572 goto out; 2798 goto out;
3573 }
3574 2799
3575 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED, 2800 if (unlikely(!atomic_test_mask(ZFCP_STATUS_COMMON_UNBLOCKED,
3576 &unit->status))) 2801 &unit->status)))
@@ -3674,7 +2899,6 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3674 int retval = -EINVAL; 2899 int retval = -EINVAL;
3675 struct zfcp_unit *unit; 2900 struct zfcp_unit *unit;
3676 struct fsf_qtcb_header *header; 2901 struct fsf_qtcb_header *header;
3677 u16 subtable, rule, counter;
3678 2902
3679 header = &fsf_req->qtcb->header; 2903 header = &fsf_req->qtcb->header;
3680 2904
@@ -3692,137 +2916,61 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3692 switch (header->fsf_status) { 2916 switch (header->fsf_status) {
3693 2917
3694 case FSF_PORT_HANDLE_NOT_VALID: 2918 case FSF_PORT_HANDLE_NOT_VALID:
3695 ZFCP_LOG_INFO("Temporary port identifier 0x%x for port "
3696 "0x%016Lx on adapter %s invalid\n",
3697 unit->port->handle,
3698 unit->port->wwpn, zfcp_get_busid_by_unit(unit));
3699 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3700 (char *) &header->fsf_status_qual,
3701 sizeof (union fsf_status_qual));
3702 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 112, fsf_req); 2919 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 112, fsf_req);
3703 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2920 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3704 break; 2921 break;
3705 2922
3706 case FSF_LUN_HANDLE_NOT_VALID: 2923 case FSF_LUN_HANDLE_NOT_VALID:
3707 ZFCP_LOG_INFO("Temporary LUN identifier 0x%x for unit "
3708 "0x%016Lx on port 0x%016Lx on adapter %s is "
3709 "invalid. This may happen occasionally.\n",
3710 unit->handle,
3711 unit->fcp_lun,
3712 unit->port->wwpn,
3713 zfcp_get_busid_by_unit(unit));
3714 ZFCP_LOG_NORMAL("Status qualifier data:\n");
3715 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL,
3716 (char *) &header->fsf_status_qual,
3717 sizeof (union fsf_status_qual));
3718 zfcp_erp_port_reopen(unit->port, 0, 113, fsf_req); 2924 zfcp_erp_port_reopen(unit->port, 0, 113, fsf_req);
3719 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2925 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3720 break; 2926 break;
3721 2927
3722 case FSF_HANDLE_MISMATCH: 2928 case FSF_HANDLE_MISMATCH:
3723 ZFCP_LOG_NORMAL("bug: The port handle 0x%x has changed "
3724 "unexpectedly. (adapter %s, port 0x%016Lx, "
3725 "unit 0x%016Lx)\n",
3726 unit->port->handle,
3727 zfcp_get_busid_by_unit(unit),
3728 unit->port->wwpn,
3729 unit->fcp_lun);
3730 ZFCP_LOG_NORMAL("status qualifier:\n");
3731 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_NORMAL,
3732 (char *) &header->fsf_status_qual,
3733 sizeof (union fsf_status_qual));
3734 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 114, fsf_req); 2929 zfcp_erp_adapter_reopen(unit->port->adapter, 0, 114, fsf_req);
3735 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2930 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3736 break; 2931 break;
3737 2932
3738 case FSF_SERVICE_CLASS_NOT_SUPPORTED: 2933 case FSF_SERVICE_CLASS_NOT_SUPPORTED:
3739 ZFCP_LOG_INFO("error: adapter %s does not support fc " 2934 zfcp_fsf_class_not_supp(fsf_req);
3740 "class %d.\n",
3741 zfcp_get_busid_by_unit(unit),
3742 ZFCP_FC_SERVICE_CLASS_DEFAULT);
3743 /* stop operation for this adapter */
3744 zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 132, fsf_req);
3745 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3746 break; 2935 break;
3747 2936
3748 case FSF_FCPLUN_NOT_VALID: 2937 case FSF_FCPLUN_NOT_VALID:
3749 ZFCP_LOG_NORMAL("bug: unit 0x%016Lx on port 0x%016Lx on "
3750 "adapter %s does not have correct unit "
3751 "handle 0x%x\n",
3752 unit->fcp_lun,
3753 unit->port->wwpn,
3754 zfcp_get_busid_by_unit(unit),
3755 unit->handle);
3756 ZFCP_LOG_DEBUG("status qualifier:\n");
3757 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3758 (char *) &header->fsf_status_qual,
3759 sizeof (union fsf_status_qual));
3760 zfcp_erp_port_reopen(unit->port, 0, 115, fsf_req); 2938 zfcp_erp_port_reopen(unit->port, 0, 115, fsf_req);
3761 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2939 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3762 break; 2940 break;
3763 2941
3764 case FSF_ACCESS_DENIED: 2942 case FSF_ACCESS_DENIED:
3765 ZFCP_LOG_NORMAL("Access denied, cannot send FCP command to " 2943 zfcp_fsf_access_denied_unit(fsf_req, unit);
3766 "unit 0x%016Lx on port 0x%016Lx on "
3767 "adapter %s\n", unit->fcp_lun, unit->port->wwpn,
3768 zfcp_get_busid_by_unit(unit));
3769 for (counter = 0; counter < 2; counter++) {
3770 subtable = header->fsf_status_qual.halfword[counter * 2];
3771 rule = header->fsf_status_qual.halfword[counter * 2 + 1];
3772 switch (subtable) {
3773 case FSF_SQ_CFDC_SUBTABLE_OS:
3774 case FSF_SQ_CFDC_SUBTABLE_PORT_WWPN:
3775 case FSF_SQ_CFDC_SUBTABLE_PORT_DID:
3776 case FSF_SQ_CFDC_SUBTABLE_LUN:
3777 ZFCP_LOG_INFO("Access denied (%s rule %d)\n",
3778 zfcp_act_subtable_type[subtable], rule);
3779 break;
3780 }
3781 }
3782 zfcp_erp_unit_access_denied(unit, 61, fsf_req);
3783 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3784 break; 2944 break;
3785 2945
3786 case FSF_DIRECTION_INDICATOR_NOT_VALID: 2946 case FSF_DIRECTION_INDICATOR_NOT_VALID:
3787 ZFCP_LOG_INFO("bug: Invalid data direction given for unit " 2947 dev_err(&fsf_req->adapter->ccw_device->dev,
3788 "0x%016Lx on port 0x%016Lx on adapter %s " 2948 "Invalid data direction (%d) given for unit 0x%016Lx "
3789 "(debug info %d)\n", 2949 "on port 0x%016Lx, shutting down adapter.\n",
3790 unit->fcp_lun, 2950 fsf_req->qtcb->bottom.io.data_direction,
3791 unit->port->wwpn, 2951 unit->fcp_lun, unit->port->wwpn);
3792 zfcp_get_busid_by_unit(unit),
3793 fsf_req->qtcb->bottom.io.data_direction);
3794 /* stop operation for this adapter */
3795 zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 133, fsf_req); 2952 zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 133, fsf_req);
3796 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2953 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3797 break; 2954 break;
3798 2955
3799 case FSF_CMND_LENGTH_NOT_VALID: 2956 case FSF_CMND_LENGTH_NOT_VALID:
3800 ZFCP_LOG_NORMAL 2957 dev_err(&fsf_req->adapter->ccw_device->dev,
3801 ("bug: An invalid control-data-block length field " 2958 "An invalid control-data-block length field (%d) "
3802 "was found in a command for unit 0x%016Lx on port " 2959 "was found in a command for unit 0x%016Lx on port "
3803 "0x%016Lx on adapter %s " "(debug info %d)\n", 2960 "0x%016Lx. Shutting down adapter.\n",
3804 unit->fcp_lun, unit->port->wwpn, 2961 fsf_req->qtcb->bottom.io.fcp_cmnd_length,
3805 zfcp_get_busid_by_unit(unit), 2962 unit->fcp_lun, unit->port->wwpn);
3806 fsf_req->qtcb->bottom.io.fcp_cmnd_length);
3807 /* stop operation for this adapter */
3808 zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 134, fsf_req); 2963 zfcp_erp_adapter_shutdown(unit->port->adapter, 0, 134, fsf_req);
3809 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2964 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3810 break; 2965 break;
3811 2966
3812 case FSF_PORT_BOXED: 2967 case FSF_PORT_BOXED:
3813 ZFCP_LOG_DEBUG("The remote port 0x%016Lx on adapter %s "
3814 "needs to be reopened\n",
3815 unit->port->wwpn, zfcp_get_busid_by_unit(unit));
3816 zfcp_erp_port_boxed(unit->port, 53, fsf_req); 2968 zfcp_erp_port_boxed(unit->port, 53, fsf_req);
3817 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR | 2969 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR |
3818 ZFCP_STATUS_FSFREQ_RETRY; 2970 ZFCP_STATUS_FSFREQ_RETRY;
3819 break; 2971 break;
3820 2972
3821 case FSF_LUN_BOXED: 2973 case FSF_LUN_BOXED:
3822 ZFCP_LOG_NORMAL("unit needs to be reopened (adapter %s, "
3823 "wwpn=0x%016Lx, fcp_lun=0x%016Lx)\n",
3824 zfcp_get_busid_by_unit(unit),
3825 unit->port->wwpn, unit->fcp_lun);
3826 zfcp_erp_unit_boxed(unit, 54, fsf_req); 2974 zfcp_erp_unit_boxed(unit, 54, fsf_req);
3827 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR 2975 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR
3828 | ZFCP_STATUS_FSFREQ_RETRY; 2976 | ZFCP_STATUS_FSFREQ_RETRY;
@@ -3838,11 +2986,6 @@ zfcp_fsf_send_fcp_command_handler(struct zfcp_fsf_req *fsf_req)
3838 /* FIXME(hw) need proper specs for proper action */ 2986 /* FIXME(hw) need proper specs for proper action */
3839 /* let scsi stack deal with retries and escalation */ 2987 /* let scsi stack deal with retries and escalation */
3840 break; 2988 break;
3841 default:
3842 ZFCP_LOG_NORMAL
3843 ("Unknown status qualifier 0x%x arrived.\n",
3844 header->fsf_status_qual.word[0]);
3845 break;
3846 } 2989 }
3847 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR; 2990 fsf_req->status |= ZFCP_STATUS_FSFREQ_ERROR;
3848 break; 2991 break;
@@ -3880,34 +3023,26 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
3880 struct scsi_cmnd *scpnt; 3023 struct scsi_cmnd *scpnt;
3881 struct fcp_rsp_iu *fcp_rsp_iu = (struct fcp_rsp_iu *) 3024 struct fcp_rsp_iu *fcp_rsp_iu = (struct fcp_rsp_iu *)
3882 &(fsf_req->qtcb->bottom.io.fcp_rsp); 3025 &(fsf_req->qtcb->bottom.io.fcp_rsp);
3883 struct fcp_cmnd_iu *fcp_cmnd_iu = (struct fcp_cmnd_iu *)
3884 &(fsf_req->qtcb->bottom.io.fcp_cmnd);
3885 u32 sns_len; 3026 u32 sns_len;
3886 char *fcp_rsp_info = zfcp_get_fcp_rsp_info_ptr(fcp_rsp_iu); 3027 char *fcp_rsp_info = zfcp_get_fcp_rsp_info_ptr(fcp_rsp_iu);
3887 unsigned long flags; 3028 unsigned long flags;
3888 struct zfcp_unit *unit = fsf_req->unit;
3889 3029
3890 read_lock_irqsave(&fsf_req->adapter->abort_lock, flags); 3030 read_lock_irqsave(&fsf_req->adapter->abort_lock, flags);
3891 scpnt = (struct scsi_cmnd *) fsf_req->data; 3031 scpnt = (struct scsi_cmnd *) fsf_req->data;
3892 if (unlikely(!scpnt)) { 3032 if (unlikely(!scpnt))
3893 ZFCP_LOG_DEBUG
3894 ("Command with fsf_req %p is not associated to "
3895 "a scsi command anymore. Aborted?\n", fsf_req);
3896 goto out; 3033 goto out;
3897 } 3034
3898 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ABORTED)) { 3035 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ABORTED)) {
3899 /* FIXME: (design) mid-layer should handle DID_ABORT like 3036 /* FIXME: (design) mid-layer should handle DID_ABORT like
3900 * DID_SOFT_ERROR by retrying the request for devices 3037 * DID_SOFT_ERROR by retrying the request for devices
3901 * that allow retries. 3038 * that allow retries.
3902 */ 3039 */
3903 ZFCP_LOG_DEBUG("Setting DID_SOFT_ERROR and SUGGEST_RETRY\n");
3904 set_host_byte(&scpnt->result, DID_SOFT_ERROR); 3040 set_host_byte(&scpnt->result, DID_SOFT_ERROR);
3905 set_driver_byte(&scpnt->result, SUGGEST_RETRY); 3041 set_driver_byte(&scpnt->result, SUGGEST_RETRY);
3906 goto skip_fsfstatus; 3042 goto skip_fsfstatus;
3907 } 3043 }
3908 3044
3909 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)) { 3045 if (unlikely(fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR)) {
3910 ZFCP_LOG_DEBUG("Setting DID_ERROR\n");
3911 set_host_byte(&scpnt->result, DID_ERROR); 3046 set_host_byte(&scpnt->result, DID_ERROR);
3912 goto skip_fsfstatus; 3047 goto skip_fsfstatus;
3913 } 3048 }
@@ -3920,97 +3055,31 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
3920 * of result in SCSI command 3055 * of result in SCSI command
3921 */ 3056 */
3922 scpnt->result |= fcp_rsp_iu->scsi_status; 3057 scpnt->result |= fcp_rsp_iu->scsi_status;
3923 if (unlikely(fcp_rsp_iu->scsi_status)) {
3924 /* DEBUG */
3925 ZFCP_LOG_DEBUG("status for SCSI Command:\n");
3926 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3927 scpnt->cmnd, scpnt->cmd_len);
3928 ZFCP_LOG_DEBUG("SCSI status code 0x%x\n",
3929 fcp_rsp_iu->scsi_status);
3930 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3931 (void *) fcp_rsp_iu, sizeof (struct fcp_rsp_iu));
3932 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3933 zfcp_get_fcp_sns_info_ptr(fcp_rsp_iu),
3934 fcp_rsp_iu->fcp_sns_len);
3935 }
3936 3058
3937 if (fsf_req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA) 3059 if (fsf_req->adapter->adapter_features & FSF_FEATURE_MEASUREMENT_DATA)
3938 zfcp_fsf_req_latency(fsf_req); 3060 zfcp_fsf_req_latency(fsf_req);
3939 3061
3940 /* check FCP_RSP_INFO */ 3062 /* check FCP_RSP_INFO */
3941 if (unlikely(fcp_rsp_iu->validity.bits.fcp_rsp_len_valid)) { 3063 if (unlikely(fcp_rsp_iu->validity.bits.fcp_rsp_len_valid)) {
3942 ZFCP_LOG_DEBUG("rsp_len is valid\n");
3943 switch (fcp_rsp_info[3]) { 3064 switch (fcp_rsp_info[3]) {
3944 case RSP_CODE_GOOD: 3065 case RSP_CODE_GOOD:
3945 /* ok, continue */ 3066 /* ok, continue */
3946 ZFCP_LOG_TRACE("no failure or Task Management "
3947 "Function complete\n");
3948 set_host_byte(&scpnt->result, DID_OK); 3067 set_host_byte(&scpnt->result, DID_OK);
3949 break; 3068 break;
3950 case RSP_CODE_LENGTH_MISMATCH: 3069 case RSP_CODE_LENGTH_MISMATCH:
3951 /* hardware bug */ 3070 /* hardware bug */
3952 ZFCP_LOG_NORMAL("bug: FCP response code indictates "
3953 "that the fibrechannel protocol data "
3954 "length differs from the burst length. "
3955 "The problem occured on unit 0x%016Lx "
3956 "on port 0x%016Lx on adapter %s",
3957 unit->fcp_lun,
3958 unit->port->wwpn,
3959 zfcp_get_busid_by_unit(unit));
3960 /* dump SCSI CDB as prepared by zfcp */
3961 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3962 (char *) &fsf_req->qtcb->
3963 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE);
3964 set_host_byte(&scpnt->result, DID_ERROR); 3071 set_host_byte(&scpnt->result, DID_ERROR);
3965 goto skip_fsfstatus; 3072 goto skip_fsfstatus;
3966 case RSP_CODE_FIELD_INVALID: 3073 case RSP_CODE_FIELD_INVALID:
3967 /* driver or hardware bug */ 3074 /* driver or hardware bug */
3968 ZFCP_LOG_NORMAL("bug: FCP response code indictates "
3969 "that the fibrechannel protocol data "
3970 "fields were incorrectly set up. "
3971 "The problem occured on the unit "
3972 "0x%016Lx on port 0x%016Lx on "
3973 "adapter %s",
3974 unit->fcp_lun,
3975 unit->port->wwpn,
3976 zfcp_get_busid_by_unit(unit));
3977 /* dump SCSI CDB as prepared by zfcp */
3978 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3979 (char *) &fsf_req->qtcb->
3980 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE);
3981 set_host_byte(&scpnt->result, DID_ERROR); 3075 set_host_byte(&scpnt->result, DID_ERROR);
3982 goto skip_fsfstatus; 3076 goto skip_fsfstatus;
3983 case RSP_CODE_RO_MISMATCH: 3077 case RSP_CODE_RO_MISMATCH:
3984 /* hardware bug */ 3078 /* hardware bug */
3985 ZFCP_LOG_NORMAL("bug: The FCP response code indicates "
3986 "that conflicting values for the "
3987 "fibrechannel payload offset from the "
3988 "header were found. "
3989 "The problem occured on unit 0x%016Lx "
3990 "on port 0x%016Lx on adapter %s.\n",
3991 unit->fcp_lun,
3992 unit->port->wwpn,
3993 zfcp_get_busid_by_unit(unit));
3994 /* dump SCSI CDB as prepared by zfcp */
3995 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
3996 (char *) &fsf_req->qtcb->
3997 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE);
3998 set_host_byte(&scpnt->result, DID_ERROR); 3079 set_host_byte(&scpnt->result, DID_ERROR);
3999 goto skip_fsfstatus; 3080 goto skip_fsfstatus;
4000 default: 3081 default:
4001 ZFCP_LOG_NORMAL("bug: An invalid FCP response " 3082 /* invalid FCP response code */
4002 "code was detected for a command. "
4003 "The problem occured on the unit "
4004 "0x%016Lx on port 0x%016Lx on "
4005 "adapter %s (debug info 0x%x)\n",
4006 unit->fcp_lun,
4007 unit->port->wwpn,
4008 zfcp_get_busid_by_unit(unit),
4009 fcp_rsp_info[3]);
4010 /* dump SCSI CDB as prepared by zfcp */
4011 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_DEBUG,
4012 (char *) &fsf_req->qtcb->
4013 bottom.io.fcp_cmnd, FSF_FCP_CMND_SIZE);
4014 set_host_byte(&scpnt->result, DID_ERROR); 3083 set_host_byte(&scpnt->result, DID_ERROR);
4015 goto skip_fsfstatus; 3084 goto skip_fsfstatus;
4016 } 3085 }
@@ -4020,50 +3089,15 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
4020 if (unlikely(fcp_rsp_iu->validity.bits.fcp_sns_len_valid)) { 3089 if (unlikely(fcp_rsp_iu->validity.bits.fcp_sns_len_valid)) {
4021 sns_len = FSF_FCP_RSP_SIZE - 3090 sns_len = FSF_FCP_RSP_SIZE -
4022 sizeof (struct fcp_rsp_iu) + fcp_rsp_iu->fcp_rsp_len; 3091 sizeof (struct fcp_rsp_iu) + fcp_rsp_iu->fcp_rsp_len;
4023 ZFCP_LOG_TRACE("room for %i bytes sense data in QTCB\n",
4024 sns_len);
4025 sns_len = min(sns_len, (u32) SCSI_SENSE_BUFFERSIZE); 3092 sns_len = min(sns_len, (u32) SCSI_SENSE_BUFFERSIZE);
4026 ZFCP_LOG_TRACE("room for %i bytes sense data in SCSI command\n",
4027 SCSI_SENSE_BUFFERSIZE);
4028 sns_len = min(sns_len, fcp_rsp_iu->fcp_sns_len); 3093 sns_len = min(sns_len, fcp_rsp_iu->fcp_sns_len);
4029 ZFCP_LOG_TRACE("scpnt->result =0x%x, command was:\n",
4030 scpnt->result);
4031 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE,
4032 scpnt->cmnd, scpnt->cmd_len);
4033 3094
4034 ZFCP_LOG_TRACE("%i bytes sense data provided by FCP\n",
4035 fcp_rsp_iu->fcp_sns_len);
4036 memcpy(scpnt->sense_buffer, 3095 memcpy(scpnt->sense_buffer,
4037 zfcp_get_fcp_sns_info_ptr(fcp_rsp_iu), sns_len); 3096 zfcp_get_fcp_sns_info_ptr(fcp_rsp_iu), sns_len);
4038 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE,
4039 (void *)scpnt->sense_buffer, sns_len);
4040 }
4041
4042 /* check for overrun */
4043 if (unlikely(fcp_rsp_iu->validity.bits.fcp_resid_over)) {
4044 ZFCP_LOG_INFO("A data overrun was detected for a command. "
4045 "unit 0x%016Lx, port 0x%016Lx, adapter %s. "
4046 "The response data length is "
4047 "%d, the original length was %d.\n",
4048 unit->fcp_lun,
4049 unit->port->wwpn,
4050 zfcp_get_busid_by_unit(unit),
4051 fcp_rsp_iu->fcp_resid,
4052 (int) zfcp_get_fcp_dl(fcp_cmnd_iu));
4053 } 3097 }
4054 3098
4055 /* check for underrun */ 3099 /* check for underrun */
4056 if (unlikely(fcp_rsp_iu->validity.bits.fcp_resid_under)) { 3100 if (unlikely(fcp_rsp_iu->validity.bits.fcp_resid_under)) {
4057 ZFCP_LOG_INFO("A data underrun was detected for a command. "
4058 "unit 0x%016Lx, port 0x%016Lx, adapter %s. "
4059 "The response data length is "
4060 "%d, the original length was %d.\n",
4061 unit->fcp_lun,
4062 unit->port->wwpn,
4063 zfcp_get_busid_by_unit(unit),
4064 fcp_rsp_iu->fcp_resid,
4065 (int) zfcp_get_fcp_dl(fcp_cmnd_iu));
4066
4067 scsi_set_resid(scpnt, fcp_rsp_iu->fcp_resid); 3101 scsi_set_resid(scpnt, fcp_rsp_iu->fcp_resid);
4068 if (scsi_bufflen(scpnt) - scsi_get_resid(scpnt) < 3102 if (scsi_bufflen(scpnt) - scsi_get_resid(scpnt) <
4069 scpnt->underflow) 3103 scpnt->underflow)
@@ -4071,8 +3105,6 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
4071 } 3105 }
4072 3106
4073 skip_fsfstatus: 3107 skip_fsfstatus:
4074 ZFCP_LOG_DEBUG("scpnt->result =0x%x\n", scpnt->result);
4075
4076 if (scpnt->result != 0) 3108 if (scpnt->result != 0)
4077 zfcp_scsi_dbf_event_result("erro", 3, fsf_req->adapter, scpnt, fsf_req); 3109 zfcp_scsi_dbf_event_result("erro", 3, fsf_req->adapter, scpnt, fsf_req);
4078 else if (scpnt->retries > 0) 3110 else if (scpnt->retries > 0)
@@ -4111,7 +3143,6 @@ zfcp_fsf_send_fcp_command_task_management_handler(struct zfcp_fsf_req *fsf_req)
4111 struct fcp_rsp_iu *fcp_rsp_iu = (struct fcp_rsp_iu *) 3143 struct fcp_rsp_iu *fcp_rsp_iu = (struct fcp_rsp_iu *)
4112 &(fsf_req->qtcb->bottom.io.fcp_rsp); 3144 &(fsf_req->qtcb->bottom.io.fcp_rsp);
4113 char *fcp_rsp_info = zfcp_get_fcp_rsp_info_ptr(fcp_rsp_iu); 3145 char *fcp_rsp_info = zfcp_get_fcp_rsp_info_ptr(fcp_rsp_iu);
4114 struct zfcp_unit *unit = (struct zfcp_unit *) fsf_req->data;
4115 3146
4116 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) { 3147 if (fsf_req->status & ZFCP_STATUS_FSFREQ_ERROR) {
4117 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED; 3148 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED;
@@ -4122,36 +3153,15 @@ zfcp_fsf_send_fcp_command_task_management_handler(struct zfcp_fsf_req *fsf_req)
4122 switch (fcp_rsp_info[3]) { 3153 switch (fcp_rsp_info[3]) {
4123 case RSP_CODE_GOOD: 3154 case RSP_CODE_GOOD:
4124 /* ok, continue */ 3155 /* ok, continue */
4125 ZFCP_LOG_DEBUG("no failure or Task Management "
4126 "Function complete\n");
4127 break; 3156 break;
4128 case RSP_CODE_TASKMAN_UNSUPP: 3157 case RSP_CODE_TASKMAN_UNSUPP:
4129 ZFCP_LOG_NORMAL("bug: A reuested task management function "
4130 "is not supported on the target device "
4131 "unit 0x%016Lx, port 0x%016Lx, adapter %s\n ",
4132 unit->fcp_lun,
4133 unit->port->wwpn,
4134 zfcp_get_busid_by_unit(unit));
4135 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCNOTSUPP; 3158 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCNOTSUPP;
4136 break; 3159 break;
4137 case RSP_CODE_TASKMAN_FAILED: 3160 case RSP_CODE_TASKMAN_FAILED:
4138 ZFCP_LOG_NORMAL("bug: A reuested task management function "
4139 "failed to complete successfully. "
4140 "unit 0x%016Lx, port 0x%016Lx, adapter %s.\n",
4141 unit->fcp_lun,
4142 unit->port->wwpn,
4143 zfcp_get_busid_by_unit(unit));
4144 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED; 3161 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED;
4145 break; 3162 break;
4146 default: 3163 default:
4147 ZFCP_LOG_NORMAL("bug: An invalid FCP response " 3164 /* invalid FCP response code */
4148 "code was detected for a command. "
4149 "unit 0x%016Lx, port 0x%016Lx, adapter %s "
4150 "(debug info 0x%x)\n",
4151 unit->fcp_lun,
4152 unit->port->wwpn,
4153 zfcp_get_busid_by_unit(unit),
4154 fcp_rsp_info[3]);
4155 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED; 3165 fsf_req->status |= ZFCP_STATUS_FSFREQ_TMFUNCFAILED;
4156 } 3166 }
4157 3167
@@ -4332,9 +3342,7 @@ zfcp_fsf_req_create(struct zfcp_adapter *adapter, u32 fsf_cmd, int req_flags,
4332 3342
4333 /* allocate new FSF request */ 3343 /* allocate new FSF request */
4334 fsf_req = zfcp_fsf_req_alloc(pool, req_flags); 3344 fsf_req = zfcp_fsf_req_alloc(pool, req_flags);
4335 if (unlikely(NULL == fsf_req)) { 3345 if (unlikely(!fsf_req)) {
4336 ZFCP_LOG_DEBUG("error: Could not put an FSF request into "
4337 "the outbound (send) queue.\n");
4338 ret = -ENOMEM; 3346 ret = -ENOMEM;
4339 goto failed_fsf_req; 3347 goto failed_fsf_req;
4340 } 3348 }
@@ -4393,9 +3401,6 @@ zfcp_fsf_req_create(struct zfcp_adapter *adapter, u32 fsf_cmd, int req_flags,
4393 sbale[1].length = sizeof(struct fsf_qtcb); 3401 sbale[1].length = sizeof(struct fsf_qtcb);
4394 } 3402 }
4395 3403
4396 ZFCP_LOG_TRACE("got %i free BUFFERs starting at index %i\n",
4397 fsf_req->sbal_number, fsf_req->sbal_first);
4398
4399 goto success; 3404 goto success;
4400 3405
4401 failed_sbals: 3406 failed_sbals:
@@ -4429,13 +3434,7 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *fsf_req)
4429 adapter = fsf_req->adapter; 3434 adapter = fsf_req->adapter;
4430 req_q = &adapter->req_q; 3435 req_q = &adapter->req_q;
4431 3436
4432
4433 /* FIXME(debug): remove it later */
4434 sbale = zfcp_qdio_sbale_req(fsf_req); 3437 sbale = zfcp_qdio_sbale_req(fsf_req);
4435 ZFCP_LOG_DEBUG("SBALE0 flags=0x%x\n", sbale[0].flags);
4436 ZFCP_LOG_TRACE("HEX DUMP OF SBALE1 PAYLOAD:\n");
4437 ZFCP_HEX_DUMP(ZFCP_LOG_LEVEL_TRACE, (char *) sbale[1].addr,
4438 sbale[1].length);
4439 3438
4440 /* put allocated FSF request into hash table */ 3439 /* put allocated FSF request into hash table */
4441 spin_lock(&adapter->req_list_lock); 3440 spin_lock(&adapter->req_list_lock);
@@ -4476,5 +3475,3 @@ static int zfcp_fsf_req_send(struct zfcp_fsf_req *fsf_req)
4476 } 3475 }
4477 return retval; 3476 return retval;
4478} 3477}
4479
4480#undef ZFCP_LOG_AREA
diff --git a/drivers/s390/scsi/zfcp_fsf.h b/drivers/s390/scsi/zfcp_fsf.h
index 598eba9baa31..6ce2f1e4b00e 100644
--- a/drivers/s390/scsi/zfcp_fsf.h
+++ b/drivers/s390/scsi/zfcp_fsf.h
@@ -1,22 +1,9 @@
1/* 1/*
2 * This file is part of the zfcp device driver for 2 * zfcp device driver
3 * FCP adapters for IBM System z9 and zSeries.
4 * 3 *
5 * (C) Copyright IBM Corp. 2002, 2006 4 * Interface to the FSF support functions.
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * Copyright IBM Corporation 2002, 2008
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#ifndef FSF_H 9#ifndef FSF_H
@@ -342,6 +329,7 @@ struct fsf_qual_latency_info {
342} __attribute__ ((packed)); 329} __attribute__ ((packed));
343 330
344union fsf_prot_status_qual { 331union fsf_prot_status_qual {
332 u32 word[FSF_PROT_STATUS_QUAL_SIZE / sizeof(u32)];
345 u64 doubleword[FSF_PROT_STATUS_QUAL_SIZE / sizeof(u64)]; 333 u64 doubleword[FSF_PROT_STATUS_QUAL_SIZE / sizeof(u64)];
346 struct fsf_qual_version_error version_error; 334 struct fsf_qual_version_error version_error;
347 struct fsf_qual_sequence_error sequence_error; 335 struct fsf_qual_sequence_error sequence_error;
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c
index 4b0c85acb0f0..a96e5c3b9460 100644
--- a/drivers/s390/scsi/zfcp_scsi.c
+++ b/drivers/s390/scsi/zfcp_scsi.c
@@ -1,26 +1,11 @@
1/* 1/*
2 * This file is part of the zfcp device driver for 2 * zfcp device driver
3 * FCP adapters for IBM System z9 and zSeries.
4 * 3 *
5 * (C) Copyright IBM Corp. 2002, 2006 4 * Interface to Linux SCSI midlayer.
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * Copyright IBM Corporation 2002, 2008
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#define ZFCP_LOG_AREA ZFCP_LOG_AREA_SCSI
23
24#include "zfcp_ext.h" 9#include "zfcp_ext.h"
25#include <asm/atomic.h> 10#include <asm/atomic.h>
26 11
@@ -44,7 +29,7 @@ static struct device_attribute *zfcp_a_stats_attrs[];
44 29
45struct zfcp_data zfcp_data = { 30struct zfcp_data zfcp_data = {
46 .scsi_host_template = { 31 .scsi_host_template = {
47 .name = ZFCP_NAME, 32 .name = "zfcp",
48 .module = THIS_MODULE, 33 .module = THIS_MODULE,
49 .proc_name = "zfcp", 34 .proc_name = "zfcp",
50 .slave_alloc = zfcp_scsi_slave_alloc, 35 .slave_alloc = zfcp_scsi_slave_alloc,
@@ -64,7 +49,6 @@ struct zfcp_data zfcp_data = {
64 .max_sectors = ZFCP_MAX_SECTORS, 49 .max_sectors = ZFCP_MAX_SECTORS,
65 .shost_attrs = zfcp_a_stats_attrs, 50 .shost_attrs = zfcp_a_stats_attrs,
66 }, 51 },
67 .driver_version = ZFCP_VERSION,
68}; 52};
69 53
70/* Find start of Response Information in FCP response unit*/ 54/* Find start of Response Information in FCP response unit*/
@@ -181,16 +165,14 @@ zfcp_scsi_slave_alloc(struct scsi_device *sdp)
181static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt) 165static void zfcp_scsi_slave_destroy(struct scsi_device *sdpnt)
182{ 166{
183 struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata; 167 struct zfcp_unit *unit = (struct zfcp_unit *) sdpnt->hostdata;
184 168 WARN_ON(!unit);
185 if (unit) { 169 if (unit) {
186 atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status); 170 atomic_clear_mask(ZFCP_STATUS_UNIT_REGISTERED, &unit->status);
187 sdpnt->hostdata = NULL; 171 sdpnt->hostdata = NULL;
188 unit->device = NULL; 172 unit->device = NULL;
189 zfcp_erp_unit_failed(unit, 12, NULL); 173 zfcp_erp_unit_failed(unit, 12, NULL);
190 zfcp_unit_put(unit); 174 zfcp_unit_put(unit);
191 } else 175 }
192 ZFCP_LOG_NORMAL("bug: no unit associated with SCSI device at "
193 "address %p\n", sdpnt);
194} 176}
195 177
196/* 178/*
@@ -253,10 +235,6 @@ zfcp_scsi_command_async(struct zfcp_adapter *adapter, struct zfcp_unit *unit,
253 if (unlikely( 235 if (unlikely(
254 atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &unit->status) || 236 atomic_test_mask(ZFCP_STATUS_COMMON_ERP_FAILED, &unit->status) ||
255 !atomic_test_mask(ZFCP_STATUS_COMMON_RUNNING, &unit->status))) { 237 !atomic_test_mask(ZFCP_STATUS_COMMON_RUNNING, &unit->status))) {
256 ZFCP_LOG_DEBUG("stopping SCSI I/O on unit 0x%016Lx on port "
257 "0x%016Lx on adapter %s\n",
258 unit->fcp_lun, unit->port->wwpn,
259 zfcp_get_busid_by_adapter(adapter));
260 zfcp_scsi_command_fail(scpnt, DID_ERROR); 238 zfcp_scsi_command_fail(scpnt, DID_ERROR);
261 goto out; 239 goto out;
262 } 240 }
@@ -264,18 +242,12 @@ zfcp_scsi_command_async(struct zfcp_adapter *adapter, struct zfcp_unit *unit,
264 tmp = zfcp_fsf_send_fcp_command_task(adapter, unit, scpnt, use_timer, 242 tmp = zfcp_fsf_send_fcp_command_task(adapter, unit, scpnt, use_timer,
265 ZFCP_REQ_AUTO_CLEANUP); 243 ZFCP_REQ_AUTO_CLEANUP);
266 if (unlikely(tmp == -EBUSY)) { 244 if (unlikely(tmp == -EBUSY)) {
267 ZFCP_LOG_DEBUG("adapter %s not ready or unit 0x%016Lx "
268 "on port 0x%016Lx in recovery\n",
269 zfcp_get_busid_by_unit(unit),
270 unit->fcp_lun, unit->port->wwpn);
271 zfcp_scsi_command_fail(scpnt, DID_NO_CONNECT); 245 zfcp_scsi_command_fail(scpnt, DID_NO_CONNECT);
272 goto out; 246 goto out;
273 } 247 }
274 248
275 if (unlikely(tmp < 0)) { 249 if (unlikely(tmp < 0))
276 ZFCP_LOG_DEBUG("error: initiation of Send FCP Cmnd failed\n");
277 retval = SCSI_MLQUEUE_HOST_BUSY; 250 retval = SCSI_MLQUEUE_HOST_BUSY;
278 }
279 251
280out: 252out:
281 return retval; 253 return retval;
@@ -394,9 +366,6 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
394 adapter = (struct zfcp_adapter *) scsi_host->hostdata[0]; 366 adapter = (struct zfcp_adapter *) scsi_host->hostdata[0];
395 unit = (struct zfcp_unit *) scpnt->device->hostdata; 367 unit = (struct zfcp_unit *) scpnt->device->hostdata;
396 368
397 ZFCP_LOG_INFO("aborting scsi_cmnd=%p on adapter %s\n",
398 scpnt, zfcp_get_busid_by_adapter(adapter));
399
400 /* avoid race condition between late normal completion and abort */ 369 /* avoid race condition between late normal completion and abort */
401 write_lock_irqsave(&adapter->abort_lock, flags); 370 write_lock_irqsave(&adapter->abort_lock, flags);
402 371
@@ -420,7 +389,6 @@ static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd *scpnt)
420 389
421 fsf_req = zfcp_fsf_abort_fcp_command(old_req_id, adapter, unit, 0); 390 fsf_req = zfcp_fsf_abort_fcp_command(old_req_id, adapter, unit, 0);
422 if (!fsf_req) { 391 if (!fsf_req) {
423 ZFCP_LOG_INFO("error: initiation of Abort FCP Cmnd failed\n");
424 zfcp_scsi_dbf_event_abort("nres", adapter, scpnt, NULL, 392 zfcp_scsi_dbf_event_abort("nres", adapter, scpnt, NULL,
425 old_req_id); 393 old_req_id);
426 retval = FAILED; 394 retval = FAILED;
@@ -485,10 +453,6 @@ zfcp_task_management_function(struct zfcp_unit *unit, u8 tm_flags,
485 fsf_req = zfcp_fsf_send_fcp_command_task_management 453 fsf_req = zfcp_fsf_send_fcp_command_task_management
486 (adapter, unit, tm_flags, 0); 454 (adapter, unit, tm_flags, 0);
487 if (!fsf_req) { 455 if (!fsf_req) {
488 ZFCP_LOG_INFO("error: creation of task management request "
489 "failed for unit 0x%016Lx on port 0x%016Lx on "
490 "adapter %s\n", unit->fcp_lun, unit->port->wwpn,
491 zfcp_get_busid_by_adapter(adapter));
492 zfcp_scsi_dbf_event_devreset("nres", tm_flags, unit, scpnt); 456 zfcp_scsi_dbf_event_devreset("nres", tm_flags, unit, scpnt);
493 retval = -ENOMEM; 457 retval = -ENOMEM;
494 goto out; 458 goto out;
@@ -524,12 +488,6 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt)
524 488
525 unit = (struct zfcp_unit*) scpnt->device->hostdata; 489 unit = (struct zfcp_unit*) scpnt->device->hostdata;
526 adapter = unit->port->adapter; 490 adapter = unit->port->adapter;
527
528 ZFCP_LOG_NORMAL("host reset because of problems with "
529 "unit 0x%016Lx on port 0x%016Lx, adapter %s\n",
530 unit->fcp_lun, unit->port->wwpn,
531 zfcp_get_busid_by_adapter(unit->port->adapter));
532
533 zfcp_erp_adapter_reopen(adapter, 0, 141, scpnt); 491 zfcp_erp_adapter_reopen(adapter, 0, 141, scpnt);
534 zfcp_erp_wait(adapter); 492 zfcp_erp_wait(adapter);
535 493
@@ -549,13 +507,11 @@ zfcp_adapter_scsi_register(struct zfcp_adapter *adapter)
549 adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template, 507 adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template,
550 sizeof (struct zfcp_adapter *)); 508 sizeof (struct zfcp_adapter *));
551 if (!adapter->scsi_host) { 509 if (!adapter->scsi_host) {
552 ZFCP_LOG_NORMAL("error: registration with SCSI stack failed " 510 dev_err(&adapter->ccw_device->dev,
553 "for adapter %s ", 511 "registration with SCSI stack failed.");
554 zfcp_get_busid_by_adapter(adapter));
555 retval = -EIO; 512 retval = -EIO;
556 goto out; 513 goto out;
557 } 514 }
558 ZFCP_LOG_DEBUG("host registered, scsi_host=%p\n", adapter->scsi_host);
559 515
560 /* tell the SCSI stack some characteristics of this adapter */ 516 /* tell the SCSI stack some characteristics of this adapter */
561 adapter->scsi_host->max_id = 1; 517 adapter->scsi_host->max_id = 1;
@@ -987,5 +943,3 @@ static struct device_attribute *zfcp_a_stats_attrs[] = {
987 &dev_attr_seconds_active, 943 &dev_attr_seconds_active,
988 NULL 944 NULL
989}; 945};
990
991#undef ZFCP_LOG_AREA
diff --git a/drivers/s390/scsi/zfcp_sysfs_adapter.c b/drivers/s390/scsi/zfcp_sysfs_adapter.c
index ccbba4dd3a77..1f2a8c21b731 100644
--- a/drivers/s390/scsi/zfcp_sysfs_adapter.c
+++ b/drivers/s390/scsi/zfcp_sysfs_adapter.c
@@ -1,28 +1,13 @@
1/* 1/*
2 * This file is part of the zfcp device driver for 2 * zfcp device driver
3 * FCP adapters for IBM System z9 and zSeries.
4 * 3 *
5 * (C) Copyright IBM Corp. 2002, 2006 4 * sysfs attributes for CCW device.
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * Copyright IBM Corporation 2002, 2008
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#include "zfcp_ext.h" 9#include "zfcp_ext.h"
23 10
24#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
25
26/** 11/**
27 * ZFCP_DEFINE_ADAPTER_ATTR 12 * ZFCP_DEFINE_ADAPTER_ATTR
28 * @_name: name of show attribute 13 * @_name: name of show attribute
@@ -266,5 +251,3 @@ zfcp_sysfs_adapter_remove_files(struct device *dev)
266{ 251{
267 sysfs_remove_group(&dev->kobj, &zfcp_adapter_attr_group); 252 sysfs_remove_group(&dev->kobj, &zfcp_adapter_attr_group);
268} 253}
269
270#undef ZFCP_LOG_AREA
diff --git a/drivers/s390/scsi/zfcp_sysfs_driver.c b/drivers/s390/scsi/zfcp_sysfs_driver.c
deleted file mode 100644
index 651edd58906a..000000000000
--- a/drivers/s390/scsi/zfcp_sysfs_driver.c
+++ /dev/null
@@ -1,106 +0,0 @@
1/*
2 * This file is part of the zfcp device driver for
3 * FCP adapters for IBM System z9 and zSeries.
4 *
5 * (C) Copyright IBM Corp. 2002, 2006
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21
22#include "zfcp_ext.h"
23
24#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
25
26/**
27 * ZFCP_DEFINE_DRIVER_ATTR - define for all loglevels sysfs attributes
28 * @_name: name of attribute
29 * @_define: name of ZFCP loglevel define
30 *
31 * Generates store function for a sysfs loglevel attribute of zfcp driver.
32 */
33#define ZFCP_DEFINE_DRIVER_ATTR(_name, _define) \
34static ssize_t zfcp_sysfs_loglevel_##_name##_store(struct device_driver *drv, \
35 const char *buf, \
36 size_t count) \
37{ \
38 unsigned int loglevel; \
39 unsigned int new_loglevel; \
40 char *endp; \
41 \
42 new_loglevel = simple_strtoul(buf, &endp, 0); \
43 if ((endp + 1) < (buf + count)) \
44 return -EINVAL; \
45 if (new_loglevel > 3) \
46 return -EINVAL; \
47 down(&zfcp_data.config_sema); \
48 loglevel = atomic_read(&zfcp_data.loglevel); \
49 loglevel &= ~((unsigned int) 0xf << (ZFCP_LOG_AREA_##_define << 2)); \
50 loglevel |= new_loglevel << (ZFCP_LOG_AREA_##_define << 2); \
51 atomic_set(&zfcp_data.loglevel, loglevel); \
52 up(&zfcp_data.config_sema); \
53 return count; \
54} \
55 \
56static ssize_t zfcp_sysfs_loglevel_##_name##_show(struct device_driver *dev, \
57 char *buf) \
58{ \
59 return sprintf(buf,"%d\n", (unsigned int) \
60 ZFCP_GET_LOG_VALUE(ZFCP_LOG_AREA_##_define)); \
61} \
62 \
63static DRIVER_ATTR(loglevel_##_name, S_IWUSR | S_IRUGO, \
64 zfcp_sysfs_loglevel_##_name##_show, \
65 zfcp_sysfs_loglevel_##_name##_store);
66
67ZFCP_DEFINE_DRIVER_ATTR(other, OTHER);
68ZFCP_DEFINE_DRIVER_ATTR(scsi, SCSI);
69ZFCP_DEFINE_DRIVER_ATTR(fsf, FSF);
70ZFCP_DEFINE_DRIVER_ATTR(config, CONFIG);
71ZFCP_DEFINE_DRIVER_ATTR(cio, CIO);
72ZFCP_DEFINE_DRIVER_ATTR(qdio, QDIO);
73ZFCP_DEFINE_DRIVER_ATTR(erp, ERP);
74ZFCP_DEFINE_DRIVER_ATTR(fc, FC);
75
76static ssize_t zfcp_sysfs_version_show(struct device_driver *dev,
77 char *buf)
78{
79 return sprintf(buf, "%s\n", zfcp_data.driver_version);
80}
81
82static DRIVER_ATTR(version, S_IRUGO, zfcp_sysfs_version_show, NULL);
83
84static struct attribute *zfcp_driver_attrs[] = {
85 &driver_attr_loglevel_other.attr,
86 &driver_attr_loglevel_scsi.attr,
87 &driver_attr_loglevel_fsf.attr,
88 &driver_attr_loglevel_config.attr,
89 &driver_attr_loglevel_cio.attr,
90 &driver_attr_loglevel_qdio.attr,
91 &driver_attr_loglevel_erp.attr,
92 &driver_attr_loglevel_fc.attr,
93 &driver_attr_version.attr,
94 NULL
95};
96
97static struct attribute_group zfcp_driver_attr_group = {
98 .attrs = zfcp_driver_attrs,
99};
100
101struct attribute_group *zfcp_driver_attr_groups[] = {
102 &zfcp_driver_attr_group,
103 NULL,
104};
105
106#undef ZFCP_LOG_AREA
diff --git a/drivers/s390/scsi/zfcp_sysfs_port.c b/drivers/s390/scsi/zfcp_sysfs_port.c
index 703c1b5cb602..438675f2978e 100644
--- a/drivers/s390/scsi/zfcp_sysfs_port.c
+++ b/drivers/s390/scsi/zfcp_sysfs_port.c
@@ -1,28 +1,13 @@
1/* 1/*
2 * This file is part of the zfcp device driver for 2 * zfcp device driver
3 * FCP adapters for IBM System z9 and zSeries.
4 * 3 *
5 * (C) Copyright IBM Corp. 2002, 2006 4 * sysfs attributes for zfcp port.
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * Copyright IBM Corporation 2002, 2008
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#include "zfcp_ext.h" 9#include "zfcp_ext.h"
23 10
24#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
25
26/** 11/**
27 * zfcp_sysfs_port_release - gets called when a struct device port is released 12 * zfcp_sysfs_port_release - gets called when a struct device port is released
28 * @dev: pointer to belonging device 13 * @dev: pointer to belonging device
@@ -291,5 +276,3 @@ zfcp_sysfs_port_remove_files(struct device *dev, u32 flags)
291 if (!(flags & ZFCP_STATUS_PORT_WKA)) 276 if (!(flags & ZFCP_STATUS_PORT_WKA))
292 sysfs_remove_group(&dev->kobj, &zfcp_port_no_ns_attr_group); 277 sysfs_remove_group(&dev->kobj, &zfcp_port_no_ns_attr_group);
293} 278}
294
295#undef ZFCP_LOG_AREA
diff --git a/drivers/s390/scsi/zfcp_sysfs_unit.c b/drivers/s390/scsi/zfcp_sysfs_unit.c
index 80fb2c2cf48a..587d9e3e12d2 100644
--- a/drivers/s390/scsi/zfcp_sysfs_unit.c
+++ b/drivers/s390/scsi/zfcp_sysfs_unit.c
@@ -1,28 +1,13 @@
1/* 1/*
2 * This file is part of the zfcp device driver for 2 * zfcp device driver
3 * FCP adapters for IBM System z9 and zSeries.
4 * 3 *
5 * (C) Copyright IBM Corp. 2002, 2006 4 * sysfs interface for zfcp unit.
6 * 5 *
7 * This program is free software; you can redistribute it and/or modify 6 * Copyright IBM Corporation 2002, 2008
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
10 * any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 7 */
21 8
22#include "zfcp_ext.h" 9#include "zfcp_ext.h"
23 10
24#define ZFCP_LOG_AREA ZFCP_LOG_AREA_CONFIG
25
26/** 11/**
27 * zfcp_sysfs_unit_release - gets called when a struct device unit is released 12 * zfcp_sysfs_unit_release - gets called when a struct device unit is released
28 * @dev: pointer to belonging device 13 * @dev: pointer to belonging device
@@ -163,5 +148,3 @@ zfcp_sysfs_unit_remove_files(struct device *dev)
163{ 148{
164 sysfs_remove_group(&dev->kobj, &zfcp_unit_attr_group); 149 sysfs_remove_group(&dev->kobj, &zfcp_unit_attr_group);
165} 150}
166
167#undef ZFCP_LOG_AREA