• Home
  • Raw
  • Download

Lines Matching refs:hba

78 static int bnx2fc_em_config(struct fc_lport *lport, struct bnx2fc_hba *hba);
79 static int bnx2fc_bind_adapter_devices(struct bnx2fc_hba *hba);
80 static void bnx2fc_unbind_adapter_devices(struct bnx2fc_hba *hba);
81 static int bnx2fc_bind_pcidev(struct bnx2fc_hba *hba);
82 static void bnx2fc_unbind_pcidev(struct bnx2fc_hba *hba);
93 static int bnx2fc_fw_init(struct bnx2fc_hba *hba);
94 static void bnx2fc_fw_destroy(struct bnx2fc_hba *hba);
193 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_cleanup() local
198 mutex_lock(&hba->hba_mutex); in bnx2fc_cleanup()
199 spin_lock_bh(&hba->hba_lock); in bnx2fc_cleanup()
201 tgt = hba->tgt_ofld_list[i]; in bnx2fc_cleanup()
205 spin_unlock_bh(&hba->hba_lock); in bnx2fc_cleanup()
208 spin_lock_bh(&hba->hba_lock); in bnx2fc_cleanup()
212 spin_unlock_bh(&hba->hba_lock); in bnx2fc_cleanup()
213 mutex_unlock(&hba->hba_mutex); in bnx2fc_cleanup()
272 struct bnx2fc_hba *hba; in bnx2fc_xmit() local
285 hba = interface->hba; in bnx2fc_xmit()
319 spin_lock_bh(&hba->hba_lock); in bnx2fc_xmit()
325 spin_unlock_bh(&hba->hba_lock); in bnx2fc_xmit()
332 spin_unlock_bh(&hba->hba_lock); in bnx2fc_xmit()
690 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_get_host_stats() local
694 fw_stats = (struct fcoe_statistics_params *)hba->stats_buffer; in bnx2fc_get_host_stats()
698 mutex_lock(&hba->hba_stats_mutex); in bnx2fc_get_host_stats()
702 init_completion(&hba->stat_req_done); in bnx2fc_get_host_stats()
703 if (bnx2fc_send_stat_req(hba)) in bnx2fc_get_host_stats()
705 rc = wait_for_completion_timeout(&hba->stat_req_done, (2 * HZ)); in bnx2fc_get_host_stats()
710 BNX2FC_STATS(hba, rx_stat2, fc_crc_cnt); in bnx2fc_get_host_stats()
711 bnx2fc_stats->invalid_crc_count += hba->bfw_stats.fc_crc_cnt; in bnx2fc_get_host_stats()
712 BNX2FC_STATS(hba, tx_stat, fcoe_tx_pkt_cnt); in bnx2fc_get_host_stats()
713 bnx2fc_stats->tx_frames += hba->bfw_stats.fcoe_tx_pkt_cnt; in bnx2fc_get_host_stats()
714 BNX2FC_STATS(hba, tx_stat, fcoe_tx_byte_cnt); in bnx2fc_get_host_stats()
715 bnx2fc_stats->tx_words += ((hba->bfw_stats.fcoe_tx_byte_cnt) / 4); in bnx2fc_get_host_stats()
716 BNX2FC_STATS(hba, rx_stat0, fcoe_rx_pkt_cnt); in bnx2fc_get_host_stats()
717 bnx2fc_stats->rx_frames += hba->bfw_stats.fcoe_rx_pkt_cnt; in bnx2fc_get_host_stats()
718 BNX2FC_STATS(hba, rx_stat0, fcoe_rx_byte_cnt); in bnx2fc_get_host_stats()
719 bnx2fc_stats->rx_words += ((hba->bfw_stats.fcoe_rx_byte_cnt) / 4); in bnx2fc_get_host_stats()
728 memcpy(&hba->prev_stats, hba->stats_buffer, in bnx2fc_get_host_stats()
732 mutex_unlock(&hba->hba_stats_mutex); in bnx2fc_get_host_stats()
740 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_shost_config() local
763 BNX2FC_NAME, hba->chip_num, BNX2FC_VERSION, in bnx2fc_shost_config()
773 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_link_ok() local
774 struct net_device *dev = hba->phys_dev; in bnx2fc_link_ok()
778 clear_bit(ADAPTER_STATE_LINK_DOWN, &hba->adapter_state); in bnx2fc_link_ok()
780 set_bit(ADAPTER_STATE_LINK_DOWN, &hba->adapter_state); in bnx2fc_link_ok()
793 void bnx2fc_get_link_state(struct bnx2fc_hba *hba) in bnx2fc_get_link_state() argument
795 if (test_bit(__LINK_STATE_NOCARRIER, &hba->phys_dev->state)) in bnx2fc_get_link_state()
796 set_bit(ADAPTER_STATE_LINK_DOWN, &hba->adapter_state); in bnx2fc_get_link_state()
798 clear_bit(ADAPTER_STATE_LINK_DOWN, &hba->adapter_state); in bnx2fc_get_link_state()
803 struct bnx2fc_hba *hba; in bnx2fc_net_config() local
812 hba = interface->hba; in bnx2fc_net_config()
815 if (!hba->phys_dev->ethtool_ops || in bnx2fc_net_config()
816 !hba->phys_dev->ethtool_ops->get_pauseparam) in bnx2fc_net_config()
848 struct bnx2fc_hba *hba = from_timer(hba, t, destroy_timer); in bnx2fc_destroy_timer() local
852 set_bit(BNX2FC_FLAG_DESTROY_CMPL, &hba->flags); in bnx2fc_destroy_timer()
853 wake_up_interruptible(&hba->destroy_wait); in bnx2fc_destroy_timer()
869 struct bnx2fc_hba *hba = (struct bnx2fc_hba *)context; in bnx2fc_indicate_netevent() local
883 if (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state)) in bnx2fc_indicate_netevent()
889 clear_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state); in bnx2fc_indicate_netevent()
890 clear_bit(ADAPTER_STATE_UP, &hba->adapter_state); in bnx2fc_indicate_netevent()
895 set_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state); in bnx2fc_indicate_netevent()
907 if (interface->hba == hba && in bnx2fc_indicate_netevent()
921 if (interface->hba != hba) in bnx2fc_indicate_netevent()
975 clear_bit(ADAPTER_STATE_READY, &hba->adapter_state); in bnx2fc_indicate_netevent()
976 init_waitqueue_head(&hba->shutdown_wait); in bnx2fc_indicate_netevent()
979 hba->num_ofld_sess); in bnx2fc_indicate_netevent()
980 hba->wait_for_link_down = 1; in bnx2fc_indicate_netevent()
981 wait_event_interruptible(hba->shutdown_wait, in bnx2fc_indicate_netevent()
982 (hba->num_ofld_sess == 0)); in bnx2fc_indicate_netevent()
984 hba->num_ofld_sess); in bnx2fc_indicate_netevent()
985 hba->wait_for_link_down = 0; in bnx2fc_indicate_netevent()
1005 static int bnx2fc_em_config(struct fc_lport *lport, struct bnx2fc_hba *hba) in bnx2fc_em_config() argument
1009 fcoe_min_xid = hba->max_xid + 1; in bnx2fc_em_config()
1011 fcoe_max_xid = hba->max_xid + FCOE_XIDS_PER_CPU_OFFSET; in bnx2fc_em_config()
1013 fcoe_max_xid = hba->max_xid + FCOE_MAX_XID_OFFSET; in bnx2fc_em_config()
1147 if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &interface->hba->flags)) { in bnx2fc_vport_create()
1178 static void bnx2fc_free_vport(struct bnx2fc_hba *hba, struct fc_lport *lport) in bnx2fc_free_vport() argument
1182 spin_lock_bh(&hba->hba_lock); in bnx2fc_free_vport()
1183 list_for_each_entry_safe(blport, tmp, &hba->vports, list) { in bnx2fc_free_vport()
1189 spin_unlock_bh(&hba->hba_lock); in bnx2fc_free_vport()
1215 bnx2fc_free_vport(interface->hba, port->lport); in bnx2fc_vport_destroy()
1241 struct net_device *physdev = interface->hba->phys_dev; in bnx2fc_interface_setup()
1343 static void bnx2fc_hba_destroy(struct bnx2fc_hba *hba) in bnx2fc_hba_destroy() argument
1346 if (hba->cmd_mgr) { in bnx2fc_hba_destroy()
1347 bnx2fc_cmd_mgr_free(hba->cmd_mgr); in bnx2fc_hba_destroy()
1348 hba->cmd_mgr = NULL; in bnx2fc_hba_destroy()
1350 kfree(hba->tgt_ofld_list); in bnx2fc_hba_destroy()
1351 bnx2fc_unbind_pcidev(hba); in bnx2fc_hba_destroy()
1352 kfree(hba); in bnx2fc_hba_destroy()
1365 struct bnx2fc_hba *hba; in bnx2fc_hba_create() local
1369 hba = kzalloc(sizeof(*hba), GFP_KERNEL); in bnx2fc_hba_create()
1370 if (!hba) { in bnx2fc_hba_create()
1374 spin_lock_init(&hba->hba_lock); in bnx2fc_hba_create()
1375 mutex_init(&hba->hba_mutex); in bnx2fc_hba_create()
1376 mutex_init(&hba->hba_stats_mutex); in bnx2fc_hba_create()
1378 hba->cnic = cnic; in bnx2fc_hba_create()
1380 hba->max_tasks = cnic->max_fcoe_exchanges; in bnx2fc_hba_create()
1381 hba->elstm_xids = (hba->max_tasks / 2); in bnx2fc_hba_create()
1382 hba->max_outstanding_cmds = hba->elstm_xids; in bnx2fc_hba_create()
1383 hba->max_xid = (hba->max_tasks - 1); in bnx2fc_hba_create()
1385 rc = bnx2fc_bind_pcidev(hba); in bnx2fc_hba_create()
1390 hba->phys_dev = cnic->netdev; in bnx2fc_hba_create()
1391 hba->next_conn_id = 0; in bnx2fc_hba_create()
1393 hba->tgt_ofld_list = in bnx2fc_hba_create()
1396 if (!hba->tgt_ofld_list) { in bnx2fc_hba_create()
1401 hba->num_ofld_sess = 0; in bnx2fc_hba_create()
1403 hba->cmd_mgr = bnx2fc_cmd_mgr_alloc(hba); in bnx2fc_hba_create()
1404 if (!hba->cmd_mgr) { in bnx2fc_hba_create()
1408 fcoe_cap = &hba->fcoe_cap; in bnx2fc_hba_create()
1414 fcoe_cap->capability2 = hba->max_outstanding_cmds << in bnx2fc_hba_create()
1420 fcoe_cap->capability3 |= hba->max_outstanding_cmds << in bnx2fc_hba_create()
1424 init_waitqueue_head(&hba->shutdown_wait); in bnx2fc_hba_create()
1425 init_waitqueue_head(&hba->destroy_wait); in bnx2fc_hba_create()
1426 INIT_LIST_HEAD(&hba->vports); in bnx2fc_hba_create()
1428 return hba; in bnx2fc_hba_create()
1431 kfree(hba->tgt_ofld_list); in bnx2fc_hba_create()
1433 bnx2fc_unbind_pcidev(hba); in bnx2fc_hba_create()
1435 kfree(hba); in bnx2fc_hba_create()
1440 bnx2fc_interface_create(struct bnx2fc_hba *hba, in bnx2fc_interface_create() argument
1462 interface->hba = hba; in bnx2fc_interface_create()
1502 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_if_create() local
1512 bnx2fc_shost_template.can_queue = hba->max_outstanding_cmds; in bnx2fc_if_create()
1566 rc = bnx2fc_em_config(lport, hba); in bnx2fc_if_create()
1580 spin_lock_bh(&hba->hba_lock); in bnx2fc_if_create()
1582 list_add_tail(&blport->list, &hba->vports); in bnx2fc_if_create()
1583 spin_unlock_bh(&hba->hba_lock); in bnx2fc_if_create()
1609 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_interface_cleanup() local
1619 bnx2fc_free_vport(hba, lport); in bnx2fc_interface_cleanup()
1705 static void bnx2fc_unbind_adapter_devices(struct bnx2fc_hba *hba) in bnx2fc_unbind_adapter_devices() argument
1707 bnx2fc_free_fw_resc(hba); in bnx2fc_unbind_adapter_devices()
1708 bnx2fc_free_task_ctx(hba); in bnx2fc_unbind_adapter_devices()
1717 static int bnx2fc_bind_adapter_devices(struct bnx2fc_hba *hba) in bnx2fc_bind_adapter_devices() argument
1719 if (bnx2fc_setup_task_ctx(hba)) in bnx2fc_bind_adapter_devices()
1722 if (bnx2fc_setup_fw_resc(hba)) in bnx2fc_bind_adapter_devices()
1727 bnx2fc_unbind_adapter_devices(hba); in bnx2fc_bind_adapter_devices()
1731 static int bnx2fc_bind_pcidev(struct bnx2fc_hba *hba) in bnx2fc_bind_pcidev() argument
1736 if (!hba->cnic) { in bnx2fc_bind_pcidev()
1740 cnic = hba->cnic; in bnx2fc_bind_pcidev()
1741 pdev = hba->pcidev = cnic->pcidev; in bnx2fc_bind_pcidev()
1742 if (!hba->pcidev) in bnx2fc_bind_pcidev()
1747 strncpy(hba->chip_num, "BCM57710", BCM_CHIP_LEN); in bnx2fc_bind_pcidev()
1750 strncpy(hba->chip_num, "BCM57711", BCM_CHIP_LEN); in bnx2fc_bind_pcidev()
1755 strncpy(hba->chip_num, "BCM57712", BCM_CHIP_LEN); in bnx2fc_bind_pcidev()
1760 strncpy(hba->chip_num, "BCM57800", BCM_CHIP_LEN); in bnx2fc_bind_pcidev()
1765 strncpy(hba->chip_num, "BCM57810", BCM_CHIP_LEN); in bnx2fc_bind_pcidev()
1772 strncpy(hba->chip_num, "BCM57840", BCM_CHIP_LEN); in bnx2fc_bind_pcidev()
1778 pci_dev_get(hba->pcidev); in bnx2fc_bind_pcidev()
1782 static void bnx2fc_unbind_pcidev(struct bnx2fc_hba *hba) in bnx2fc_unbind_pcidev() argument
1784 if (hba->pcidev) { in bnx2fc_unbind_pcidev()
1785 hba->chip_num[0] = '\0'; in bnx2fc_unbind_pcidev()
1786 pci_dev_put(hba->pcidev); in bnx2fc_unbind_pcidev()
1788 hba->pcidev = NULL; in bnx2fc_unbind_pcidev()
1798 struct bnx2fc_hba *hba = handle; in bnx2fc_ulp_get_stats() local
1802 if (!hba) in bnx2fc_ulp_get_stats()
1805 cnic = hba->cnic; in bnx2fc_ulp_get_stats()
1834 struct bnx2fc_hba *hba = handle; in bnx2fc_ulp_start() local
1841 if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &hba->flags)) in bnx2fc_ulp_start()
1842 bnx2fc_fw_init(hba); in bnx2fc_ulp_start()
1847 if (interface->hba == hba) { in bnx2fc_ulp_start()
1873 if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &interface->hba->flags)) in bnx2fc_stop()
1889 static int bnx2fc_fw_init(struct bnx2fc_hba *hba) in bnx2fc_fw_init() argument
1895 rc = bnx2fc_bind_adapter_devices(hba); in bnx2fc_fw_init()
1902 rc = bnx2fc_send_fw_fcoe_init_msg(hba); in bnx2fc_fw_init()
1913 while (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state) && i--) in bnx2fc_fw_init()
1916 if (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state)) { in bnx2fc_fw_init()
1919 hba->cnic->netdev->name); in bnx2fc_fw_init()
1925 set_bit(BNX2FC_FLAG_FW_INIT_DONE, &hba->flags); in bnx2fc_fw_init()
1929 bnx2fc_unbind_adapter_devices(hba); in bnx2fc_fw_init()
1934 static void bnx2fc_fw_destroy(struct bnx2fc_hba *hba) in bnx2fc_fw_destroy() argument
1936 if (test_and_clear_bit(BNX2FC_FLAG_FW_INIT_DONE, &hba->flags)) { in bnx2fc_fw_destroy()
1937 if (bnx2fc_send_fw_fcoe_destroy_msg(hba) == 0) { in bnx2fc_fw_destroy()
1938 timer_setup(&hba->destroy_timer, bnx2fc_destroy_timer, in bnx2fc_fw_destroy()
1940 hba->destroy_timer.expires = BNX2FC_FW_TIMEOUT + in bnx2fc_fw_destroy()
1942 add_timer(&hba->destroy_timer); in bnx2fc_fw_destroy()
1943 wait_event_interruptible(hba->destroy_wait, in bnx2fc_fw_destroy()
1945 &hba->flags)); in bnx2fc_fw_destroy()
1946 clear_bit(BNX2FC_FLAG_DESTROY_CMPL, &hba->flags); in bnx2fc_fw_destroy()
1951 del_timer_sync(&hba->destroy_timer); in bnx2fc_fw_destroy()
1953 bnx2fc_unbind_adapter_devices(hba); in bnx2fc_fw_destroy()
1967 struct bnx2fc_hba *hba = handle; in bnx2fc_ulp_stop() local
1973 if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &hba->flags)) in bnx2fc_ulp_stop()
1976 if (interface->hba == hba) in bnx2fc_ulp_stop()
1979 BUG_ON(hba->num_ofld_sess != 0); in bnx2fc_ulp_stop()
1981 mutex_lock(&hba->hba_mutex); in bnx2fc_ulp_stop()
1982 clear_bit(ADAPTER_STATE_UP, &hba->adapter_state); in bnx2fc_ulp_stop()
1984 &hba->adapter_state); in bnx2fc_ulp_stop()
1986 clear_bit(ADAPTER_STATE_READY, &hba->adapter_state); in bnx2fc_ulp_stop()
1987 mutex_unlock(&hba->hba_mutex); in bnx2fc_ulp_stop()
1989 bnx2fc_fw_destroy(hba); in bnx2fc_ulp_stop()
2002 if (!test_bit(BNX2FC_FLAG_FW_INIT_DONE, &interface->hba->flags)) { in bnx2fc_start_disc()
2014 set_bit(ADAPTER_STATE_READY, &interface->hba->adapter_state); in bnx2fc_start_disc()
2044 struct bnx2fc_hba *hba; in bnx2fc_ulp_init() local
2057 hba = bnx2fc_hba_create(dev); in bnx2fc_ulp_init()
2058 if (!hba) { in bnx2fc_ulp_init()
2067 list_add_tail(&hba->list, &adapter_list); in bnx2fc_ulp_init()
2071 dev->fcoe_cap = &hba->fcoe_cap; in bnx2fc_ulp_init()
2072 clear_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic); in bnx2fc_ulp_init()
2074 (void *) hba); in bnx2fc_ulp_init()
2078 set_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic); in bnx2fc_ulp_init()
2180 struct bnx2fc_hba *hba; in __bnx2fc_enable() local
2195 hba = interface->hba; in __bnx2fc_enable()
2198 if (!hba) in __bnx2fc_enable()
2201 if (!hba->cnic) in __bnx2fc_enable()
2210 if (!hba->cnic->get_fc_npiv_tbl) in __bnx2fc_enable()
2217 if (hba->cnic->get_fc_npiv_tbl(hba->cnic, npiv_tbl)) in __bnx2fc_enable()
2305 struct bnx2fc_hba *hba; in _bnx2fc_create() local
2347 hba = bnx2fc_hba_lookup(phys_dev); in _bnx2fc_create()
2348 if (!hba) { in _bnx2fc_create()
2359 interface = bnx2fc_interface_create(hba, netdev, fip_mode); in _bnx2fc_create()
2409 set_bit(ADAPTER_STATE_READY, &interface->hba->adapter_state); in _bnx2fc_create()
2481 struct bnx2fc_hba *hba; in bnx2fc_find_hba_for_cnic() local
2484 list_for_each_entry(hba, &adapter_list, list) { in bnx2fc_find_hba_for_cnic()
2485 if (hba->cnic == cnic) in bnx2fc_find_hba_for_cnic()
2486 return hba; in bnx2fc_find_hba_for_cnic()
2507 struct bnx2fc_hba *hba; in bnx2fc_hba_lookup() local
2510 list_for_each_entry(hba, &adapter_list, list) { in bnx2fc_hba_lookup()
2511 if (hba->phys_dev == phys_dev) in bnx2fc_hba_lookup()
2512 return hba; in bnx2fc_hba_lookup()
2525 struct bnx2fc_hba *hba; in bnx2fc_ulp_exit() local
2537 hba = bnx2fc_find_hba_for_cnic(dev); in bnx2fc_ulp_exit()
2538 if (!hba) { in bnx2fc_ulp_exit()
2545 list_del_init(&hba->list); in bnx2fc_ulp_exit()
2550 if (interface->hba == hba) in bnx2fc_ulp_exit()
2554 bnx2fc_ulp_stop(hba); in bnx2fc_ulp_exit()
2556 if (test_and_clear_bit(BNX2FC_CNIC_REGISTERED, &hba->reg_with_cnic)) in bnx2fc_ulp_exit()
2557 hba->cnic->unregister_device(hba->cnic, CNIC_ULP_FCOE); in bnx2fc_ulp_exit()
2558 bnx2fc_hba_destroy(hba); in bnx2fc_ulp_exit()
2760 struct bnx2fc_hba *hba, *next; in bnx2fc_mod_exit() local
2777 list_for_each_entry_safe(hba, next, &to_be_deleted, list) { in bnx2fc_mod_exit()
2778 list_del_init(&hba->list); in bnx2fc_mod_exit()
2780 hba); in bnx2fc_mod_exit()
2781 bnx2fc_ulp_stop(hba); in bnx2fc_mod_exit()
2784 &hba->reg_with_cnic)) in bnx2fc_mod_exit()
2785 hba->cnic->unregister_device(hba->cnic, in bnx2fc_mod_exit()
2787 bnx2fc_hba_destroy(hba); in bnx2fc_mod_exit()