Lines Matching refs:hba
34 if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) in bnx2i_get_cid_num()
48 static void bnx2i_adjust_qp_size(struct bnx2i_hba *hba) in bnx2i_adjust_qp_size() argument
52 if (test_bit(BNX2I_NX2_DEV_5706, &hba->cnic_dev_type) || in bnx2i_adjust_qp_size()
53 test_bit(BNX2I_NX2_DEV_5708, &hba->cnic_dev_type) || in bnx2i_adjust_qp_size()
54 test_bit(BNX2I_NX2_DEV_5709, &hba->cnic_dev_type)) { in bnx2i_adjust_qp_size()
55 if (!is_power_of_2(hba->max_sqes)) in bnx2i_adjust_qp_size()
56 hba->max_sqes = rounddown_pow_of_two(hba->max_sqes); in bnx2i_adjust_qp_size()
58 if (!is_power_of_2(hba->max_rqes)) in bnx2i_adjust_qp_size()
59 hba->max_rqes = rounddown_pow_of_two(hba->max_rqes); in bnx2i_adjust_qp_size()
67 if (hba->max_sqes < num_elements_per_pg) in bnx2i_adjust_qp_size()
68 hba->max_sqes = num_elements_per_pg; in bnx2i_adjust_qp_size()
69 else if (hba->max_sqes % num_elements_per_pg) in bnx2i_adjust_qp_size()
70 hba->max_sqes = (hba->max_sqes + num_elements_per_pg - 1) & in bnx2i_adjust_qp_size()
75 if (hba->max_cqes < num_elements_per_pg) in bnx2i_adjust_qp_size()
76 hba->max_cqes = num_elements_per_pg; in bnx2i_adjust_qp_size()
77 else if (hba->max_cqes % num_elements_per_pg) in bnx2i_adjust_qp_size()
78 hba->max_cqes = (hba->max_cqes + num_elements_per_pg - 1) & in bnx2i_adjust_qp_size()
83 if (hba->max_rqes < num_elements_per_pg) in bnx2i_adjust_qp_size()
84 hba->max_rqes = num_elements_per_pg; in bnx2i_adjust_qp_size()
85 else if (hba->max_rqes % num_elements_per_pg) in bnx2i_adjust_qp_size()
86 hba->max_rqes = (hba->max_rqes + num_elements_per_pg - 1) & in bnx2i_adjust_qp_size()
97 static void bnx2i_get_link_state(struct bnx2i_hba *hba) in bnx2i_get_link_state() argument
99 if (test_bit(__LINK_STATE_NOCARRIER, &hba->netdev->state)) in bnx2i_get_link_state()
100 set_bit(ADAPTER_STATE_LINK_DOWN, &hba->adapter_state); in bnx2i_get_link_state()
102 clear_bit(ADAPTER_STATE_LINK_DOWN, &hba->adapter_state); in bnx2i_get_link_state()
114 static void bnx2i_iscsi_license_error(struct bnx2i_hba *hba, u32 error_code) in bnx2i_iscsi_license_error() argument
119 hba->netdev->name); in bnx2i_iscsi_license_error()
124 hba->netdev->name); in bnx2i_iscsi_license_error()
125 set_bit(ADAPTER_STATE_INIT_FAILED, &hba->adapter_state); in bnx2i_iscsi_license_error()
146 if (!test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) in bnx2i_arm_cq_event_coalescing()
241 if (ep->qp.rq_prod_idx > bnx2i_conn->hba->max_rqes) { in bnx2i_put_rq_buf()
242 ep->qp.rq_prod_idx %= bnx2i_conn->hba->max_rqes; in bnx2i_put_rq_buf()
248 if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) { in bnx2i_put_rq_buf()
275 if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) { in bnx2i_ring_sq_dbell()
438 tmfabort_wqe->bd_list_addr_lo = (u32) bnx2i_conn->hba->mp_bd_dma; in bnx2i_send_iscsi_tmf()
440 ((u64) bnx2i_conn->hba->mp_bd_dma >> 32); in bnx2i_send_iscsi_tmf()
548 if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) in bnx2i_send_iscsi_nopout()
568 bnx2i_conn->hba->mp_bd_dma; in bnx2i_send_iscsi_nopout()
570 (u32) ((u64) bnx2i_conn->hba->mp_bd_dma >> 32); in bnx2i_send_iscsi_nopout()
610 logout_wqe->bd_list_addr_lo = (u32) bnx2i_conn->hba->mp_bd_dma; in bnx2i_send_iscsi_logout()
612 ((u64) bnx2i_conn->hba->mp_bd_dma >> 32); in bnx2i_send_iscsi_logout()
632 struct bnx2i_hba *hba = bnx2i_conn->hba; in bnx2i_update_iscsi_conn() local
644 if (test_bit(BNX2I_NX2_DEV_57710, &bnx2i_conn->ep->hba->cnic_dev_type)) in bnx2i_update_iscsi_conn()
674 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2i_update_iscsi_conn()
675 hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, 1); in bnx2i_update_iscsi_conn()
727 void bnx2i_send_cmd_cleanup_req(struct bnx2i_hba *hba, struct bnx2i_cmd *cmd) in bnx2i_send_cmd_cleanup_req() argument
751 int bnx2i_send_conn_destroy(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) in bnx2i_send_conn_destroy() argument
763 if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) in bnx2i_send_conn_destroy()
771 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2i_send_conn_destroy()
772 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, 1); in bnx2i_send_conn_destroy()
785 static int bnx2i_570x_send_conn_ofld_req(struct bnx2i_hba *hba, in bnx2i_570x_send_conn_ofld_req() argument
831 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2i_570x_send_conn_ofld_req()
832 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2i_570x_send_conn_ofld_req()
845 static int bnx2i_5771x_send_conn_ofld_req(struct bnx2i_hba *hba, in bnx2i_5771x_send_conn_ofld_req() argument
900 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2i_5771x_send_conn_ofld_req()
901 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, num_kwqes); in bnx2i_5771x_send_conn_ofld_req()
914 int bnx2i_send_conn_ofld_req(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) in bnx2i_send_conn_ofld_req() argument
918 if (test_bit(BNX2I_NX2_DEV_57710, &hba->cnic_dev_type)) in bnx2i_send_conn_ofld_req()
919 rc = bnx2i_5771x_send_conn_ofld_req(hba, ep); in bnx2i_send_conn_ofld_req()
921 rc = bnx2i_570x_send_conn_ofld_req(hba, ep); in bnx2i_send_conn_ofld_req()
942 if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) in setup_qp_page_tables()
1043 int bnx2i_alloc_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) in bnx2i_alloc_qp_resc() argument
1047 ep->hba = hba; in bnx2i_alloc_qp_resc()
1052 ep->qp.sq_mem_size = hba->max_sqes * BNX2I_SQ_WQE_SIZE; in bnx2i_alloc_qp_resc()
1061 dma_alloc_coherent(&hba->pcidev->dev, ep->qp.sq_pgtbl_size, in bnx2i_alloc_qp_resc()
1071 dma_alloc_coherent(&hba->pcidev->dev, ep->qp.sq_mem_size, in bnx2i_alloc_qp_resc()
1082 ep->qp.sq_last_qe = &ep->qp.sq_first_qe[hba->max_sqes - 1]; in bnx2i_alloc_qp_resc()
1085 ep->qp.sqe_left = hba->max_sqes; in bnx2i_alloc_qp_resc()
1088 ep->qp.cq_mem_size = hba->max_cqes * BNX2I_CQE_SIZE; in bnx2i_alloc_qp_resc()
1097 dma_alloc_coherent(&hba->pcidev->dev, ep->qp.cq_pgtbl_size, in bnx2i_alloc_qp_resc()
1107 dma_alloc_coherent(&hba->pcidev->dev, ep->qp.cq_mem_size, in bnx2i_alloc_qp_resc()
1118 ep->qp.cq_last_qe = &ep->qp.cq_first_qe[hba->max_cqes - 1]; in bnx2i_alloc_qp_resc()
1121 ep->qp.cqe_left = hba->max_cqes; in bnx2i_alloc_qp_resc()
1123 ep->qp.cqe_size = hba->max_cqes; in bnx2i_alloc_qp_resc()
1130 ep->qp.rq_mem_size = hba->max_rqes * BNX2I_RQ_WQE_SIZE; in bnx2i_alloc_qp_resc()
1139 dma_alloc_coherent(&hba->pcidev->dev, ep->qp.rq_pgtbl_size, in bnx2i_alloc_qp_resc()
1149 dma_alloc_coherent(&hba->pcidev->dev, ep->qp.rq_mem_size, in bnx2i_alloc_qp_resc()
1160 ep->qp.rq_last_qe = &ep->qp.rq_first_qe[hba->max_rqes - 1]; in bnx2i_alloc_qp_resc()
1163 ep->qp.rqe_left = hba->max_rqes; in bnx2i_alloc_qp_resc()
1170 bnx2i_free_qp_resc(hba, ep); in bnx2i_alloc_qp_resc()
1183 void bnx2i_free_qp_resc(struct bnx2i_hba *hba, struct bnx2i_endpoint *ep) in bnx2i_free_qp_resc() argument
1191 dma_free_coherent(&hba->pcidev->dev, ep->qp.sq_pgtbl_size, in bnx2i_free_qp_resc()
1197 dma_free_coherent(&hba->pcidev->dev, ep->qp.sq_mem_size, in bnx2i_free_qp_resc()
1205 dma_free_coherent(&hba->pcidev->dev, ep->qp.rq_pgtbl_size, in bnx2i_free_qp_resc()
1211 dma_free_coherent(&hba->pcidev->dev, ep->qp.rq_mem_size, in bnx2i_free_qp_resc()
1219 dma_free_coherent(&hba->pcidev->dev, ep->qp.cq_pgtbl_size, in bnx2i_free_qp_resc()
1225 dma_free_coherent(&hba->pcidev->dev, ep->qp.cq_mem_size, in bnx2i_free_qp_resc()
1244 int bnx2i_send_fw_iscsi_init_msg(struct bnx2i_hba *hba) in bnx2i_send_fw_iscsi_init_msg() argument
1255 bnx2i_adjust_qp_size(hba); in bnx2i_send_fw_iscsi_init_msg()
1267 iscsi_init.dummy_buffer_addr_lo = (u32) hba->dummy_buf_dma; in bnx2i_send_fw_iscsi_init_msg()
1269 (u32) ((u64) hba->dummy_buf_dma >> 32); in bnx2i_send_fw_iscsi_init_msg()
1271 hba->num_ccell = hba->max_sqes >> 1; in bnx2i_send_fw_iscsi_init_msg()
1272 hba->ctx_ccell_tasks = in bnx2i_send_fw_iscsi_init_msg()
1273 ((hba->num_ccell & 0xFFFF) | (hba->max_sqes << 16)); in bnx2i_send_fw_iscsi_init_msg()
1274 iscsi_init.num_ccells_per_conn = hba->num_ccell; in bnx2i_send_fw_iscsi_init_msg()
1275 iscsi_init.num_tasks_per_conn = hba->max_sqes; in bnx2i_send_fw_iscsi_init_msg()
1277 iscsi_init.sq_num_wqes = hba->max_sqes; in bnx2i_send_fw_iscsi_init_msg()
1280 iscsi_init.cq_num_wqes = hba->max_cqes; in bnx2i_send_fw_iscsi_init_msg()
1281 iscsi_init.cq_num_pages = (hba->max_cqes * BNX2I_CQE_SIZE + in bnx2i_send_fw_iscsi_init_msg()
1283 iscsi_init.sq_num_pages = (hba->max_sqes * BNX2I_SQ_WQE_SIZE + in bnx2i_send_fw_iscsi_init_msg()
1286 iscsi_init.rq_num_wqes = hba->max_rqes; in bnx2i_send_fw_iscsi_init_msg()
1292 iscsi_init2.max_cq_sqn = hba->max_cqes * 2 + 1; in bnx2i_send_fw_iscsi_init_msg()
1322 if (hba->cnic && hba->cnic->submit_kwqes) in bnx2i_send_fw_iscsi_init_msg()
1323 rc = hba->cnic->submit_kwqes(hba->cnic, kwqe_arr, 2); in bnx2i_send_fw_iscsi_init_msg()
1341 struct bnx2i_hba *hba = bnx2i_conn->hba; in bnx2i_process_scsi_cmd_resp() local
1362 ADD_STATS_64(hba, rx_pdus, in bnx2i_process_scsi_cmd_resp()
1364 ADD_STATS_64(hba, rx_bytes, in bnx2i_process_scsi_cmd_resp()
1373 ADD_STATS_64(hba, tx_pdus, in bnx2i_process_scsi_cmd_resp()
1375 ADD_STATS_64(hba, tx_bytes, in bnx2i_process_scsi_cmd_resp()
1377 ADD_STATS_64(hba, rx_pdus, in bnx2i_process_scsi_cmd_resp()
1959 struct bnx2i_hba *hba = bnx2i_conn->hba; in bnx2i_process_new_cqes() local
1972 hba->netdev->name); in bnx2i_process_new_cqes()
1986 hba->netdev->name); in bnx2i_process_new_cqes()
2044 ADD_STATS_64(hba, rx_pdus, 1); in bnx2i_process_new_cqes()
2045 ADD_STATS_64(hba, rx_bytes, nopin->data_length); in bnx2i_process_new_cqes()
2051 hba->netdev->name, in bnx2i_process_new_cqes()
2086 static void bnx2i_fastpath_notification(struct bnx2i_hba *hba, in bnx2i_fastpath_notification() argument
2094 bnx2i_conn = bnx2i_get_conn_from_id(hba, iscsi_cid); in bnx2i_fastpath_notification()
2120 static void bnx2i_process_update_conn_cmpl(struct bnx2i_hba *hba, in bnx2i_process_update_conn_cmpl() argument
2127 conn = bnx2i_get_conn_from_id(hba, iscsi_cid); in bnx2i_process_update_conn_cmpl()
2155 static void bnx2i_recovery_que_add_conn(struct bnx2i_hba *hba, in bnx2i_recovery_que_add_conn() argument
2171 static void bnx2i_process_tcp_error(struct bnx2i_hba *hba, in bnx2i_process_tcp_error() argument
2178 bnx2i_conn = bnx2i_get_conn_from_id(hba, iscsi_cid); in bnx2i_process_tcp_error()
2187 bnx2i_recovery_que_add_conn(bnx2i_conn->hba, bnx2i_conn); in bnx2i_process_tcp_error()
2204 static void bnx2i_process_iscsi_error(struct bnx2i_hba *hba, in bnx2i_process_iscsi_error() argument
2215 bnx2i_conn = bnx2i_get_conn_from_id(hba, iscsi_cid); in bnx2i_process_iscsi_error()
2367 bnx2i_conn->hba->shost->host_no, in bnx2i_process_iscsi_error()
2370 bnx2i_recovery_que_add_conn(bnx2i_conn->hba, bnx2i_conn); in bnx2i_process_iscsi_error()
2388 static void bnx2i_process_conn_destroy_cmpl(struct bnx2i_hba *hba, in bnx2i_process_conn_destroy_cmpl() argument
2393 ep = bnx2i_find_ep_in_destroy_list(hba, conn_destroy->iscsi_conn_id); in bnx2i_process_conn_destroy_cmpl()
2400 if (hba != ep->hba) { in bnx2i_process_conn_destroy_cmpl()
2422 static void bnx2i_process_ofld_cmpl(struct bnx2i_hba *hba, in bnx2i_process_ofld_cmpl() argument
2428 ep = bnx2i_find_ep_in_ofld_list(hba, ofld_kcqe->iscsi_conn_id); in bnx2i_process_ofld_cmpl()
2434 if (hba != ep->hba) { in bnx2i_process_ofld_cmpl()
2445 hba->netdev->name); in bnx2i_process_ofld_cmpl()
2449 "opcode\n", hba->netdev->name); in bnx2i_process_ofld_cmpl()
2456 "error code %d\n", hba->netdev->name, in bnx2i_process_ofld_cmpl()
2478 struct bnx2i_hba *hba = context; in bnx2i_indicate_kcqe() local
2487 bnx2i_fastpath_notification(hba, ikcqe); in bnx2i_indicate_kcqe()
2489 bnx2i_process_ofld_cmpl(hba, ikcqe); in bnx2i_indicate_kcqe()
2491 bnx2i_process_update_conn_cmpl(hba, ikcqe); in bnx2i_indicate_kcqe()
2495 bnx2i_iscsi_license_error(hba, ikcqe->\ in bnx2i_indicate_kcqe()
2498 set_bit(ADAPTER_STATE_UP, &hba->adapter_state); in bnx2i_indicate_kcqe()
2499 bnx2i_get_link_state(hba); in bnx2i_indicate_kcqe()
2502 (u8)hba->pcidev->bus->number, in bnx2i_indicate_kcqe()
2503 hba->pci_devno, in bnx2i_indicate_kcqe()
2504 (u8)hba->pci_func); in bnx2i_indicate_kcqe()
2509 bnx2i_process_conn_destroy_cmpl(hba, ikcqe); in bnx2i_indicate_kcqe()
2511 bnx2i_process_iscsi_error(hba, ikcqe); in bnx2i_indicate_kcqe()
2513 bnx2i_process_tcp_error(hba, ikcqe); in bnx2i_indicate_kcqe()
2533 struct bnx2i_hba *hba = context; in bnx2i_indicate_netevent() local
2541 if (!test_bit(ADAPTER_STATE_UP, &hba->adapter_state)) in bnx2i_indicate_netevent()
2542 bnx2i_send_fw_iscsi_init_msg(hba); in bnx2i_indicate_netevent()
2545 clear_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state); in bnx2i_indicate_netevent()
2546 clear_bit(ADAPTER_STATE_UP, &hba->adapter_state); in bnx2i_indicate_netevent()
2549 set_bit(ADAPTER_STATE_GOING_DOWN, &hba->adapter_state); in bnx2i_indicate_netevent()
2550 iscsi_host_for_each_session(hba->shost, in bnx2i_indicate_netevent()
2554 bnx2i_get_link_state(hba); in bnx2i_indicate_netevent()
2573 if (test_bit(ADAPTER_STATE_GOING_DOWN, &ep->hba->adapter_state)) in bnx2i_cm_connect_cmpl()
2629 bnx2i_recovery_que_add_conn(ep->hba, ep->conn); in bnx2i_cm_remote_close()
2649 bnx2i_recovery_que_add_conn(ep->hba, ep->conn); in bnx2i_cm_remote_abort()
2656 struct bnx2i_hba *hba = context; in bnx2i_send_nl_mesg() local
2659 if (!hba) in bnx2i_send_nl_mesg()
2662 rc = iscsi_offload_mesg(hba->shost, &bnx2i_iscsi_transport, in bnx2i_send_nl_mesg()
2712 if (test_bit(BNX2I_NX2_DEV_57710, &ep->hba->cnic_dev_type)) { in bnx2i_map_ep_dbell_regs()
2713 reg_base = pci_resource_start(ep->hba->pcidev, in bnx2i_map_ep_dbell_regs()
2722 if ((test_bit(BNX2I_NX2_DEV_5709, &ep->hba->cnic_dev_type)) && in bnx2i_map_ep_dbell_regs()
2723 (ep->hba->mail_queue_access == BNX2I_MQ_BIN_MODE)) { in bnx2i_map_ep_dbell_regs()
2724 config2 = REG_RD(ep->hba, BNX2_MQ_CONFIG2); in bnx2i_map_ep_dbell_regs()
2737 ep->qp.ctx_base = ioremap(ep->hba->reg_base + reg_off, in bnx2i_map_ep_dbell_regs()