aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-12-30 20:43:10 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2008-12-30 20:43:10 -0500
commit590cf28580c999c8ba70dc39b40bab09d69e2630 (patch)
tree22b9aa4b148bea8a310b760521d1032eef7d743f /drivers/s390
parentf54a6ec0fd85002d94d05b4bb679508eeb066683 (diff)
parentfb5edd020fa0fbe991f4a473611ad530d2237425 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (104 commits) [SCSI] fcoe: fix configuration problems [SCSI] cxgb3i: fix select/depend problem [SCSI] fcoe: fix incorrect use of struct module [SCSI] cxgb3i: remove use of skb->sp [SCSI] cxgb3i: Add cxgb3i iSCSI driver. [SCSI] zfcp: Remove unnecessary warning message [SCSI] zfcp: Add support for unchained FSF requests [SCSI] zfcp: Remove busid macro [SCSI] zfcp: remove DID_DID flag [SCSI] zfcp: Simplify mask lookups for incoming RSCNs [SCSI] zfcp: Remove initial device data from zfcp_data [SCSI] zfcp: fix compile warning [SCSI] zfcp: Remove adapter list [SCSI] zfcp: Simplify SBAL allocation to fix sparse warnings [SCSI] zfcp: register with SCSI layer on ccw registration [SCSI] zfcp: Fix message line break [SCSI] qla2xxx: changes in multiq code [SCSI] eata: fix the data buffer accessors conversion regression [SCSI] ibmvfc: Improve async event handling [SCSI] lpfc : correct printk types on PPC compiles ...
Diffstat (limited to 'drivers/s390')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c110
-rw-r--r--drivers/s390/scsi/zfcp_ccw.c6
-rw-r--r--drivers/s390/scsi/zfcp_cfdc.c17
-rw-r--r--drivers/s390/scsi/zfcp_dbf.c12
-rw-r--r--drivers/s390/scsi/zfcp_dbf.h1
-rw-r--r--drivers/s390/scsi/zfcp_def.h32
-rw-r--r--drivers/s390/scsi/zfcp_erp.c10
-rw-r--r--drivers/s390/scsi/zfcp_fc.c88
-rw-r--r--drivers/s390/scsi/zfcp_fsf.c77
-rw-r--r--drivers/s390/scsi/zfcp_fsf.h2
-rw-r--r--drivers/s390/scsi/zfcp_qdio.c4
11 files changed, 157 insertions, 202 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c
index e529b55b3ce9..8af7dfbe022c 100644
--- a/drivers/s390/scsi/zfcp_aux.c
+++ b/drivers/s390/scsi/zfcp_aux.c
@@ -34,13 +34,12 @@
34 34
35#define ZFCP_BUS_ID_SIZE 20 35#define ZFCP_BUS_ID_SIZE 20
36 36
37static char *device;
38
39MODULE_AUTHOR("IBM Deutschland Entwicklung GmbH - linux390@de.ibm.com"); 37MODULE_AUTHOR("IBM Deutschland Entwicklung GmbH - linux390@de.ibm.com");
40MODULE_DESCRIPTION("FCP HBA driver"); 38MODULE_DESCRIPTION("FCP HBA driver");
41MODULE_LICENSE("GPL"); 39MODULE_LICENSE("GPL");
42 40
43module_param(device, charp, 0400); 41static char *init_device;
42module_param_named(device, init_device, charp, 0400);
44MODULE_PARM_DESC(device, "specify initial device"); 43MODULE_PARM_DESC(device, "specify initial device");
45 44
46static int zfcp_reqlist_alloc(struct zfcp_adapter *adapter) 45static int zfcp_reqlist_alloc(struct zfcp_adapter *adapter)
@@ -73,46 +72,7 @@ int zfcp_reqlist_isempty(struct zfcp_adapter *adapter)
73 return 1; 72 return 1;
74} 73}
75 74
76static int __init zfcp_device_setup(char *devstr) 75static void __init zfcp_init_device_configure(char *busid, u64 wwpn, u64 lun)
77{
78 char *token;
79 char *str;
80
81 if (!devstr)
82 return 0;
83
84 /* duplicate devstr and keep the original for sysfs presentation*/
85 str = kmalloc(strlen(devstr) + 1, GFP_KERNEL);
86 if (!str)
87 return 0;
88
89 strcpy(str, devstr);
90
91 token = strsep(&str, ",");
92 if (!token || strlen(token) >= ZFCP_BUS_ID_SIZE)
93 goto err_out;
94 strncpy(zfcp_data.init_busid, token, ZFCP_BUS_ID_SIZE);
95
96 token = strsep(&str, ",");
97 if (!token || strict_strtoull(token, 0,
98 (unsigned long long *) &zfcp_data.init_wwpn))
99 goto err_out;
100
101 token = strsep(&str, ",");
102 if (!token || strict_strtoull(token, 0,
103 (unsigned long long *) &zfcp_data.init_fcp_lun))
104 goto err_out;
105
106 kfree(str);
107 return 1;
108
109 err_out:
110 kfree(str);
111 pr_err("%s is not a valid SCSI device\n", devstr);
112 return 0;
113}
114
115static void __init zfcp_init_device_configure(void)
116{ 76{
117 struct zfcp_adapter *adapter; 77 struct zfcp_adapter *adapter;
118 struct zfcp_port *port; 78 struct zfcp_port *port;
@@ -120,17 +80,17 @@ static void __init zfcp_init_device_configure(void)
120 80
121 down(&zfcp_data.config_sema); 81 down(&zfcp_data.config_sema);
122 read_lock_irq(&zfcp_data.config_lock); 82 read_lock_irq(&zfcp_data.config_lock);
123 adapter = zfcp_get_adapter_by_busid(zfcp_data.init_busid); 83 adapter = zfcp_get_adapter_by_busid(busid);
124 if (adapter) 84 if (adapter)
125 zfcp_adapter_get(adapter); 85 zfcp_adapter_get(adapter);
126 read_unlock_irq(&zfcp_data.config_lock); 86 read_unlock_irq(&zfcp_data.config_lock);
127 87
128 if (!adapter) 88 if (!adapter)
129 goto out_adapter; 89 goto out_adapter;
130 port = zfcp_port_enqueue(adapter, zfcp_data.init_wwpn, 0, 0); 90 port = zfcp_port_enqueue(adapter, wwpn, 0, 0);
131 if (IS_ERR(port)) 91 if (IS_ERR(port))
132 goto out_port; 92 goto out_port;
133 unit = zfcp_unit_enqueue(port, zfcp_data.init_fcp_lun); 93 unit = zfcp_unit_enqueue(port, lun);
134 if (IS_ERR(unit)) 94 if (IS_ERR(unit))
135 goto out_unit; 95 goto out_unit;
136 up(&zfcp_data.config_sema); 96 up(&zfcp_data.config_sema);
@@ -160,6 +120,42 @@ static struct kmem_cache *zfcp_cache_create(int size, char *name)
160 return kmem_cache_create(name , size, align, 0, NULL); 120 return kmem_cache_create(name , size, align, 0, NULL);
161} 121}
162 122
123static void __init zfcp_init_device_setup(char *devstr)
124{
125 char *token;
126 char *str;
127 char busid[ZFCP_BUS_ID_SIZE];
128 u64 wwpn, lun;
129
130 /* duplicate devstr and keep the original for sysfs presentation*/
131 str = kmalloc(strlen(devstr) + 1, GFP_KERNEL);
132 if (!str)
133 return;
134
135 strcpy(str, devstr);
136
137 token = strsep(&str, ",");
138 if (!token || strlen(token) >= ZFCP_BUS_ID_SIZE)
139 goto err_out;
140 strncpy(busid, token, ZFCP_BUS_ID_SIZE);
141
142 token = strsep(&str, ",");
143 if (!token || strict_strtoull(token, 0, (unsigned long long *) &wwpn))
144 goto err_out;
145
146 token = strsep(&str, ",");
147 if (!token || strict_strtoull(token, 0, (unsigned long long *) &lun))
148 goto err_out;
149
150 kfree(str);
151 zfcp_init_device_configure(busid, wwpn, lun);
152 return;
153
154 err_out:
155 kfree(str);
156 pr_err("%s is not a valid SCSI device\n", devstr);
157}
158
163static int __init zfcp_module_init(void) 159static int __init zfcp_module_init(void)
164{ 160{
165 int retval = -ENOMEM; 161 int retval = -ENOMEM;
@@ -181,7 +177,6 @@ static int __init zfcp_module_init(void)
181 177
182 zfcp_data.work_queue = create_singlethread_workqueue("zfcp_wq"); 178 zfcp_data.work_queue = create_singlethread_workqueue("zfcp_wq");
183 179
184 INIT_LIST_HEAD(&zfcp_data.adapter_list_head);
185 sema_init(&zfcp_data.config_sema, 1); 180 sema_init(&zfcp_data.config_sema, 1);
186 rwlock_init(&zfcp_data.config_lock); 181 rwlock_init(&zfcp_data.config_lock);
187 182
@@ -203,10 +198,9 @@ static int __init zfcp_module_init(void)
203 goto out_ccw_register; 198 goto out_ccw_register;
204 } 199 }
205 200
206 if (zfcp_device_setup(device)) 201 if (init_device)
207 zfcp_init_device_configure(); 202 zfcp_init_device_setup(init_device);
208 203 return 0;
209 goto out;
210 204
211out_ccw_register: 205out_ccw_register:
212 misc_deregister(&zfcp_cfdc_misc); 206 misc_deregister(&zfcp_cfdc_misc);
@@ -527,14 +521,11 @@ int zfcp_adapter_enqueue(struct ccw_device *ccw_device)
527 &zfcp_sysfs_adapter_attrs)) 521 &zfcp_sysfs_adapter_attrs))
528 goto sysfs_failed; 522 goto sysfs_failed;
529 523
530 write_lock_irq(&zfcp_data.config_lock);
531 atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status); 524 atomic_clear_mask(ZFCP_STATUS_COMMON_REMOVE, &adapter->status);
532 list_add_tail(&adapter->list, &zfcp_data.adapter_list_head);
533 write_unlock_irq(&zfcp_data.config_lock);
534
535 zfcp_fc_nameserver_init(adapter); 525 zfcp_fc_nameserver_init(adapter);
536 526
537 return 0; 527 if (!zfcp_adapter_scsi_register(adapter))
528 return 0;
538 529
539sysfs_failed: 530sysfs_failed:
540 zfcp_adapter_debug_unregister(adapter); 531 zfcp_adapter_debug_unregister(adapter);
@@ -573,14 +564,7 @@ void zfcp_adapter_dequeue(struct zfcp_adapter *adapter)
573 return; 564 return;
574 565
575 zfcp_adapter_debug_unregister(adapter); 566 zfcp_adapter_debug_unregister(adapter);
576
577 /* remove specified adapter data structure from list */
578 write_lock_irq(&zfcp_data.config_lock);
579 list_del(&adapter->list);
580 write_unlock_irq(&zfcp_data.config_lock);
581
582 zfcp_qdio_free(adapter); 567 zfcp_qdio_free(adapter);
583
584 zfcp_free_low_mem_buffers(adapter); 568 zfcp_free_low_mem_buffers(adapter);
585 kfree(adapter->req_list); 569 kfree(adapter->req_list);
586 kfree(adapter->fc_stats); 570 kfree(adapter->fc_stats);
diff --git a/drivers/s390/scsi/zfcp_ccw.c b/drivers/s390/scsi/zfcp_ccw.c
index 728147131e1d..285881f07648 100644
--- a/drivers/s390/scsi/zfcp_ccw.c
+++ b/drivers/s390/scsi/zfcp_ccw.c
@@ -106,10 +106,6 @@ static int zfcp_ccw_set_online(struct ccw_device *ccw_device)
106 if (retval) 106 if (retval)
107 goto out; 107 goto out;
108 108
109 retval = zfcp_adapter_scsi_register(adapter);
110 if (retval)
111 goto out_scsi_register;
112
113 /* initialize request counter */ 109 /* initialize request counter */
114 BUG_ON(!zfcp_reqlist_isempty(adapter)); 110 BUG_ON(!zfcp_reqlist_isempty(adapter));
115 adapter->req_no = 0; 111 adapter->req_no = 0;
@@ -123,8 +119,6 @@ static int zfcp_ccw_set_online(struct ccw_device *ccw_device)
123 flush_work(&adapter->scan_work); 119 flush_work(&adapter->scan_work);
124 return 0; 120 return 0;
125 121
126 out_scsi_register:
127 zfcp_erp_thread_kill(adapter);
128 out: 122 out:
129 up(&zfcp_data.config_sema); 123 up(&zfcp_data.config_sema);
130 return retval; 124 return retval;
diff --git a/drivers/s390/scsi/zfcp_cfdc.c b/drivers/s390/scsi/zfcp_cfdc.c
index f1a7518e67ed..10cbfd172a28 100644
--- a/drivers/s390/scsi/zfcp_cfdc.c
+++ b/drivers/s390/scsi/zfcp_cfdc.c
@@ -85,20 +85,9 @@ static int zfcp_cfdc_copy_to_user(void __user *user_buffer,
85 85
86static struct zfcp_adapter *zfcp_cfdc_get_adapter(u32 devno) 86static struct zfcp_adapter *zfcp_cfdc_get_adapter(u32 devno)
87{ 87{
88 struct zfcp_adapter *adapter = NULL, *cur_adapter; 88 char busid[9];
89 struct ccw_dev_id dev_id; 89 snprintf(busid, sizeof(busid), "0.0.%04x", devno);
90 90 return zfcp_get_adapter_by_busid(busid);
91 read_lock_irq(&zfcp_data.config_lock);
92 list_for_each_entry(cur_adapter, &zfcp_data.adapter_list_head, list) {
93 ccw_device_get_id(cur_adapter->ccw_device, &dev_id);
94 if (dev_id.devno == devno) {
95 adapter = cur_adapter;
96 zfcp_adapter_get(adapter);
97 break;
98 }
99 }
100 read_unlock_irq(&zfcp_data.config_lock);
101 return adapter;
102} 91}
103 92
104static int zfcp_cfdc_set_fsf(struct zfcp_fsf_cfdc *fsf_cfdc, int command) 93static int zfcp_cfdc_set_fsf(struct zfcp_fsf_cfdc *fsf_cfdc, int command)
diff --git a/drivers/s390/scsi/zfcp_dbf.c b/drivers/s390/scsi/zfcp_dbf.c
index 735d675623f8..cb6df609953e 100644
--- a/drivers/s390/scsi/zfcp_dbf.c
+++ b/drivers/s390/scsi/zfcp_dbf.c
@@ -522,7 +522,7 @@ static const char *zfcp_rec_dbf_ids[] = {
522 [29] = "link down", 522 [29] = "link down",
523 [30] = "link up status read", 523 [30] = "link up status read",
524 [31] = "open port failed", 524 [31] = "open port failed",
525 [32] = "open port failed", 525 [32] = "",
526 [33] = "close port", 526 [33] = "close port",
527 [34] = "open unit failed", 527 [34] = "open unit failed",
528 [35] = "exclusive open unit failed", 528 [35] = "exclusive open unit failed",
@@ -936,6 +936,7 @@ void zfcp_san_dbf_event_ct_response(struct zfcp_fsf_req *fsf_req)
936 rct->reason_code = hdr->reason_code; 936 rct->reason_code = hdr->reason_code;
937 rct->expl = hdr->reason_code_expl; 937 rct->expl = hdr->reason_code_expl;
938 rct->vendor_unique = hdr->vendor_unique; 938 rct->vendor_unique = hdr->vendor_unique;
939 rct->max_res_size = hdr->max_res_size;
939 rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr), 940 rct->len = min((int)ct->resp->length - (int)sizeof(struct ct_hdr),
940 ZFCP_DBF_SAN_MAX_PAYLOAD); 941 ZFCP_DBF_SAN_MAX_PAYLOAD);
941 debug_event(adapter->san_dbf, level, r, sizeof(*r)); 942 debug_event(adapter->san_dbf, level, r, sizeof(*r));
@@ -1043,6 +1044,7 @@ static int zfcp_san_dbf_view_format(debug_info_t *id, struct debug_view *view,
1043 zfcp_dbf_out(&p, "reason_code", "0x%02x", ct->reason_code); 1044 zfcp_dbf_out(&p, "reason_code", "0x%02x", ct->reason_code);
1044 zfcp_dbf_out(&p, "reason_code_expl", "0x%02x", ct->expl); 1045 zfcp_dbf_out(&p, "reason_code_expl", "0x%02x", ct->expl);
1045 zfcp_dbf_out(&p, "vendor_unique", "0x%02x", ct->vendor_unique); 1046 zfcp_dbf_out(&p, "vendor_unique", "0x%02x", ct->vendor_unique);
1047 zfcp_dbf_out(&p, "max_res_size", "0x%04x", ct->max_res_size);
1046 } else if (strncmp(r->tag, "oels", ZFCP_DBF_TAG_SIZE) == 0 || 1048 } else if (strncmp(r->tag, "oels", ZFCP_DBF_TAG_SIZE) == 0 ||
1047 strncmp(r->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 || 1049 strncmp(r->tag, "rels", ZFCP_DBF_TAG_SIZE) == 0 ||
1048 strncmp(r->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) { 1050 strncmp(r->tag, "iels", ZFCP_DBF_TAG_SIZE) == 0) {
@@ -1249,7 +1251,7 @@ int zfcp_adapter_debug_register(struct zfcp_adapter *adapter)
1249 char dbf_name[DEBUG_MAX_NAME_LEN]; 1251 char dbf_name[DEBUG_MAX_NAME_LEN];
1250 1252
1251 /* debug feature area which records recovery activity */ 1253 /* debug feature area which records recovery activity */
1252 sprintf(dbf_name, "zfcp_%s_rec", zfcp_get_busid_by_adapter(adapter)); 1254 sprintf(dbf_name, "zfcp_%s_rec", dev_name(&adapter->ccw_device->dev));
1253 adapter->rec_dbf = debug_register(dbf_name, dbfsize, 1, 1255 adapter->rec_dbf = debug_register(dbf_name, dbfsize, 1,
1254 sizeof(struct zfcp_rec_dbf_record)); 1256 sizeof(struct zfcp_rec_dbf_record));
1255 if (!adapter->rec_dbf) 1257 if (!adapter->rec_dbf)
@@ -1259,7 +1261,7 @@ int zfcp_adapter_debug_register(struct zfcp_adapter *adapter)
1259 debug_set_level(adapter->rec_dbf, 3); 1261 debug_set_level(adapter->rec_dbf, 3);
1260 1262
1261 /* debug feature area which records HBA (FSF and QDIO) conditions */ 1263 /* debug feature area which records HBA (FSF and QDIO) conditions */
1262 sprintf(dbf_name, "zfcp_%s_hba", zfcp_get_busid_by_adapter(adapter)); 1264 sprintf(dbf_name, "zfcp_%s_hba", dev_name(&adapter->ccw_device->dev));
1263 adapter->hba_dbf = debug_register(dbf_name, dbfsize, 1, 1265 adapter->hba_dbf = debug_register(dbf_name, dbfsize, 1,
1264 sizeof(struct zfcp_hba_dbf_record)); 1266 sizeof(struct zfcp_hba_dbf_record));
1265 if (!adapter->hba_dbf) 1267 if (!adapter->hba_dbf)
@@ -1269,7 +1271,7 @@ int zfcp_adapter_debug_register(struct zfcp_adapter *adapter)
1269 debug_set_level(adapter->hba_dbf, 3); 1271 debug_set_level(adapter->hba_dbf, 3);
1270 1272
1271 /* debug feature area which records SAN command failures and recovery */ 1273 /* debug feature area which records SAN command failures and recovery */
1272 sprintf(dbf_name, "zfcp_%s_san", zfcp_get_busid_by_adapter(adapter)); 1274 sprintf(dbf_name, "zfcp_%s_san", dev_name(&adapter->ccw_device->dev));
1273 adapter->san_dbf = debug_register(dbf_name, dbfsize, 1, 1275 adapter->san_dbf = debug_register(dbf_name, dbfsize, 1,
1274 sizeof(struct zfcp_san_dbf_record)); 1276 sizeof(struct zfcp_san_dbf_record));
1275 if (!adapter->san_dbf) 1277 if (!adapter->san_dbf)
@@ -1279,7 +1281,7 @@ int zfcp_adapter_debug_register(struct zfcp_adapter *adapter)
1279 debug_set_level(adapter->san_dbf, 6); 1281 debug_set_level(adapter->san_dbf, 6);
1280 1282
1281 /* debug feature area which records SCSI command failures and recovery */ 1283 /* debug feature area which records SCSI command failures and recovery */
1282 sprintf(dbf_name, "zfcp_%s_scsi", zfcp_get_busid_by_adapter(adapter)); 1284 sprintf(dbf_name, "zfcp_%s_scsi", dev_name(&adapter->ccw_device->dev));
1283 adapter->scsi_dbf = debug_register(dbf_name, dbfsize, 1, 1285 adapter->scsi_dbf = debug_register(dbf_name, dbfsize, 1,
1284 sizeof(struct zfcp_scsi_dbf_record)); 1286 sizeof(struct zfcp_scsi_dbf_record));
1285 if (!adapter->scsi_dbf) 1287 if (!adapter->scsi_dbf)
diff --git a/drivers/s390/scsi/zfcp_dbf.h b/drivers/s390/scsi/zfcp_dbf.h
index 5d6b2dff855b..74998ff88e57 100644
--- a/drivers/s390/scsi/zfcp_dbf.h
+++ b/drivers/s390/scsi/zfcp_dbf.h
@@ -171,6 +171,7 @@ struct zfcp_san_dbf_record_ct_response {
171 u8 reason_code; 171 u8 reason_code;
172 u8 expl; 172 u8 expl;
173 u8 vendor_unique; 173 u8 vendor_unique;
174 u16 max_res_size;
174 u32 len; 175 u32 len;
175} __attribute__ ((packed)); 176} __attribute__ ((packed));
176 177
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h
index e19e46ae4a68..510662783a6f 100644
--- a/drivers/s390/scsi/zfcp_def.h
+++ b/drivers/s390/scsi/zfcp_def.h
@@ -159,20 +159,6 @@ struct fcp_rscn_element {
159 u32 nport_did:24; 159 u32 nport_did:24;
160} __attribute__((packed)); 160} __attribute__((packed));
161 161
162#define ZFCP_PORT_ADDRESS 0x0
163#define ZFCP_AREA_ADDRESS 0x1
164#define ZFCP_DOMAIN_ADDRESS 0x2
165#define ZFCP_FABRIC_ADDRESS 0x3
166
167#define ZFCP_PORTS_RANGE_PORT 0xFFFFFF
168#define ZFCP_PORTS_RANGE_AREA 0xFFFF00
169#define ZFCP_PORTS_RANGE_DOMAIN 0xFF0000
170#define ZFCP_PORTS_RANGE_FABRIC 0x000000
171
172#define ZFCP_NO_PORTS_PER_AREA 0x100
173#define ZFCP_NO_PORTS_PER_DOMAIN 0x10000
174#define ZFCP_NO_PORTS_PER_FABRIC 0x1000000
175
176/* see fc-ph */ 162/* see fc-ph */
177struct fcp_logo { 163struct fcp_logo {
178 u32 command; 164 u32 command;
@@ -211,7 +197,6 @@ struct zfcp_ls_adisc {
211#define ZFCP_CT_UNABLE_TO_PERFORM_CMD 0x09 197#define ZFCP_CT_UNABLE_TO_PERFORM_CMD 0x09
212#define ZFCP_CT_GID_PN 0x0121 198#define ZFCP_CT_GID_PN 0x0121
213#define ZFCP_CT_GPN_FT 0x0172 199#define ZFCP_CT_GPN_FT 0x0172
214#define ZFCP_CT_MAX_SIZE 0x1020
215#define ZFCP_CT_ACCEPT 0x8002 200#define ZFCP_CT_ACCEPT 0x8002
216#define ZFCP_CT_REJECT 0x8001 201#define ZFCP_CT_REJECT 0x8001
217 202
@@ -258,7 +243,6 @@ struct zfcp_ls_adisc {
258 243
259/* remote port status */ 244/* remote port status */
260#define ZFCP_STATUS_PORT_PHYS_OPEN 0x00000001 245#define ZFCP_STATUS_PORT_PHYS_OPEN 0x00000001
261#define ZFCP_STATUS_PORT_DID_DID 0x00000002
262#define ZFCP_STATUS_PORT_PHYS_CLOSING 0x00000004 246#define ZFCP_STATUS_PORT_PHYS_CLOSING 0x00000004
263#define ZFCP_STATUS_PORT_NO_WWPN 0x00000008 247#define ZFCP_STATUS_PORT_NO_WWPN 0x00000008
264#define ZFCP_STATUS_PORT_INVALID_WWPN 0x00000020 248#define ZFCP_STATUS_PORT_INVALID_WWPN 0x00000020
@@ -340,8 +324,6 @@ struct ct_iu_gid_pn_resp {
340 * @wka_port: port where the request is sent to 324 * @wka_port: port where the request is sent to
341 * @req: scatter-gather list for request 325 * @req: scatter-gather list for request
342 * @resp: scatter-gather list for response 326 * @resp: scatter-gather list for response
343 * @req_count: number of elements in request scatter-gather list
344 * @resp_count: number of elements in response scatter-gather list
345 * @handler: handler function (called for response to the request) 327 * @handler: handler function (called for response to the request)
346 * @handler_data: data passed to handler function 328 * @handler_data: data passed to handler function
347 * @timeout: FSF timeout for this request 329 * @timeout: FSF timeout for this request
@@ -352,8 +334,6 @@ struct zfcp_send_ct {
352 struct zfcp_wka_port *wka_port; 334 struct zfcp_wka_port *wka_port;
353 struct scatterlist *req; 335 struct scatterlist *req;
354 struct scatterlist *resp; 336 struct scatterlist *resp;
355 unsigned int req_count;
356 unsigned int resp_count;
357 void (*handler)(unsigned long); 337 void (*handler)(unsigned long);
358 unsigned long handler_data; 338 unsigned long handler_data;
359 int timeout; 339 int timeout;
@@ -378,8 +358,6 @@ struct zfcp_gid_pn_data {
378 * @d_id: destiniation id of port where request is sent to 358 * @d_id: destiniation id of port where request is sent to
379 * @req: scatter-gather list for request 359 * @req: scatter-gather list for request
380 * @resp: scatter-gather list for response 360 * @resp: scatter-gather list for response
381 * @req_count: number of elements in request scatter-gather list
382 * @resp_count: number of elements in response scatter-gather list
383 * @handler: handler function (called for response to the request) 361 * @handler: handler function (called for response to the request)
384 * @handler_data: data passed to handler function 362 * @handler_data: data passed to handler function
385 * @completion: completion for synchronization purposes 363 * @completion: completion for synchronization purposes
@@ -392,8 +370,6 @@ struct zfcp_send_els {
392 u32 d_id; 370 u32 d_id;
393 struct scatterlist *req; 371 struct scatterlist *req;
394 struct scatterlist *resp; 372 struct scatterlist *resp;
395 unsigned int req_count;
396 unsigned int resp_count;
397 void (*handler)(unsigned long); 373 void (*handler)(unsigned long);
398 unsigned long handler_data; 374 unsigned long handler_data;
399 struct completion *completion; 375 struct completion *completion;
@@ -451,7 +427,6 @@ struct zfcp_latencies {
451}; 427};
452 428
453struct zfcp_adapter { 429struct zfcp_adapter {
454 struct list_head list; /* list of adapters */
455 atomic_t refcount; /* reference count */ 430 atomic_t refcount; /* reference count */
456 wait_queue_head_t remove_wq; /* can be used to wait for 431 wait_queue_head_t remove_wq; /* can be used to wait for
457 refcount drop to zero */ 432 refcount drop to zero */
@@ -593,16 +568,11 @@ struct zfcp_fsf_req {
593struct zfcp_data { 568struct zfcp_data {
594 struct scsi_host_template scsi_host_template; 569 struct scsi_host_template scsi_host_template;
595 struct scsi_transport_template *scsi_transport_template; 570 struct scsi_transport_template *scsi_transport_template;
596 struct list_head adapter_list_head; /* head of adapter list */
597 rwlock_t config_lock; /* serialises changes 571 rwlock_t config_lock; /* serialises changes
598 to adapter/port/unit 572 to adapter/port/unit
599 lists */ 573 lists */
600 struct semaphore config_sema; /* serialises configuration 574 struct semaphore config_sema; /* serialises configuration
601 changes */ 575 changes */
602 atomic_t loglevel; /* current loglevel */
603 char init_busid[20];
604 u64 init_wwpn;
605 u64 init_fcp_lun;
606 struct kmem_cache *fsf_req_qtcb_cache; 576 struct kmem_cache *fsf_req_qtcb_cache;
607 struct kmem_cache *sr_buffer_cache; 577 struct kmem_cache *sr_buffer_cache;
608 struct kmem_cache *gid_pn_cache; 578 struct kmem_cache *gid_pn_cache;
@@ -623,8 +593,6 @@ struct zfcp_fsf_req_qtcb {
623#define ZFCP_SET 0x00000100 593#define ZFCP_SET 0x00000100
624#define ZFCP_CLEAR 0x00000200 594#define ZFCP_CLEAR 0x00000200
625 595
626#define zfcp_get_busid_by_adapter(adapter) (dev_name(&adapter->ccw_device->dev))
627
628/* 596/*
629 * Helper functions for request ID management. 597 * Helper functions for request ID management.
630 */ 598 */
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c
index 4ed4950d994b..387a3af528ac 100644
--- a/drivers/s390/scsi/zfcp_erp.c
+++ b/drivers/s390/scsi/zfcp_erp.c
@@ -840,7 +840,6 @@ static int zfcp_erp_open_ptp_port(struct zfcp_erp_action *act)
840 return ZFCP_ERP_FAILED; 840 return ZFCP_ERP_FAILED;
841 } 841 }
842 port->d_id = adapter->peer_d_id; 842 port->d_id = adapter->peer_d_id;
843 atomic_set_mask(ZFCP_STATUS_PORT_DID_DID, &port->status);
844 return zfcp_erp_port_strategy_open_port(act); 843 return zfcp_erp_port_strategy_open_port(act);
845} 844}
846 845
@@ -871,12 +870,12 @@ static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *act)
871 case ZFCP_ERP_STEP_PORT_CLOSING: 870 case ZFCP_ERP_STEP_PORT_CLOSING:
872 if (fc_host_port_type(adapter->scsi_host) == FC_PORTTYPE_PTP) 871 if (fc_host_port_type(adapter->scsi_host) == FC_PORTTYPE_PTP)
873 return zfcp_erp_open_ptp_port(act); 872 return zfcp_erp_open_ptp_port(act);
874 if (!(p_status & ZFCP_STATUS_PORT_DID_DID)) { 873 if (!port->d_id) {
875 queue_work(zfcp_data.work_queue, &port->gid_pn_work); 874 queue_work(zfcp_data.work_queue, &port->gid_pn_work);
876 return ZFCP_ERP_CONTINUES; 875 return ZFCP_ERP_CONTINUES;
877 } 876 }
878 case ZFCP_ERP_STEP_NAMESERVER_LOOKUP: 877 case ZFCP_ERP_STEP_NAMESERVER_LOOKUP:
879 if (!(p_status & ZFCP_STATUS_PORT_DID_DID)) { 878 if (!port->d_id) {
880 if (p_status & (ZFCP_STATUS_PORT_INVALID_WWPN)) { 879 if (p_status & (ZFCP_STATUS_PORT_INVALID_WWPN)) {
881 zfcp_erp_port_failed(port, 26, NULL); 880 zfcp_erp_port_failed(port, 26, NULL);
882 return ZFCP_ERP_EXIT; 881 return ZFCP_ERP_EXIT;
@@ -888,7 +887,7 @@ static int zfcp_erp_port_strategy_open_common(struct zfcp_erp_action *act)
888 case ZFCP_ERP_STEP_PORT_OPENING: 887 case ZFCP_ERP_STEP_PORT_OPENING:
889 /* D_ID might have changed during open */ 888 /* D_ID might have changed during open */
890 if (p_status & ZFCP_STATUS_COMMON_OPEN) { 889 if (p_status & ZFCP_STATUS_COMMON_OPEN) {
891 if (p_status & ZFCP_STATUS_PORT_DID_DID) 890 if (port->d_id)
892 return ZFCP_ERP_SUCCEEDED; 891 return ZFCP_ERP_SUCCEEDED;
893 else { 892 else {
894 act->step = ZFCP_ERP_STEP_PORT_CLOSING; 893 act->step = ZFCP_ERP_STEP_PORT_CLOSING;
@@ -1385,6 +1384,7 @@ static int zfcp_erp_thread(void *data)
1385 struct list_head *next; 1384 struct list_head *next;
1386 struct zfcp_erp_action *act; 1385 struct zfcp_erp_action *act;
1387 unsigned long flags; 1386 unsigned long flags;
1387 int ignore;
1388 1388
1389 daemonize("zfcperp%s", dev_name(&adapter->ccw_device->dev)); 1389 daemonize("zfcperp%s", dev_name(&adapter->ccw_device->dev));
1390 /* Block all signals */ 1390 /* Block all signals */
@@ -1407,7 +1407,7 @@ static int zfcp_erp_thread(void *data)
1407 } 1407 }
1408 1408
1409 zfcp_rec_dbf_event_thread_lock(4, adapter); 1409 zfcp_rec_dbf_event_thread_lock(4, adapter);
1410 down_interruptible(&adapter->erp_ready_sem); 1410 ignore = down_interruptible(&adapter->erp_ready_sem);
1411 zfcp_rec_dbf_event_thread_lock(5, adapter); 1411 zfcp_rec_dbf_event_thread_lock(5, adapter);
1412 } 1412 }
1413 1413
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c
index f009f2a7ec3e..eabdfe24456e 100644
--- a/drivers/s390/scsi/zfcp_fc.c
+++ b/drivers/s390/scsi/zfcp_fc.c
@@ -11,6 +11,20 @@
11 11
12#include "zfcp_ext.h" 12#include "zfcp_ext.h"
13 13
14enum rscn_address_format {
15 RSCN_PORT_ADDRESS = 0x0,
16 RSCN_AREA_ADDRESS = 0x1,
17 RSCN_DOMAIN_ADDRESS = 0x2,
18 RSCN_FABRIC_ADDRESS = 0x3,
19};
20
21static u32 rscn_range_mask[] = {
22 [RSCN_PORT_ADDRESS] = 0xFFFFFF,
23 [RSCN_AREA_ADDRESS] = 0xFFFF00,
24 [RSCN_DOMAIN_ADDRESS] = 0xFF0000,
25 [RSCN_FABRIC_ADDRESS] = 0x000000,
26};
27
14struct ct_iu_gpn_ft_req { 28struct ct_iu_gpn_ft_req {
15 struct ct_hdr header; 29 struct ct_hdr header;
16 u8 flags; 30 u8 flags;
@@ -26,9 +40,12 @@ struct gpn_ft_resp_acc {
26 u64 wwpn; 40 u64 wwpn;
27} __attribute__ ((packed)); 41} __attribute__ ((packed));
28 42
29#define ZFCP_GPN_FT_ENTRIES ((PAGE_SIZE - sizeof(struct ct_hdr)) \ 43#define ZFCP_CT_SIZE_ONE_PAGE (PAGE_SIZE - sizeof(struct ct_hdr))
30 / sizeof(struct gpn_ft_resp_acc)) 44#define ZFCP_GPN_FT_ENTRIES (ZFCP_CT_SIZE_ONE_PAGE \
45 / sizeof(struct gpn_ft_resp_acc))
31#define ZFCP_GPN_FT_BUFFERS 4 46#define ZFCP_GPN_FT_BUFFERS 4
47#define ZFCP_GPN_FT_MAX_SIZE (ZFCP_GPN_FT_BUFFERS * PAGE_SIZE \
48 - sizeof(struct ct_hdr))
32#define ZFCP_GPN_FT_MAX_ENTRIES ZFCP_GPN_FT_BUFFERS * (ZFCP_GPN_FT_ENTRIES + 1) 49#define ZFCP_GPN_FT_MAX_ENTRIES ZFCP_GPN_FT_BUFFERS * (ZFCP_GPN_FT_ENTRIES + 1)
33 50
34struct ct_iu_gpn_ft_resp { 51struct ct_iu_gpn_ft_resp {
@@ -160,22 +177,7 @@ static void zfcp_fc_incoming_rscn(struct zfcp_fsf_req *fsf_req)
160 for (i = 1; i < no_entries; i++) { 177 for (i = 1; i < no_entries; i++) {
161 /* skip head and start with 1st element */ 178 /* skip head and start with 1st element */
162 fcp_rscn_element++; 179 fcp_rscn_element++;
163 switch (fcp_rscn_element->addr_format) { 180 range_mask = rscn_range_mask[fcp_rscn_element->addr_format];
164 case ZFCP_PORT_ADDRESS:
165 range_mask = ZFCP_PORTS_RANGE_PORT;
166 break;
167 case ZFCP_AREA_ADDRESS:
168 range_mask = ZFCP_PORTS_RANGE_AREA;
169 break;
170 case ZFCP_DOMAIN_ADDRESS:
171 range_mask = ZFCP_PORTS_RANGE_DOMAIN;
172 break;
173 case ZFCP_FABRIC_ADDRESS:
174 range_mask = ZFCP_PORTS_RANGE_FABRIC;
175 break;
176 default:
177 continue;
178 }
179 _zfcp_fc_incoming_rscn(fsf_req, range_mask, fcp_rscn_element); 181 _zfcp_fc_incoming_rscn(fsf_req, range_mask, fcp_rscn_element);
180 } 182 }
181 schedule_work(&fsf_req->adapter->scan_work); 183 schedule_work(&fsf_req->adapter->scan_work);
@@ -266,7 +268,6 @@ static void zfcp_fc_ns_gid_pn_eval(unsigned long data)
266 return; 268 return;
267 /* looks like a valid d_id */ 269 /* looks like a valid d_id */
268 port->d_id = ct_iu_resp->d_id & ZFCP_DID_MASK; 270 port->d_id = ct_iu_resp->d_id & ZFCP_DID_MASK;
269 atomic_set_mask(ZFCP_STATUS_PORT_DID_DID, &port->status);
270} 271}
271 272
272int static zfcp_fc_ns_gid_pn_request(struct zfcp_erp_action *erp_action, 273int static zfcp_fc_ns_gid_pn_request(struct zfcp_erp_action *erp_action,
@@ -284,8 +285,6 @@ int static zfcp_fc_ns_gid_pn_request(struct zfcp_erp_action *erp_action,
284 gid_pn->ct.timeout = ZFCP_NS_GID_PN_TIMEOUT; 285 gid_pn->ct.timeout = ZFCP_NS_GID_PN_TIMEOUT;
285 gid_pn->ct.req = &gid_pn->req; 286 gid_pn->ct.req = &gid_pn->req;
286 gid_pn->ct.resp = &gid_pn->resp; 287 gid_pn->ct.resp = &gid_pn->resp;
287 gid_pn->ct.req_count = 1;
288 gid_pn->ct.resp_count = 1;
289 sg_init_one(&gid_pn->req, &gid_pn->ct_iu_req, 288 sg_init_one(&gid_pn->req, &gid_pn->ct_iu_req,
290 sizeof(struct ct_iu_gid_pn_req)); 289 sizeof(struct ct_iu_gid_pn_req));
291 sg_init_one(&gid_pn->resp, &gid_pn->ct_iu_resp, 290 sg_init_one(&gid_pn->resp, &gid_pn->ct_iu_resp,
@@ -297,7 +296,7 @@ int static zfcp_fc_ns_gid_pn_request(struct zfcp_erp_action *erp_action,
297 gid_pn->ct_iu_req.header.gs_subtype = ZFCP_CT_NAME_SERVER; 296 gid_pn->ct_iu_req.header.gs_subtype = ZFCP_CT_NAME_SERVER;
298 gid_pn->ct_iu_req.header.options = ZFCP_CT_SYNCHRONOUS; 297 gid_pn->ct_iu_req.header.options = ZFCP_CT_SYNCHRONOUS;
299 gid_pn->ct_iu_req.header.cmd_rsp_code = ZFCP_CT_GID_PN; 298 gid_pn->ct_iu_req.header.cmd_rsp_code = ZFCP_CT_GID_PN;
300 gid_pn->ct_iu_req.header.max_res_size = ZFCP_CT_MAX_SIZE; 299 gid_pn->ct_iu_req.header.max_res_size = ZFCP_CT_SIZE_ONE_PAGE / 4;
301 gid_pn->ct_iu_req.wwpn = erp_action->port->wwpn; 300 gid_pn->ct_iu_req.wwpn = erp_action->port->wwpn;
302 301
303 init_completion(&compl_rec.done); 302 init_completion(&compl_rec.done);
@@ -407,8 +406,6 @@ static int zfcp_fc_adisc(struct zfcp_port *port)
407 sg_init_one(adisc->els.resp, &adisc->ls_adisc_acc, 406 sg_init_one(adisc->els.resp, &adisc->ls_adisc_acc,
408 sizeof(struct zfcp_ls_adisc)); 407 sizeof(struct zfcp_ls_adisc));
409 408
410 adisc->els.req_count = 1;
411 adisc->els.resp_count = 1;
412 adisc->els.adapter = adapter; 409 adisc->els.adapter = adapter;
413 adisc->els.port = port; 410 adisc->els.port = port;
414 adisc->els.d_id = port->d_id; 411 adisc->els.d_id = port->d_id;
@@ -448,17 +445,17 @@ void zfcp_test_link(struct zfcp_port *port)
448 zfcp_erp_port_forced_reopen(port, 0, 65, NULL); 445 zfcp_erp_port_forced_reopen(port, 0, 65, NULL);
449} 446}
450 447
451static void zfcp_free_sg_env(struct zfcp_gpn_ft *gpn_ft) 448static void zfcp_free_sg_env(struct zfcp_gpn_ft *gpn_ft, int buf_num)
452{ 449{
453 struct scatterlist *sg = &gpn_ft->sg_req; 450 struct scatterlist *sg = &gpn_ft->sg_req;
454 451
455 kfree(sg_virt(sg)); /* free request buffer */ 452 kfree(sg_virt(sg)); /* free request buffer */
456 zfcp_sg_free_table(gpn_ft->sg_resp, ZFCP_GPN_FT_BUFFERS); 453 zfcp_sg_free_table(gpn_ft->sg_resp, buf_num);
457 454
458 kfree(gpn_ft); 455 kfree(gpn_ft);
459} 456}
460 457
461static struct zfcp_gpn_ft *zfcp_alloc_sg_env(void) 458static struct zfcp_gpn_ft *zfcp_alloc_sg_env(int buf_num)
462{ 459{
463 struct zfcp_gpn_ft *gpn_ft; 460 struct zfcp_gpn_ft *gpn_ft;
464 struct ct_iu_gpn_ft_req *req; 461 struct ct_iu_gpn_ft_req *req;
@@ -475,8 +472,8 @@ static struct zfcp_gpn_ft *zfcp_alloc_sg_env(void)
475 } 472 }
476 sg_init_one(&gpn_ft->sg_req, req, sizeof(*req)); 473 sg_init_one(&gpn_ft->sg_req, req, sizeof(*req));
477 474
478 if (zfcp_sg_setup_table(gpn_ft->sg_resp, ZFCP_GPN_FT_BUFFERS)) { 475 if (zfcp_sg_setup_table(gpn_ft->sg_resp, buf_num)) {
479 zfcp_free_sg_env(gpn_ft); 476 zfcp_free_sg_env(gpn_ft, buf_num);
480 gpn_ft = NULL; 477 gpn_ft = NULL;
481 } 478 }
482out: 479out:
@@ -485,7 +482,8 @@ out:
485 482
486 483
487static int zfcp_scan_issue_gpn_ft(struct zfcp_gpn_ft *gpn_ft, 484static int zfcp_scan_issue_gpn_ft(struct zfcp_gpn_ft *gpn_ft,
488 struct zfcp_adapter *adapter) 485 struct zfcp_adapter *adapter,
486 int max_bytes)
489{ 487{
490 struct zfcp_send_ct *ct = &gpn_ft->ct; 488 struct zfcp_send_ct *ct = &gpn_ft->ct;
491 struct ct_iu_gpn_ft_req *req = sg_virt(&gpn_ft->sg_req); 489 struct ct_iu_gpn_ft_req *req = sg_virt(&gpn_ft->sg_req);
@@ -498,8 +496,7 @@ static int zfcp_scan_issue_gpn_ft(struct zfcp_gpn_ft *gpn_ft,
498 req->header.gs_subtype = ZFCP_CT_NAME_SERVER; 496 req->header.gs_subtype = ZFCP_CT_NAME_SERVER;
499 req->header.options = ZFCP_CT_SYNCHRONOUS; 497 req->header.options = ZFCP_CT_SYNCHRONOUS;
500 req->header.cmd_rsp_code = ZFCP_CT_GPN_FT; 498 req->header.cmd_rsp_code = ZFCP_CT_GPN_FT;
501 req->header.max_res_size = (sizeof(struct gpn_ft_resp_acc) * 499 req->header.max_res_size = max_bytes / 4;
502 (ZFCP_GPN_FT_MAX_ENTRIES - 1)) >> 2;
503 req->flags = 0; 500 req->flags = 0;
504 req->domain_id_scope = 0; 501 req->domain_id_scope = 0;
505 req->area_id_scope = 0; 502 req->area_id_scope = 0;
@@ -512,8 +509,6 @@ static int zfcp_scan_issue_gpn_ft(struct zfcp_gpn_ft *gpn_ft,
512 ct->timeout = 10; 509 ct->timeout = 10;
513 ct->req = &gpn_ft->sg_req; 510 ct->req = &gpn_ft->sg_req;
514 ct->resp = gpn_ft->sg_resp; 511 ct->resp = gpn_ft->sg_resp;
515 ct->req_count = 1;
516 ct->resp_count = ZFCP_GPN_FT_BUFFERS;
517 512
518 init_completion(&compl_rec.done); 513 init_completion(&compl_rec.done);
519 compl_rec.handler = NULL; 514 compl_rec.handler = NULL;
@@ -540,7 +535,7 @@ static void zfcp_validate_port(struct zfcp_port *port)
540 zfcp_port_dequeue(port); 535 zfcp_port_dequeue(port);
541} 536}
542 537
543static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft) 538static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft, int max_entries)
544{ 539{
545 struct zfcp_send_ct *ct = &gpn_ft->ct; 540 struct zfcp_send_ct *ct = &gpn_ft->ct;
546 struct scatterlist *sg = gpn_ft->sg_resp; 541 struct scatterlist *sg = gpn_ft->sg_resp;
@@ -560,13 +555,17 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft)
560 return -EIO; 555 return -EIO;
561 } 556 }
562 557
563 if (hdr->max_res_size) 558 if (hdr->max_res_size) {
559 dev_warn(&adapter->ccw_device->dev,
560 "The name server reported %d words residual data\n",
561 hdr->max_res_size);
564 return -E2BIG; 562 return -E2BIG;
563 }
565 564
566 down(&zfcp_data.config_sema); 565 down(&zfcp_data.config_sema);
567 566
568 /* first entry is the header */ 567 /* first entry is the header */
569 for (x = 1; x < ZFCP_GPN_FT_MAX_ENTRIES && !last; x++) { 568 for (x = 1; x < max_entries && !last; x++) {
570 if (x % (ZFCP_GPN_FT_ENTRIES + 1)) 569 if (x % (ZFCP_GPN_FT_ENTRIES + 1))
571 acc++; 570 acc++;
572 else 571 else
@@ -589,7 +588,6 @@ static int zfcp_scan_eval_gpn_ft(struct zfcp_gpn_ft *gpn_ft)
589 } 588 }
590 589
591 port = zfcp_port_enqueue(adapter, acc->wwpn, 590 port = zfcp_port_enqueue(adapter, acc->wwpn,
592 ZFCP_STATUS_PORT_DID_DID |
593 ZFCP_STATUS_COMMON_NOESC, d_id); 591 ZFCP_STATUS_COMMON_NOESC, d_id);
594 if (IS_ERR(port)) 592 if (IS_ERR(port))
595 ret = PTR_ERR(port); 593 ret = PTR_ERR(port);
@@ -612,6 +610,12 @@ int zfcp_scan_ports(struct zfcp_adapter *adapter)
612{ 610{
613 int ret, i; 611 int ret, i;
614 struct zfcp_gpn_ft *gpn_ft; 612 struct zfcp_gpn_ft *gpn_ft;
613 int chain, max_entries, buf_num, max_bytes;
614
615 chain = adapter->adapter_features & FSF_FEATURE_ELS_CT_CHAINED_SBALS;
616 buf_num = chain ? ZFCP_GPN_FT_BUFFERS : 1;
617 max_entries = chain ? ZFCP_GPN_FT_MAX_ENTRIES : ZFCP_GPN_FT_ENTRIES;
618 max_bytes = chain ? ZFCP_GPN_FT_MAX_SIZE : ZFCP_CT_SIZE_ONE_PAGE;
615 619
616 if (fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPORT) 620 if (fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPORT)
617 return 0; 621 return 0;
@@ -620,23 +624,23 @@ int zfcp_scan_ports(struct zfcp_adapter *adapter)
620 if (ret) 624 if (ret)
621 return ret; 625 return ret;
622 626
623 gpn_ft = zfcp_alloc_sg_env(); 627 gpn_ft = zfcp_alloc_sg_env(buf_num);
624 if (!gpn_ft) { 628 if (!gpn_ft) {
625 ret = -ENOMEM; 629 ret = -ENOMEM;
626 goto out; 630 goto out;
627 } 631 }
628 632
629 for (i = 0; i < 3; i++) { 633 for (i = 0; i < 3; i++) {
630 ret = zfcp_scan_issue_gpn_ft(gpn_ft, adapter); 634 ret = zfcp_scan_issue_gpn_ft(gpn_ft, adapter, max_bytes);
631 if (!ret) { 635 if (!ret) {
632 ret = zfcp_scan_eval_gpn_ft(gpn_ft); 636 ret = zfcp_scan_eval_gpn_ft(gpn_ft, max_entries);
633 if (ret == -EAGAIN) 637 if (ret == -EAGAIN)
634 ssleep(1); 638 ssleep(1);
635 else 639 else
636 break; 640 break;
637 } 641 }
638 } 642 }
639 zfcp_free_sg_env(gpn_ft); 643 zfcp_free_sg_env(gpn_ft, buf_num);
640out: 644out:
641 zfcp_wka_port_put(&adapter->nsp); 645 zfcp_wka_port_put(&adapter->nsp);
642 return ret; 646 return ret;
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c
index 9c72e083559d..e6416f8541b0 100644
--- a/drivers/s390/scsi/zfcp_fsf.c
+++ b/drivers/s390/scsi/zfcp_fsf.c
@@ -644,38 +644,38 @@ static void zfcp_fsf_exchange_port_data_handler(struct zfcp_fsf_req *req)
644 } 644 }
645} 645}
646 646
647static int zfcp_fsf_sbal_check(struct zfcp_adapter *adapter) 647static int zfcp_fsf_sbal_available(struct zfcp_adapter *adapter)
648{ 648{
649 struct zfcp_qdio_queue *req_q = &adapter->req_q; 649 if (atomic_read(&adapter->req_q.count) > 0)
650
651 spin_lock_bh(&adapter->req_q_lock);
652 if (atomic_read(&req_q->count))
653 return 1; 650 return 1;
654 spin_unlock_bh(&adapter->req_q_lock); 651 atomic_inc(&adapter->qdio_outb_full);
655 return 0; 652 return 0;
656} 653}
657 654
658static int zfcp_fsf_sbal_available(struct zfcp_adapter *adapter)
659{
660 unsigned int count = atomic_read(&adapter->req_q.count);
661 if (!count)
662 atomic_inc(&adapter->qdio_outb_full);
663 return count > 0;
664}
665
666static int zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter) 655static int zfcp_fsf_req_sbal_get(struct zfcp_adapter *adapter)
656 __releases(&adapter->req_q_lock)
657 __acquires(&adapter->req_q_lock)
667{ 658{
659 struct zfcp_qdio_queue *req_q = &adapter->req_q;
668 long ret; 660 long ret;
669 661
662 if (atomic_read(&req_q->count) <= -REQUEST_LIST_SIZE)
663 return -EIO;
664 if (atomic_read(&req_q->count) > 0)
665 return 0;
666
667 atomic_dec(&req_q->count);
670 spin_unlock_bh(&adapter->req_q_lock); 668 spin_unlock_bh(&adapter->req_q_lock);
671 ret = wait_event_interruptible_timeout(adapter->request_wq, 669 ret = wait_event_interruptible_timeout(adapter->request_wq,
672 zfcp_fsf_sbal_check(adapter), 5 * HZ); 670 atomic_read(&req_q->count) >= 0,
671 5 * HZ);
672 spin_lock_bh(&adapter->req_q_lock);
673 atomic_inc(&req_q->count);
674
673 if (ret > 0) 675 if (ret > 0)
674 return 0; 676 return 0;
675 if (!ret) 677 if (!ret)
676 atomic_inc(&adapter->qdio_outb_full); 678 atomic_inc(&adapter->qdio_outb_full);
677
678 spin_lock_bh(&adapter->req_q_lock);
679 return -EIO; 679 return -EIO;
680} 680}
681 681
@@ -1013,12 +1013,29 @@ skip_fsfstatus:
1013 send_ct->handler(send_ct->handler_data); 1013 send_ct->handler(send_ct->handler_data);
1014} 1014}
1015 1015
1016static int zfcp_fsf_setup_sbals(struct zfcp_fsf_req *req, 1016static int zfcp_fsf_setup_ct_els_sbals(struct zfcp_fsf_req *req,
1017 struct scatterlist *sg_req, 1017 struct scatterlist *sg_req,
1018 struct scatterlist *sg_resp, int max_sbals) 1018 struct scatterlist *sg_resp,
1019 int max_sbals)
1019{ 1020{
1021 struct qdio_buffer_element *sbale = zfcp_qdio_sbale_req(req);
1022 u32 feat = req->adapter->adapter_features;
1020 int bytes; 1023 int bytes;
1021 1024
1025 if (!(feat & FSF_FEATURE_ELS_CT_CHAINED_SBALS)) {
1026 if (sg_req->length > PAGE_SIZE || sg_resp->length > PAGE_SIZE ||
1027 !sg_is_last(sg_req) || !sg_is_last(sg_resp))
1028 return -EOPNOTSUPP;
1029
1030 sbale[0].flags |= SBAL_FLAGS0_TYPE_WRITE_READ;
1031 sbale[2].addr = sg_virt(sg_req);
1032 sbale[2].length = sg_req->length;
1033 sbale[3].addr = sg_virt(sg_resp);
1034 sbale[3].length = sg_resp->length;
1035 sbale[3].flags |= SBAL_FLAGS_LAST_ENTRY;
1036 return 0;
1037 }
1038
1022 bytes = zfcp_qdio_sbals_from_sg(req, SBAL_FLAGS0_TYPE_WRITE_READ, 1039 bytes = zfcp_qdio_sbals_from_sg(req, SBAL_FLAGS0_TYPE_WRITE_READ,
1023 sg_req, max_sbals); 1040 sg_req, max_sbals);
1024 if (bytes <= 0) 1041 if (bytes <= 0)
@@ -1060,8 +1077,8 @@ int zfcp_fsf_send_ct(struct zfcp_send_ct *ct, mempool_t *pool,
1060 goto out; 1077 goto out;
1061 } 1078 }
1062 1079
1063 ret = zfcp_fsf_setup_sbals(req, ct->req, ct->resp, 1080 ret = zfcp_fsf_setup_ct_els_sbals(req, ct->req, ct->resp,
1064 FSF_MAX_SBALS_PER_REQ); 1081 FSF_MAX_SBALS_PER_REQ);
1065 if (ret) 1082 if (ret)
1066 goto failed_send; 1083 goto failed_send;
1067 1084
@@ -1171,7 +1188,7 @@ int zfcp_fsf_send_els(struct zfcp_send_els *els)
1171 goto out; 1188 goto out;
1172 } 1189 }
1173 1190
1174 ret = zfcp_fsf_setup_sbals(req, els->req, els->resp, 2); 1191 ret = zfcp_fsf_setup_ct_els_sbals(req, els->req, els->resp, 2);
1175 1192
1176 if (ret) 1193 if (ret)
1177 goto failed_send; 1194 goto failed_send;
@@ -1406,13 +1423,7 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
1406 switch (header->fsf_status_qual.word[0]) { 1423 switch (header->fsf_status_qual.word[0]) {
1407 case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE: 1424 case FSF_SQ_INVOKE_LINK_TEST_PROCEDURE:
1408 case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED: 1425 case FSF_SQ_ULP_DEPENDENT_ERP_REQUIRED:
1409 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1410 break;
1411 case FSF_SQ_NO_RETRY_POSSIBLE: 1426 case FSF_SQ_NO_RETRY_POSSIBLE:
1412 dev_warn(&req->adapter->ccw_device->dev,
1413 "Remote port 0x%016Lx could not be opened\n",
1414 (unsigned long long)port->wwpn);
1415 zfcp_erp_port_failed(port, 32, req);
1416 req->status |= ZFCP_STATUS_FSFREQ_ERROR; 1427 req->status |= ZFCP_STATUS_FSFREQ_ERROR;
1417 break; 1428 break;
1418 } 1429 }
@@ -1440,10 +1451,10 @@ static void zfcp_fsf_open_port_handler(struct zfcp_fsf_req *req)
1440 * Alternately, an ADISC/PDISC ELS should suffice, as well. 1451 * Alternately, an ADISC/PDISC ELS should suffice, as well.
1441 */ 1452 */
1442 plogi = (struct fsf_plogi *) req->qtcb->bottom.support.els; 1453 plogi = (struct fsf_plogi *) req->qtcb->bottom.support.els;
1443 if (req->qtcb->bottom.support.els1_length >= sizeof(*plogi)) { 1454 if (req->qtcb->bottom.support.els1_length >=
1455 FSF_PLOGI_MIN_LEN) {
1444 if (plogi->serv_param.wwpn != port->wwpn) 1456 if (plogi->serv_param.wwpn != port->wwpn)
1445 atomic_clear_mask(ZFCP_STATUS_PORT_DID_DID, 1457 port->d_id = 0;
1446 &port->status);
1447 else { 1458 else {
1448 port->wwnn = plogi->serv_param.wwnn; 1459 port->wwnn = plogi->serv_param.wwnn;
1449 zfcp_fc_plogi_evaluate(port, plogi); 1460 zfcp_fc_plogi_evaluate(port, plogi);
@@ -1907,7 +1918,7 @@ static void zfcp_fsf_open_unit_handler(struct zfcp_fsf_req *req)
1907 dev_err(&adapter->ccw_device->dev, 1918 dev_err(&adapter->ccw_device->dev,
1908 "Shared read-write access not " 1919 "Shared read-write access not "
1909 "supported (unit 0x%016Lx, port " 1920 "supported (unit 0x%016Lx, port "
1910 "0x%016Lx\n)", 1921 "0x%016Lx)\n",
1911 (unsigned long long)unit->fcp_lun, 1922 (unsigned long long)unit->fcp_lun,
1912 (unsigned long long)unit->port->wwpn); 1923 (unsigned long long)unit->port->wwpn);
1913 zfcp_erp_unit_failed(unit, 36, req); 1924 zfcp_erp_unit_failed(unit, 36, req);
diff --git a/drivers/s390/scsi/zfcp_fsf.h b/drivers/s390/scsi/zfcp_fsf.h
index fa2a31780611..8bb200252347 100644
--- a/drivers/s390/scsi/zfcp_fsf.h
+++ b/drivers/s390/scsi/zfcp_fsf.h
@@ -164,6 +164,7 @@
164#define FSF_FEATURE_LUN_SHARING 0x00000004 164#define FSF_FEATURE_LUN_SHARING 0x00000004
165#define FSF_FEATURE_NOTIFICATION_LOST 0x00000008 165#define FSF_FEATURE_NOTIFICATION_LOST 0x00000008
166#define FSF_FEATURE_HBAAPI_MANAGEMENT 0x00000010 166#define FSF_FEATURE_HBAAPI_MANAGEMENT 0x00000010
167#define FSF_FEATURE_ELS_CT_CHAINED_SBALS 0x00000020
167#define FSF_FEATURE_UPDATE_ALERT 0x00000100 168#define FSF_FEATURE_UPDATE_ALERT 0x00000100
168#define FSF_FEATURE_MEASUREMENT_DATA 0x00000200 169#define FSF_FEATURE_MEASUREMENT_DATA 0x00000200
169 170
@@ -322,6 +323,7 @@ struct fsf_nport_serv_param {
322 u8 vendor_version_level[16]; 323 u8 vendor_version_level[16];
323} __attribute__ ((packed)); 324} __attribute__ ((packed));
324 325
326#define FSF_PLOGI_MIN_LEN 112
325struct fsf_plogi { 327struct fsf_plogi {
326 u32 code; 328 u32 code;
327 struct fsf_nport_serv_param serv_param; 329 struct fsf_nport_serv_param serv_param;
diff --git a/drivers/s390/scsi/zfcp_qdio.c b/drivers/s390/scsi/zfcp_qdio.c
index d3b55fb66f13..33e0a206a0a4 100644
--- a/drivers/s390/scsi/zfcp_qdio.c
+++ b/drivers/s390/scsi/zfcp_qdio.c
@@ -112,7 +112,7 @@ static void zfcp_qdio_reqid_check(struct zfcp_adapter *adapter,
112 * corruption and must stop the machine immediatly. 112 * corruption and must stop the machine immediatly.
113 */ 113 */
114 panic("error: unknown request id (%lx) on adapter %s.\n", 114 panic("error: unknown request id (%lx) on adapter %s.\n",
115 req_id, zfcp_get_busid_by_adapter(adapter)); 115 req_id, dev_name(&adapter->ccw_device->dev));
116 116
117 zfcp_reqlist_remove(adapter, fsf_req); 117 zfcp_reqlist_remove(adapter, fsf_req);
118 spin_unlock_irqrestore(&adapter->req_list_lock, flags); 118 spin_unlock_irqrestore(&adapter->req_list_lock, flags);
@@ -392,7 +392,7 @@ int zfcp_qdio_allocate(struct zfcp_adapter *adapter)
392 392
393 init_data->cdev = adapter->ccw_device; 393 init_data->cdev = adapter->ccw_device;
394 init_data->q_format = QDIO_ZFCP_QFMT; 394 init_data->q_format = QDIO_ZFCP_QFMT;
395 memcpy(init_data->adapter_name, zfcp_get_busid_by_adapter(adapter), 8); 395 memcpy(init_data->adapter_name, dev_name(&adapter->ccw_device->dev), 8);
396 ASCEBC(init_data->adapter_name, 8); 396 ASCEBC(init_data->adapter_name, 8);
397 init_data->qib_param_field_format = 0; 397 init_data->qib_param_field_format = 0;
398 init_data->qib_param_field = NULL; 398 init_data->qib_param_field = NULL;