Lines Matching refs:hba

19 static void bnx2fc_fastpath_notification(struct bnx2fc_hba *hba,
21 static void bnx2fc_process_ofld_cmpl(struct bnx2fc_hba *hba,
23 static void bnx2fc_process_enable_conn_cmpl(struct bnx2fc_hba *hba,
25 static void bnx2fc_init_failure(struct bnx2fc_hba *hba, u32 err_code);
26 static void bnx2fc_process_conn_destroy_cmpl(struct bnx2fc_hba *hba,
29 int bnx2fc_send_stat_req(struct bnx2fc_hba *hba) in bnx2fc_send_stat_req() argument
41 stat_req.stat_params_addr_lo = (u32) hba->stats_buf_dma; in bnx2fc_send_stat_req()
42 stat_req.stat_params_addr_hi = (u32) ((u64)hba->stats_buf_dma >> 32); in bnx2fc_send_stat_req()
46 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2fc_send_stat_req()
47 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2fc_send_stat_req()
61 int bnx2fc_send_fw_fcoe_init_msg(struct bnx2fc_hba *hba) in bnx2fc_send_fw_fcoe_init_msg() argument
70 if (!hba->cnic) { in bnx2fc_send_fw_fcoe_init_msg()
81 fcoe_init1.num_tasks = hba->max_tasks; in bnx2fc_send_fw_fcoe_init_msg()
86 fcoe_init1.dummy_buffer_addr_lo = (u32) hba->dummy_buf_dma; in bnx2fc_send_fw_fcoe_init_msg()
87 fcoe_init1.dummy_buffer_addr_hi = (u32) ((u64)hba->dummy_buf_dma >> 32); in bnx2fc_send_fw_fcoe_init_msg()
88 fcoe_init1.task_list_pbl_addr_lo = (u32) hba->task_ctx_bd_dma; in bnx2fc_send_fw_fcoe_init_msg()
90 (u32) ((u64) hba->task_ctx_bd_dma >> 32); in bnx2fc_send_fw_fcoe_init_msg()
108 fcoe_init2.hash_tbl_pbl_addr_lo = (u32) hba->hash_tbl_pbl_dma; in bnx2fc_send_fw_fcoe_init_msg()
110 ((u64) hba->hash_tbl_pbl_dma >> 32); in bnx2fc_send_fw_fcoe_init_msg()
112 fcoe_init2.t2_hash_tbl_addr_lo = (u32) hba->t2_hash_tbl_dma; in bnx2fc_send_fw_fcoe_init_msg()
114 ((u64) hba->t2_hash_tbl_dma >> 32); in bnx2fc_send_fw_fcoe_init_msg()
116 fcoe_init2.t2_ptr_hash_tbl_addr_lo = (u32) hba->t2_hash_tbl_ptr_dma; in bnx2fc_send_fw_fcoe_init_msg()
118 ((u64) hba->t2_hash_tbl_ptr_dma >> 32); in bnx2fc_send_fw_fcoe_init_msg()
140 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2fc_send_fw_fcoe_init_msg()
141 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2fc_send_fw_fcoe_init_msg()
145 int bnx2fc_send_fw_fcoe_destroy_msg(struct bnx2fc_hba *hba) in bnx2fc_send_fw_fcoe_destroy_msg() argument
159 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2fc_send_fw_fcoe_destroy_msg()
160 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2fc_send_fw_fcoe_destroy_msg()
176 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_send_session_ofld_req() local
343 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2fc_send_session_ofld_req()
344 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2fc_send_session_ofld_req()
361 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_send_session_enable_req() local
414 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2fc_send_session_enable_req()
415 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2fc_send_session_enable_req()
430 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_send_session_disable_req() local
478 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2fc_send_session_disable_req()
479 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2fc_send_session_disable_req()
490 int bnx2fc_send_session_destroy_req(struct bnx2fc_hba *hba, in bnx2fc_send_session_destroy_req() argument
508 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2fc_send_session_destroy_req()
509 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2fc_send_session_destroy_req()
514 static bool is_valid_lport(struct bnx2fc_hba *hba, struct fc_lport *lport) in is_valid_lport() argument
518 spin_lock_bh(&hba->hba_lock); in is_valid_lport()
519 list_for_each_entry(blport, &hba->vports, list) { in is_valid_lport()
521 spin_unlock_bh(&hba->hba_lock); in is_valid_lport()
525 spin_unlock_bh(&hba->hba_lock); in is_valid_lport()
535 struct bnx2fc_hba *hba; in bnx2fc_unsol_els_work() local
541 hba = unsol_els->hba; in bnx2fc_unsol_els_work()
542 if (is_valid_lport(hba, lport)) in bnx2fc_unsol_els_work()
614 unsol_els->hba = interface->hba; in bnx2fc_process_l2_frame_compl()
637 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_process_unsol_compl() local
705 if (xid > hba->max_xid) { in bnx2fc_process_unsol_compl()
714 hba->task_ctx[task_idx]; in bnx2fc_process_unsol_compl()
717 io_req = (struct bnx2fc_cmd *)hba->cmd_mgr->cmds[xid]; in bnx2fc_process_unsol_compl()
823 if (xid > hba->max_xid) { in bnx2fc_process_unsol_compl()
842 interface->hba->task_ctx[task_idx]; in bnx2fc_process_unsol_compl()
844 io_req = (struct bnx2fc_cmd *)hba->cmd_mgr->cmds[xid]; in bnx2fc_process_unsol_compl()
878 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_process_cq_compl() local
888 if (xid >= hba->max_tasks) { in bnx2fc_process_cq_compl()
895 task_page = (struct fcoe_task_ctx_entry *)hba->task_ctx[task_idx]; in bnx2fc_process_cq_compl()
902 io_req = (struct bnx2fc_cmd *)hba->cmd_mgr->cmds[xid]; in bnx2fc_process_cq_compl()
1097 static void bnx2fc_fastpath_notification(struct bnx2fc_hba *hba, in bnx2fc_fastpath_notification() argument
1101 struct bnx2fc_rport *tgt = hba->tgt_ofld_list[conn_id]; in bnx2fc_fastpath_notification()
1120 static void bnx2fc_process_ofld_cmpl(struct bnx2fc_hba *hba, in bnx2fc_process_ofld_cmpl() argument
1131 tgt = hba->tgt_ofld_list[conn_id]; in bnx2fc_process_ofld_cmpl()
1140 if (hba != interface->hba) { in bnx2fc_process_ofld_cmpl()
1174 static void bnx2fc_process_enable_conn_cmpl(struct bnx2fc_hba *hba, in bnx2fc_process_enable_conn_cmpl() argument
1184 tgt = hba->tgt_ofld_list[conn_id]; in bnx2fc_process_enable_conn_cmpl()
1202 if (hba != interface->hba) { in bnx2fc_process_enable_conn_cmpl()
1215 static void bnx2fc_process_conn_disable_cmpl(struct bnx2fc_hba *hba, in bnx2fc_process_conn_disable_cmpl() argument
1223 tgt = hba->tgt_ofld_list[conn_id]; in bnx2fc_process_conn_disable_cmpl()
1248 static void bnx2fc_process_conn_destroy_cmpl(struct bnx2fc_hba *hba, in bnx2fc_process_conn_destroy_cmpl() argument
1255 tgt = hba->tgt_ofld_list[conn_id]; in bnx2fc_process_conn_destroy_cmpl()
1277 static void bnx2fc_init_failure(struct bnx2fc_hba *hba, u32 err_code) in bnx2fc_init_failure() argument
1314 struct bnx2fc_hba *hba = (struct bnx2fc_hba *)context; in bnx2fc_indicate_kcqe() local
1323 bnx2fc_fastpath_notification(hba, kcqe); in bnx2fc_indicate_kcqe()
1327 bnx2fc_process_ofld_cmpl(hba, kcqe); in bnx2fc_indicate_kcqe()
1331 bnx2fc_process_enable_conn_cmpl(hba, kcqe); in bnx2fc_indicate_kcqe()
1337 bnx2fc_init_failure(hba, in bnx2fc_indicate_kcqe()
1340 set_bit(ADAPTER_STATE_UP, &hba->adapter_state); in bnx2fc_indicate_kcqe()
1341 bnx2fc_get_link_state(hba); in bnx2fc_indicate_kcqe()
1343 (u8)hba->pcidev->bus->number); in bnx2fc_indicate_kcqe()
1355 set_bit(BNX2FC_FLAG_DESTROY_CMPL, &hba->flags); in bnx2fc_indicate_kcqe()
1356 wake_up_interruptible(&hba->destroy_wait); in bnx2fc_indicate_kcqe()
1360 bnx2fc_process_conn_disable_cmpl(hba, kcqe); in bnx2fc_indicate_kcqe()
1364 bnx2fc_process_conn_destroy_cmpl(hba, kcqe); in bnx2fc_indicate_kcqe()
1371 complete(&hba->stat_req_done); in bnx2fc_indicate_kcqe()
1421 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_map_doorbell() local
1423 reg_base = pci_resource_start(hba->pcidev, in bnx2fc_map_doorbell()
1532 interface->hba->task_ctx[orig_task_idx]; in bnx2fc_init_seq_cleanup_task()
1844 int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba) in bnx2fc_setup_task_ctx() argument
1858 hba->task_ctx_bd_tbl = dma_alloc_coherent(&hba->pcidev->dev, in bnx2fc_setup_task_ctx()
1860 &hba->task_ctx_bd_dma, in bnx2fc_setup_task_ctx()
1862 if (!hba->task_ctx_bd_tbl) { in bnx2fc_setup_task_ctx()
1867 memset(hba->task_ctx_bd_tbl, 0, PAGE_SIZE); in bnx2fc_setup_task_ctx()
1873 task_ctx_arr_sz = (hba->max_tasks / BNX2FC_TASKS_PER_PAGE); in bnx2fc_setup_task_ctx()
1874 hba->task_ctx = kzalloc((task_ctx_arr_sz * sizeof(void *)), in bnx2fc_setup_task_ctx()
1876 if (!hba->task_ctx) { in bnx2fc_setup_task_ctx()
1885 hba->task_ctx_dma = kmalloc((task_ctx_arr_sz * in bnx2fc_setup_task_ctx()
1887 if (!hba->task_ctx_dma) { in bnx2fc_setup_task_ctx()
1893 task_ctx_bdt = (struct regpair *)hba->task_ctx_bd_tbl; in bnx2fc_setup_task_ctx()
1896 hba->task_ctx[i] = dma_alloc_coherent(&hba->pcidev->dev, in bnx2fc_setup_task_ctx()
1898 &hba->task_ctx_dma[i], in bnx2fc_setup_task_ctx()
1900 if (!hba->task_ctx[i]) { in bnx2fc_setup_task_ctx()
1905 memset(hba->task_ctx[i], 0, PAGE_SIZE); in bnx2fc_setup_task_ctx()
1906 addr = (u64)hba->task_ctx_dma[i]; in bnx2fc_setup_task_ctx()
1915 if (hba->task_ctx[i]) { in bnx2fc_setup_task_ctx()
1917 dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_setup_task_ctx()
1918 hba->task_ctx[i], hba->task_ctx_dma[i]); in bnx2fc_setup_task_ctx()
1919 hba->task_ctx[i] = NULL; in bnx2fc_setup_task_ctx()
1923 kfree(hba->task_ctx_dma); in bnx2fc_setup_task_ctx()
1924 hba->task_ctx_dma = NULL; in bnx2fc_setup_task_ctx()
1926 kfree(hba->task_ctx); in bnx2fc_setup_task_ctx()
1927 hba->task_ctx = NULL; in bnx2fc_setup_task_ctx()
1929 dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_setup_task_ctx()
1930 hba->task_ctx_bd_tbl, hba->task_ctx_bd_dma); in bnx2fc_setup_task_ctx()
1931 hba->task_ctx_bd_tbl = NULL; in bnx2fc_setup_task_ctx()
1936 void bnx2fc_free_task_ctx(struct bnx2fc_hba *hba) in bnx2fc_free_task_ctx() argument
1941 if (hba->task_ctx_bd_tbl) { in bnx2fc_free_task_ctx()
1942 dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_free_task_ctx()
1943 hba->task_ctx_bd_tbl, in bnx2fc_free_task_ctx()
1944 hba->task_ctx_bd_dma); in bnx2fc_free_task_ctx()
1945 hba->task_ctx_bd_tbl = NULL; in bnx2fc_free_task_ctx()
1948 task_ctx_arr_sz = (hba->max_tasks / BNX2FC_TASKS_PER_PAGE); in bnx2fc_free_task_ctx()
1949 if (hba->task_ctx) { in bnx2fc_free_task_ctx()
1951 if (hba->task_ctx[i]) { in bnx2fc_free_task_ctx()
1952 dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_free_task_ctx()
1953 hba->task_ctx[i], in bnx2fc_free_task_ctx()
1954 hba->task_ctx_dma[i]); in bnx2fc_free_task_ctx()
1955 hba->task_ctx[i] = NULL; in bnx2fc_free_task_ctx()
1958 kfree(hba->task_ctx); in bnx2fc_free_task_ctx()
1959 hba->task_ctx = NULL; in bnx2fc_free_task_ctx()
1962 kfree(hba->task_ctx_dma); in bnx2fc_free_task_ctx()
1963 hba->task_ctx_dma = NULL; in bnx2fc_free_task_ctx()
1966 static void bnx2fc_free_hash_table(struct bnx2fc_hba *hba) in bnx2fc_free_hash_table() argument
1972 if (hba->hash_tbl_segments) { in bnx2fc_free_hash_table()
1974 pbl = hba->hash_tbl_pbl; in bnx2fc_free_hash_table()
1976 segment_count = hba->hash_tbl_segment_count; in bnx2fc_free_hash_table()
1984 dma_free_coherent(&hba->pcidev->dev, in bnx2fc_free_hash_table()
1986 hba->hash_tbl_segments[i], in bnx2fc_free_hash_table()
1991 kfree(hba->hash_tbl_segments); in bnx2fc_free_hash_table()
1992 hba->hash_tbl_segments = NULL; in bnx2fc_free_hash_table()
1995 if (hba->hash_tbl_pbl) { in bnx2fc_free_hash_table()
1996 dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_free_hash_table()
1997 hba->hash_tbl_pbl, in bnx2fc_free_hash_table()
1998 hba->hash_tbl_pbl_dma); in bnx2fc_free_hash_table()
1999 hba->hash_tbl_pbl = NULL; in bnx2fc_free_hash_table()
2003 static int bnx2fc_allocate_hash_table(struct bnx2fc_hba *hba) in bnx2fc_allocate_hash_table() argument
2018 hba->hash_tbl_segment_count = segment_count; in bnx2fc_allocate_hash_table()
2020 segment_array_size = segment_count * sizeof(*hba->hash_tbl_segments); in bnx2fc_allocate_hash_table()
2021 hba->hash_tbl_segments = kzalloc(segment_array_size, GFP_KERNEL); in bnx2fc_allocate_hash_table()
2022 if (!hba->hash_tbl_segments) { in bnx2fc_allocate_hash_table()
2034 hba->hash_tbl_segments[i] = in bnx2fc_allocate_hash_table()
2035 dma_alloc_coherent(&hba->pcidev->dev, in bnx2fc_allocate_hash_table()
2039 if (!hba->hash_tbl_segments[i]) { in bnx2fc_allocate_hash_table()
2043 memset(hba->hash_tbl_segments[i], 0, in bnx2fc_allocate_hash_table()
2047 hba->hash_tbl_pbl = dma_alloc_coherent(&hba->pcidev->dev, in bnx2fc_allocate_hash_table()
2049 &hba->hash_tbl_pbl_dma, in bnx2fc_allocate_hash_table()
2051 if (!hba->hash_tbl_pbl) { in bnx2fc_allocate_hash_table()
2055 memset(hba->hash_tbl_pbl, 0, PAGE_SIZE); in bnx2fc_allocate_hash_table()
2057 pbl = hba->hash_tbl_pbl; in bnx2fc_allocate_hash_table()
2065 pbl = hba->hash_tbl_pbl; in bnx2fc_allocate_hash_table()
2081 if (hba->hash_tbl_segments[i]) in bnx2fc_allocate_hash_table()
2082 dma_free_coherent(&hba->pcidev->dev, in bnx2fc_allocate_hash_table()
2084 hba->hash_tbl_segments[i], in bnx2fc_allocate_hash_table()
2091 kfree(hba->hash_tbl_segments); in bnx2fc_allocate_hash_table()
2092 hba->hash_tbl_segments = NULL; in bnx2fc_allocate_hash_table()
2102 int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba) in bnx2fc_setup_fw_resc() argument
2108 if (bnx2fc_allocate_hash_table(hba)) in bnx2fc_setup_fw_resc()
2112 hba->t2_hash_tbl_ptr = dma_alloc_coherent(&hba->pcidev->dev, mem_size, in bnx2fc_setup_fw_resc()
2113 &hba->t2_hash_tbl_ptr_dma, in bnx2fc_setup_fw_resc()
2115 if (!hba->t2_hash_tbl_ptr) { in bnx2fc_setup_fw_resc()
2117 bnx2fc_free_fw_resc(hba); in bnx2fc_setup_fw_resc()
2120 memset(hba->t2_hash_tbl_ptr, 0x00, mem_size); in bnx2fc_setup_fw_resc()
2124 hba->t2_hash_tbl = dma_alloc_coherent(&hba->pcidev->dev, mem_size, in bnx2fc_setup_fw_resc()
2125 &hba->t2_hash_tbl_dma, in bnx2fc_setup_fw_resc()
2127 if (!hba->t2_hash_tbl) { in bnx2fc_setup_fw_resc()
2129 bnx2fc_free_fw_resc(hba); in bnx2fc_setup_fw_resc()
2132 memset(hba->t2_hash_tbl, 0x00, mem_size); in bnx2fc_setup_fw_resc()
2134 addr = (unsigned long) hba->t2_hash_tbl_dma + in bnx2fc_setup_fw_resc()
2136 hba->t2_hash_tbl[i].next.lo = addr & 0xffffffff; in bnx2fc_setup_fw_resc()
2137 hba->t2_hash_tbl[i].next.hi = addr >> 32; in bnx2fc_setup_fw_resc()
2140 hba->dummy_buffer = dma_alloc_coherent(&hba->pcidev->dev, in bnx2fc_setup_fw_resc()
2141 PAGE_SIZE, &hba->dummy_buf_dma, in bnx2fc_setup_fw_resc()
2143 if (!hba->dummy_buffer) { in bnx2fc_setup_fw_resc()
2145 bnx2fc_free_fw_resc(hba); in bnx2fc_setup_fw_resc()
2149 hba->stats_buffer = dma_alloc_coherent(&hba->pcidev->dev, in bnx2fc_setup_fw_resc()
2151 &hba->stats_buf_dma, in bnx2fc_setup_fw_resc()
2153 if (!hba->stats_buffer) { in bnx2fc_setup_fw_resc()
2155 bnx2fc_free_fw_resc(hba); in bnx2fc_setup_fw_resc()
2158 memset(hba->stats_buffer, 0x00, PAGE_SIZE); in bnx2fc_setup_fw_resc()
2163 void bnx2fc_free_fw_resc(struct bnx2fc_hba *hba) in bnx2fc_free_fw_resc() argument
2167 if (hba->stats_buffer) { in bnx2fc_free_fw_resc()
2168 dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_free_fw_resc()
2169 hba->stats_buffer, hba->stats_buf_dma); in bnx2fc_free_fw_resc()
2170 hba->stats_buffer = NULL; in bnx2fc_free_fw_resc()
2173 if (hba->dummy_buffer) { in bnx2fc_free_fw_resc()
2174 dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_free_fw_resc()
2175 hba->dummy_buffer, hba->dummy_buf_dma); in bnx2fc_free_fw_resc()
2176 hba->dummy_buffer = NULL; in bnx2fc_free_fw_resc()
2179 if (hba->t2_hash_tbl_ptr) { in bnx2fc_free_fw_resc()
2181 dma_free_coherent(&hba->pcidev->dev, mem_size, in bnx2fc_free_fw_resc()
2182 hba->t2_hash_tbl_ptr, in bnx2fc_free_fw_resc()
2183 hba->t2_hash_tbl_ptr_dma); in bnx2fc_free_fw_resc()
2184 hba->t2_hash_tbl_ptr = NULL; in bnx2fc_free_fw_resc()
2187 if (hba->t2_hash_tbl) { in bnx2fc_free_fw_resc()
2190 dma_free_coherent(&hba->pcidev->dev, mem_size, in bnx2fc_free_fw_resc()
2191 hba->t2_hash_tbl, hba->t2_hash_tbl_dma); in bnx2fc_free_fw_resc()
2192 hba->t2_hash_tbl = NULL; in bnx2fc_free_fw_resc()
2194 bnx2fc_free_hash_table(hba); in bnx2fc_free_fw_resc()