aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/scsi/zfcp_aux.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/s390/scsi/zfcp_aux.c')
-rw-r--r--drivers/s390/scsi/zfcp_aux.c80
1 files changed, 29 insertions, 51 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)
175out_ccw_register: 160out_ccw_register:
176 misc_deregister(&zfcp_cfdc_misc); 161 misc_deregister(&zfcp_cfdc_misc);
177out_misc: 162out_misc:
178 fc_release_transport(zfcp_data.scsi_transport_template); 163 fc_release_transport(zfcp_scsi_transport_template);
179out_transport: 164out_transport:
180 kmem_cache_destroy(zfcp_data.adisc_cache); 165 kmem_cache_destroy(zfcp_fc_req_cache);
181out_adisc_cache: 166out_fc_cache:
182 kmem_cache_destroy(zfcp_data.gid_pn_cache); 167 kmem_cache_destroy(zfcp_fsf_qtcb_cache);
183out_gid_cache:
184 kmem_cache_destroy(zfcp_data.sr_buffer_cache);
185out_sr_cache:
186 kmem_cache_destroy(zfcp_data.qtcb_cache);
187out_qtcb_cache: 168out_qtcb_cache:
188 kmem_cache_destroy(zfcp_data.gpn_ft_cache);
189out:
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
207module_exit(zfcp_module_exit); 183module_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
443failed: 420failed:
@@ -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);