Lines Matching +full:module +full:- +full:instance
3 * Copyright (c) 2006 - 2013 Broadcom Corporation
14 * Maintained by: QLogic-Storage-Upstream@qlogic.com
74 * bnx2i_identify_device - identifies NetXtreme II device type
84 hba->cnic_dev_type = 0; in bnx2i_identify_device()
85 if (test_bit(CNIC_F_BNX2_CLASS, &dev->flags)) { in bnx2i_identify_device()
86 if (hba->pci_did == PCI_DEVICE_ID_NX2_5706 || in bnx2i_identify_device()
87 hba->pci_did == PCI_DEVICE_ID_NX2_5706S) { in bnx2i_identify_device()
88 set_bit(BNX2I_NX2_DEV_5706, &hba->cnic_dev_type); in bnx2i_identify_device()
89 } else if (hba->pci_did == PCI_DEVICE_ID_NX2_5708 || in bnx2i_identify_device()
90 hba->pci_did == PCI_DEVICE_ID_NX2_5708S) { in bnx2i_identify_device()
91 set_bit(BNX2I_NX2_DEV_5708, &hba->cnic_dev_type); in bnx2i_identify_device()
92 } else if (hba->pci_did == PCI_DEVICE_ID_NX2_5709 || in bnx2i_identify_device()
93 hba->pci_did == PCI_DEVICE_ID_NX2_5709S) { in bnx2i_identify_device()
94 set_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type); in bnx2i_identify_device()
95 hba->mail_queue_access = BNX2I_MQ_BIN_MODE; in bnx2i_identify_device()
97 } else if (test_bit(CNIC_F_BNX2X_CLASS, &dev->flags)) { in bnx2i_identify_device()
98 set_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type); in bnx2i_identify_device()
101 hba->pci_did); in bnx2i_identify_device()
107 * get_adapter_list_head - returns head of adapter list
119 if (tmp_hba->cnic && tmp_hba->cnic->cm_select_dev) { in get_adapter_list_head()
131 * bnx2i_find_hba_for_cnic - maps cnic device instance to bnx2i adapter instance
132 * @cnic: pointer to cnic device instance
141 if (hba->cnic == cnic) { in bnx2i_find_hba_for_cnic()
152 * bnx2i_start - cnic callback to initialize & start adapter instance
157 * This bnx2i - cnic interface api callback is issued after following
158 * 2 conditions are met -
161 * b) bnx2i adapter instance is registered
175 while (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state) && in bnx2i_start()
176 !test_bit(ADAPTER_STATE_INIT_FAILED, &hba->adapter_state) && i--) in bnx2i_start()
182 * bnx2i_chip_cleanup - local routine to handle chip cleanup
183 * @hba: Adapter instance to register
193 if (hba->ofld_conns_active) { in bnx2i_chip_cleanup()
199 "connections\n", hba->netdev->name, in bnx2i_chip_cleanup()
200 hba->ofld_conns_active); in bnx2i_chip_cleanup()
201 mutex_lock(&hba->net_dev_lock); in bnx2i_chip_cleanup()
202 list_for_each_safe(pos, tmp, &hba->ep_active_list) { in bnx2i_chip_cleanup()
206 bnx2i_ep->cm_sk = NULL; in bnx2i_chip_cleanup()
208 mutex_unlock(&hba->net_dev_lock); in bnx2i_chip_cleanup()
214 * bnx2i_stop - cnic callback to shutdown adapter instance
228 &hba->adapter_state)) { in bnx2i_stop()
229 iscsi_host_for_each_session(hba->shost, in bnx2i_stop()
231 wait_delay = hba->hba_shutdown_tmo; in bnx2i_stop()
238 wait_event_interruptible_timeout(hba->eh_wait, in bnx2i_stop()
239 (list_empty(&hba->ep_ofld_list) && in bnx2i_stop()
240 list_empty(&hba->ep_destroy_list)), in bnx2i_stop()
246 while (hba->ofld_conns_active) { in bnx2i_stop()
247 conns_active = hba->ofld_conns_active; in bnx2i_stop()
248 wait_event_interruptible_timeout(hba->eh_wait, in bnx2i_stop()
249 (hba->ofld_conns_active != conns_active), in bnx2i_stop()
251 if (hba->ofld_conns_active == conns_active) in bnx2i_stop()
259 clear_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state); in bnx2i_stop()
260 clear_bit(ADAPTER_STATE_UP, &hba->adapter_state); in bnx2i_stop()
265 * bnx2i_init_one - initialize an adapter instance and allocate memory resources
266 * @hba: bnx2i adapter instance
278 if (!cnic->max_iscsi_conn) { in bnx2i_init_one()
280 "iSCSI\n", hba->netdev->name); in bnx2i_init_one()
281 rc = -EOPNOTSUPP; in bnx2i_init_one()
285 hba->cnic = cnic; in bnx2i_init_one()
286 rc = cnic->register_device(cnic, CNIC_ULP_ISCSI, hba); in bnx2i_init_one()
288 hba->age++; in bnx2i_init_one()
289 set_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic); in bnx2i_init_one()
290 list_add_tail(&hba->link, &adapter_list); in bnx2i_init_one()
292 } else if (rc == -EBUSY) /* duplicate registration */ in bnx2i_init_one()
295 else if (rc == -EAGAIN) in bnx2i_init_one()
297 else if (rc == -EINVAL) in bnx2i_init_one()
310 * bnx2i_ulp_init - initialize an adapter instance
329 clear_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic); in bnx2i_ulp_init()
331 printk(KERN_ERR "bnx2i - hba %p init failed\n", hba); in bnx2i_ulp_init()
338 * bnx2i_ulp_exit - shuts down adapter instance and frees all resources
353 list_del_init(&hba->link); in bnx2i_ulp_exit()
354 adapter_count--; in bnx2i_ulp_exit()
356 if (test_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic)) { in bnx2i_ulp_exit()
357 hba->cnic->unregister_device(hba->cnic, CNIC_ULP_ISCSI); in bnx2i_ulp_exit()
358 clear_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic); in bnx2i_ulp_exit()
367 * bnx2i_get_stats - Retrieve various statistic from iSCSI offload
370 * function callback exported via bnx2i - cnic driver interface to
379 return -EINVAL; in bnx2i_get_stats()
381 stats = (struct iscsi_stats_info *)hba->cnic->stats_addr; in bnx2i_get_stats()
384 return -ENOMEM; in bnx2i_get_stats()
386 strscpy(stats->version, DRV_MODULE_VERSION, sizeof(stats->version)); in bnx2i_get_stats()
387 memcpy(stats->mac_add1 + 2, hba->cnic->mac_addr, ETH_ALEN); in bnx2i_get_stats()
389 stats->max_frame_size = hba->netdev->mtu; in bnx2i_get_stats()
390 stats->txq_size = hba->max_sqes; in bnx2i_get_stats()
391 stats->rxq_size = hba->max_cqes; in bnx2i_get_stats()
393 stats->txq_avg_depth = 0; in bnx2i_get_stats()
394 stats->rxq_avg_depth = 0; in bnx2i_get_stats()
407 * bnx2i_cpu_online - Create a receive thread for an online CPU
423 p->iothread = thread; in bnx2i_cpu_online()
436 spin_lock_bh(&p->p_work_lock); in bnx2i_cpu_offline()
437 thread = p->iothread; in bnx2i_cpu_offline()
438 p->iothread = NULL; in bnx2i_cpu_offline()
441 list_for_each_entry_safe(work, tmp, &p->work_list, list) { in bnx2i_cpu_offline()
442 list_del_init(&work->list); in bnx2i_cpu_offline()
443 bnx2i_process_scsi_cmd_resp(work->session, in bnx2i_cpu_offline()
444 work->bnx2i_conn, &work->cqe); in bnx2i_cpu_offline()
448 spin_unlock_bh(&p->p_work_lock); in bnx2i_cpu_offline()
457 * bnx2i_mod_init - module init entry point
461 * with the cnic module
478 err = -ENOMEM; in bnx2i_mod_init()
491 INIT_LIST_HEAD(&p->work_list); in bnx2i_mod_init()
492 spin_lock_init(&p->p_work_lock); in bnx2i_mod_init()
493 p->iothread = NULL; in bnx2i_mod_init()
513 * bnx2i_mod_exit - module cleanup/exit entry point
516 * in this function. Driver will browse through the adapter list, cleans-up
517 * each instance, unregisters iscsi transport name and finally driver will
518 * unregister itself with the cnic module
527 list_del(&hba->link); in bnx2i_mod_exit()
528 adapter_count--; in bnx2i_mod_exit()
530 if (test_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic)) { in bnx2i_mod_exit()
532 hba->cnic->unregister_device(hba->cnic, CNIC_ULP_ISCSI); in bnx2i_mod_exit()
533 clear_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic); in bnx2i_mod_exit()