• Home
  • Raw
  • Download

Lines Matching refs:hba

76 static int bnx2fc_em_config(struct fc_lport *lport, struct bnx2fc_hba *hba);
77 static int bnx2fc_bind_adapter_devices(struct bnx2fc_hba *hba);
78 static void bnx2fc_unbind_adapter_devices(struct bnx2fc_hba *hba);
79 static int bnx2fc_bind_pcidev(struct bnx2fc_hba *hba);
80 static void bnx2fc_unbind_pcidev(struct bnx2fc_hba *hba);
91 static int bnx2fc_fw_init(struct bnx2fc_hba *hba);
92 static void bnx2fc_fw_destroy(struct bnx2fc_hba *hba);
191 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_cleanup() local
196 mutex_lock(&hba->hba_mutex); in bnx2fc_cleanup()
197 spin_lock_bh(&hba->hba_lock); in bnx2fc_cleanup()
199 tgt = hba->tgt_ofld_list[i]; in bnx2fc_cleanup()
203 spin_unlock_bh(&hba->hba_lock); in bnx2fc_cleanup()
206 spin_lock_bh(&hba->hba_lock); in bnx2fc_cleanup()
210 spin_unlock_bh(&hba->hba_lock); in bnx2fc_cleanup()
211 mutex_unlock(&hba->hba_mutex); in bnx2fc_cleanup()
270 struct bnx2fc_hba *hba; in bnx2fc_xmit() local
283 hba = interface->hba; in bnx2fc_xmit()
317 spin_lock_bh(&hba->hba_lock); in bnx2fc_xmit()
323 spin_unlock_bh(&hba->hba_lock); in bnx2fc_xmit()
330 spin_unlock_bh(&hba->hba_lock); in bnx2fc_xmit()
691 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_get_host_stats() local
695 fw_stats = (struct fcoe_statistics_params *)hba->stats_buffer; in bnx2fc_get_host_stats()
699 mutex_lock(&hba->hba_stats_mutex); in bnx2fc_get_host_stats()
703 init_completion(&hba->stat_req_done); in bnx2fc_get_host_stats()
704 if (bnx2fc_send_stat_req(hba)) in bnx2fc_get_host_stats()
706 rc = wait_for_completion_timeout(&hba->stat_req_done, (2 * HZ)); in bnx2fc_get_host_stats()
711 BNX2FC_STATS(hba, rx_stat2, fc_crc_cnt); in bnx2fc_get_host_stats()
712 bnx2fc_stats->invalid_crc_count += hba->bfw_stats.fc_crc_cnt; in bnx2fc_get_host_stats()
713 BNX2FC_STATS(hba, tx_stat, fcoe_tx_pkt_cnt); in bnx2fc_get_host_stats()
714 bnx2fc_stats->tx_frames += hba->bfw_stats.fcoe_tx_pkt_cnt; in bnx2fc_get_host_stats()
715 BNX2FC_STATS(hba, tx_stat, fcoe_tx_byte_cnt); in bnx2fc_get_host_stats()
716 bnx2fc_stats->tx_words += ((hba->bfw_stats.fcoe_tx_byte_cnt) / 4); in bnx2fc_get_host_stats()
717 BNX2FC_STATS(hba, rx_stat0, fcoe_rx_pkt_cnt); in bnx2fc_get_host_stats()
718 bnx2fc_stats->rx_frames += hba->bfw_stats.fcoe_rx_pkt_cnt; in bnx2fc_get_host_stats()
719 BNX2FC_STATS(hba, rx_stat0, fcoe_rx_byte_cnt); in bnx2fc_get_host_stats()
720 bnx2fc_stats->rx_words += ((hba->bfw_stats.fcoe_rx_byte_cnt) / 4); in bnx2fc_get_host_stats()
729 memcpy(&hba->prev_stats, hba->stats_buffer, in bnx2fc_get_host_stats()
733 mutex_unlock(&hba->hba_stats_mutex); in bnx2fc_get_host_stats()
741 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_shost_config() local
764 BNX2FC_NAME, hba->chip_num, BNX2FC_VERSION, in bnx2fc_shost_config()
774 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_link_ok() local
775 struct net_device *dev = hba->phys_dev; in bnx2fc_link_ok()
779 clear_bit(ADAPTER_STATE_LINK_DOWN, &hba->adapter_state); in bnx2fc_link_ok()
781 set_bit(ADAPTER_STATE_LINK_DOWN, &hba->adapter_state); in bnx2fc_link_ok()
794 void bnx2fc_get_link_state(struct bnx2fc_hba *hba) in bnx2fc_get_link_state() argument
796 if (test_bit(__LINK_STATE_NOCARRIER, &hba->phys_dev->state)) in bnx2fc_get_link_state()
797 set_bit(ADAPTER_STATE_LINK_DOWN, &hba->adapter_state); in bnx2fc_get_link_state()
799 clear_bit(ADAPTER_STATE_LINK_DOWN, &hba->adapter_state); in bnx2fc_get_link_state()
804 struct bnx2fc_hba *hba; in bnx2fc_net_config() local
813 hba = interface->hba; in bnx2fc_net_config()
816 if (!hba->phys_dev->ethtool_ops || in bnx2fc_net_config()
817 !hba->phys_dev->ethtool_ops->get_pauseparam) in bnx2fc_net_config()
849 struct bnx2fc_hba *hba = from_timer(hba, t, destroy_timer); in bnx2fc_destroy_timer() local
853 set_bit(BNX2FC_FLAG_DESTROY_CMPL, &hba->flags); in bnx2fc_destroy_timer()
854 wake_up_interruptible(&hba->destroy_wait); in bnx2fc_destroy_timer()
870 struct bnx2fc_hba *hba = (struct bnx2fc_hba *)context; in bnx2fc_indicate_netevent() local
884 if (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state)) in bnx2fc_indicate_netevent()
890 clear_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state); in bnx2fc_indicate_netevent()
891 clear_bit(ADAPTER_STATE_UP, &hba->adapter_state); in bnx2fc_indicate_netevent()
896 set_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state); in bnx2fc_indicate_netevent()
908 if (interface->hba == hba && in bnx2fc_indicate_netevent()
922 if (interface->hba != hba) in bnx2fc_indicate_netevent()
976 clear_bit(ADAPTER_STATE_READY, &hba->adapter_state); in bnx2fc_indicate_netevent()
977 init_waitqueue_head(&hba->shutdown_wait); in bnx2fc_indicate_netevent()
980 hba->num_ofld_sess); in bnx2fc_indicate_netevent()
981 hba->wait_for_link_down = 1; in bnx2fc_indicate_netevent()
982 wait_event_interruptible(hba->shutdown_wait, in bnx2fc_indicate_netevent()
983 (hba->num_ofld_sess == 0)); in bnx2fc_indicate_netevent()
985 hba->num_ofld_sess); in bnx2fc_indicate_netevent()
986 hba->wait_for_link_down = 0; in bnx2fc_indicate_netevent()
1006 static int bnx2fc_em_config(struct fc_lport *lport, struct bnx2fc_hba *hba) in bnx2fc_em_config() argument
1010 fcoe_min_xid = hba->max_xid + 1; in bnx2fc_em_config()
1012 fcoe_max_xid = hba->max_xid + FCOE_XIDS_PER_CPU_OFFSET; in bnx2fc_em_config()
1014 fcoe_max_xid = hba->max_xid + FCOE_MAX_XID_OFFSET; in bnx2fc_em_config()
1148 if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &interface->hba->flags)) { in bnx2fc_vport_create()
1179 static void bnx2fc_free_vport(struct bnx2fc_hba *hba, struct fc_lport *lport) in bnx2fc_free_vport() argument
1183 spin_lock_bh(&hba->hba_lock); in bnx2fc_free_vport()
1184 list_for_each_entry_safe(blport, tmp, &hba->vports, list) { in bnx2fc_free_vport()
1190 spin_unlock_bh(&hba->hba_lock); in bnx2fc_free_vport()
1216 bnx2fc_free_vport(interface->hba, port->lport); in bnx2fc_vport_destroy()
1242 struct net_device *physdev = interface->hba->phys_dev; in bnx2fc_interface_setup()
1344 static void bnx2fc_hba_destroy(struct bnx2fc_hba *hba) in bnx2fc_hba_destroy() argument
1347 if (hba->cmd_mgr) { in bnx2fc_hba_destroy()
1348 bnx2fc_cmd_mgr_free(hba->cmd_mgr); in bnx2fc_hba_destroy()
1349 hba->cmd_mgr = NULL; in bnx2fc_hba_destroy()
1351 kfree(hba->tgt_ofld_list); in bnx2fc_hba_destroy()
1352 bnx2fc_unbind_pcidev(hba); in bnx2fc_hba_destroy()
1353 kfree(hba); in bnx2fc_hba_destroy()
1366 struct bnx2fc_hba *hba; in bnx2fc_hba_create() local
1370 hba = kzalloc(sizeof(*hba), GFP_KERNEL); in bnx2fc_hba_create()
1371 if (!hba) { in bnx2fc_hba_create()
1375 spin_lock_init(&hba->hba_lock); in bnx2fc_hba_create()
1376 mutex_init(&hba->hba_mutex); in bnx2fc_hba_create()
1377 mutex_init(&hba->hba_stats_mutex); in bnx2fc_hba_create()
1379 hba->cnic = cnic; in bnx2fc_hba_create()
1381 hba->max_tasks = cnic->max_fcoe_exchanges; in bnx2fc_hba_create()
1382 hba->elstm_xids = (hba->max_tasks / 2); in bnx2fc_hba_create()
1383 hba->max_outstanding_cmds = hba->elstm_xids; in bnx2fc_hba_create()
1384 hba->max_xid = (hba->max_tasks - 1); in bnx2fc_hba_create()
1386 rc = bnx2fc_bind_pcidev(hba); in bnx2fc_hba_create()
1391 hba->phys_dev = cnic->netdev; in bnx2fc_hba_create()
1392 hba->next_conn_id = 0; in bnx2fc_hba_create()
1394 hba->tgt_ofld_list = in bnx2fc_hba_create()
1397 if (!hba->tgt_ofld_list) { in bnx2fc_hba_create()
1402 hba->num_ofld_sess = 0; in bnx2fc_hba_create()
1404 hba->cmd_mgr = bnx2fc_cmd_mgr_alloc(hba); in bnx2fc_hba_create()
1405 if (!hba->cmd_mgr) { in bnx2fc_hba_create()
1409 fcoe_cap = &hba->fcoe_cap; in bnx2fc_hba_create()
1415 fcoe_cap->capability2 = hba->max_outstanding_cmds << in bnx2fc_hba_create()
1421 fcoe_cap->capability3 |= hba->max_outstanding_cmds << in bnx2fc_hba_create()
1425 init_waitqueue_head(&hba->shutdown_wait); in bnx2fc_hba_create()
1426 init_waitqueue_head(&hba->destroy_wait); in bnx2fc_hba_create()
1427 INIT_LIST_HEAD(&hba->vports); in bnx2fc_hba_create()
1429 return hba; in bnx2fc_hba_create()
1432 kfree(hba->tgt_ofld_list); in bnx2fc_hba_create()
1434 bnx2fc_unbind_pcidev(hba); in bnx2fc_hba_create()
1436 kfree(hba); in bnx2fc_hba_create()
1441 bnx2fc_interface_create(struct bnx2fc_hba *hba, in bnx2fc_interface_create() argument
1463 interface->hba = hba; in bnx2fc_interface_create()
1503 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_if_create() local
1513 bnx2fc_shost_template.can_queue = hba->max_outstanding_cmds; in bnx2fc_if_create()
1567 rc = bnx2fc_em_config(lport, hba); in bnx2fc_if_create()
1581 spin_lock_bh(&hba->hba_lock); in bnx2fc_if_create()
1583 list_add_tail(&blport->list, &hba->vports); in bnx2fc_if_create()
1584 spin_unlock_bh(&hba->hba_lock); in bnx2fc_if_create()
1610 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_interface_cleanup() local
1620 bnx2fc_free_vport(hba, lport); in bnx2fc_interface_cleanup()
1706 static void bnx2fc_unbind_adapter_devices(struct bnx2fc_hba *hba) in bnx2fc_unbind_adapter_devices() argument
1708 bnx2fc_free_fw_resc(hba); in bnx2fc_unbind_adapter_devices()
1709 bnx2fc_free_task_ctx(hba); in bnx2fc_unbind_adapter_devices()
1718 static int bnx2fc_bind_adapter_devices(struct bnx2fc_hba *hba) in bnx2fc_bind_adapter_devices() argument
1720 if (bnx2fc_setup_task_ctx(hba)) in bnx2fc_bind_adapter_devices()
1723 if (bnx2fc_setup_fw_resc(hba)) in bnx2fc_bind_adapter_devices()
1728 bnx2fc_unbind_adapter_devices(hba); in bnx2fc_bind_adapter_devices()
1732 static int bnx2fc_bind_pcidev(struct bnx2fc_hba *hba) in bnx2fc_bind_pcidev() argument
1737 if (!hba->cnic) { in bnx2fc_bind_pcidev()
1741 cnic = hba->cnic; in bnx2fc_bind_pcidev()
1742 pdev = hba->pcidev = cnic->pcidev; in bnx2fc_bind_pcidev()
1743 if (!hba->pcidev) in bnx2fc_bind_pcidev()
1748 strncpy(hba->chip_num, "BCM57710", BCM_CHIP_LEN); in bnx2fc_bind_pcidev()
1751 strncpy(hba->chip_num, "BCM57711", BCM_CHIP_LEN); in bnx2fc_bind_pcidev()
1756 strncpy(hba->chip_num, "BCM57712", BCM_CHIP_LEN); in bnx2fc_bind_pcidev()
1761 strncpy(hba->chip_num, "BCM57800", BCM_CHIP_LEN); in bnx2fc_bind_pcidev()
1766 strncpy(hba->chip_num, "BCM57810", BCM_CHIP_LEN); in bnx2fc_bind_pcidev()
1773 strncpy(hba->chip_num, "BCM57840", BCM_CHIP_LEN); in bnx2fc_bind_pcidev()
1779 pci_dev_get(hba->pcidev); in bnx2fc_bind_pcidev()
1783 static void bnx2fc_unbind_pcidev(struct bnx2fc_hba *hba) in bnx2fc_unbind_pcidev() argument
1785 if (hba->pcidev) { in bnx2fc_unbind_pcidev()
1786 hba->chip_num[0] = '\0'; in bnx2fc_unbind_pcidev()
1787 pci_dev_put(hba->pcidev); in bnx2fc_unbind_pcidev()
1789 hba->pcidev = NULL; in bnx2fc_unbind_pcidev()
1799 struct bnx2fc_hba *hba = handle; in bnx2fc_ulp_get_stats() local
1803 if (!hba) in bnx2fc_ulp_get_stats()
1806 cnic = hba->cnic; in bnx2fc_ulp_get_stats()
1835 struct bnx2fc_hba *hba = handle; in bnx2fc_ulp_start() local
1842 if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &hba->flags)) in bnx2fc_ulp_start()
1843 bnx2fc_fw_init(hba); in bnx2fc_ulp_start()
1848 if (interface->hba == hba) { in bnx2fc_ulp_start()
1874 if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &interface->hba->flags)) in bnx2fc_stop()
1890 static int bnx2fc_fw_init(struct bnx2fc_hba *hba) in bnx2fc_fw_init() argument
1896 rc = bnx2fc_bind_adapter_devices(hba); in bnx2fc_fw_init()
1903 rc = bnx2fc_send_fw_fcoe_init_msg(hba); in bnx2fc_fw_init()
1914 while (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state) && i--) in bnx2fc_fw_init()
1917 if (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state)) { in bnx2fc_fw_init()
1920 hba->cnic->netdev->name); in bnx2fc_fw_init()
1926 set_bit(BNX2FC_FLAG_FW_INIT_DONE, &hba->flags); in bnx2fc_fw_init()
1930 bnx2fc_unbind_adapter_devices(hba); in bnx2fc_fw_init()
1935 static void bnx2fc_fw_destroy(struct bnx2fc_hba *hba) in bnx2fc_fw_destroy() argument
1937 if (test_and_clear_bit(BNX2FC_FLAG_FW_INIT_DONE, &hba->flags)) { in bnx2fc_fw_destroy()
1938 if (bnx2fc_send_fw_fcoe_destroy_msg(hba) == 0) { in bnx2fc_fw_destroy()
1939 timer_setup(&hba->destroy_timer, bnx2fc_destroy_timer, in bnx2fc_fw_destroy()
1941 hba->destroy_timer.expires = BNX2FC_FW_TIMEOUT + in bnx2fc_fw_destroy()
1943 add_timer(&hba->destroy_timer); in bnx2fc_fw_destroy()
1944 wait_event_interruptible(hba->destroy_wait, in bnx2fc_fw_destroy()
1946 &hba->flags)); in bnx2fc_fw_destroy()
1947 clear_bit(BNX2FC_FLAG_DESTROY_CMPL, &hba->flags); in bnx2fc_fw_destroy()
1952 del_timer_sync(&hba->destroy_timer); in bnx2fc_fw_destroy()
1954 bnx2fc_unbind_adapter_devices(hba); in bnx2fc_fw_destroy()
1968 struct bnx2fc_hba *hba = handle; in bnx2fc_ulp_stop() local
1974 if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &hba->flags)) in bnx2fc_ulp_stop()
1977 if (interface->hba == hba) in bnx2fc_ulp_stop()
1980 BUG_ON(hba->num_ofld_sess != 0); in bnx2fc_ulp_stop()
1982 mutex_lock(&hba->hba_mutex); in bnx2fc_ulp_stop()
1983 clear_bit(ADAPTER_STATE_UP, &hba->adapter_state); in bnx2fc_ulp_stop()
1985 &hba->adapter_state); in bnx2fc_ulp_stop()
1987 clear_bit(ADAPTER_STATE_READY, &hba->adapter_state); in bnx2fc_ulp_stop()
1988 mutex_unlock(&hba->hba_mutex); in bnx2fc_ulp_stop()
1990 bnx2fc_fw_destroy(hba); in bnx2fc_ulp_stop()
2003 if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &interface->hba->flags)) { in bnx2fc_start_disc()
2015 set_bit(ADAPTER_STATE_READY, &interface->hba->adapter_state); in bnx2fc_start_disc()
2045 struct bnx2fc_hba *hba; in bnx2fc_ulp_init() local
2058 hba = bnx2fc_hba_create(dev); in bnx2fc_ulp_init()
2059 if (!hba) { in bnx2fc_ulp_init()
2068 list_add_tail(&hba->list, &adapter_list); in bnx2fc_ulp_init()
2072 dev->fcoe_cap = &hba->fcoe_cap; in bnx2fc_ulp_init()
2073 clear_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic); in bnx2fc_ulp_init()
2075 (void *) hba); in bnx2fc_ulp_init()
2079 set_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic); in bnx2fc_ulp_init()
2181 struct bnx2fc_hba *hba; in __bnx2fc_enable() local
2196 hba = interface->hba; in __bnx2fc_enable()
2199 if (!hba) in __bnx2fc_enable()
2202 if (!hba->cnic) in __bnx2fc_enable()
2211 if (!hba->cnic->get_fc_npiv_tbl) in __bnx2fc_enable()
2218 if (hba->cnic->get_fc_npiv_tbl(hba->cnic, npiv_tbl)) in __bnx2fc_enable()
2306 struct bnx2fc_hba *hba; in _bnx2fc_create() local
2348 hba = bnx2fc_hba_lookup(phys_dev); in _bnx2fc_create()
2349 if (!hba) { in _bnx2fc_create()
2360 interface = bnx2fc_interface_create(hba, netdev, fip_mode); in _bnx2fc_create()
2410 set_bit(ADAPTER_STATE_READY, &interface->hba->adapter_state); in _bnx2fc_create()
2482 struct bnx2fc_hba *hba; in bnx2fc_find_hba_for_cnic() local
2485 list_for_each_entry(hba, &adapter_list, list) { in bnx2fc_find_hba_for_cnic()
2486 if (hba->cnic == cnic) in bnx2fc_find_hba_for_cnic()
2487 return hba; in bnx2fc_find_hba_for_cnic()
2508 struct bnx2fc_hba *hba; in bnx2fc_hba_lookup() local
2511 list_for_each_entry(hba, &adapter_list, list) { in bnx2fc_hba_lookup()
2512 if (hba->phys_dev == phys_dev) in bnx2fc_hba_lookup()
2513 return hba; in bnx2fc_hba_lookup()
2526 struct bnx2fc_hba *hba; in bnx2fc_ulp_exit() local
2538 hba = bnx2fc_find_hba_for_cnic(dev); in bnx2fc_ulp_exit()
2539 if (!hba) { in bnx2fc_ulp_exit()
2546 list_del_init(&hba->list); in bnx2fc_ulp_exit()
2551 if (interface->hba == hba) in bnx2fc_ulp_exit()
2555 bnx2fc_ulp_stop(hba); in bnx2fc_ulp_exit()
2557 if (test_and_clear_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic)) in bnx2fc_ulp_exit()
2558 hba->cnic->unregister_device(hba->cnic, CNIC_ULP_FCOE); in bnx2fc_ulp_exit()
2559 bnx2fc_hba_destroy(hba); in bnx2fc_ulp_exit()
2761 struct bnx2fc_hba *hba, *next; in bnx2fc_mod_exit() local
2778 list_for_each_entry_safe(hba, next, &to_be_deleted, list) { in bnx2fc_mod_exit()
2779 list_del_init(&hba->list); in bnx2fc_mod_exit()
2781 hba); in bnx2fc_mod_exit()
2782 bnx2fc_ulp_stop(hba); in bnx2fc_mod_exit()
2785 &hba->reg_with_cnic)) in bnx2fc_mod_exit()
2786 hba->cnic->unregister_device(hba->cnic, in bnx2fc_mod_exit()
2788 bnx2fc_hba_destroy(hba); in bnx2fc_mod_exit()