Lines Matching +full:fine +full:- +full:granular
1 // SPDX-License-Identifier: GPL-2.0
44 MODULE_AUTHOR("IBM Deutschland Entwicklung GmbH - linux390@de.ibm.com");
78 flush_work(&port->rport_work); in zfcp_init_device_configure()
81 put_device(&port->dev); in zfcp_init_device_configure()
86 put_device(&cdev->dev); in zfcp_init_device_configure()
127 int retval = -ENOMEM; in zfcp_module_init()
183 * zfcp_get_port_by_wwpn - find port in port list of adapter by wwpn
195 read_lock_irqsave(&adapter->port_list_lock, flags); in zfcp_get_port_by_wwpn()
196 list_for_each_entry(port, &adapter->port_list, list) in zfcp_get_port_by_wwpn()
197 if (port->wwpn == wwpn) { in zfcp_get_port_by_wwpn()
198 if (!get_device(&port->dev)) in zfcp_get_port_by_wwpn()
200 read_unlock_irqrestore(&adapter->port_list_lock, flags); in zfcp_get_port_by_wwpn()
203 read_unlock_irqrestore(&adapter->port_list_lock, flags); in zfcp_get_port_by_wwpn()
209 adapter->pool.erp_req = in zfcp_allocate_low_mem_buffers()
211 if (!adapter->pool.erp_req) in zfcp_allocate_low_mem_buffers()
212 return -ENOMEM; in zfcp_allocate_low_mem_buffers()
214 adapter->pool.gid_pn_req = in zfcp_allocate_low_mem_buffers()
216 if (!adapter->pool.gid_pn_req) in zfcp_allocate_low_mem_buffers()
217 return -ENOMEM; in zfcp_allocate_low_mem_buffers()
219 adapter->pool.scsi_req = in zfcp_allocate_low_mem_buffers()
221 if (!adapter->pool.scsi_req) in zfcp_allocate_low_mem_buffers()
222 return -ENOMEM; in zfcp_allocate_low_mem_buffers()
224 adapter->pool.scsi_abort = in zfcp_allocate_low_mem_buffers()
226 if (!adapter->pool.scsi_abort) in zfcp_allocate_low_mem_buffers()
227 return -ENOMEM; in zfcp_allocate_low_mem_buffers()
229 adapter->pool.status_read_req = in zfcp_allocate_low_mem_buffers()
232 if (!adapter->pool.status_read_req) in zfcp_allocate_low_mem_buffers()
233 return -ENOMEM; in zfcp_allocate_low_mem_buffers()
235 adapter->pool.qtcb_pool = in zfcp_allocate_low_mem_buffers()
237 if (!adapter->pool.qtcb_pool) in zfcp_allocate_low_mem_buffers()
238 return -ENOMEM; in zfcp_allocate_low_mem_buffers()
241 adapter->pool.sr_data = in zfcp_allocate_low_mem_buffers()
243 if (!adapter->pool.sr_data) in zfcp_allocate_low_mem_buffers()
244 return -ENOMEM; in zfcp_allocate_low_mem_buffers()
246 adapter->pool.gid_pn = in zfcp_allocate_low_mem_buffers()
248 if (!adapter->pool.gid_pn) in zfcp_allocate_low_mem_buffers()
249 return -ENOMEM; in zfcp_allocate_low_mem_buffers()
256 mempool_destroy(adapter->pool.erp_req); in zfcp_free_low_mem_buffers()
257 mempool_destroy(adapter->pool.scsi_req); in zfcp_free_low_mem_buffers()
258 mempool_destroy(adapter->pool.scsi_abort); in zfcp_free_low_mem_buffers()
259 mempool_destroy(adapter->pool.qtcb_pool); in zfcp_free_low_mem_buffers()
260 mempool_destroy(adapter->pool.status_read_req); in zfcp_free_low_mem_buffers()
261 mempool_destroy(adapter->pool.sr_data); in zfcp_free_low_mem_buffers()
262 mempool_destroy(adapter->pool.gid_pn); in zfcp_free_low_mem_buffers()
266 * zfcp_status_read_refill - refill the long running status_read_requests
276 while (atomic_add_unless(&adapter->stat_miss, -1, 0)) in zfcp_status_read_refill()
277 if (zfcp_fsf_status_read(adapter->qdio)) { in zfcp_status_read_refill()
278 atomic_inc(&adapter->stat_miss); /* undo add -1 */ in zfcp_status_read_refill()
279 if (atomic_read(&adapter->stat_miss) >= in zfcp_status_read_refill()
280 adapter->stat_read_buf_num) { in zfcp_status_read_refill()
300 zfcp_fsf_exchange_config_data_sync(adapter->qdio, NULL); in zfcp_version_change_lost_work()
309 dev_name(&adapter->ccw_device->dev), in zfcp_print_sl()
310 adapter->fsf_lic_version); in zfcp_print_sl()
318 dev_name(&adapter->ccw_device->dev)); in zfcp_setup_adapter_work_queue()
319 adapter->work_queue = alloc_ordered_workqueue(name, WQ_MEM_RECLAIM); in zfcp_setup_adapter_work_queue()
321 if (adapter->work_queue) in zfcp_setup_adapter_work_queue()
323 return -ENOMEM; in zfcp_setup_adapter_work_queue()
328 if (adapter->work_queue) in zfcp_destroy_adapter_work_queue()
329 destroy_workqueue(adapter->work_queue); in zfcp_destroy_adapter_work_queue()
330 adapter->work_queue = NULL; in zfcp_destroy_adapter_work_queue()
335 * zfcp_adapter_enqueue - enqueue a new adapter to the list
341 * Proc-fs entries are also created.
347 if (!get_device(&ccw_device->dev)) in zfcp_adapter_enqueue()
348 return ERR_PTR(-ENODEV); in zfcp_adapter_enqueue()
352 put_device(&ccw_device->dev); in zfcp_adapter_enqueue()
353 return ERR_PTR(-ENOMEM); in zfcp_adapter_enqueue()
356 kref_init(&adapter->ref); in zfcp_adapter_enqueue()
358 ccw_device->handler = NULL; in zfcp_adapter_enqueue()
359 adapter->ccw_device = ccw_device; in zfcp_adapter_enqueue()
361 INIT_WORK(&adapter->stat_work, _zfcp_status_read_scheduler); in zfcp_adapter_enqueue()
362 INIT_DELAYED_WORK(&adapter->scan_work, zfcp_fc_scan_ports); in zfcp_adapter_enqueue()
363 INIT_WORK(&adapter->ns_up_work, zfcp_fc_sym_name_update); in zfcp_adapter_enqueue()
364 INIT_WORK(&adapter->version_change_lost_work, in zfcp_adapter_enqueue()
367 adapter->next_port_scan = jiffies; in zfcp_adapter_enqueue()
369 adapter->erp_action.adapter = adapter; in zfcp_adapter_enqueue()
380 adapter->req_list = zfcp_reqlist_alloc(); in zfcp_adapter_enqueue()
381 if (!adapter->req_list) in zfcp_adapter_enqueue()
393 rwlock_init(&adapter->port_list_lock); in zfcp_adapter_enqueue()
394 INIT_LIST_HEAD(&adapter->port_list); in zfcp_adapter_enqueue()
396 INIT_LIST_HEAD(&adapter->events.list); in zfcp_adapter_enqueue()
397 INIT_WORK(&adapter->events.work, zfcp_fc_post_event); in zfcp_adapter_enqueue()
398 spin_lock_init(&adapter->events.list_lock); in zfcp_adapter_enqueue()
400 init_waitqueue_head(&adapter->erp_ready_wq); in zfcp_adapter_enqueue()
401 init_waitqueue_head(&adapter->erp_done_wqh); in zfcp_adapter_enqueue()
403 INIT_LIST_HEAD(&adapter->erp_ready_head); in zfcp_adapter_enqueue()
404 INIT_LIST_HEAD(&adapter->erp_running_head); in zfcp_adapter_enqueue()
406 rwlock_init(&adapter->erp_lock); in zfcp_adapter_enqueue()
407 rwlock_init(&adapter->abort_lock); in zfcp_adapter_enqueue()
412 adapter->service_level.seq_print = zfcp_print_sl; in zfcp_adapter_enqueue()
414 dev_set_drvdata(&ccw_device->dev, adapter); in zfcp_adapter_enqueue()
416 if (device_add_groups(&ccw_device->dev, zfcp_sysfs_adapter_attr_groups)) in zfcp_adapter_enqueue()
419 /* report size limit per scatter-gather segment */ in zfcp_adapter_enqueue()
420 adapter->ccw_device->dev.dma_parms = &adapter->dma_parms; in zfcp_adapter_enqueue()
422 adapter->stat_read_buf_num = FSF_STATUS_READS_RECOM; in zfcp_adapter_enqueue()
428 /* TODO: make this more fine-granular */ in zfcp_adapter_enqueue()
429 cancel_delayed_work_sync(&adapter->scan_work); in zfcp_adapter_enqueue()
430 cancel_work_sync(&adapter->stat_work); in zfcp_adapter_enqueue()
431 cancel_work_sync(&adapter->ns_up_work); in zfcp_adapter_enqueue()
432 cancel_work_sync(&adapter->version_change_lost_work); in zfcp_adapter_enqueue()
435 zfcp_fc_wka_ports_force_offline(adapter->gs); in zfcp_adapter_enqueue()
440 zfcp_qdio_destroy(adapter->qdio); in zfcp_adapter_enqueue()
443 return ERR_PTR(-ENOMEM); in zfcp_adapter_enqueue()
448 struct ccw_device *cdev = adapter->ccw_device; in zfcp_adapter_unregister()
450 cancel_delayed_work_sync(&adapter->scan_work); in zfcp_adapter_unregister()
451 cancel_work_sync(&adapter->stat_work); in zfcp_adapter_unregister()
452 cancel_work_sync(&adapter->ns_up_work); in zfcp_adapter_unregister()
453 cancel_work_sync(&adapter->version_change_lost_work); in zfcp_adapter_unregister()
456 zfcp_fc_wka_ports_force_offline(adapter->gs); in zfcp_adapter_unregister()
458 device_remove_groups(&cdev->dev, zfcp_sysfs_adapter_attr_groups); in zfcp_adapter_unregister()
462 zfcp_qdio_destroy(adapter->qdio); in zfcp_adapter_unregister()
468 * zfcp_adapter_release - remove the adapter from the resource list
476 struct ccw_device *cdev = adapter->ccw_device; in zfcp_adapter_release()
478 dev_set_drvdata(&adapter->ccw_device->dev, NULL); in zfcp_adapter_release()
482 kfree(adapter->req_list); in zfcp_adapter_release()
483 kfree(adapter->fc_stats); in zfcp_adapter_release()
484 kfree(adapter->stats_reset_data); in zfcp_adapter_release()
486 put_device(&cdev->dev); in zfcp_adapter_release()
493 zfcp_ccw_adapter_put(port->adapter); in zfcp_port_release()
498 * zfcp_port_enqueue - enqueue port to port list of adapter
513 int retval = -ENOMEM; in zfcp_port_enqueue()
515 kref_get(&adapter->ref); in zfcp_port_enqueue()
519 put_device(&port->dev); in zfcp_port_enqueue()
520 retval = -EEXIST; in zfcp_port_enqueue()
528 rwlock_init(&port->unit_list_lock); in zfcp_port_enqueue()
529 INIT_LIST_HEAD(&port->unit_list); in zfcp_port_enqueue()
530 atomic_set(&port->units, 0); in zfcp_port_enqueue()
532 INIT_WORK(&port->gid_pn_work, zfcp_fc_port_did_lookup); in zfcp_port_enqueue()
533 INIT_WORK(&port->test_link_work, zfcp_fc_link_test_work); in zfcp_port_enqueue()
534 INIT_WORK(&port->rport_work, zfcp_scsi_rport_work); in zfcp_port_enqueue()
536 port->adapter = adapter; in zfcp_port_enqueue()
537 port->d_id = d_id; in zfcp_port_enqueue()
538 port->wwpn = wwpn; in zfcp_port_enqueue()
539 port->rport_task = RPORT_NONE; in zfcp_port_enqueue()
540 port->dev.parent = &adapter->ccw_device->dev; in zfcp_port_enqueue()
541 port->dev.groups = zfcp_port_attr_groups; in zfcp_port_enqueue()
542 port->dev.release = zfcp_port_release; in zfcp_port_enqueue()
544 port->erp_action.adapter = adapter; in zfcp_port_enqueue()
545 port->erp_action.port = port; in zfcp_port_enqueue()
547 if (dev_set_name(&port->dev, "0x%016llx", (unsigned long long)wwpn)) { in zfcp_port_enqueue()
551 retval = -EINVAL; in zfcp_port_enqueue()
553 if (device_register(&port->dev)) { in zfcp_port_enqueue()
554 put_device(&port->dev); in zfcp_port_enqueue()
558 write_lock_irq(&adapter->port_list_lock); in zfcp_port_enqueue()
559 list_add_tail(&port->list, &adapter->port_list); in zfcp_port_enqueue()
560 write_unlock_irq(&adapter->port_list_lock); in zfcp_port_enqueue()
562 atomic_or(status | ZFCP_STATUS_COMMON_RUNNING, &port->status); in zfcp_port_enqueue()