Lines Matching refs:hba
90 void bnx2i_identify_device(struct bnx2i_hba *hba, struct cnic_dev *dev) in bnx2i_identify_device() argument
92 hba->cnic_dev_type = 0; in bnx2i_identify_device()
94 if (hba->pci_did == PCI_DEVICE_ID_NX2_5706 || in bnx2i_identify_device()
95 hba->pci_did == PCI_DEVICE_ID_NX2_5706S) { in bnx2i_identify_device()
96 set_bit(BNX2I_NX2_DEV_5706, &hba->cnic_dev_type); in bnx2i_identify_device()
97 } else if (hba->pci_did == PCI_DEVICE_ID_NX2_5708 || in bnx2i_identify_device()
98 hba->pci_did == PCI_DEVICE_ID_NX2_5708S) { in bnx2i_identify_device()
99 set_bit(BNX2I_NX2_DEV_5708, &hba->cnic_dev_type); in bnx2i_identify_device()
100 } else if (hba->pci_did == PCI_DEVICE_ID_NX2_5709 || in bnx2i_identify_device()
101 hba->pci_did == PCI_DEVICE_ID_NX2_5709S) { in bnx2i_identify_device()
102 set_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type); in bnx2i_identify_device()
103 hba->mail_queue_access = BNX2I_MQ_BIN_MODE; in bnx2i_identify_device()
106 set_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type); in bnx2i_identify_device()
109 hba->pci_did); in bnx2i_identify_device()
119 struct bnx2i_hba *hba = NULL; in get_adapter_list_head() local
128 hba = tmp_hba; in get_adapter_list_head()
134 return hba; in get_adapter_list_head()
145 struct bnx2i_hba *hba, *temp; in bnx2i_find_hba_for_cnic() local
148 list_for_each_entry_safe(hba, temp, &adapter_list, link) { in bnx2i_find_hba_for_cnic()
149 if (hba->cnic == cnic) { in bnx2i_find_hba_for_cnic()
151 return hba; in bnx2i_find_hba_for_cnic()
174 struct bnx2i_hba *hba = handle; in bnx2i_start() local
182 bnx2i_send_fw_iscsi_init_msg(hba); in bnx2i_start()
183 while (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state) && in bnx2i_start()
184 !test_bit(ADAPTER_STATE_INIT_FAILED, &hba->adapter_state) && i--) in bnx2i_start()
196 static void bnx2i_chip_cleanup(struct bnx2i_hba *hba) in bnx2i_chip_cleanup() argument
201 if (hba->ofld_conns_active) { in bnx2i_chip_cleanup()
207 "connections\n", hba->netdev->name, in bnx2i_chip_cleanup()
208 hba->ofld_conns_active); in bnx2i_chip_cleanup()
209 mutex_lock(&hba->net_dev_lock); in bnx2i_chip_cleanup()
210 list_for_each_safe(pos, tmp, &hba->ep_active_list) { in bnx2i_chip_cleanup()
216 mutex_unlock(&hba->net_dev_lock); in bnx2i_chip_cleanup()
230 struct bnx2i_hba *hba = handle; in bnx2i_stop() local
236 &hba->adapter_state)) { in bnx2i_stop()
237 iscsi_host_for_each_session(hba->shost, in bnx2i_stop()
239 wait_delay = hba->hba_shutdown_tmo; in bnx2i_stop()
246 wait_event_interruptible_timeout(hba->eh_wait, in bnx2i_stop()
247 (list_empty(&hba->ep_ofld_list) && in bnx2i_stop()
248 list_empty(&hba->ep_destroy_list)), in bnx2i_stop()
254 while (hba->ofld_conns_active) { in bnx2i_stop()
255 conns_active = hba->ofld_conns_active; in bnx2i_stop()
256 wait_event_interruptible_timeout(hba->eh_wait, in bnx2i_stop()
257 (hba->ofld_conns_active != conns_active), in bnx2i_stop()
259 if (hba->ofld_conns_active == conns_active) in bnx2i_stop()
262 bnx2i_chip_cleanup(hba); in bnx2i_stop()
267 clear_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state); in bnx2i_stop()
268 clear_bit(ADAPTER_STATE_UP, &hba->adapter_state); in bnx2i_stop()
281 static int bnx2i_init_one(struct bnx2i_hba *hba, struct cnic_dev *cnic) in bnx2i_init_one() argument
288 "iSCSI\n", hba->netdev->name); in bnx2i_init_one()
293 hba->cnic = cnic; in bnx2i_init_one()
294 rc = cnic->register_device(cnic, CNIC_ULP_ISCSI, hba); in bnx2i_init_one()
296 hba->age++; in bnx2i_init_one()
297 set_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic); in bnx2i_init_one()
298 list_add_tail(&hba->link, &adapter_list); in bnx2i_init_one()
302 "hba=%p, cnic=%p\n", hba, cnic); in bnx2i_init_one()
327 struct bnx2i_hba *hba; in bnx2i_ulp_init() local
330 hba = bnx2i_alloc_hba(dev); in bnx2i_ulp_init()
331 if (!hba) { in bnx2i_ulp_init()
337 clear_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic); in bnx2i_ulp_init()
338 if (bnx2i_init_one(hba, dev)) { in bnx2i_ulp_init()
339 printk(KERN_ERR "bnx2i - hba %p init failed\n", hba); in bnx2i_ulp_init()
340 bnx2i_free_hba(hba); in bnx2i_ulp_init()
352 struct bnx2i_hba *hba; in bnx2i_ulp_exit() local
354 hba = bnx2i_find_hba_for_cnic(dev); in bnx2i_ulp_exit()
355 if (!hba) { in bnx2i_ulp_exit()
361 list_del_init(&hba->link); in bnx2i_ulp_exit()
364 if (test_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic)) { in bnx2i_ulp_exit()
365 hba->cnic->unregister_device(hba->cnic, CNIC_ULP_ISCSI); in bnx2i_ulp_exit()
366 clear_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic); in bnx2i_ulp_exit()
370 bnx2i_free_hba(hba); in bnx2i_ulp_exit()
383 struct bnx2i_hba *hba = handle; in bnx2i_get_stats() local
386 if (!hba) in bnx2i_get_stats()
389 stats = (struct iscsi_stats_info *)hba->cnic->stats_addr; in bnx2i_get_stats()
395 memcpy(stats->mac_add1 + 2, hba->cnic->mac_addr, ETH_ALEN); in bnx2i_get_stats()
397 stats->max_frame_size = hba->netdev->mtu; in bnx2i_get_stats()
398 stats->txq_size = hba->max_sqes; in bnx2i_get_stats()
399 stats->rxq_size = hba->max_cqes; in bnx2i_get_stats()
404 GET_STATS_64(hba, stats, rx_pdus); in bnx2i_get_stats()
405 GET_STATS_64(hba, stats, rx_bytes); in bnx2i_get_stats()
407 GET_STATS_64(hba, stats, tx_pdus); in bnx2i_get_stats()
408 GET_STATS_64(hba, stats, tx_bytes); in bnx2i_get_stats()
571 struct bnx2i_hba *hba; in bnx2i_mod_exit() local
576 hba = list_entry(adapter_list.next, struct bnx2i_hba, link); in bnx2i_mod_exit()
577 list_del(&hba->link); in bnx2i_mod_exit()
580 if (test_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic)) { in bnx2i_mod_exit()
581 bnx2i_chip_cleanup(hba); in bnx2i_mod_exit()
582 hba->cnic->unregister_device(hba->cnic, CNIC_ULP_ISCSI); in bnx2i_mod_exit()
583 clear_bit(BNX2I_CNIC_REGISTERED, &hba->reg_with_cnic); in bnx2i_mod_exit()
586 bnx2i_free_hba(hba); in bnx2i_mod_exit()