Lines Matching refs:p_hwfn
59 #define CONN_CXT_SIZE(p_hwfn) \ argument
60 ALIGNED_TYPE_SIZE(union conn_context, p_hwfn)
144 static void qed_cxt_qm_iids(struct qed_hwfn *p_hwfn, in qed_cxt_qm_iids() argument
147 struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; in qed_cxt_qm_iids()
153 DP_VERBOSE(p_hwfn, QED_MSG_ILT, "iids: CIDS %08x\n", iids->cids); in qed_cxt_qm_iids()
157 static void qed_cxt_set_proto_cid_count(struct qed_hwfn *p_hwfn, in qed_cxt_set_proto_cid_count() argument
161 struct qed_cxt_mngr *p_mgr = p_hwfn->p_cxt_mngr; in qed_cxt_set_proto_cid_count()
185 static void qed_ilt_cli_adv_line(struct qed_hwfn *p_hwfn, in qed_ilt_cli_adv_line() argument
201 DP_VERBOSE(p_hwfn, QED_MSG_ILT, in qed_ilt_cli_adv_line()
208 int qed_cxt_cfg_ilt_compute(struct qed_hwfn *p_hwfn) in qed_cxt_cfg_ilt_compute() argument
210 struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; in qed_cxt_cfg_ilt_compute()
218 p_mngr->pf_start_line = RESC_START(p_hwfn, QED_ILT); in qed_cxt_cfg_ilt_compute()
220 DP_VERBOSE(p_hwfn, QED_MSG_ILT, in qed_cxt_cfg_ilt_compute()
222 p_hwfn->my_id, p_hwfn->p_cxt_mngr->pf_start_line); in qed_cxt_cfg_ilt_compute()
234 total = pf_cids * CONN_CXT_SIZE(p_hwfn); in qed_cxt_cfg_ilt_compute()
237 total, CONN_CXT_SIZE(p_hwfn)); in qed_cxt_cfg_ilt_compute()
239 qed_ilt_cli_adv_line(p_hwfn, p_cli, p_blk, &curr_line, ILT_CLI_CDUC); in qed_cxt_cfg_ilt_compute()
246 qed_cxt_qm_iids(p_hwfn, &qm_iids); in qed_cxt_cfg_ilt_compute()
247 total = qed_qm_pf_mem_size(p_hwfn->rel_pf_id, qm_iids.cids, 0, 0, in qed_cxt_cfg_ilt_compute()
248 p_hwfn->qm_info.num_pqs, 0); in qed_cxt_cfg_ilt_compute()
250 DP_VERBOSE(p_hwfn, QED_MSG_ILT, in qed_cxt_cfg_ilt_compute()
252 qm_iids.cids, p_hwfn->qm_info.num_pqs, total); in qed_cxt_cfg_ilt_compute()
258 qed_ilt_cli_adv_line(p_hwfn, p_cli, p_blk, &curr_line, ILT_CLI_QM); in qed_cxt_cfg_ilt_compute()
261 if (curr_line - p_hwfn->p_cxt_mngr->pf_start_line > in qed_cxt_cfg_ilt_compute()
262 RESC_NUM(p_hwfn, QED_ILT)) { in qed_cxt_cfg_ilt_compute()
263 DP_ERR(p_hwfn, "too many ilt lines...#lines=%d\n", in qed_cxt_cfg_ilt_compute()
264 curr_line - p_hwfn->p_cxt_mngr->pf_start_line); in qed_cxt_cfg_ilt_compute()
290 static void qed_ilt_shadow_free(struct qed_hwfn *p_hwfn) in qed_ilt_shadow_free() argument
292 struct qed_ilt_client_cfg *p_cli = p_hwfn->p_cxt_mngr->clients; in qed_ilt_shadow_free()
293 struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; in qed_ilt_shadow_free()
302 dma_free_coherent(&p_hwfn->cdev->pdev->dev, in qed_ilt_shadow_free()
310 static int qed_ilt_blk_alloc(struct qed_hwfn *p_hwfn, in qed_ilt_blk_alloc() argument
315 struct qed_dma_mem *ilt_shadow = p_hwfn->p_cxt_mngr->ilt_shadow; in qed_ilt_blk_alloc()
324 p_hwfn->p_cxt_mngr->pf_start_line; in qed_ilt_blk_alloc()
333 p_virt = dma_alloc_coherent(&p_hwfn->cdev->pdev->dev, in qed_ilt_blk_alloc()
345 DP_VERBOSE(p_hwfn, QED_MSG_ILT, in qed_ilt_blk_alloc()
356 static int qed_ilt_shadow_alloc(struct qed_hwfn *p_hwfn) in qed_ilt_shadow_alloc() argument
358 struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; in qed_ilt_shadow_alloc()
368 DP_NOTICE(p_hwfn, "Failed to allocate ilt shadow table\n"); in qed_ilt_shadow_alloc()
373 DP_VERBOSE(p_hwfn, QED_MSG_ILT, in qed_ilt_shadow_alloc()
382 rc = qed_ilt_blk_alloc(p_hwfn, p_blk, i, 0); in qed_ilt_shadow_alloc()
391 qed_ilt_shadow_free(p_hwfn); in qed_ilt_shadow_alloc()
395 static void qed_cid_map_free(struct qed_hwfn *p_hwfn) in qed_cid_map_free() argument
397 struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; in qed_cid_map_free()
407 static int qed_cid_map_alloc(struct qed_hwfn *p_hwfn) in qed_cid_map_alloc() argument
409 struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; in qed_cid_map_alloc()
414 u32 cid_cnt = p_hwfn->p_cxt_mngr->conn_cfg[type].cid_count; in qed_cid_map_alloc()
430 p_hwfn->p_cxt_mngr->conn_cfg[type].cid_start = start_cid; in qed_cid_map_alloc()
432 DP_VERBOSE(p_hwfn, QED_MSG_CXT, in qed_cid_map_alloc()
442 qed_cid_map_free(p_hwfn); in qed_cid_map_alloc()
446 int qed_cxt_mngr_alloc(struct qed_hwfn *p_hwfn) in qed_cxt_mngr_alloc() argument
453 DP_NOTICE(p_hwfn, "Failed to allocate `struct qed_cxt_mngr'\n"); in qed_cxt_mngr_alloc()
471 p_hwfn->p_cxt_mngr = p_mngr; in qed_cxt_mngr_alloc()
476 int qed_cxt_tables_alloc(struct qed_hwfn *p_hwfn) in qed_cxt_tables_alloc() argument
481 rc = qed_ilt_shadow_alloc(p_hwfn); in qed_cxt_tables_alloc()
483 DP_NOTICE(p_hwfn, "Failed to allocate ilt memory\n"); in qed_cxt_tables_alloc()
488 rc = qed_cid_map_alloc(p_hwfn); in qed_cxt_tables_alloc()
490 DP_NOTICE(p_hwfn, "Failed to allocate cid maps\n"); in qed_cxt_tables_alloc()
497 qed_cxt_mngr_free(p_hwfn); in qed_cxt_tables_alloc()
501 void qed_cxt_mngr_free(struct qed_hwfn *p_hwfn) in qed_cxt_mngr_free() argument
503 if (!p_hwfn->p_cxt_mngr) in qed_cxt_mngr_free()
506 qed_cid_map_free(p_hwfn); in qed_cxt_mngr_free()
507 qed_ilt_shadow_free(p_hwfn); in qed_cxt_mngr_free()
508 kfree(p_hwfn->p_cxt_mngr); in qed_cxt_mngr_free()
510 p_hwfn->p_cxt_mngr = NULL; in qed_cxt_mngr_free()
513 void qed_cxt_mngr_setup(struct qed_hwfn *p_hwfn) in qed_cxt_mngr_setup() argument
515 struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; in qed_cxt_mngr_setup()
520 u32 cid_cnt = p_hwfn->p_cxt_mngr->conn_cfg[type].cid_count; in qed_cxt_mngr_setup()
551 static void qed_cdu_init_common(struct qed_hwfn *p_hwfn) in qed_cdu_init_common() argument
556 page_sz = p_hwfn->p_cxt_mngr->clients[ILT_CLI_CDUC].p_size.val; in qed_cdu_init_common()
557 cxt_size = CONN_CXT_SIZE(p_hwfn); in qed_cdu_init_common()
564 STORE_RT_REG(p_hwfn, CDU_REG_CID_ADDR_PARAMS_RT_OFFSET, cdu_params); in qed_cdu_init_common()
567 void qed_qm_init_pf(struct qed_hwfn *p_hwfn) in qed_qm_init_pf() argument
570 struct qed_qm_info *qm_info = &p_hwfn->qm_info; in qed_qm_init_pf()
574 qed_cxt_qm_iids(p_hwfn, &iids); in qed_qm_init_pf()
577 params.port_id = p_hwfn->port_id; in qed_qm_init_pf()
578 params.pf_id = p_hwfn->rel_pf_id; in qed_qm_init_pf()
580 params.is_first_pf = p_hwfn->first_on_engine; in qed_qm_init_pf()
590 qed_qm_pf_rt_init(p_hwfn, p_hwfn->p_main_ptt, ¶ms); in qed_qm_init_pf()
594 static int qed_cm_init_pf(struct qed_hwfn *p_hwfn) in qed_cm_init_pf() argument
602 pq = qed_get_qm_pq(p_hwfn, PROTOCOLID_CORE, &pq_params); in qed_cm_init_pf()
603 STORE_RT_REG(p_hwfn, XCM_REG_CON_PHY_Q3_RT_OFFSET, pq); in qed_cm_init_pf()
609 static void qed_dq_init_pf(struct qed_hwfn *p_hwfn) in qed_dq_init_pf() argument
611 struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; in qed_dq_init_pf()
615 STORE_RT_REG(p_hwfn, DORQ_REG_PF_MAX_ICID_0_RT_OFFSET, dq_pf_max_cid); in qed_dq_init_pf()
618 STORE_RT_REG(p_hwfn, DORQ_REG_PF_MAX_ICID_1_RT_OFFSET, dq_pf_max_cid); in qed_dq_init_pf()
621 STORE_RT_REG(p_hwfn, DORQ_REG_PF_MAX_ICID_2_RT_OFFSET, dq_pf_max_cid); in qed_dq_init_pf()
624 STORE_RT_REG(p_hwfn, DORQ_REG_PF_MAX_ICID_3_RT_OFFSET, dq_pf_max_cid); in qed_dq_init_pf()
627 STORE_RT_REG(p_hwfn, DORQ_REG_PF_MAX_ICID_4_RT_OFFSET, dq_pf_max_cid); in qed_dq_init_pf()
631 STORE_RT_REG(p_hwfn, DORQ_REG_PF_MAX_ICID_5_RT_OFFSET, dq_pf_max_cid); in qed_dq_init_pf()
634 static void qed_ilt_bounds_init(struct qed_hwfn *p_hwfn) in qed_ilt_bounds_init() argument
639 ilt_clients = p_hwfn->p_cxt_mngr->clients; in qed_ilt_bounds_init()
643 STORE_RT_REG(p_hwfn, in qed_ilt_bounds_init()
646 STORE_RT_REG(p_hwfn, in qed_ilt_bounds_init()
649 STORE_RT_REG(p_hwfn, in qed_ilt_bounds_init()
656 static void qed_ilt_init_pf(struct qed_hwfn *p_hwfn) in qed_ilt_init_pf() argument
663 qed_ilt_bounds_init(p_hwfn); in qed_ilt_init_pf()
665 p_mngr = p_hwfn->p_cxt_mngr; in qed_ilt_init_pf()
667 clients = p_hwfn->p_cxt_mngr->clients; in qed_ilt_init_pf()
692 DP_VERBOSE(p_hwfn, QED_MSG_ILT, in qed_ilt_init_pf()
698 STORE_RT_REG_AGG(p_hwfn, rt_offst, ilt_hw_entry); in qed_ilt_init_pf()
703 void qed_cxt_hw_init_common(struct qed_hwfn *p_hwfn) in qed_cxt_hw_init_common() argument
705 qed_cdu_init_common(p_hwfn); in qed_cxt_hw_init_common()
708 void qed_cxt_hw_init_pf(struct qed_hwfn *p_hwfn) in qed_cxt_hw_init_pf() argument
710 qed_qm_init_pf(p_hwfn); in qed_cxt_hw_init_pf()
711 qed_cm_init_pf(p_hwfn); in qed_cxt_hw_init_pf()
712 qed_dq_init_pf(p_hwfn); in qed_cxt_hw_init_pf()
713 qed_ilt_init_pf(p_hwfn); in qed_cxt_hw_init_pf()
716 int qed_cxt_acquire_cid(struct qed_hwfn *p_hwfn, in qed_cxt_acquire_cid() argument
720 struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; in qed_cxt_acquire_cid()
724 DP_NOTICE(p_hwfn, "Invalid protocol type %d", type); in qed_cxt_acquire_cid()
732 DP_NOTICE(p_hwfn, "no CID available for protocol %d\n", in qed_cxt_acquire_cid()
744 static bool qed_cxt_test_cid_acquired(struct qed_hwfn *p_hwfn, in qed_cxt_test_cid_acquired() argument
748 struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; in qed_cxt_test_cid_acquired()
766 DP_NOTICE(p_hwfn, "Invalid CID %d", cid); in qed_cxt_test_cid_acquired()
772 DP_NOTICE(p_hwfn, "CID %d not acquired", cid); in qed_cxt_test_cid_acquired()
778 void qed_cxt_release_cid(struct qed_hwfn *p_hwfn, in qed_cxt_release_cid() argument
781 struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; in qed_cxt_release_cid()
787 b_acquired = qed_cxt_test_cid_acquired(p_hwfn, cid, &type); in qed_cxt_release_cid()
796 int qed_cxt_get_cid_info(struct qed_hwfn *p_hwfn, in qed_cxt_get_cid_info() argument
799 struct qed_cxt_mngr *p_mngr = p_hwfn->p_cxt_mngr; in qed_cxt_get_cid_info()
805 b_acquired = qed_cxt_test_cid_acquired(p_hwfn, p_info->iid, &type); in qed_cxt_get_cid_info()
814 hw_p_size = p_hwfn->p_cxt_mngr->clients[ILT_CLI_CDUC].p_size.val; in qed_cxt_get_cid_info()
816 conn_cxt_size = CONN_CXT_SIZE(p_hwfn); in qed_cxt_get_cid_info()
827 DP_VERBOSE(p_hwfn, (QED_MSG_ILT | QED_MSG_CXT), in qed_cxt_get_cid_info()
834 int qed_cxt_set_pf_params(struct qed_hwfn *p_hwfn) in qed_cxt_set_pf_params() argument
836 struct qed_eth_pf_params *p_params = &p_hwfn->pf_params.eth_pf_params; in qed_cxt_set_pf_params()
841 qed_cxt_set_proto_cid_count(p_hwfn, PROTOCOLID_CORE, core_cids); in qed_cxt_set_pf_params()
843 qed_cxt_set_proto_cid_count(p_hwfn, PROTOCOLID_ETH, in qed_cxt_set_pf_params()