Lines Matching full:hba

20 static void bnx2fc_fastpath_notification(struct bnx2fc_hba *hba,
22 static void bnx2fc_process_ofld_cmpl(struct bnx2fc_hba *hba,
24 static void bnx2fc_process_enable_conn_cmpl(struct bnx2fc_hba *hba,
26 static void bnx2fc_init_failure(struct bnx2fc_hba *hba, u32 err_code);
27 static void bnx2fc_process_conn_destroy_cmpl(struct bnx2fc_hba *hba,
30 int bnx2fc_send_stat_req(struct bnx2fc_hba *hba) in bnx2fc_send_stat_req() argument
42 stat_req.stat_params_addr_lo = (u32) hba->stats_buf_dma; in bnx2fc_send_stat_req()
43 stat_req.stat_params_addr_hi = (u32) ((u64)hba->stats_buf_dma >> 32); in bnx2fc_send_stat_req()
47 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2fc_send_stat_req()
48 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2fc_send_stat_req()
56 * @hba: adapter structure pointer
62 int bnx2fc_send_fw_fcoe_init_msg(struct bnx2fc_hba *hba) in bnx2fc_send_fw_fcoe_init_msg() argument
71 if (!hba->cnic) { in bnx2fc_send_fw_fcoe_init_msg()
72 printk(KERN_ERR PFX "hba->cnic NULL during fcoe fw init\n"); in bnx2fc_send_fw_fcoe_init_msg()
82 fcoe_init1.num_tasks = hba->max_tasks; in bnx2fc_send_fw_fcoe_init_msg()
87 fcoe_init1.dummy_buffer_addr_lo = (u32) hba->dummy_buf_dma; in bnx2fc_send_fw_fcoe_init_msg()
88 fcoe_init1.dummy_buffer_addr_hi = (u32) ((u64)hba->dummy_buf_dma >> 32); in bnx2fc_send_fw_fcoe_init_msg()
89 fcoe_init1.task_list_pbl_addr_lo = (u32) hba->task_ctx_bd_dma; in bnx2fc_send_fw_fcoe_init_msg()
91 (u32) ((u64) hba->task_ctx_bd_dma >> 32); in bnx2fc_send_fw_fcoe_init_msg()
109 fcoe_init2.hash_tbl_pbl_addr_lo = (u32) hba->hash_tbl_pbl_dma; in bnx2fc_send_fw_fcoe_init_msg()
111 ((u64) hba->hash_tbl_pbl_dma >> 32); in bnx2fc_send_fw_fcoe_init_msg()
113 fcoe_init2.t2_hash_tbl_addr_lo = (u32) hba->t2_hash_tbl_dma; in bnx2fc_send_fw_fcoe_init_msg()
115 ((u64) hba->t2_hash_tbl_dma >> 32); in bnx2fc_send_fw_fcoe_init_msg()
117 fcoe_init2.t2_ptr_hash_tbl_addr_lo = (u32) hba->t2_hash_tbl_ptr_dma; in bnx2fc_send_fw_fcoe_init_msg()
119 ((u64) hba->t2_hash_tbl_ptr_dma >> 32); in bnx2fc_send_fw_fcoe_init_msg()
141 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2fc_send_fw_fcoe_init_msg()
142 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2fc_send_fw_fcoe_init_msg()
146 int bnx2fc_send_fw_fcoe_destroy_msg(struct bnx2fc_hba *hba) in bnx2fc_send_fw_fcoe_destroy_msg() argument
160 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2fc_send_fw_fcoe_destroy_msg()
161 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2fc_send_fw_fcoe_destroy_msg()
177 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_send_session_ofld_req() local
344 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2fc_send_session_ofld_req()
345 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2fc_send_session_ofld_req()
362 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_send_session_enable_req() local
415 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2fc_send_session_enable_req()
416 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2fc_send_session_enable_req()
431 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_send_session_disable_req() local
479 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2fc_send_session_disable_req()
480 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2fc_send_session_disable_req()
488 * @hba: adapter structure pointer
491 int bnx2fc_send_session_destroy_req(struct bnx2fc_hba *hba, in bnx2fc_send_session_destroy_req() argument
509 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2fc_send_session_destroy_req()
510 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2fc_send_session_destroy_req()
515 static bool is_valid_lport(struct bnx2fc_hba *hba, struct fc_lport *lport) in is_valid_lport() argument
519 spin_lock_bh(&hba->hba_lock); in is_valid_lport()
520 list_for_each_entry(blport, &hba->vports, list) { in is_valid_lport()
522 spin_unlock_bh(&hba->hba_lock); in is_valid_lport()
526 spin_unlock_bh(&hba->hba_lock); in is_valid_lport()
536 struct bnx2fc_hba *hba; in bnx2fc_unsol_els_work() local
542 hba = unsol_els->hba; in bnx2fc_unsol_els_work()
543 if (is_valid_lport(hba, lport)) in bnx2fc_unsol_els_work()
615 unsol_els->hba = interface->hba; in bnx2fc_process_l2_frame_compl()
637 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_process_unsol_compl() local
703 if (xid > hba->max_xid) { in bnx2fc_process_unsol_compl()
710 io_req = (struct bnx2fc_cmd *)hba->cmd_mgr->cmds[xid]; in bnx2fc_process_unsol_compl()
815 if (xid > hba->max_xid) { in bnx2fc_process_unsol_compl()
831 io_req = (struct bnx2fc_cmd *)hba->cmd_mgr->cmds[xid]; in bnx2fc_process_unsol_compl()
865 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_process_cq_compl() local
875 io_req = (struct bnx2fc_cmd *)hba->cmd_mgr->cmds[xid]; in bnx2fc_process_cq_compl()
1000 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_pending_work() local
1009 if (xid >= hba->max_tasks) { in bnx2fc_pending_work()
1016 task_page = (struct fcoe_task_ctx_entry *)hba->task_ctx[task_idx]; in bnx2fc_pending_work()
1125 * @hba: adapter structure pointer
1130 static void bnx2fc_fastpath_notification(struct bnx2fc_hba *hba, in bnx2fc_fastpath_notification() argument
1134 struct bnx2fc_rport *tgt = hba->tgt_ofld_list[conn_id]; in bnx2fc_fastpath_notification()
1147 * @hba: adapter structure pointer
1153 static void bnx2fc_process_ofld_cmpl(struct bnx2fc_hba *hba, in bnx2fc_process_ofld_cmpl() argument
1163 tgt = hba->tgt_ofld_list[conn_id]; in bnx2fc_process_ofld_cmpl()
1171 if (hba != interface->hba) { in bnx2fc_process_ofld_cmpl()
1172 printk(KERN_ERR PFX "ERROR:ofld_cmpl: HBA mismatch\n"); in bnx2fc_process_ofld_cmpl()
1199 * @hba: adapter structure pointer
1205 static void bnx2fc_process_enable_conn_cmpl(struct bnx2fc_hba *hba, in bnx2fc_process_enable_conn_cmpl() argument
1215 tgt = hba->tgt_ofld_list[conn_id]; in bnx2fc_process_enable_conn_cmpl()
1233 if (hba != interface->hba) { in bnx2fc_process_enable_conn_cmpl()
1234 printk(KERN_ERR PFX "bnx2fc-enbl_cmpl: HBA mismatch\n"); in bnx2fc_process_enable_conn_cmpl()
1246 static void bnx2fc_process_conn_disable_cmpl(struct bnx2fc_hba *hba, in bnx2fc_process_conn_disable_cmpl() argument
1254 tgt = hba->tgt_ofld_list[conn_id]; in bnx2fc_process_conn_disable_cmpl()
1279 static void bnx2fc_process_conn_destroy_cmpl(struct bnx2fc_hba *hba, in bnx2fc_process_conn_destroy_cmpl() argument
1286 tgt = hba->tgt_ofld_list[conn_id]; in bnx2fc_process_conn_destroy_cmpl()
1308 static void bnx2fc_init_failure(struct bnx2fc_hba *hba, u32 err_code) in bnx2fc_init_failure() argument
1345 struct bnx2fc_hba *hba = (struct bnx2fc_hba *)context; in bnx2fc_indicate_kcqe() local
1354 bnx2fc_fastpath_notification(hba, kcqe); in bnx2fc_indicate_kcqe()
1358 bnx2fc_process_ofld_cmpl(hba, kcqe); in bnx2fc_indicate_kcqe()
1362 bnx2fc_process_enable_conn_cmpl(hba, kcqe); in bnx2fc_indicate_kcqe()
1368 bnx2fc_init_failure(hba, in bnx2fc_indicate_kcqe()
1371 set_bit(ADAPTER_STATE_UP, &hba->adapter_state); in bnx2fc_indicate_kcqe()
1372 bnx2fc_get_link_state(hba); in bnx2fc_indicate_kcqe()
1374 (u8)hba->pcidev->bus->number); in bnx2fc_indicate_kcqe()
1386 set_bit(BNX2FC_FLAG_DESTROY_CMPL, &hba->flags); in bnx2fc_indicate_kcqe()
1387 wake_up_interruptible(&hba->destroy_wait); in bnx2fc_indicate_kcqe()
1391 bnx2fc_process_conn_disable_cmpl(hba, kcqe); in bnx2fc_indicate_kcqe()
1395 bnx2fc_process_conn_destroy_cmpl(hba, kcqe); in bnx2fc_indicate_kcqe()
1402 complete(&hba->stat_req_done); in bnx2fc_indicate_kcqe()
1450 struct bnx2fc_hba *hba = interface->hba; in bnx2fc_map_doorbell() local
1452 reg_base = pci_resource_start(hba->pcidev, in bnx2fc_map_doorbell()
1861 * @hba: pointer to adapter structure
1867 int bnx2fc_setup_task_ctx(struct bnx2fc_hba *hba) in bnx2fc_setup_task_ctx() argument
1881 hba->task_ctx_bd_tbl = dma_alloc_coherent(&hba->pcidev->dev, in bnx2fc_setup_task_ctx()
1883 &hba->task_ctx_bd_dma, in bnx2fc_setup_task_ctx()
1885 if (!hba->task_ctx_bd_tbl) { in bnx2fc_setup_task_ctx()
1895 task_ctx_arr_sz = (hba->max_tasks / BNX2FC_TASKS_PER_PAGE); in bnx2fc_setup_task_ctx()
1896 hba->task_ctx = kzalloc((task_ctx_arr_sz * sizeof(void *)), in bnx2fc_setup_task_ctx()
1898 if (!hba->task_ctx) { in bnx2fc_setup_task_ctx()
1907 hba->task_ctx_dma = kmalloc((task_ctx_arr_sz * in bnx2fc_setup_task_ctx()
1909 if (!hba->task_ctx_dma) { in bnx2fc_setup_task_ctx()
1915 task_ctx_bdt = (struct regpair *)hba->task_ctx_bd_tbl; in bnx2fc_setup_task_ctx()
1918 hba->task_ctx[i] = dma_alloc_coherent(&hba->pcidev->dev, in bnx2fc_setup_task_ctx()
1920 &hba->task_ctx_dma[i], in bnx2fc_setup_task_ctx()
1922 if (!hba->task_ctx[i]) { in bnx2fc_setup_task_ctx()
1927 addr = (u64)hba->task_ctx_dma[i]; in bnx2fc_setup_task_ctx()
1936 if (hba->task_ctx[i]) { in bnx2fc_setup_task_ctx()
1938 dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_setup_task_ctx()
1939 hba->task_ctx[i], hba->task_ctx_dma[i]); in bnx2fc_setup_task_ctx()
1940 hba->task_ctx[i] = NULL; in bnx2fc_setup_task_ctx()
1944 kfree(hba->task_ctx_dma); in bnx2fc_setup_task_ctx()
1945 hba->task_ctx_dma = NULL; in bnx2fc_setup_task_ctx()
1947 kfree(hba->task_ctx); in bnx2fc_setup_task_ctx()
1948 hba->task_ctx = NULL; in bnx2fc_setup_task_ctx()
1950 dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_setup_task_ctx()
1951 hba->task_ctx_bd_tbl, hba->task_ctx_bd_dma); in bnx2fc_setup_task_ctx()
1952 hba->task_ctx_bd_tbl = NULL; in bnx2fc_setup_task_ctx()
1957 void bnx2fc_free_task_ctx(struct bnx2fc_hba *hba) in bnx2fc_free_task_ctx() argument
1962 if (hba->task_ctx_bd_tbl) { in bnx2fc_free_task_ctx()
1963 dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_free_task_ctx()
1964 hba->task_ctx_bd_tbl, in bnx2fc_free_task_ctx()
1965 hba->task_ctx_bd_dma); in bnx2fc_free_task_ctx()
1966 hba->task_ctx_bd_tbl = NULL; in bnx2fc_free_task_ctx()
1969 task_ctx_arr_sz = (hba->max_tasks / BNX2FC_TASKS_PER_PAGE); in bnx2fc_free_task_ctx()
1970 if (hba->task_ctx) { in bnx2fc_free_task_ctx()
1972 if (hba->task_ctx[i]) { in bnx2fc_free_task_ctx()
1973 dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_free_task_ctx()
1974 hba->task_ctx[i], in bnx2fc_free_task_ctx()
1975 hba->task_ctx_dma[i]); in bnx2fc_free_task_ctx()
1976 hba->task_ctx[i] = NULL; in bnx2fc_free_task_ctx()
1979 kfree(hba->task_ctx); in bnx2fc_free_task_ctx()
1980 hba->task_ctx = NULL; in bnx2fc_free_task_ctx()
1983 kfree(hba->task_ctx_dma); in bnx2fc_free_task_ctx()
1984 hba->task_ctx_dma = NULL; in bnx2fc_free_task_ctx()
1987 static void bnx2fc_free_hash_table(struct bnx2fc_hba *hba) in bnx2fc_free_hash_table() argument
1993 if (hba->hash_tbl_segments) { in bnx2fc_free_hash_table()
1995 pbl = hba->hash_tbl_pbl; in bnx2fc_free_hash_table()
1997 segment_count = hba->hash_tbl_segment_count; in bnx2fc_free_hash_table()
2005 dma_free_coherent(&hba->pcidev->dev, in bnx2fc_free_hash_table()
2007 hba->hash_tbl_segments[i], in bnx2fc_free_hash_table()
2012 kfree(hba->hash_tbl_segments); in bnx2fc_free_hash_table()
2013 hba->hash_tbl_segments = NULL; in bnx2fc_free_hash_table()
2016 if (hba->hash_tbl_pbl) { in bnx2fc_free_hash_table()
2017 dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_free_hash_table()
2018 hba->hash_tbl_pbl, in bnx2fc_free_hash_table()
2019 hba->hash_tbl_pbl_dma); in bnx2fc_free_hash_table()
2020 hba->hash_tbl_pbl = NULL; in bnx2fc_free_hash_table()
2024 static int bnx2fc_allocate_hash_table(struct bnx2fc_hba *hba) in bnx2fc_allocate_hash_table() argument
2039 hba->hash_tbl_segment_count = segment_count; in bnx2fc_allocate_hash_table()
2041 segment_array_size = segment_count * sizeof(*hba->hash_tbl_segments); in bnx2fc_allocate_hash_table()
2042 hba->hash_tbl_segments = kzalloc(segment_array_size, GFP_KERNEL); in bnx2fc_allocate_hash_table()
2043 if (!hba->hash_tbl_segments) { in bnx2fc_allocate_hash_table()
2055 hba->hash_tbl_segments[i] = dma_alloc_coherent(&hba->pcidev->dev, in bnx2fc_allocate_hash_table()
2059 if (!hba->hash_tbl_segments[i]) { in bnx2fc_allocate_hash_table()
2065 hba->hash_tbl_pbl = dma_alloc_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_allocate_hash_table()
2066 &hba->hash_tbl_pbl_dma, in bnx2fc_allocate_hash_table()
2068 if (!hba->hash_tbl_pbl) { in bnx2fc_allocate_hash_table()
2073 pbl = hba->hash_tbl_pbl; in bnx2fc_allocate_hash_table()
2081 pbl = hba->hash_tbl_pbl; in bnx2fc_allocate_hash_table()
2093 if (hba->hash_tbl_segments[i]) in bnx2fc_allocate_hash_table()
2094 dma_free_coherent(&hba->pcidev->dev, in bnx2fc_allocate_hash_table()
2096 hba->hash_tbl_segments[i], in bnx2fc_allocate_hash_table()
2103 kfree(hba->hash_tbl_segments); in bnx2fc_allocate_hash_table()
2104 hba->hash_tbl_segments = NULL; in bnx2fc_allocate_hash_table()
2111 * @hba: Pointer to adapter structure
2114 int bnx2fc_setup_fw_resc(struct bnx2fc_hba *hba) in bnx2fc_setup_fw_resc() argument
2120 if (bnx2fc_allocate_hash_table(hba)) in bnx2fc_setup_fw_resc()
2124 hba->t2_hash_tbl_ptr = dma_alloc_coherent(&hba->pcidev->dev, mem_size, in bnx2fc_setup_fw_resc()
2125 &hba->t2_hash_tbl_ptr_dma, in bnx2fc_setup_fw_resc()
2127 if (!hba->t2_hash_tbl_ptr) { in bnx2fc_setup_fw_resc()
2129 bnx2fc_free_fw_resc(hba); in bnx2fc_setup_fw_resc()
2135 hba->t2_hash_tbl = dma_alloc_coherent(&hba->pcidev->dev, mem_size, in bnx2fc_setup_fw_resc()
2136 &hba->t2_hash_tbl_dma, in bnx2fc_setup_fw_resc()
2138 if (!hba->t2_hash_tbl) { in bnx2fc_setup_fw_resc()
2140 bnx2fc_free_fw_resc(hba); in bnx2fc_setup_fw_resc()
2144 addr = (unsigned long) hba->t2_hash_tbl_dma + in bnx2fc_setup_fw_resc()
2146 hba->t2_hash_tbl[i].next.lo = addr & 0xffffffff; in bnx2fc_setup_fw_resc()
2147 hba->t2_hash_tbl[i].next.hi = addr >> 32; in bnx2fc_setup_fw_resc()
2150 hba->dummy_buffer = dma_alloc_coherent(&hba->pcidev->dev, in bnx2fc_setup_fw_resc()
2151 PAGE_SIZE, &hba->dummy_buf_dma, in bnx2fc_setup_fw_resc()
2153 if (!hba->dummy_buffer) { in bnx2fc_setup_fw_resc()
2155 bnx2fc_free_fw_resc(hba); in bnx2fc_setup_fw_resc()
2159 hba->stats_buffer = dma_alloc_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_setup_fw_resc()
2160 &hba->stats_buf_dma, in bnx2fc_setup_fw_resc()
2162 if (!hba->stats_buffer) { in bnx2fc_setup_fw_resc()
2164 bnx2fc_free_fw_resc(hba); in bnx2fc_setup_fw_resc()
2171 void bnx2fc_free_fw_resc(struct bnx2fc_hba *hba) in bnx2fc_free_fw_resc() argument
2175 if (hba->stats_buffer) { in bnx2fc_free_fw_resc()
2176 dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_free_fw_resc()
2177 hba->stats_buffer, hba->stats_buf_dma); in bnx2fc_free_fw_resc()
2178 hba->stats_buffer = NULL; in bnx2fc_free_fw_resc()
2181 if (hba->dummy_buffer) { in bnx2fc_free_fw_resc()
2182 dma_free_coherent(&hba->pcidev->dev, PAGE_SIZE, in bnx2fc_free_fw_resc()
2183 hba->dummy_buffer, hba->dummy_buf_dma); in bnx2fc_free_fw_resc()
2184 hba->dummy_buffer = NULL; in bnx2fc_free_fw_resc()
2187 if (hba->t2_hash_tbl_ptr) { in bnx2fc_free_fw_resc()
2189 dma_free_coherent(&hba->pcidev->dev, mem_size, in bnx2fc_free_fw_resc()
2190 hba->t2_hash_tbl_ptr, in bnx2fc_free_fw_resc()
2191 hba->t2_hash_tbl_ptr_dma); in bnx2fc_free_fw_resc()
2192 hba->t2_hash_tbl_ptr = NULL; in bnx2fc_free_fw_resc()
2195 if (hba->t2_hash_tbl) { in bnx2fc_free_fw_resc()
2198 dma_free_coherent(&hba->pcidev->dev, mem_size, in bnx2fc_free_fw_resc()
2199 hba->t2_hash_tbl, hba->t2_hash_tbl_dma); in bnx2fc_free_fw_resc()
2200 hba->t2_hash_tbl = NULL; in bnx2fc_free_fw_resc()
2202 bnx2fc_free_hash_table(hba); in bnx2fc_free_fw_resc()