diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-17 20:54:40 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-03-17 20:54:40 -0400 |
commit | c55d267de274d308927b60c3e740c1a826832317 (patch) | |
tree | 21b53a8c725d9f9650f60d94b349459d5b8dae10 /drivers/s390 | |
parent | 61ef46fd45c3c62dc7c880a45dd2aa841b9af8fb (diff) | |
parent | bc898c97f7ba24def788d9f80786cf028a197122 (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: (170 commits)
[SCSI] scsi_dh_rdac: Add MD36xxf into device list
[SCSI] scsi_debug: add consecutive medium errors
[SCSI] libsas: fix ata list corruption issue
[SCSI] hpsa: export resettable host attribute
[SCSI] hpsa: move device attributes to avoid forward declarations
[SCSI] scsi_debug: Logical Block Provisioning (SBC3r26)
[SCSI] sd: Logical Block Provisioning update
[SCSI] Include protection operation in SCSI command trace
[SCSI] hpsa: fix incorrect PCI IDs and add two new ones (2nd try)
[SCSI] target: Fix volume size misreporting for volumes > 2TB
[SCSI] bnx2fc: Broadcom FCoE offload driver
[SCSI] fcoe: fix broken fcoe interface reset
[SCSI] fcoe: precedence bug in fcoe_filter_frames()
[SCSI] libfcoe: Remove stale fcoe-netdev entries
[SCSI] libfcoe: Move FCOE_MTU definition from fcoe.h to libfcoe.h
[SCSI] libfc: introduce __fc_fill_fc_hdr that accepts fc_hdr as an argument
[SCSI] fcoe, libfc: initialize EM anchors list and then update npiv EMs
[SCSI] Revert "[SCSI] libfc: fix exchange being deleted when the abort itself is timed out"
[SCSI] libfc: Fixing a memory leak when destroying an interface
[SCSI] megaraid_sas: Version and Changelog update
...
Fix up trivial conflicts due to whitespace differences in
drivers/scsi/libsas/{sas_ata.c,sas_scsi_host.c}
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/scsi/zfcp_aux.c | 80 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_def.h | 15 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_erp.c | 4 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_ext.h | 9 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_fc.c | 333 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_fc.h | 124 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_fsf.c | 27 | ||||
-rw-r--r-- | drivers/s390/scsi/zfcp_scsi.c | 71 |
8 files changed, 374 insertions, 289 deletions
diff --git a/drivers/s390/scsi/zfcp_aux.c b/drivers/s390/scsi/zfcp_aux.c index 51c666fb67a4..645b0fcbb370 100644 --- a/drivers/s390/scsi/zfcp_aux.c +++ b/drivers/s390/scsi/zfcp_aux.c | |||
@@ -122,36 +122,21 @@ static int __init zfcp_module_init(void) | |||
122 | { | 122 | { |
123 | int retval = -ENOMEM; | 123 | int retval = -ENOMEM; |
124 | 124 | ||
125 | zfcp_data.gpn_ft_cache = zfcp_cache_hw_align("zfcp_gpn", | 125 | zfcp_fsf_qtcb_cache = zfcp_cache_hw_align("zfcp_fsf_qtcb", |
126 | sizeof(struct zfcp_fc_gpn_ft_req)); | 126 | sizeof(struct fsf_qtcb)); |
127 | if (!zfcp_data.gpn_ft_cache) | 127 | if (!zfcp_fsf_qtcb_cache) |
128 | goto out; | ||
129 | |||
130 | zfcp_data.qtcb_cache = zfcp_cache_hw_align("zfcp_qtcb", | ||
131 | sizeof(struct fsf_qtcb)); | ||
132 | if (!zfcp_data.qtcb_cache) | ||
133 | goto out_qtcb_cache; | 128 | goto out_qtcb_cache; |
134 | 129 | ||
135 | zfcp_data.sr_buffer_cache = zfcp_cache_hw_align("zfcp_sr", | 130 | zfcp_fc_req_cache = zfcp_cache_hw_align("zfcp_fc_req", |
136 | sizeof(struct fsf_status_read_buffer)); | 131 | sizeof(struct zfcp_fc_req)); |
137 | if (!zfcp_data.sr_buffer_cache) | 132 | if (!zfcp_fc_req_cache) |
138 | goto out_sr_cache; | 133 | goto out_fc_cache; |
139 | 134 | ||
140 | zfcp_data.gid_pn_cache = zfcp_cache_hw_align("zfcp_gid", | 135 | zfcp_scsi_transport_template = |
141 | sizeof(struct zfcp_fc_gid_pn)); | ||
142 | if (!zfcp_data.gid_pn_cache) | ||
143 | goto out_gid_cache; | ||
144 | |||
145 | zfcp_data.adisc_cache = zfcp_cache_hw_align("zfcp_adisc", | ||
146 | sizeof(struct zfcp_fc_els_adisc)); | ||
147 | if (!zfcp_data.adisc_cache) | ||
148 | goto out_adisc_cache; | ||
149 | |||
150 | zfcp_data.scsi_transport_template = | ||
151 | fc_attach_transport(&zfcp_transport_functions); | 136 | fc_attach_transport(&zfcp_transport_functions); |
152 | if (!zfcp_data.scsi_transport_template) | 137 | if (!zfcp_scsi_transport_template) |
153 | goto out_transport; | 138 | goto out_transport; |
154 | scsi_transport_reserve_device(zfcp_data.scsi_transport_template, | 139 | scsi_transport_reserve_device(zfcp_scsi_transport_template, |
155 | sizeof(struct zfcp_scsi_dev)); | 140 | sizeof(struct zfcp_scsi_dev)); |
156 | 141 | ||
157 | 142 | ||
@@ -175,18 +160,12 @@ static int __init zfcp_module_init(void) | |||
175 | out_ccw_register: | 160 | out_ccw_register: |
176 | misc_deregister(&zfcp_cfdc_misc); | 161 | misc_deregister(&zfcp_cfdc_misc); |
177 | out_misc: | 162 | out_misc: |
178 | fc_release_transport(zfcp_data.scsi_transport_template); | 163 | fc_release_transport(zfcp_scsi_transport_template); |
179 | out_transport: | 164 | out_transport: |
180 | kmem_cache_destroy(zfcp_data.adisc_cache); | 165 | kmem_cache_destroy(zfcp_fc_req_cache); |
181 | out_adisc_cache: | 166 | out_fc_cache: |
182 | kmem_cache_destroy(zfcp_data.gid_pn_cache); | 167 | kmem_cache_destroy(zfcp_fsf_qtcb_cache); |
183 | out_gid_cache: | ||
184 | kmem_cache_destroy(zfcp_data.sr_buffer_cache); | ||
185 | out_sr_cache: | ||
186 | kmem_cache_destroy(zfcp_data.qtcb_cache); | ||
187 | out_qtcb_cache: | 168 | out_qtcb_cache: |
188 | kmem_cache_destroy(zfcp_data.gpn_ft_cache); | ||
189 | out: | ||
190 | return retval; | 169 | return retval; |
191 | } | 170 | } |
192 | 171 | ||
@@ -196,12 +175,9 @@ static void __exit zfcp_module_exit(void) | |||
196 | { | 175 | { |
197 | ccw_driver_unregister(&zfcp_ccw_driver); | 176 | ccw_driver_unregister(&zfcp_ccw_driver); |
198 | misc_deregister(&zfcp_cfdc_misc); | 177 | misc_deregister(&zfcp_cfdc_misc); |
199 | fc_release_transport(zfcp_data.scsi_transport_template); | 178 | fc_release_transport(zfcp_scsi_transport_template); |
200 | kmem_cache_destroy(zfcp_data.adisc_cache); | 179 | kmem_cache_destroy(zfcp_fc_req_cache); |
201 | kmem_cache_destroy(zfcp_data.gid_pn_cache); | 180 | kmem_cache_destroy(zfcp_fsf_qtcb_cache); |
202 | kmem_cache_destroy(zfcp_data.sr_buffer_cache); | ||
203 | kmem_cache_destroy(zfcp_data.qtcb_cache); | ||
204 | kmem_cache_destroy(zfcp_data.gpn_ft_cache); | ||
205 | } | 181 | } |
206 | 182 | ||
207 | module_exit(zfcp_module_exit); | 183 | module_exit(zfcp_module_exit); |
@@ -260,18 +236,18 @@ static int zfcp_allocate_low_mem_buffers(struct zfcp_adapter *adapter) | |||
260 | return -ENOMEM; | 236 | return -ENOMEM; |
261 | 237 | ||
262 | adapter->pool.qtcb_pool = | 238 | adapter->pool.qtcb_pool = |
263 | mempool_create_slab_pool(4, zfcp_data.qtcb_cache); | 239 | mempool_create_slab_pool(4, zfcp_fsf_qtcb_cache); |
264 | if (!adapter->pool.qtcb_pool) | 240 | if (!adapter->pool.qtcb_pool) |
265 | return -ENOMEM; | 241 | return -ENOMEM; |
266 | 242 | ||
267 | adapter->pool.status_read_data = | 243 | BUILD_BUG_ON(sizeof(struct fsf_status_read_buffer) > PAGE_SIZE); |
268 | mempool_create_slab_pool(FSF_STATUS_READS_RECOM, | 244 | adapter->pool.sr_data = |
269 | zfcp_data.sr_buffer_cache); | 245 | mempool_create_page_pool(FSF_STATUS_READS_RECOM, 0); |
270 | if (!adapter->pool.status_read_data) | 246 | if (!adapter->pool.sr_data) |
271 | return -ENOMEM; | 247 | return -ENOMEM; |
272 | 248 | ||
273 | adapter->pool.gid_pn = | 249 | adapter->pool.gid_pn = |
274 | mempool_create_slab_pool(1, zfcp_data.gid_pn_cache); | 250 | mempool_create_slab_pool(1, zfcp_fc_req_cache); |
275 | if (!adapter->pool.gid_pn) | 251 | if (!adapter->pool.gid_pn) |
276 | return -ENOMEM; | 252 | return -ENOMEM; |
277 | 253 | ||
@@ -290,8 +266,8 @@ static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter) | |||
290 | mempool_destroy(adapter->pool.qtcb_pool); | 266 | mempool_destroy(adapter->pool.qtcb_pool); |
291 | if (adapter->pool.status_read_req) | 267 | if (adapter->pool.status_read_req) |
292 | mempool_destroy(adapter->pool.status_read_req); | 268 | mempool_destroy(adapter->pool.status_read_req); |
293 | if (adapter->pool.status_read_data) | 269 | if (adapter->pool.sr_data) |
294 | mempool_destroy(adapter->pool.status_read_data); | 270 | mempool_destroy(adapter->pool.sr_data); |
295 | if (adapter->pool.gid_pn) | 271 | if (adapter->pool.gid_pn) |
296 | mempool_destroy(adapter->pool.gid_pn); | 272 | mempool_destroy(adapter->pool.gid_pn); |
297 | } | 273 | } |
@@ -386,6 +362,7 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device) | |||
386 | 362 | ||
387 | INIT_WORK(&adapter->stat_work, _zfcp_status_read_scheduler); | 363 | INIT_WORK(&adapter->stat_work, _zfcp_status_read_scheduler); |
388 | INIT_WORK(&adapter->scan_work, zfcp_fc_scan_ports); | 364 | INIT_WORK(&adapter->scan_work, zfcp_fc_scan_ports); |
365 | INIT_WORK(&adapter->ns_up_work, zfcp_fc_sym_name_update); | ||
389 | 366 | ||
390 | if (zfcp_qdio_setup(adapter)) | 367 | if (zfcp_qdio_setup(adapter)) |
391 | goto failed; | 368 | goto failed; |
@@ -437,7 +414,7 @@ struct zfcp_adapter *zfcp_adapter_enqueue(struct ccw_device *ccw_device) | |||
437 | adapter->dma_parms.max_segment_size = ZFCP_QDIO_SBALE_LEN; | 414 | adapter->dma_parms.max_segment_size = ZFCP_QDIO_SBALE_LEN; |
438 | adapter->ccw_device->dev.dma_parms = &adapter->dma_parms; | 415 | adapter->ccw_device->dev.dma_parms = &adapter->dma_parms; |
439 | 416 | ||
440 | if (!zfcp_adapter_scsi_register(adapter)) | 417 | if (!zfcp_scsi_adapter_register(adapter)) |
441 | return adapter; | 418 | return adapter; |
442 | 419 | ||
443 | failed: | 420 | failed: |
@@ -451,10 +428,11 @@ void zfcp_adapter_unregister(struct zfcp_adapter *adapter) | |||
451 | 428 | ||
452 | cancel_work_sync(&adapter->scan_work); | 429 | cancel_work_sync(&adapter->scan_work); |
453 | cancel_work_sync(&adapter->stat_work); | 430 | cancel_work_sync(&adapter->stat_work); |
431 | cancel_work_sync(&adapter->ns_up_work); | ||
454 | zfcp_destroy_adapter_work_queue(adapter); | 432 | zfcp_destroy_adapter_work_queue(adapter); |
455 | 433 | ||
456 | zfcp_fc_wka_ports_force_offline(adapter->gs); | 434 | zfcp_fc_wka_ports_force_offline(adapter->gs); |
457 | zfcp_adapter_scsi_unregister(adapter); | 435 | zfcp_scsi_adapter_unregister(adapter); |
458 | sysfs_remove_group(&cdev->dev.kobj, &zfcp_sysfs_adapter_attrs); | 436 | sysfs_remove_group(&cdev->dev.kobj, &zfcp_sysfs_adapter_attrs); |
459 | 437 | ||
460 | zfcp_erp_thread_kill(adapter); | 438 | zfcp_erp_thread_kill(adapter); |
diff --git a/drivers/s390/scsi/zfcp_def.h b/drivers/s390/scsi/zfcp_def.h index 9ae1d0a6f627..527ba48eea57 100644 --- a/drivers/s390/scsi/zfcp_def.h +++ b/drivers/s390/scsi/zfcp_def.h | |||
@@ -89,7 +89,6 @@ struct zfcp_reqlist; | |||
89 | #define ZFCP_STATUS_LUN_READONLY 0x00000008 | 89 | #define ZFCP_STATUS_LUN_READONLY 0x00000008 |
90 | 90 | ||
91 | /* FSF request status (this does not have a common part) */ | 91 | /* FSF request status (this does not have a common part) */ |
92 | #define ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT 0x00000002 | ||
93 | #define ZFCP_STATUS_FSFREQ_ERROR 0x00000008 | 92 | #define ZFCP_STATUS_FSFREQ_ERROR 0x00000008 |
94 | #define ZFCP_STATUS_FSFREQ_CLEANUP 0x00000010 | 93 | #define ZFCP_STATUS_FSFREQ_CLEANUP 0x00000010 |
95 | #define ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED 0x00000040 | 94 | #define ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED 0x00000040 |
@@ -108,7 +107,7 @@ struct zfcp_adapter_mempool { | |||
108 | mempool_t *scsi_req; | 107 | mempool_t *scsi_req; |
109 | mempool_t *scsi_abort; | 108 | mempool_t *scsi_abort; |
110 | mempool_t *status_read_req; | 109 | mempool_t *status_read_req; |
111 | mempool_t *status_read_data; | 110 | mempool_t *sr_data; |
112 | mempool_t *gid_pn; | 111 | mempool_t *gid_pn; |
113 | mempool_t *qtcb_pool; | 112 | mempool_t *qtcb_pool; |
114 | }; | 113 | }; |
@@ -190,6 +189,7 @@ struct zfcp_adapter { | |||
190 | struct fsf_qtcb_bottom_port *stats_reset_data; | 189 | struct fsf_qtcb_bottom_port *stats_reset_data; |
191 | unsigned long stats_reset; | 190 | unsigned long stats_reset; |
192 | struct work_struct scan_work; | 191 | struct work_struct scan_work; |
192 | struct work_struct ns_up_work; | ||
193 | struct service_level service_level; | 193 | struct service_level service_level; |
194 | struct workqueue_struct *work_queue; | 194 | struct workqueue_struct *work_queue; |
195 | struct device_dma_parameters dma_parms; | 195 | struct device_dma_parameters dma_parms; |
@@ -314,15 +314,4 @@ struct zfcp_fsf_req { | |||
314 | void (*handler)(struct zfcp_fsf_req *); | 314 | void (*handler)(struct zfcp_fsf_req *); |
315 | }; | 315 | }; |
316 | 316 | ||
317 | /* driver data */ | ||
318 | struct zfcp_data { | ||
319 | struct scsi_host_template scsi_host_template; | ||
320 | struct scsi_transport_template *scsi_transport_template; | ||
321 | struct kmem_cache *gpn_ft_cache; | ||
322 | struct kmem_cache *qtcb_cache; | ||
323 | struct kmem_cache *sr_buffer_cache; | ||
324 | struct kmem_cache *gid_pn_cache; | ||
325 | struct kmem_cache *adisc_cache; | ||
326 | }; | ||
327 | |||
328 | #endif /* ZFCP_DEF_H */ | 317 | #endif /* ZFCP_DEF_H */ |
diff --git a/drivers/s390/scsi/zfcp_erp.c b/drivers/s390/scsi/zfcp_erp.c index e003e306f870..e1b4f800e226 100644 --- a/drivers/s390/scsi/zfcp_erp.c +++ b/drivers/s390/scsi/zfcp_erp.c | |||
@@ -732,7 +732,7 @@ static int zfcp_erp_adapter_strategy_open_fsf(struct zfcp_erp_action *act) | |||
732 | if (zfcp_erp_adapter_strategy_open_fsf_xport(act) == ZFCP_ERP_FAILED) | 732 | if (zfcp_erp_adapter_strategy_open_fsf_xport(act) == ZFCP_ERP_FAILED) |
733 | return ZFCP_ERP_FAILED; | 733 | return ZFCP_ERP_FAILED; |
734 | 734 | ||
735 | if (mempool_resize(act->adapter->pool.status_read_data, | 735 | if (mempool_resize(act->adapter->pool.sr_data, |
736 | act->adapter->stat_read_buf_num, GFP_KERNEL)) | 736 | act->adapter->stat_read_buf_num, GFP_KERNEL)) |
737 | return ZFCP_ERP_FAILED; | 737 | return ZFCP_ERP_FAILED; |
738 | 738 | ||
@@ -1231,8 +1231,10 @@ static void zfcp_erp_action_cleanup(struct zfcp_erp_action *act, int result) | |||
1231 | if (result == ZFCP_ERP_SUCCEEDED) { | 1231 | if (result == ZFCP_ERP_SUCCEEDED) { |
1232 | register_service_level(&adapter->service_level); | 1232 | register_service_level(&adapter->service_level); |
1233 | queue_work(adapter->work_queue, &adapter->scan_work); | 1233 | queue_work(adapter->work_queue, &adapter->scan_work); |
1234 | queue_work(adapter->work_queue, &adapter->ns_up_work); | ||
1234 | } else | 1235 | } else |
1235 | unregister_service_level(&adapter->service_level); | 1236 | unregister_service_level(&adapter->service_level); |
1237 | |||
1236 | kref_put(&adapter->ref, zfcp_adapter_release); | 1238 | kref_put(&adapter->ref, zfcp_adapter_release); |
1237 | break; | 1239 | break; |
1238 | } | 1240 | } |
diff --git a/drivers/s390/scsi/zfcp_ext.h b/drivers/s390/scsi/zfcp_ext.h index 6e325284fbe7..03627cfd81cd 100644 --- a/drivers/s390/scsi/zfcp_ext.h +++ b/drivers/s390/scsi/zfcp_ext.h | |||
@@ -80,6 +80,7 @@ extern void zfcp_erp_notify(struct zfcp_erp_action *, unsigned long); | |||
80 | extern void zfcp_erp_timeout_handler(unsigned long); | 80 | extern void zfcp_erp_timeout_handler(unsigned long); |
81 | 81 | ||
82 | /* zfcp_fc.c */ | 82 | /* zfcp_fc.c */ |
83 | extern struct kmem_cache *zfcp_fc_req_cache; | ||
83 | extern void zfcp_fc_enqueue_event(struct zfcp_adapter *, | 84 | extern void zfcp_fc_enqueue_event(struct zfcp_adapter *, |
84 | enum fc_host_event_code event_code, u32); | 85 | enum fc_host_event_code event_code, u32); |
85 | extern void zfcp_fc_post_event(struct work_struct *); | 86 | extern void zfcp_fc_post_event(struct work_struct *); |
@@ -95,8 +96,10 @@ extern int zfcp_fc_gs_setup(struct zfcp_adapter *); | |||
95 | extern void zfcp_fc_gs_destroy(struct zfcp_adapter *); | 96 | extern void zfcp_fc_gs_destroy(struct zfcp_adapter *); |
96 | extern int zfcp_fc_exec_bsg_job(struct fc_bsg_job *); | 97 | extern int zfcp_fc_exec_bsg_job(struct fc_bsg_job *); |
97 | extern int zfcp_fc_timeout_bsg_job(struct fc_bsg_job *); | 98 | extern int zfcp_fc_timeout_bsg_job(struct fc_bsg_job *); |
99 | extern void zfcp_fc_sym_name_update(struct work_struct *); | ||
98 | 100 | ||
99 | /* zfcp_fsf.c */ | 101 | /* zfcp_fsf.c */ |
102 | extern struct kmem_cache *zfcp_fsf_qtcb_cache; | ||
100 | extern int zfcp_fsf_open_port(struct zfcp_erp_action *); | 103 | extern int zfcp_fsf_open_port(struct zfcp_erp_action *); |
101 | extern int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *); | 104 | extern int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *); |
102 | extern int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *); | 105 | extern int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *); |
@@ -139,9 +142,9 @@ extern struct zfcp_fsf_req *zfcp_fsf_get_req(struct zfcp_qdio *, | |||
139 | struct qdio_buffer *); | 142 | struct qdio_buffer *); |
140 | 143 | ||
141 | /* zfcp_scsi.c */ | 144 | /* zfcp_scsi.c */ |
142 | extern struct zfcp_data zfcp_data; | 145 | extern struct scsi_transport_template *zfcp_scsi_transport_template; |
143 | extern int zfcp_adapter_scsi_register(struct zfcp_adapter *); | 146 | extern int zfcp_scsi_adapter_register(struct zfcp_adapter *); |
144 | extern void zfcp_adapter_scsi_unregister(struct zfcp_adapter *); | 147 | extern void zfcp_scsi_adapter_unregister(struct zfcp_adapter *); |
145 | extern struct fc_function_template zfcp_transport_functions; | 148 | extern struct fc_function_template zfcp_transport_functions; |
146 | extern void zfcp_scsi_rport_work(struct work_struct *); | 149 | extern void zfcp_scsi_rport_work(struct work_struct *); |
147 | extern void zfcp_scsi_schedule_rport_register(struct zfcp_port *); | 150 | extern void zfcp_scsi_schedule_rport_register(struct zfcp_port *); |
diff --git a/drivers/s390/scsi/zfcp_fc.c b/drivers/s390/scsi/zfcp_fc.c index 30cf91a787a3..297e6b71ce9c 100644 --- a/drivers/s390/scsi/zfcp_fc.c +++ b/drivers/s390/scsi/zfcp_fc.c | |||
@@ -11,11 +11,14 @@ | |||
11 | 11 | ||
12 | #include <linux/types.h> | 12 | #include <linux/types.h> |
13 | #include <linux/slab.h> | 13 | #include <linux/slab.h> |
14 | #include <linux/utsname.h> | ||
14 | #include <scsi/fc/fc_els.h> | 15 | #include <scsi/fc/fc_els.h> |
15 | #include <scsi/libfc.h> | 16 | #include <scsi/libfc.h> |
16 | #include "zfcp_ext.h" | 17 | #include "zfcp_ext.h" |
17 | #include "zfcp_fc.h" | 18 | #include "zfcp_fc.h" |
18 | 19 | ||
20 | struct kmem_cache *zfcp_fc_req_cache; | ||
21 | |||
19 | static u32 zfcp_fc_rscn_range_mask[] = { | 22 | static u32 zfcp_fc_rscn_range_mask[] = { |
20 | [ELS_ADDR_FMT_PORT] = 0xFFFFFF, | 23 | [ELS_ADDR_FMT_PORT] = 0xFFFFFF, |
21 | [ELS_ADDR_FMT_AREA] = 0xFFFF00, | 24 | [ELS_ADDR_FMT_AREA] = 0xFFFF00, |
@@ -260,24 +263,18 @@ void zfcp_fc_incoming_els(struct zfcp_fsf_req *fsf_req) | |||
260 | zfcp_fc_incoming_rscn(fsf_req); | 263 | zfcp_fc_incoming_rscn(fsf_req); |
261 | } | 264 | } |
262 | 265 | ||
263 | static void zfcp_fc_ns_gid_pn_eval(void *data) | 266 | static void zfcp_fc_ns_gid_pn_eval(struct zfcp_fc_req *fc_req) |
264 | { | 267 | { |
265 | struct zfcp_fc_gid_pn *gid_pn = data; | 268 | struct zfcp_fsf_ct_els *ct_els = &fc_req->ct_els; |
266 | struct zfcp_fsf_ct_els *ct = &gid_pn->ct; | 269 | struct zfcp_fc_gid_pn_rsp *gid_pn_rsp = &fc_req->u.gid_pn.rsp; |
267 | struct zfcp_fc_gid_pn_req *gid_pn_req = sg_virt(ct->req); | ||
268 | struct zfcp_fc_gid_pn_resp *gid_pn_resp = sg_virt(ct->resp); | ||
269 | struct zfcp_port *port = gid_pn->port; | ||
270 | 270 | ||
271 | if (ct->status) | 271 | if (ct_els->status) |
272 | return; | 272 | return; |
273 | if (gid_pn_resp->ct_hdr.ct_cmd != FC_FS_ACC) | 273 | if (gid_pn_rsp->ct_hdr.ct_cmd != FC_FS_ACC) |
274 | return; | 274 | return; |
275 | 275 | ||
276 | /* paranoia */ | ||
277 | if (gid_pn_req->gid_pn.fn_wwpn != port->wwpn) | ||
278 | return; | ||
279 | /* looks like a valid d_id */ | 276 | /* looks like a valid d_id */ |
280 | port->d_id = ntoh24(gid_pn_resp->gid_pn.fp_fid); | 277 | ct_els->port->d_id = ntoh24(gid_pn_rsp->gid_pn.fp_fid); |
281 | } | 278 | } |
282 | 279 | ||
283 | static void zfcp_fc_complete(void *data) | 280 | static void zfcp_fc_complete(void *data) |
@@ -285,69 +282,73 @@ static void zfcp_fc_complete(void *data) | |||
285 | complete(data); | 282 | complete(data); |
286 | } | 283 | } |
287 | 284 | ||
285 | static void zfcp_fc_ct_ns_init(struct fc_ct_hdr *ct_hdr, u16 cmd, u16 mr_size) | ||
286 | { | ||
287 | ct_hdr->ct_rev = FC_CT_REV; | ||
288 | ct_hdr->ct_fs_type = FC_FST_DIR; | ||
289 | ct_hdr->ct_fs_subtype = FC_NS_SUBTYPE; | ||
290 | ct_hdr->ct_cmd = cmd; | ||
291 | ct_hdr->ct_mr_size = mr_size / 4; | ||
292 | } | ||
293 | |||
288 | static int zfcp_fc_ns_gid_pn_request(struct zfcp_port *port, | 294 | static int zfcp_fc_ns_gid_pn_request(struct zfcp_port *port, |
289 | struct zfcp_fc_gid_pn *gid_pn) | 295 | struct zfcp_fc_req *fc_req) |
290 | { | 296 | { |
291 | struct zfcp_adapter *adapter = port->adapter; | 297 | struct zfcp_adapter *adapter = port->adapter; |
292 | DECLARE_COMPLETION_ONSTACK(completion); | 298 | DECLARE_COMPLETION_ONSTACK(completion); |
299 | struct zfcp_fc_gid_pn_req *gid_pn_req = &fc_req->u.gid_pn.req; | ||
300 | struct zfcp_fc_gid_pn_rsp *gid_pn_rsp = &fc_req->u.gid_pn.rsp; | ||
293 | int ret; | 301 | int ret; |
294 | 302 | ||
295 | /* setup parameters for send generic command */ | 303 | /* setup parameters for send generic command */ |
296 | gid_pn->port = port; | 304 | fc_req->ct_els.port = port; |
297 | gid_pn->ct.handler = zfcp_fc_complete; | 305 | fc_req->ct_els.handler = zfcp_fc_complete; |
298 | gid_pn->ct.handler_data = &completion; | 306 | fc_req->ct_els.handler_data = &completion; |
299 | gid_pn->ct.req = &gid_pn->sg_req; | 307 | fc_req->ct_els.req = &fc_req->sg_req; |
300 | gid_pn->ct.resp = &gid_pn->sg_resp; | 308 | fc_req->ct_els.resp = &fc_req->sg_rsp; |
301 | sg_init_one(&gid_pn->sg_req, &gid_pn->gid_pn_req, | 309 | sg_init_one(&fc_req->sg_req, gid_pn_req, sizeof(*gid_pn_req)); |
302 | sizeof(struct zfcp_fc_gid_pn_req)); | 310 | sg_init_one(&fc_req->sg_rsp, gid_pn_rsp, sizeof(*gid_pn_rsp)); |
303 | sg_init_one(&gid_pn->sg_resp, &gid_pn->gid_pn_resp, | 311 | |
304 | sizeof(struct zfcp_fc_gid_pn_resp)); | 312 | zfcp_fc_ct_ns_init(&gid_pn_req->ct_hdr, |
305 | 313 | FC_NS_GID_PN, ZFCP_FC_CT_SIZE_PAGE); | |
306 | /* setup nameserver request */ | 314 | gid_pn_req->gid_pn.fn_wwpn = port->wwpn; |
307 | gid_pn->gid_pn_req.ct_hdr.ct_rev = FC_CT_REV; | 315 | |
308 | gid_pn->gid_pn_req.ct_hdr.ct_fs_type = FC_FST_DIR; | 316 | ret = zfcp_fsf_send_ct(&adapter->gs->ds, &fc_req->ct_els, |
309 | gid_pn->gid_pn_req.ct_hdr.ct_fs_subtype = FC_NS_SUBTYPE; | ||
310 | gid_pn->gid_pn_req.ct_hdr.ct_options = 0; | ||
311 | gid_pn->gid_pn_req.ct_hdr.ct_cmd = FC_NS_GID_PN; | ||
312 | gid_pn->gid_pn_req.ct_hdr.ct_mr_size = ZFCP_FC_CT_SIZE_PAGE / 4; | ||
313 | gid_pn->gid_pn_req.gid_pn.fn_wwpn = port->wwpn; | ||
314 | |||
315 | ret = zfcp_fsf_send_ct(&adapter->gs->ds, &gid_pn->ct, | ||
316 | adapter->pool.gid_pn_req, | 317 | adapter->pool.gid_pn_req, |
317 | ZFCP_FC_CTELS_TMO); | 318 | ZFCP_FC_CTELS_TMO); |
318 | if (!ret) { | 319 | if (!ret) { |
319 | wait_for_completion(&completion); | 320 | wait_for_completion(&completion); |
320 | zfcp_fc_ns_gid_pn_eval(gid_pn); | 321 | zfcp_fc_ns_gid_pn_eval(fc_req); |
321 | } | 322 | } |
322 | return ret; | 323 | return ret; |
323 | } | 324 | } |
324 | 325 | ||
325 | /** | 326 | /** |
326 | * zfcp_fc_ns_gid_pn_request - initiate GID_PN nameserver request | 327 | * zfcp_fc_ns_gid_pn - initiate GID_PN nameserver request |
327 | * @port: port where GID_PN request is needed | 328 | * @port: port where GID_PN request is needed |
328 | * return: -ENOMEM on error, 0 otherwise | 329 | * return: -ENOMEM on error, 0 otherwise |
329 | */ | 330 | */ |
330 | static int zfcp_fc_ns_gid_pn(struct zfcp_port *port) | 331 | static int zfcp_fc_ns_gid_pn(struct zfcp_port *port) |
331 | { | 332 | { |
332 | int ret; | 333 | int ret; |
333 | struct zfcp_fc_gid_pn *gid_pn; | 334 | struct zfcp_fc_req *fc_req; |
334 | struct zfcp_adapter *adapter = port->adapter; | 335 | struct zfcp_adapter *adapter = port->adapter; |
335 | 336 | ||
336 | gid_pn = mempool_alloc(adapter->pool.gid_pn, GFP_ATOMIC); | 337 | fc_req = mempool_alloc(adapter->pool.gid_pn, GFP_ATOMIC); |
337 | if (!gid_pn) | 338 | if (!fc_req) |
338 | return -ENOMEM; | 339 | return -ENOMEM; |
339 | 340 | ||
340 | memset(gid_pn, 0, sizeof(*gid_pn)); | 341 | memset(fc_req, 0, sizeof(*fc_req)); |
341 | 342 | ||
342 | ret = zfcp_fc_wka_port_get(&adapter->gs->ds); | 343 | ret = zfcp_fc_wka_port_get(&adapter->gs->ds); |
343 | if (ret) | 344 | if (ret) |
344 | goto out; | 345 | goto out; |
345 | 346 | ||
346 | ret = zfcp_fc_ns_gid_pn_request(port, gid_pn); | 347 | ret = zfcp_fc_ns_gid_pn_request(port, fc_req); |
347 | 348 | ||
348 | zfcp_fc_wka_port_put(&adapter->gs->ds); | 349 | zfcp_fc_wka_port_put(&adapter->gs->ds); |
349 | out: | 350 | out: |
350 | mempool_free(gid_pn, adapter->pool.gid_pn); | 351 | mempool_free(fc_req, adapter->pool.gid_pn); |
351 | return ret; | 352 | return ret; |
352 | } | 353 | } |
353 | 354 | ||
@@ -419,11 +420,11 @@ void zfcp_fc_plogi_evaluate(struct zfcp_port *port, struct fc_els_flogi *plogi) | |||
419 | 420 | ||
420 | static void zfcp_fc_adisc_handler(void *data) | 421 | static void zfcp_fc_adisc_handler(void *data) |
421 | { | 422 | { |
422 | struct zfcp_fc_els_adisc *adisc = data; | 423 | struct zfcp_fc_req *fc_req = data; |
423 | struct zfcp_port *port = adisc->els.port; | 424 | struct zfcp_port *port = fc_req->ct_els.port; |
424 | struct fc_els_adisc *adisc_resp = &adisc->adisc_resp; | 425 | struct fc_els_adisc *adisc_resp = &fc_req->u.adisc.rsp; |
425 | 426 | ||
426 | if (adisc->els.status) { | 427 | if (fc_req->ct_els.status) { |
427 | /* request rejected or timed out */ | 428 | /* request rejected or timed out */ |
428 | zfcp_erp_port_forced_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, | 429 | zfcp_erp_port_forced_reopen(port, ZFCP_STATUS_COMMON_ERP_FAILED, |
429 | "fcadh_1"); | 430 | "fcadh_1"); |
@@ -445,42 +446,42 @@ static void zfcp_fc_adisc_handler(void *data) | |||
445 | out: | 446 | out: |
446 | atomic_clear_mask(ZFCP_STATUS_PORT_LINK_TEST, &port->status); | 447 | atomic_clear_mask(ZFCP_STATUS_PORT_LINK_TEST, &port->status); |
447 | put_device(&port->dev); | 448 | put_device(&port->dev); |
448 | kmem_cache_free(zfcp_data.adisc_cache, adisc); | 449 | kmem_cache_free(zfcp_fc_req_cache, fc_req); |
449 | } | 450 | } |
450 | 451 | ||
451 | static int zfcp_fc_adisc(struct zfcp_port *port) | 452 | static int zfcp_fc_adisc(struct zfcp_port *port) |
452 | { | 453 | { |
453 | struct zfcp_fc_els_adisc *adisc; | 454 | struct zfcp_fc_req *fc_req; |
454 | struct zfcp_adapter *adapter = port->adapter; | 455 | struct zfcp_adapter *adapter = port->adapter; |
456 | struct Scsi_Host *shost = adapter->scsi_host; | ||
455 | int ret; | 457 | int ret; |
456 | 458 | ||
457 | adisc = kmem_cache_zalloc(zfcp_data.adisc_cache, GFP_ATOMIC); | 459 | fc_req = kmem_cache_zalloc(zfcp_fc_req_cache, GFP_ATOMIC); |
458 | if (!adisc) | 460 | if (!fc_req) |
459 | return -ENOMEM; | 461 | return -ENOMEM; |
460 | 462 | ||
461 | adisc->els.port = port; | 463 | fc_req->ct_els.port = port; |
462 | adisc->els.req = &adisc->req; | 464 | fc_req->ct_els.req = &fc_req->sg_req; |
463 | adisc->els.resp = &adisc->resp; | 465 | fc_req->ct_els.resp = &fc_req->sg_rsp; |
464 | sg_init_one(adisc->els.req, &adisc->adisc_req, | 466 | sg_init_one(&fc_req->sg_req, &fc_req->u.adisc.req, |
465 | sizeof(struct fc_els_adisc)); | 467 | sizeof(struct fc_els_adisc)); |
466 | sg_init_one(adisc->els.resp, &adisc->adisc_resp, | 468 | sg_init_one(&fc_req->sg_rsp, &fc_req->u.adisc.rsp, |
467 | sizeof(struct fc_els_adisc)); | 469 | sizeof(struct fc_els_adisc)); |
468 | 470 | ||
469 | adisc->els.handler = zfcp_fc_adisc_handler; | 471 | fc_req->ct_els.handler = zfcp_fc_adisc_handler; |
470 | adisc->els.handler_data = adisc; | 472 | fc_req->ct_els.handler_data = fc_req; |
471 | 473 | ||
472 | /* acc. to FC-FS, hard_nport_id in ADISC should not be set for ports | 474 | /* acc. to FC-FS, hard_nport_id in ADISC should not be set for ports |
473 | without FC-AL-2 capability, so we don't set it */ | 475 | without FC-AL-2 capability, so we don't set it */ |
474 | adisc->adisc_req.adisc_wwpn = fc_host_port_name(adapter->scsi_host); | 476 | fc_req->u.adisc.req.adisc_wwpn = fc_host_port_name(shost); |
475 | adisc->adisc_req.adisc_wwnn = fc_host_node_name(adapter->scsi_host); | 477 | fc_req->u.adisc.req.adisc_wwnn = fc_host_node_name(shost); |
476 | adisc->adisc_req.adisc_cmd = ELS_ADISC; | 478 | fc_req->u.adisc.req.adisc_cmd = ELS_ADISC; |
477 | hton24(adisc->adisc_req.adisc_port_id, | 479 | hton24(fc_req->u.adisc.req.adisc_port_id, fc_host_port_id(shost)); |
478 | fc_host_port_id(adapter->scsi_host)); | ||
479 | 480 | ||
480 | ret = zfcp_fsf_send_els(adapter, port->d_id, &adisc->els, | 481 | ret = zfcp_fsf_send_els(adapter, port->d_id, &fc_req->ct_els, |
481 | ZFCP_FC_CTELS_TMO); | 482 | ZFCP_FC_CTELS_TMO); |
482 | if (ret) | 483 | if (ret) |
483 | kmem_cache_free(zfcp_data.adisc_cache, adisc); | 484 | kmem_cache_free(zfcp_fc_req_cache, fc_req); |
484 | 485 | ||
485 | return ret; | 486 | return ret; |
486 | } | 487 | } |
@@ -528,68 +529,42 @@ void zfcp_fc_test_link(struct zfcp_port *port) | |||
528 | put_device(&port->dev); | 529 | put_device(&port->dev); |
529 | } | 530 | } |
530 | 531 | ||
531 | static void zfcp_free_sg_env(struct zfcp_fc_gpn_ft *gpn_ft, int buf_num) | 532 | static struct zfcp_fc_req *zfcp_alloc_sg_env(int buf_num) |
532 | { | 533 | { |
533 | struct scatterlist *sg = &gpn_ft->sg_req; | 534 | struct zfcp_fc_req *fc_req; |
534 | |||
535 | kmem_cache_free(zfcp_data.gpn_ft_cache, sg_virt(sg)); | ||
536 | zfcp_sg_free_table(gpn_ft->sg_resp, buf_num); | ||
537 | |||
538 | kfree(gpn_ft); | ||
539 | } | ||
540 | 535 | ||
541 | static struct zfcp_fc_gpn_ft *zfcp_alloc_sg_env(int buf_num) | 536 | fc_req = kmem_cache_zalloc(zfcp_fc_req_cache, GFP_KERNEL); |
542 | { | 537 | if (!fc_req) |
543 | struct zfcp_fc_gpn_ft *gpn_ft; | ||
544 | struct zfcp_fc_gpn_ft_req *req; | ||
545 | |||
546 | gpn_ft = kzalloc(sizeof(*gpn_ft), GFP_KERNEL); | ||
547 | if (!gpn_ft) | ||
548 | return NULL; | 538 | return NULL; |
549 | 539 | ||
550 | req = kmem_cache_zalloc(zfcp_data.gpn_ft_cache, GFP_KERNEL); | 540 | if (zfcp_sg_setup_table(&fc_req->sg_rsp, buf_num)) { |
551 | if (!req) { | 541 | kmem_cache_free(zfcp_fc_req_cache, fc_req); |
552 | kfree(gpn_ft); | 542 | return NULL; |
553 | gpn_ft = NULL; | ||
554 | goto out; | ||
555 | } | 543 | } |
556 | sg_init_one(&gpn_ft->sg_req, req, sizeof(*req)); | ||
557 | 544 | ||
558 | if (zfcp_sg_setup_table(gpn_ft->sg_resp, buf_num)) { | 545 | sg_init_one(&fc_req->sg_req, &fc_req->u.gpn_ft.req, |
559 | zfcp_free_sg_env(gpn_ft, buf_num); | 546 | sizeof(struct zfcp_fc_gpn_ft_req)); |
560 | gpn_ft = NULL; | ||
561 | } | ||
562 | out: | ||
563 | return gpn_ft; | ||
564 | } | ||
565 | 547 | ||
548 | return fc_req; | ||
549 | } | ||
566 | 550 | ||
567 | static int zfcp_fc_send_gpn_ft(struct zfcp_fc_gpn_ft *gpn_ft, | 551 | static int zfcp_fc_send_gpn_ft(struct zfcp_fc_req *fc_req, |
568 | struct zfcp_adapter *adapter, int max_bytes) | 552 | struct zfcp_adapter *adapter, int max_bytes) |
569 | { | 553 | { |
570 | struct zfcp_fsf_ct_els *ct = &gpn_ft->ct; | 554 | struct zfcp_fsf_ct_els *ct_els = &fc_req->ct_els; |
571 | struct zfcp_fc_gpn_ft_req *req = sg_virt(&gpn_ft->sg_req); | 555 | struct zfcp_fc_gpn_ft_req *req = &fc_req->u.gpn_ft.req; |
572 | DECLARE_COMPLETION_ONSTACK(completion); | 556 | DECLARE_COMPLETION_ONSTACK(completion); |
573 | int ret; | 557 | int ret; |
574 | 558 | ||
575 | /* prepare CT IU for GPN_FT */ | 559 | zfcp_fc_ct_ns_init(&req->ct_hdr, FC_NS_GPN_FT, max_bytes); |
576 | req->ct_hdr.ct_rev = FC_CT_REV; | ||
577 | req->ct_hdr.ct_fs_type = FC_FST_DIR; | ||
578 | req->ct_hdr.ct_fs_subtype = FC_NS_SUBTYPE; | ||
579 | req->ct_hdr.ct_options = 0; | ||
580 | req->ct_hdr.ct_cmd = FC_NS_GPN_FT; | ||
581 | req->ct_hdr.ct_mr_size = max_bytes / 4; | ||
582 | req->gpn_ft.fn_domain_id_scope = 0; | ||
583 | req->gpn_ft.fn_area_id_scope = 0; | ||
584 | req->gpn_ft.fn_fc4_type = FC_TYPE_FCP; | 560 | req->gpn_ft.fn_fc4_type = FC_TYPE_FCP; |
585 | 561 | ||
586 | /* prepare zfcp_send_ct */ | 562 | ct_els->handler = zfcp_fc_complete; |
587 | ct->handler = zfcp_fc_complete; | 563 | ct_els->handler_data = &completion; |
588 | ct->handler_data = &completion; | 564 | ct_els->req = &fc_req->sg_req; |
589 | ct->req = &gpn_ft->sg_req; | 565 | ct_els->resp = &fc_req->sg_rsp; |
590 | ct->resp = gpn_ft->sg_resp; | ||
591 | 566 | ||
592 | ret = zfcp_fsf_send_ct(&adapter->gs->ds, ct, NULL, | 567 | ret = zfcp_fsf_send_ct(&adapter->gs->ds, ct_els, NULL, |
593 | ZFCP_FC_CTELS_TMO); | 568 | ZFCP_FC_CTELS_TMO); |
594 | if (!ret) | 569 | if (!ret) |
595 | wait_for_completion(&completion); | 570 | wait_for_completion(&completion); |
@@ -610,11 +585,11 @@ static void zfcp_fc_validate_port(struct zfcp_port *port, struct list_head *lh) | |||
610 | list_move_tail(&port->list, lh); | 585 | list_move_tail(&port->list, lh); |
611 | } | 586 | } |
612 | 587 | ||
613 | static int zfcp_fc_eval_gpn_ft(struct zfcp_fc_gpn_ft *gpn_ft, | 588 | static int zfcp_fc_eval_gpn_ft(struct zfcp_fc_req *fc_req, |
614 | struct zfcp_adapter *adapter, int max_entries) | 589 | struct zfcp_adapter *adapter, int max_entries) |
615 | { | 590 | { |
616 | struct zfcp_fsf_ct_els *ct = &gpn_ft->ct; | 591 | struct zfcp_fsf_ct_els *ct_els = &fc_req->ct_els; |
617 | struct scatterlist *sg = gpn_ft->sg_resp; | 592 | struct scatterlist *sg = &fc_req->sg_rsp; |
618 | struct fc_ct_hdr *hdr = sg_virt(sg); | 593 | struct fc_ct_hdr *hdr = sg_virt(sg); |
619 | struct fc_gpn_ft_resp *acc = sg_virt(sg); | 594 | struct fc_gpn_ft_resp *acc = sg_virt(sg); |
620 | struct zfcp_port *port, *tmp; | 595 | struct zfcp_port *port, *tmp; |
@@ -623,7 +598,7 @@ static int zfcp_fc_eval_gpn_ft(struct zfcp_fc_gpn_ft *gpn_ft, | |||
623 | u32 d_id; | 598 | u32 d_id; |
624 | int ret = 0, x, last = 0; | 599 | int ret = 0, x, last = 0; |
625 | 600 | ||
626 | if (ct->status) | 601 | if (ct_els->status) |
627 | return -EIO; | 602 | return -EIO; |
628 | 603 | ||
629 | if (hdr->ct_cmd != FC_FS_ACC) { | 604 | if (hdr->ct_cmd != FC_FS_ACC) { |
@@ -687,7 +662,7 @@ void zfcp_fc_scan_ports(struct work_struct *work) | |||
687 | struct zfcp_adapter *adapter = container_of(work, struct zfcp_adapter, | 662 | struct zfcp_adapter *adapter = container_of(work, struct zfcp_adapter, |
688 | scan_work); | 663 | scan_work); |
689 | int ret, i; | 664 | int ret, i; |
690 | struct zfcp_fc_gpn_ft *gpn_ft; | 665 | struct zfcp_fc_req *fc_req; |
691 | int chain, max_entries, buf_num, max_bytes; | 666 | int chain, max_entries, buf_num, max_bytes; |
692 | 667 | ||
693 | chain = adapter->adapter_features & FSF_FEATURE_ELS_CT_CHAINED_SBALS; | 668 | chain = adapter->adapter_features & FSF_FEATURE_ELS_CT_CHAINED_SBALS; |
@@ -702,25 +677,145 @@ void zfcp_fc_scan_ports(struct work_struct *work) | |||
702 | if (zfcp_fc_wka_port_get(&adapter->gs->ds)) | 677 | if (zfcp_fc_wka_port_get(&adapter->gs->ds)) |
703 | return; | 678 | return; |
704 | 679 | ||
705 | gpn_ft = zfcp_alloc_sg_env(buf_num); | 680 | fc_req = zfcp_alloc_sg_env(buf_num); |
706 | if (!gpn_ft) | 681 | if (!fc_req) |
707 | goto out; | 682 | goto out; |
708 | 683 | ||
709 | for (i = 0; i < 3; i++) { | 684 | for (i = 0; i < 3; i++) { |
710 | ret = zfcp_fc_send_gpn_ft(gpn_ft, adapter, max_bytes); | 685 | ret = zfcp_fc_send_gpn_ft(fc_req, adapter, max_bytes); |
711 | if (!ret) { | 686 | if (!ret) { |
712 | ret = zfcp_fc_eval_gpn_ft(gpn_ft, adapter, max_entries); | 687 | ret = zfcp_fc_eval_gpn_ft(fc_req, adapter, max_entries); |
713 | if (ret == -EAGAIN) | 688 | if (ret == -EAGAIN) |
714 | ssleep(1); | 689 | ssleep(1); |
715 | else | 690 | else |
716 | break; | 691 | break; |
717 | } | 692 | } |
718 | } | 693 | } |
719 | zfcp_free_sg_env(gpn_ft, buf_num); | 694 | zfcp_sg_free_table(&fc_req->sg_rsp, buf_num); |
695 | kmem_cache_free(zfcp_fc_req_cache, fc_req); | ||
720 | out: | 696 | out: |
721 | zfcp_fc_wka_port_put(&adapter->gs->ds); | 697 | zfcp_fc_wka_port_put(&adapter->gs->ds); |
722 | } | 698 | } |
723 | 699 | ||
700 | static int zfcp_fc_gspn(struct zfcp_adapter *adapter, | ||
701 | struct zfcp_fc_req *fc_req) | ||
702 | { | ||
703 | DECLARE_COMPLETION_ONSTACK(completion); | ||
704 | char devno[] = "DEVNO:"; | ||
705 | struct zfcp_fsf_ct_els *ct_els = &fc_req->ct_els; | ||
706 | struct zfcp_fc_gspn_req *gspn_req = &fc_req->u.gspn.req; | ||
707 | struct zfcp_fc_gspn_rsp *gspn_rsp = &fc_req->u.gspn.rsp; | ||
708 | int ret; | ||
709 | |||
710 | zfcp_fc_ct_ns_init(&gspn_req->ct_hdr, FC_NS_GSPN_ID, | ||
711 | FC_SYMBOLIC_NAME_SIZE); | ||
712 | hton24(gspn_req->gspn.fp_fid, fc_host_port_id(adapter->scsi_host)); | ||
713 | |||
714 | sg_init_one(&fc_req->sg_req, gspn_req, sizeof(*gspn_req)); | ||
715 | sg_init_one(&fc_req->sg_rsp, gspn_rsp, sizeof(*gspn_rsp)); | ||
716 | |||
717 | ct_els->handler = zfcp_fc_complete; | ||
718 | ct_els->handler_data = &completion; | ||
719 | ct_els->req = &fc_req->sg_req; | ||
720 | ct_els->resp = &fc_req->sg_rsp; | ||
721 | |||
722 | ret = zfcp_fsf_send_ct(&adapter->gs->ds, ct_els, NULL, | ||
723 | ZFCP_FC_CTELS_TMO); | ||
724 | if (ret) | ||
725 | return ret; | ||
726 | |||
727 | wait_for_completion(&completion); | ||
728 | if (ct_els->status) | ||
729 | return ct_els->status; | ||
730 | |||
731 | if (fc_host_port_type(adapter->scsi_host) == FC_PORTTYPE_NPIV && | ||
732 | !(strstr(gspn_rsp->gspn.fp_name, devno))) | ||
733 | snprintf(fc_host_symbolic_name(adapter->scsi_host), | ||
734 | FC_SYMBOLIC_NAME_SIZE, "%s%s %s NAME: %s", | ||
735 | gspn_rsp->gspn.fp_name, devno, | ||
736 | dev_name(&adapter->ccw_device->dev), | ||
737 | init_utsname()->nodename); | ||
738 | else | ||
739 | strlcpy(fc_host_symbolic_name(adapter->scsi_host), | ||
740 | gspn_rsp->gspn.fp_name, FC_SYMBOLIC_NAME_SIZE); | ||
741 | |||
742 | return 0; | ||
743 | } | ||
744 | |||
745 | static void zfcp_fc_rspn(struct zfcp_adapter *adapter, | ||
746 | struct zfcp_fc_req *fc_req) | ||
747 | { | ||
748 | DECLARE_COMPLETION_ONSTACK(completion); | ||
749 | struct Scsi_Host *shost = adapter->scsi_host; | ||
750 | struct zfcp_fsf_ct_els *ct_els = &fc_req->ct_els; | ||
751 | struct zfcp_fc_rspn_req *rspn_req = &fc_req->u.rspn.req; | ||
752 | struct fc_ct_hdr *rspn_rsp = &fc_req->u.rspn.rsp; | ||
753 | int ret, len; | ||
754 | |||
755 | zfcp_fc_ct_ns_init(&rspn_req->ct_hdr, FC_NS_RSPN_ID, | ||
756 | FC_SYMBOLIC_NAME_SIZE); | ||
757 | hton24(rspn_req->rspn.fr_fid.fp_fid, fc_host_port_id(shost)); | ||
758 | len = strlcpy(rspn_req->rspn.fr_name, fc_host_symbolic_name(shost), | ||
759 | FC_SYMBOLIC_NAME_SIZE); | ||
760 | rspn_req->rspn.fr_name_len = len; | ||
761 | |||
762 | sg_init_one(&fc_req->sg_req, rspn_req, sizeof(*rspn_req)); | ||
763 | sg_init_one(&fc_req->sg_rsp, rspn_rsp, sizeof(*rspn_rsp)); | ||
764 | |||
765 | ct_els->handler = zfcp_fc_complete; | ||
766 | ct_els->handler_data = &completion; | ||
767 | ct_els->req = &fc_req->sg_req; | ||
768 | ct_els->resp = &fc_req->sg_rsp; | ||
769 | |||
770 | ret = zfcp_fsf_send_ct(&adapter->gs->ds, ct_els, NULL, | ||
771 | ZFCP_FC_CTELS_TMO); | ||
772 | if (!ret) | ||
773 | wait_for_completion(&completion); | ||
774 | } | ||
775 | |||
776 | /** | ||
777 | * zfcp_fc_sym_name_update - Retrieve and update the symbolic port name | ||
778 | * @work: ns_up_work of the adapter where to update the symbolic port name | ||
779 | * | ||
780 | * Retrieve the current symbolic port name that may have been set by | ||
781 | * the hardware using the GSPN request and update the fc_host | ||
782 | * symbolic_name sysfs attribute. When running in NPIV mode (and hence | ||
783 | * the port name is unique for this system), update the symbolic port | ||
784 | * name to add Linux specific information and update the FC nameserver | ||
785 | * using the RSPN request. | ||
786 | */ | ||
787 | void zfcp_fc_sym_name_update(struct work_struct *work) | ||
788 | { | ||
789 | struct zfcp_adapter *adapter = container_of(work, struct zfcp_adapter, | ||
790 | ns_up_work); | ||
791 | int ret; | ||
792 | struct zfcp_fc_req *fc_req; | ||
793 | |||
794 | if (fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPORT && | ||
795 | fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPIV) | ||
796 | return; | ||
797 | |||
798 | fc_req = kmem_cache_zalloc(zfcp_fc_req_cache, GFP_KERNEL); | ||
799 | if (!fc_req) | ||
800 | return; | ||
801 | |||
802 | ret = zfcp_fc_wka_port_get(&adapter->gs->ds); | ||
803 | if (ret) | ||
804 | goto out_free; | ||
805 | |||
806 | ret = zfcp_fc_gspn(adapter, fc_req); | ||
807 | if (ret || fc_host_port_type(adapter->scsi_host) != FC_PORTTYPE_NPIV) | ||
808 | goto out_ds_put; | ||
809 | |||
810 | memset(fc_req, 0, sizeof(*fc_req)); | ||
811 | zfcp_fc_rspn(adapter, fc_req); | ||
812 | |||
813 | out_ds_put: | ||
814 | zfcp_fc_wka_port_put(&adapter->gs->ds); | ||
815 | out_free: | ||
816 | kmem_cache_free(zfcp_fc_req_cache, fc_req); | ||
817 | } | ||
818 | |||
724 | static void zfcp_fc_ct_els_job_handler(void *data) | 819 | static void zfcp_fc_ct_els_job_handler(void *data) |
725 | { | 820 | { |
726 | struct fc_bsg_job *job = data; | 821 | struct fc_bsg_job *job = data; |
diff --git a/drivers/s390/scsi/zfcp_fc.h b/drivers/s390/scsi/zfcp_fc.h index b464ae01086c..4561f3bf7300 100644 --- a/drivers/s390/scsi/zfcp_fc.h +++ b/drivers/s390/scsi/zfcp_fc.h | |||
@@ -64,33 +64,16 @@ struct zfcp_fc_gid_pn_req { | |||
64 | } __packed; | 64 | } __packed; |
65 | 65 | ||
66 | /** | 66 | /** |
67 | * struct zfcp_fc_gid_pn_resp - container for ct header plus gid_pn response | 67 | * struct zfcp_fc_gid_pn_rsp - container for ct header plus gid_pn response |
68 | * @ct_hdr: FC GS common transport header | 68 | * @ct_hdr: FC GS common transport header |
69 | * @gid_pn: GID_PN response | 69 | * @gid_pn: GID_PN response |
70 | */ | 70 | */ |
71 | struct zfcp_fc_gid_pn_resp { | 71 | struct zfcp_fc_gid_pn_rsp { |
72 | struct fc_ct_hdr ct_hdr; | 72 | struct fc_ct_hdr ct_hdr; |
73 | struct fc_gid_pn_resp gid_pn; | 73 | struct fc_gid_pn_resp gid_pn; |
74 | } __packed; | 74 | } __packed; |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * struct zfcp_fc_gid_pn - everything required in zfcp for gid_pn request | ||
78 | * @ct: data passed to zfcp_fsf for issuing fsf request | ||
79 | * @sg_req: scatterlist entry for request data | ||
80 | * @sg_resp: scatterlist entry for response data | ||
81 | * @gid_pn_req: GID_PN request data | ||
82 | * @gid_pn_resp: GID_PN response data | ||
83 | */ | ||
84 | struct zfcp_fc_gid_pn { | ||
85 | struct zfcp_fsf_ct_els ct; | ||
86 | struct scatterlist sg_req; | ||
87 | struct scatterlist sg_resp; | ||
88 | struct zfcp_fc_gid_pn_req gid_pn_req; | ||
89 | struct zfcp_fc_gid_pn_resp gid_pn_resp; | ||
90 | struct zfcp_port *port; | ||
91 | }; | ||
92 | |||
93 | /** | ||
94 | * struct zfcp_fc_gpn_ft - container for ct header plus gpn_ft request | 77 | * struct zfcp_fc_gpn_ft - container for ct header plus gpn_ft request |
95 | * @ct_hdr: FC GS common transport header | 78 | * @ct_hdr: FC GS common transport header |
96 | * @gpn_ft: GPN_FT request | 79 | * @gpn_ft: GPN_FT request |
@@ -101,41 +84,72 @@ struct zfcp_fc_gpn_ft_req { | |||
101 | } __packed; | 84 | } __packed; |
102 | 85 | ||
103 | /** | 86 | /** |
104 | * struct zfcp_fc_gpn_ft_resp - container for ct header plus gpn_ft response | 87 | * struct zfcp_fc_gspn_req - container for ct header plus GSPN_ID request |
105 | * @ct_hdr: FC GS common transport header | 88 | * @ct_hdr: FC GS common transport header |
106 | * @gpn_ft: Array of gpn_ft response data to fill one memory page | 89 | * @gspn: GSPN_ID request |
107 | */ | 90 | */ |
108 | struct zfcp_fc_gpn_ft_resp { | 91 | struct zfcp_fc_gspn_req { |
109 | struct fc_ct_hdr ct_hdr; | 92 | struct fc_ct_hdr ct_hdr; |
110 | struct fc_gpn_ft_resp gpn_ft[ZFCP_FC_GPN_FT_ENT_PAGE]; | 93 | struct fc_gid_pn_resp gspn; |
111 | } __packed; | 94 | } __packed; |
112 | 95 | ||
113 | /** | 96 | /** |
114 | * struct zfcp_fc_gpn_ft - zfcp data for gpn_ft request | 97 | * struct zfcp_fc_gspn_rsp - container for ct header plus GSPN_ID response |
115 | * @ct: data passed to zfcp_fsf for issuing fsf request | 98 | * @ct_hdr: FC GS common transport header |
116 | * @sg_req: scatter list entry for gpn_ft request | 99 | * @gspn: GSPN_ID response |
117 | * @sg_resp: scatter list entries for gpn_ft responses (per memory page) | 100 | * @name: The name string of the GSPN_ID response |
118 | */ | 101 | */ |
119 | struct zfcp_fc_gpn_ft { | 102 | struct zfcp_fc_gspn_rsp { |
120 | struct zfcp_fsf_ct_els ct; | 103 | struct fc_ct_hdr ct_hdr; |
121 | struct scatterlist sg_req; | 104 | struct fc_gspn_resp gspn; |
122 | struct scatterlist sg_resp[ZFCP_FC_GPN_FT_NUM_BUFS]; | 105 | char name[FC_SYMBOLIC_NAME_SIZE]; |
123 | }; | 106 | } __packed; |
124 | 107 | ||
125 | /** | 108 | /** |
126 | * struct zfcp_fc_els_adisc - everything required in zfcp for issuing ELS ADISC | 109 | * struct zfcp_fc_rspn_req - container for ct header plus RSPN_ID request |
127 | * @els: data required for issuing els fsf command | 110 | * @ct_hdr: FC GS common transport header |
128 | * @req: scatterlist entry for ELS ADISC request | 111 | * @rspn: RSPN_ID request |
129 | * @resp: scatterlist entry for ELS ADISC response | 112 | * @name: The name string of the RSPN_ID request |
130 | * @adisc_req: ELS ADISC request data | ||
131 | * @adisc_resp: ELS ADISC response data | ||
132 | */ | 113 | */ |
133 | struct zfcp_fc_els_adisc { | 114 | struct zfcp_fc_rspn_req { |
134 | struct zfcp_fsf_ct_els els; | 115 | struct fc_ct_hdr ct_hdr; |
135 | struct scatterlist req; | 116 | struct fc_ns_rspn rspn; |
136 | struct scatterlist resp; | 117 | char name[FC_SYMBOLIC_NAME_SIZE]; |
137 | struct fc_els_adisc adisc_req; | 118 | } __packed; |
138 | struct fc_els_adisc adisc_resp; | 119 | |
120 | /** | ||
121 | * struct zfcp_fc_req - Container for FC ELS and CT requests sent from zfcp | ||
122 | * @ct_els: data required for issuing fsf command | ||
123 | * @sg_req: scatterlist entry for request data | ||
124 | * @sg_rsp: scatterlist entry for response data | ||
125 | * @u: request specific data | ||
126 | */ | ||
127 | struct zfcp_fc_req { | ||
128 | struct zfcp_fsf_ct_els ct_els; | ||
129 | struct scatterlist sg_req; | ||
130 | struct scatterlist sg_rsp; | ||
131 | union { | ||
132 | struct { | ||
133 | struct fc_els_adisc req; | ||
134 | struct fc_els_adisc rsp; | ||
135 | } adisc; | ||
136 | struct { | ||
137 | struct zfcp_fc_gid_pn_req req; | ||
138 | struct zfcp_fc_gid_pn_rsp rsp; | ||
139 | } gid_pn; | ||
140 | struct { | ||
141 | struct scatterlist sg_rsp2[ZFCP_FC_GPN_FT_NUM_BUFS - 1]; | ||
142 | struct zfcp_fc_gpn_ft_req req; | ||
143 | } gpn_ft; | ||
144 | struct { | ||
145 | struct zfcp_fc_gspn_req req; | ||
146 | struct zfcp_fc_gspn_rsp rsp; | ||
147 | } gspn; | ||
148 | struct { | ||
149 | struct zfcp_fc_rspn_req req; | ||
150 | struct fc_ct_hdr rsp; | ||
151 | } rspn; | ||
152 | } u; | ||
139 | }; | 153 | }; |
140 | 154 | ||
141 | /** | 155 | /** |
@@ -192,14 +206,21 @@ struct zfcp_fc_wka_ports { | |||
192 | * zfcp_fc_scsi_to_fcp - setup FCP command with data from scsi_cmnd | 206 | * zfcp_fc_scsi_to_fcp - setup FCP command with data from scsi_cmnd |
193 | * @fcp: fcp_cmnd to setup | 207 | * @fcp: fcp_cmnd to setup |
194 | * @scsi: scsi_cmnd where to get LUN, task attributes/flags and CDB | 208 | * @scsi: scsi_cmnd where to get LUN, task attributes/flags and CDB |
209 | * @tm: task management flags to setup task management command | ||
195 | */ | 210 | */ |
196 | static inline | 211 | static inline |
197 | void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct scsi_cmnd *scsi) | 212 | void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct scsi_cmnd *scsi, |
213 | u8 tm_flags) | ||
198 | { | 214 | { |
199 | char tag[2]; | 215 | char tag[2]; |
200 | 216 | ||
201 | int_to_scsilun(scsi->device->lun, (struct scsi_lun *) &fcp->fc_lun); | 217 | int_to_scsilun(scsi->device->lun, (struct scsi_lun *) &fcp->fc_lun); |
202 | 218 | ||
219 | if (unlikely(tm_flags)) { | ||
220 | fcp->fc_tm_flags = tm_flags; | ||
221 | return; | ||
222 | } | ||
223 | |||
203 | if (scsi_populate_tag_msg(scsi, tag)) { | 224 | if (scsi_populate_tag_msg(scsi, tag)) { |
204 | switch (tag[0]) { | 225 | switch (tag[0]) { |
205 | case MSG_ORDERED_TAG: | 226 | case MSG_ORDERED_TAG: |
@@ -226,19 +247,6 @@ void zfcp_fc_scsi_to_fcp(struct fcp_cmnd *fcp, struct scsi_cmnd *scsi) | |||
226 | } | 247 | } |
227 | 248 | ||
228 | /** | 249 | /** |
229 | * zfcp_fc_fcp_tm - setup FCP command as task management command | ||
230 | * @fcp: fcp_cmnd to setup | ||
231 | * @dev: scsi_device where to send the task management command | ||
232 | * @tm: task management flags to setup tm command | ||
233 | */ | ||
234 | static inline | ||
235 | void zfcp_fc_fcp_tm(struct fcp_cmnd *fcp, struct scsi_device *dev, u8 tm_flags) | ||
236 | { | ||
237 | int_to_scsilun(dev->lun, (struct scsi_lun *) &fcp->fc_lun); | ||
238 | fcp->fc_tm_flags |= tm_flags; | ||
239 | } | ||
240 | |||
241 | /** | ||
242 | * zfcp_fc_evap_fcp_rsp - evaluate FCP RSP IU and update scsi_cmnd accordingly | 250 | * zfcp_fc_evap_fcp_rsp - evaluate FCP RSP IU and update scsi_cmnd accordingly |
243 | * @fcp_rsp: FCP RSP IU to evaluate | 251 | * @fcp_rsp: FCP RSP IU to evaluate |
244 | * @scsi: SCSI command where to update status and sense buffer | 252 | * @scsi: SCSI command where to update status and sense buffer |
diff --git a/drivers/s390/scsi/zfcp_fsf.c b/drivers/s390/scsi/zfcp_fsf.c index 60ff9d172c79..a0e05ef65924 100644 --- a/drivers/s390/scsi/zfcp_fsf.c +++ b/drivers/s390/scsi/zfcp_fsf.c | |||
@@ -18,6 +18,8 @@ | |||
18 | #include "zfcp_qdio.h" | 18 | #include "zfcp_qdio.h" |
19 | #include "zfcp_reqlist.h" | 19 | #include "zfcp_reqlist.h" |
20 | 20 | ||
21 | struct kmem_cache *zfcp_fsf_qtcb_cache; | ||
22 | |||
21 | static void zfcp_fsf_request_timeout_handler(unsigned long data) | 23 | static void zfcp_fsf_request_timeout_handler(unsigned long data) |
22 | { | 24 | { |
23 | struct zfcp_adapter *adapter = (struct zfcp_adapter *) data; | 25 | struct zfcp_adapter *adapter = (struct zfcp_adapter *) data; |
@@ -83,7 +85,7 @@ void zfcp_fsf_req_free(struct zfcp_fsf_req *req) | |||
83 | } | 85 | } |
84 | 86 | ||
85 | if (likely(req->qtcb)) | 87 | if (likely(req->qtcb)) |
86 | kmem_cache_free(zfcp_data.qtcb_cache, req->qtcb); | 88 | kmem_cache_free(zfcp_fsf_qtcb_cache, req->qtcb); |
87 | kfree(req); | 89 | kfree(req); |
88 | } | 90 | } |
89 | 91 | ||
@@ -212,7 +214,7 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req) | |||
212 | 214 | ||
213 | if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED) { | 215 | if (req->status & ZFCP_STATUS_FSFREQ_DISMISSED) { |
214 | zfcp_dbf_hba_fsf_uss("fssrh_1", req); | 216 | zfcp_dbf_hba_fsf_uss("fssrh_1", req); |
215 | mempool_free(sr_buf, adapter->pool.status_read_data); | 217 | mempool_free(virt_to_page(sr_buf), adapter->pool.sr_data); |
216 | zfcp_fsf_req_free(req); | 218 | zfcp_fsf_req_free(req); |
217 | return; | 219 | return; |
218 | } | 220 | } |
@@ -265,7 +267,7 @@ static void zfcp_fsf_status_read_handler(struct zfcp_fsf_req *req) | |||
265 | break; | 267 | break; |
266 | } | 268 | } |
267 | 269 | ||
268 | mempool_free(sr_buf, adapter->pool.status_read_data); | 270 | mempool_free(virt_to_page(sr_buf), adapter->pool.sr_data); |
269 | zfcp_fsf_req_free(req); | 271 | zfcp_fsf_req_free(req); |
270 | 272 | ||
271 | atomic_inc(&adapter->stat_miss); | 273 | atomic_inc(&adapter->stat_miss); |
@@ -628,7 +630,7 @@ static struct fsf_qtcb *zfcp_qtcb_alloc(mempool_t *pool) | |||
628 | if (likely(pool)) | 630 | if (likely(pool)) |
629 | qtcb = mempool_alloc(pool, GFP_ATOMIC); | 631 | qtcb = mempool_alloc(pool, GFP_ATOMIC); |
630 | else | 632 | else |
631 | qtcb = kmem_cache_alloc(zfcp_data.qtcb_cache, GFP_ATOMIC); | 633 | qtcb = kmem_cache_alloc(zfcp_fsf_qtcb_cache, GFP_ATOMIC); |
632 | 634 | ||
633 | if (unlikely(!qtcb)) | 635 | if (unlikely(!qtcb)) |
634 | return NULL; | 636 | return NULL; |
@@ -723,6 +725,7 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio) | |||
723 | struct zfcp_adapter *adapter = qdio->adapter; | 725 | struct zfcp_adapter *adapter = qdio->adapter; |
724 | struct zfcp_fsf_req *req; | 726 | struct zfcp_fsf_req *req; |
725 | struct fsf_status_read_buffer *sr_buf; | 727 | struct fsf_status_read_buffer *sr_buf; |
728 | struct page *page; | ||
726 | int retval = -EIO; | 729 | int retval = -EIO; |
727 | 730 | ||
728 | spin_lock_irq(&qdio->req_q_lock); | 731 | spin_lock_irq(&qdio->req_q_lock); |
@@ -736,11 +739,12 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio) | |||
736 | goto out; | 739 | goto out; |
737 | } | 740 | } |
738 | 741 | ||
739 | sr_buf = mempool_alloc(adapter->pool.status_read_data, GFP_ATOMIC); | 742 | page = mempool_alloc(adapter->pool.sr_data, GFP_ATOMIC); |
740 | if (!sr_buf) { | 743 | if (!page) { |
741 | retval = -ENOMEM; | 744 | retval = -ENOMEM; |
742 | goto failed_buf; | 745 | goto failed_buf; |
743 | } | 746 | } |
747 | sr_buf = page_address(page); | ||
744 | memset(sr_buf, 0, sizeof(*sr_buf)); | 748 | memset(sr_buf, 0, sizeof(*sr_buf)); |
745 | req->data = sr_buf; | 749 | req->data = sr_buf; |
746 | 750 | ||
@@ -755,7 +759,7 @@ int zfcp_fsf_status_read(struct zfcp_qdio *qdio) | |||
755 | 759 | ||
756 | failed_req_send: | 760 | failed_req_send: |
757 | req->data = NULL; | 761 | req->data = NULL; |
758 | mempool_free(sr_buf, adapter->pool.status_read_data); | 762 | mempool_free(virt_to_page(sr_buf), adapter->pool.sr_data); |
759 | failed_buf: | 763 | failed_buf: |
760 | zfcp_dbf_hba_fsf_uss("fssr__1", req); | 764 | zfcp_dbf_hba_fsf_uss("fssr__1", req); |
761 | zfcp_fsf_req_free(req); | 765 | zfcp_fsf_req_free(req); |
@@ -1552,7 +1556,7 @@ int zfcp_fsf_open_wka_port(struct zfcp_fc_wka_port *wka_port) | |||
1552 | SBAL_FLAGS0_TYPE_READ, | 1556 | SBAL_FLAGS0_TYPE_READ, |
1553 | qdio->adapter->pool.erp_req); | 1557 | qdio->adapter->pool.erp_req); |
1554 | 1558 | ||
1555 | if (unlikely(IS_ERR(req))) { | 1559 | if (IS_ERR(req)) { |
1556 | retval = PTR_ERR(req); | 1560 | retval = PTR_ERR(req); |
1557 | goto out; | 1561 | goto out; |
1558 | } | 1562 | } |
@@ -1605,7 +1609,7 @@ int zfcp_fsf_close_wka_port(struct zfcp_fc_wka_port *wka_port) | |||
1605 | SBAL_FLAGS0_TYPE_READ, | 1609 | SBAL_FLAGS0_TYPE_READ, |
1606 | qdio->adapter->pool.erp_req); | 1610 | qdio->adapter->pool.erp_req); |
1607 | 1611 | ||
1608 | if (unlikely(IS_ERR(req))) { | 1612 | if (IS_ERR(req)) { |
1609 | retval = PTR_ERR(req); | 1613 | retval = PTR_ERR(req); |
1610 | goto out; | 1614 | goto out; |
1611 | } | 1615 | } |
@@ -2206,7 +2210,7 @@ int zfcp_fsf_fcp_cmnd(struct scsi_cmnd *scsi_cmnd) | |||
2206 | zfcp_fsf_set_data_dir(scsi_cmnd, &io->data_direction); | 2210 | zfcp_fsf_set_data_dir(scsi_cmnd, &io->data_direction); |
2207 | 2211 | ||
2208 | fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd; | 2212 | fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd; |
2209 | zfcp_fc_scsi_to_fcp(fcp_cmnd, scsi_cmnd); | 2213 | zfcp_fc_scsi_to_fcp(fcp_cmnd, scsi_cmnd, 0); |
2210 | 2214 | ||
2211 | if (scsi_prot_sg_count(scsi_cmnd)) { | 2215 | if (scsi_prot_sg_count(scsi_cmnd)) { |
2212 | zfcp_qdio_set_data_div(qdio, &req->qdio_req, | 2216 | zfcp_qdio_set_data_div(qdio, &req->qdio_req, |
@@ -2284,7 +2288,6 @@ struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt(struct scsi_cmnd *scmnd, | |||
2284 | goto out; | 2288 | goto out; |
2285 | } | 2289 | } |
2286 | 2290 | ||
2287 | req->status |= ZFCP_STATUS_FSFREQ_TASK_MANAGEMENT; | ||
2288 | req->data = scmnd; | 2291 | req->data = scmnd; |
2289 | req->handler = zfcp_fsf_fcp_task_mgmt_handler; | 2292 | req->handler = zfcp_fsf_fcp_task_mgmt_handler; |
2290 | req->qtcb->header.lun_handle = zfcp_sdev->lun_handle; | 2293 | req->qtcb->header.lun_handle = zfcp_sdev->lun_handle; |
@@ -2296,7 +2299,7 @@ struct zfcp_fsf_req *zfcp_fsf_fcp_task_mgmt(struct scsi_cmnd *scmnd, | |||
2296 | zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); | 2299 | zfcp_qdio_set_sbale_last(qdio, &req->qdio_req); |
2297 | 2300 | ||
2298 | fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd; | 2301 | fcp_cmnd = (struct fcp_cmnd *) &req->qtcb->bottom.io.fcp_cmnd; |
2299 | zfcp_fc_fcp_tm(fcp_cmnd, scmnd->device, tm_flags); | 2302 | zfcp_fc_scsi_to_fcp(fcp_cmnd, scmnd, tm_flags); |
2300 | 2303 | ||
2301 | zfcp_fsf_start_timer(req, ZFCP_SCSI_ER_TIMEOUT); | 2304 | zfcp_fsf_start_timer(req, ZFCP_SCSI_ER_TIMEOUT); |
2302 | if (!zfcp_fsf_req_send(req)) | 2305 | if (!zfcp_fsf_req_send(req)) |
diff --git a/drivers/s390/scsi/zfcp_scsi.c b/drivers/s390/scsi/zfcp_scsi.c index ddb5800823a9..2a4991d6d4d5 100644 --- a/drivers/s390/scsi/zfcp_scsi.c +++ b/drivers/s390/scsi/zfcp_scsi.c | |||
@@ -292,7 +292,37 @@ static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd *scpnt) | |||
292 | return SUCCESS; | 292 | return SUCCESS; |
293 | } | 293 | } |
294 | 294 | ||
295 | int zfcp_adapter_scsi_register(struct zfcp_adapter *adapter) | 295 | struct scsi_transport_template *zfcp_scsi_transport_template; |
296 | |||
297 | static struct scsi_host_template zfcp_scsi_host_template = { | ||
298 | .module = THIS_MODULE, | ||
299 | .name = "zfcp", | ||
300 | .queuecommand = zfcp_scsi_queuecommand, | ||
301 | .eh_abort_handler = zfcp_scsi_eh_abort_handler, | ||
302 | .eh_device_reset_handler = zfcp_scsi_eh_device_reset_handler, | ||
303 | .eh_target_reset_handler = zfcp_scsi_eh_target_reset_handler, | ||
304 | .eh_host_reset_handler = zfcp_scsi_eh_host_reset_handler, | ||
305 | .slave_alloc = zfcp_scsi_slave_alloc, | ||
306 | .slave_configure = zfcp_scsi_slave_configure, | ||
307 | .slave_destroy = zfcp_scsi_slave_destroy, | ||
308 | .change_queue_depth = zfcp_scsi_change_queue_depth, | ||
309 | .proc_name = "zfcp", | ||
310 | .can_queue = 4096, | ||
311 | .this_id = -1, | ||
312 | .sg_tablesize = ZFCP_QDIO_MAX_SBALES_PER_REQ, | ||
313 | .max_sectors = (ZFCP_QDIO_MAX_SBALES_PER_REQ * 8), | ||
314 | .dma_boundary = ZFCP_QDIO_SBALE_LEN - 1, | ||
315 | .cmd_per_lun = 1, | ||
316 | .use_clustering = 1, | ||
317 | .shost_attrs = zfcp_sysfs_shost_attrs, | ||
318 | .sdev_attrs = zfcp_sysfs_sdev_attrs, | ||
319 | }; | ||
320 | |||
321 | /** | ||
322 | * zfcp_scsi_adapter_register - Register SCSI and FC host with SCSI midlayer | ||
323 | * @adapter: The zfcp adapter to register with the SCSI midlayer | ||
324 | */ | ||
325 | int zfcp_scsi_adapter_register(struct zfcp_adapter *adapter) | ||
296 | { | 326 | { |
297 | struct ccw_dev_id dev_id; | 327 | struct ccw_dev_id dev_id; |
298 | 328 | ||
@@ -301,7 +331,7 @@ int zfcp_adapter_scsi_register(struct zfcp_adapter *adapter) | |||
301 | 331 | ||
302 | ccw_device_get_id(adapter->ccw_device, &dev_id); | 332 | ccw_device_get_id(adapter->ccw_device, &dev_id); |
303 | /* register adapter as SCSI host with mid layer of SCSI stack */ | 333 | /* register adapter as SCSI host with mid layer of SCSI stack */ |
304 | adapter->scsi_host = scsi_host_alloc(&zfcp_data.scsi_host_template, | 334 | adapter->scsi_host = scsi_host_alloc(&zfcp_scsi_host_template, |
305 | sizeof (struct zfcp_adapter *)); | 335 | sizeof (struct zfcp_adapter *)); |
306 | if (!adapter->scsi_host) { | 336 | if (!adapter->scsi_host) { |
307 | dev_err(&adapter->ccw_device->dev, | 337 | dev_err(&adapter->ccw_device->dev, |
@@ -316,7 +346,7 @@ int zfcp_adapter_scsi_register(struct zfcp_adapter *adapter) | |||
316 | adapter->scsi_host->max_channel = 0; | 346 | adapter->scsi_host->max_channel = 0; |
317 | adapter->scsi_host->unique_id = dev_id.devno; | 347 | adapter->scsi_host->unique_id = dev_id.devno; |
318 | adapter->scsi_host->max_cmd_len = 16; /* in struct fcp_cmnd */ | 348 | adapter->scsi_host->max_cmd_len = 16; /* in struct fcp_cmnd */ |
319 | adapter->scsi_host->transportt = zfcp_data.scsi_transport_template; | 349 | adapter->scsi_host->transportt = zfcp_scsi_transport_template; |
320 | 350 | ||
321 | adapter->scsi_host->hostdata[0] = (unsigned long) adapter; | 351 | adapter->scsi_host->hostdata[0] = (unsigned long) adapter; |
322 | 352 | ||
@@ -328,7 +358,11 @@ int zfcp_adapter_scsi_register(struct zfcp_adapter *adapter) | |||
328 | return 0; | 358 | return 0; |
329 | } | 359 | } |
330 | 360 | ||
331 | void zfcp_adapter_scsi_unregister(struct zfcp_adapter *adapter) | 361 | /** |
362 | * zfcp_scsi_adapter_unregister - Unregister SCSI and FC host from SCSI midlayer | ||
363 | * @adapter: The zfcp adapter to unregister. | ||
364 | */ | ||
365 | void zfcp_scsi_adapter_unregister(struct zfcp_adapter *adapter) | ||
332 | { | 366 | { |
333 | struct Scsi_Host *shost; | 367 | struct Scsi_Host *shost; |
334 | struct zfcp_port *port; | 368 | struct zfcp_port *port; |
@@ -346,8 +380,6 @@ void zfcp_adapter_scsi_unregister(struct zfcp_adapter *adapter) | |||
346 | scsi_remove_host(shost); | 380 | scsi_remove_host(shost); |
347 | scsi_host_put(shost); | 381 | scsi_host_put(shost); |
348 | adapter->scsi_host = NULL; | 382 | adapter->scsi_host = NULL; |
349 | |||
350 | return; | ||
351 | } | 383 | } |
352 | 384 | ||
353 | static struct fc_host_statistics* | 385 | static struct fc_host_statistics* |
@@ -688,33 +720,8 @@ struct fc_function_template zfcp_transport_functions = { | |||
688 | /* no functions registered for following dynamic attributes but | 720 | /* no functions registered for following dynamic attributes but |
689 | directly set by LLDD */ | 721 | directly set by LLDD */ |
690 | .show_host_port_type = 1, | 722 | .show_host_port_type = 1, |
723 | .show_host_symbolic_name = 1, | ||
691 | .show_host_speed = 1, | 724 | .show_host_speed = 1, |
692 | .show_host_port_id = 1, | 725 | .show_host_port_id = 1, |
693 | .dd_bsg_size = sizeof(struct zfcp_fsf_ct_els), | 726 | .dd_bsg_size = sizeof(struct zfcp_fsf_ct_els), |
694 | }; | 727 | }; |
695 | |||
696 | struct zfcp_data zfcp_data = { | ||
697 | .scsi_host_template = { | ||
698 | .name = "zfcp", | ||
699 | .module = THIS_MODULE, | ||
700 | .proc_name = "zfcp", | ||
701 | .change_queue_depth = zfcp_scsi_change_queue_depth, | ||
702 | .slave_alloc = zfcp_scsi_slave_alloc, | ||
703 | .slave_configure = zfcp_scsi_slave_configure, | ||
704 | .slave_destroy = zfcp_scsi_slave_destroy, | ||
705 | .queuecommand = zfcp_scsi_queuecommand, | ||
706 | .eh_abort_handler = zfcp_scsi_eh_abort_handler, | ||
707 | .eh_device_reset_handler = zfcp_scsi_eh_device_reset_handler, | ||
708 | .eh_target_reset_handler = zfcp_scsi_eh_target_reset_handler, | ||
709 | .eh_host_reset_handler = zfcp_scsi_eh_host_reset_handler, | ||
710 | .can_queue = 4096, | ||
711 | .this_id = -1, | ||
712 | .sg_tablesize = ZFCP_QDIO_MAX_SBALES_PER_REQ, | ||
713 | .cmd_per_lun = 1, | ||
714 | .use_clustering = 1, | ||
715 | .sdev_attrs = zfcp_sysfs_sdev_attrs, | ||
716 | .max_sectors = (ZFCP_QDIO_MAX_SBALES_PER_REQ * 8), | ||
717 | .dma_boundary = ZFCP_QDIO_SBALE_LEN - 1, | ||
718 | .shost_attrs = zfcp_sysfs_shost_attrs, | ||
719 | }, | ||
720 | }; | ||