Lines Matching refs:adapter
61 struct zfcp_adapter *adapter; in zfcp_init_device_configure() local
71 adapter = zfcp_ccw_adapter_by_cdev(cdev); in zfcp_init_device_configure()
72 if (!adapter) in zfcp_init_device_configure()
75 port = zfcp_get_port_by_wwpn(adapter, wwpn); in zfcp_init_device_configure()
84 zfcp_ccw_adapter_put(adapter); in zfcp_init_device_configure()
189 struct zfcp_port *zfcp_get_port_by_wwpn(struct zfcp_adapter *adapter, in zfcp_get_port_by_wwpn() argument
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()
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()
207 static int zfcp_allocate_low_mem_buffers(struct zfcp_adapter *adapter) in zfcp_allocate_low_mem_buffers() argument
209 adapter->pool.erp_req = in zfcp_allocate_low_mem_buffers()
211 if (!adapter->pool.erp_req) 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()
219 adapter->pool.scsi_req = in zfcp_allocate_low_mem_buffers()
221 if (!adapter->pool.scsi_req) 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()
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()
235 adapter->pool.qtcb_pool = in zfcp_allocate_low_mem_buffers()
237 if (!adapter->pool.qtcb_pool) 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()
246 adapter->pool.gid_pn = in zfcp_allocate_low_mem_buffers()
248 if (!adapter->pool.gid_pn) in zfcp_allocate_low_mem_buffers()
254 static void zfcp_free_low_mem_buffers(struct zfcp_adapter *adapter) in zfcp_free_low_mem_buffers() argument
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()
274 int zfcp_status_read_refill(struct zfcp_adapter *adapter) in zfcp_status_read_refill() argument
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()
281 zfcp_erp_adapter_reopen(adapter, 0, "axsref1"); in zfcp_status_read_refill()
297 struct zfcp_adapter *adapter = container_of(work, struct zfcp_adapter, in zfcp_version_change_lost_work() local
300 zfcp_fsf_exchange_config_data_sync(adapter->qdio, NULL); in zfcp_version_change_lost_work()
305 struct zfcp_adapter *adapter = in zfcp_print_sl() local
309 dev_name(&adapter->ccw_device->dev), in zfcp_print_sl()
310 adapter->fsf_lic_version); in zfcp_print_sl()
313 static int zfcp_setup_adapter_work_queue(struct zfcp_adapter *adapter) in zfcp_setup_adapter_work_queue() argument
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()
326 static void zfcp_destroy_adapter_work_queue(struct zfcp_adapter *adapter) in zfcp_destroy_adapter_work_queue() argument
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()
345 struct zfcp_adapter *adapter; in zfcp_adapter_enqueue() local
350 adapter = kzalloc(sizeof(struct zfcp_adapter), GFP_KERNEL); in zfcp_adapter_enqueue()
351 if (!adapter) { in zfcp_adapter_enqueue()
356 kref_init(&adapter->ref); 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()
371 if (zfcp_diag_adapter_setup(adapter)) in zfcp_adapter_enqueue()
374 if (zfcp_qdio_setup(adapter)) in zfcp_adapter_enqueue()
377 if (zfcp_allocate_low_mem_buffers(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()
384 if (zfcp_dbf_adapter_register(adapter)) in zfcp_adapter_enqueue()
387 if (zfcp_setup_adapter_work_queue(adapter)) in zfcp_adapter_enqueue()
390 if (zfcp_fc_gs_setup(adapter)) 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()
409 if (zfcp_erp_thread_setup(adapter)) 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()
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()
424 return adapter; 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()
433 zfcp_destroy_adapter_work_queue(adapter); in zfcp_adapter_enqueue()
435 zfcp_fc_wka_ports_force_offline(adapter->gs); in zfcp_adapter_enqueue()
436 zfcp_scsi_adapter_unregister(adapter); in zfcp_adapter_enqueue()
438 zfcp_erp_thread_kill(adapter); in zfcp_adapter_enqueue()
439 zfcp_dbf_adapter_unregister(adapter); in zfcp_adapter_enqueue()
440 zfcp_qdio_destroy(adapter->qdio); in zfcp_adapter_enqueue()
442 zfcp_ccw_adapter_put(adapter); /* final put to release */ in zfcp_adapter_enqueue()
446 void zfcp_adapter_unregister(struct zfcp_adapter *adapter) in zfcp_adapter_unregister() argument
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()
454 zfcp_destroy_adapter_work_queue(adapter); in zfcp_adapter_unregister()
456 zfcp_fc_wka_ports_force_offline(adapter->gs); in zfcp_adapter_unregister()
457 zfcp_scsi_adapter_unregister(adapter); in zfcp_adapter_unregister()
460 zfcp_erp_thread_kill(adapter); in zfcp_adapter_unregister()
461 zfcp_dbf_adapter_unregister(adapter); in zfcp_adapter_unregister()
462 zfcp_qdio_destroy(adapter->qdio); in zfcp_adapter_unregister()
464 zfcp_ccw_adapter_put(adapter); /* final put to release */ in zfcp_adapter_unregister()
474 struct zfcp_adapter *adapter = container_of(ref, struct zfcp_adapter, in zfcp_adapter_release() local
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()
479 zfcp_fc_gs_destroy(adapter); in zfcp_adapter_release()
480 zfcp_free_low_mem_buffers(adapter); in zfcp_adapter_release()
481 zfcp_diag_adapter_free(adapter); 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()
485 kfree(adapter); in zfcp_adapter_release()
493 zfcp_ccw_adapter_put(port->adapter); in zfcp_port_release()
509 struct zfcp_port *zfcp_port_enqueue(struct zfcp_adapter *adapter, u64 wwpn, in zfcp_port_enqueue() argument
515 kref_get(&adapter->ref); in zfcp_port_enqueue()
517 port = zfcp_get_port_by_wwpn(adapter, wwpn); in zfcp_port_enqueue()
536 port->adapter = adapter; in zfcp_port_enqueue()
540 port->dev.parent = &adapter->ccw_device->dev; in zfcp_port_enqueue()
544 port->erp_action.adapter = adapter; 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()
567 zfcp_ccw_adapter_put(adapter); in zfcp_port_enqueue()