Lines Matching full:caps
1620 hr_dev->caps.fw_ver = (u64)(le32_to_cpu(resp->fw_ver)); in hns_roce_query_fw_ver()
1660 if (port > hr_dev->caps.num_ports) in hns_roce_hw_v2_query_counter()
1724 struct hns_roce_caps *caps = &hr_dev->caps; in load_func_res_caps() local
1745 caps->qpc_bt_num = hr_reg_read(r_a, FUNC_RES_A_QPC_BT_NUM) / func_num; in load_func_res_caps()
1746 caps->srqc_bt_num = hr_reg_read(r_a, FUNC_RES_A_SRQC_BT_NUM) / func_num; in load_func_res_caps()
1747 caps->cqc_bt_num = hr_reg_read(r_a, FUNC_RES_A_CQC_BT_NUM) / func_num; in load_func_res_caps()
1748 caps->mpt_bt_num = hr_reg_read(r_a, FUNC_RES_A_MPT_BT_NUM) / func_num; in load_func_res_caps()
1749 caps->eqc_bt_num = hr_reg_read(r_a, FUNC_RES_A_EQC_BT_NUM) / func_num; in load_func_res_caps()
1750 caps->smac_bt_num = hr_reg_read(r_b, FUNC_RES_B_SMAC_NUM) / func_num; in load_func_res_caps()
1751 caps->sgid_bt_num = hr_reg_read(r_b, FUNC_RES_B_SGID_NUM) / func_num; in load_func_res_caps()
1752 caps->sccc_bt_num = hr_reg_read(r_b, FUNC_RES_B_SCCC_BT_NUM) / func_num; in load_func_res_caps()
1755 caps->sl_num = hr_reg_read(r_b, FUNC_RES_V_QID_NUM) / func_num; in load_func_res_caps()
1756 caps->gmv_bt_num = hr_reg_read(r_b, FUNC_RES_V_GMV_BT_NUM) / in load_func_res_caps()
1759 caps->sl_num = hr_reg_read(r_b, FUNC_RES_B_QID_NUM) / func_num; in load_func_res_caps()
1760 caps->gmv_bt_num = hr_reg_read(r_b, FUNC_RES_B_GMV_BT_NUM) / in load_func_res_caps()
1771 struct hns_roce_caps *caps = &hr_dev->caps; in load_pf_timer_res_caps() local
1781 caps->qpc_timer_bt_num = hr_reg_read(req, PF_TIMER_RES_QPC_ITEM_NUM); in load_pf_timer_res_caps()
1782 caps->cqc_timer_bt_num = hr_reg_read(req, PF_TIMER_RES_CQC_ITEM_NUM); in load_pf_timer_res_caps()
1794 dev_err(dev, "failed to load pf res caps, ret = %d.\n", ret); in hns_roce_query_pf_resource()
1813 dev_err(dev, "failed to load vf res caps, ret = %d.\n", ret); in hns_roce_query_vf_resource()
1861 struct hns_roce_caps *caps = &hr_dev->caps; in config_vf_hem_resource() local
1869 hr_reg_write(r_a, FUNC_RES_A_QPC_BT_NUM, caps->qpc_bt_num); in config_vf_hem_resource()
1870 hr_reg_write(r_a, FUNC_RES_A_QPC_BT_IDX, vf_id * caps->qpc_bt_num); in config_vf_hem_resource()
1871 hr_reg_write(r_a, FUNC_RES_A_SRQC_BT_NUM, caps->srqc_bt_num); in config_vf_hem_resource()
1872 hr_reg_write(r_a, FUNC_RES_A_SRQC_BT_IDX, vf_id * caps->srqc_bt_num); in config_vf_hem_resource()
1873 hr_reg_write(r_a, FUNC_RES_A_CQC_BT_NUM, caps->cqc_bt_num); in config_vf_hem_resource()
1874 hr_reg_write(r_a, FUNC_RES_A_CQC_BT_IDX, vf_id * caps->cqc_bt_num); in config_vf_hem_resource()
1875 hr_reg_write(r_a, FUNC_RES_A_MPT_BT_NUM, caps->mpt_bt_num); in config_vf_hem_resource()
1876 hr_reg_write(r_a, FUNC_RES_A_MPT_BT_IDX, vf_id * caps->mpt_bt_num); in config_vf_hem_resource()
1877 hr_reg_write(r_a, FUNC_RES_A_EQC_BT_NUM, caps->eqc_bt_num); in config_vf_hem_resource()
1878 hr_reg_write(r_a, FUNC_RES_A_EQC_BT_IDX, vf_id * caps->eqc_bt_num); in config_vf_hem_resource()
1879 hr_reg_write(r_b, FUNC_RES_V_QID_NUM, caps->sl_num); in config_vf_hem_resource()
1880 hr_reg_write(r_b, FUNC_RES_B_QID_IDX, vf_id * caps->sl_num); in config_vf_hem_resource()
1881 hr_reg_write(r_b, FUNC_RES_B_SCCC_BT_NUM, caps->sccc_bt_num); in config_vf_hem_resource()
1882 hr_reg_write(r_b, FUNC_RES_B_SCCC_BT_IDX, vf_id * caps->sccc_bt_num); in config_vf_hem_resource()
1885 hr_reg_write(r_b, FUNC_RES_V_GMV_BT_NUM, caps->gmv_bt_num); in config_vf_hem_resource()
1887 vf_id * caps->gmv_bt_num); in config_vf_hem_resource()
1889 hr_reg_write(r_b, FUNC_RES_B_SGID_NUM, caps->sgid_bt_num); in config_vf_hem_resource()
1891 vf_id * caps->sgid_bt_num); in config_vf_hem_resource()
1892 hr_reg_write(r_b, FUNC_RES_B_SMAC_NUM, caps->smac_bt_num); in config_vf_hem_resource()
1894 vf_id * caps->smac_bt_num); in config_vf_hem_resource()
1923 struct hns_roce_caps *caps = &hr_dev->caps; in hns_roce_v2_set_bt() local
1928 caps->qpc_ba_pg_sz + PG_SHIFT_OFFSET); in hns_roce_v2_set_bt()
1930 caps->qpc_buf_pg_sz + PG_SHIFT_OFFSET); in hns_roce_v2_set_bt()
1932 to_hr_hem_hopnum(caps->qpc_hop_num, caps->num_qps)); in hns_roce_v2_set_bt()
1935 caps->srqc_ba_pg_sz + PG_SHIFT_OFFSET); in hns_roce_v2_set_bt()
1937 caps->srqc_buf_pg_sz + PG_SHIFT_OFFSET); in hns_roce_v2_set_bt()
1939 to_hr_hem_hopnum(caps->srqc_hop_num, caps->num_srqs)); in hns_roce_v2_set_bt()
1942 caps->cqc_ba_pg_sz + PG_SHIFT_OFFSET); in hns_roce_v2_set_bt()
1944 caps->cqc_buf_pg_sz + PG_SHIFT_OFFSET); in hns_roce_v2_set_bt()
1946 to_hr_hem_hopnum(caps->cqc_hop_num, caps->num_cqs)); in hns_roce_v2_set_bt()
1949 caps->mpt_ba_pg_sz + PG_SHIFT_OFFSET); in hns_roce_v2_set_bt()
1951 caps->mpt_buf_pg_sz + PG_SHIFT_OFFSET); in hns_roce_v2_set_bt()
1953 to_hr_hem_hopnum(caps->mpt_hop_num, caps->num_mtpts)); in hns_roce_v2_set_bt()
1956 caps->sccc_ba_pg_sz + PG_SHIFT_OFFSET); in hns_roce_v2_set_bt()
1958 caps->sccc_buf_pg_sz + PG_SHIFT_OFFSET); in hns_roce_v2_set_bt()
1960 to_hr_hem_hopnum(caps->sccc_hop_num, caps->num_qps)); in hns_roce_v2_set_bt()
2009 struct hns_roce_caps *caps = &hr_dev->caps; in set_hem_page_size() local
2012 caps->eqe_ba_pg_sz = 0; in set_hem_page_size()
2013 caps->eqe_buf_pg_sz = 0; in set_hem_page_size()
2016 caps->llm_buf_pg_sz = 0; in set_hem_page_size()
2019 caps->mpt_ba_pg_sz = 0; in set_hem_page_size()
2020 caps->mpt_buf_pg_sz = 0; in set_hem_page_size()
2021 caps->pbl_ba_pg_sz = HNS_ROCE_BA_PG_SZ_SUPPORTED_16K; in set_hem_page_size()
2022 caps->pbl_buf_pg_sz = 0; in set_hem_page_size()
2023 calc_pg_sz(caps->num_mtpts, caps->mtpt_entry_sz, caps->mpt_hop_num, in set_hem_page_size()
2024 caps->mpt_bt_num, &caps->mpt_buf_pg_sz, &caps->mpt_ba_pg_sz, in set_hem_page_size()
2028 caps->qpc_ba_pg_sz = 0; in set_hem_page_size()
2029 caps->qpc_buf_pg_sz = 0; in set_hem_page_size()
2030 caps->qpc_timer_ba_pg_sz = 0; in set_hem_page_size()
2031 caps->qpc_timer_buf_pg_sz = 0; in set_hem_page_size()
2032 caps->sccc_ba_pg_sz = 0; in set_hem_page_size()
2033 caps->sccc_buf_pg_sz = 0; in set_hem_page_size()
2034 caps->mtt_ba_pg_sz = 0; in set_hem_page_size()
2035 caps->mtt_buf_pg_sz = 0; in set_hem_page_size()
2036 calc_pg_sz(caps->num_qps, caps->qpc_sz, caps->qpc_hop_num, in set_hem_page_size()
2037 caps->qpc_bt_num, &caps->qpc_buf_pg_sz, &caps->qpc_ba_pg_sz, in set_hem_page_size()
2040 if (caps->flags & HNS_ROCE_CAP_FLAG_QP_FLOW_CTRL) in set_hem_page_size()
2041 calc_pg_sz(caps->num_qps, caps->sccc_sz, caps->sccc_hop_num, in set_hem_page_size()
2042 caps->sccc_bt_num, &caps->sccc_buf_pg_sz, in set_hem_page_size()
2043 &caps->sccc_ba_pg_sz, HEM_TYPE_SCCC); in set_hem_page_size()
2046 caps->cqc_ba_pg_sz = 0; in set_hem_page_size()
2047 caps->cqc_buf_pg_sz = 0; in set_hem_page_size()
2048 caps->cqc_timer_ba_pg_sz = 0; in set_hem_page_size()
2049 caps->cqc_timer_buf_pg_sz = 0; in set_hem_page_size()
2050 caps->cqe_ba_pg_sz = HNS_ROCE_BA_PG_SZ_SUPPORTED_256K; in set_hem_page_size()
2051 caps->cqe_buf_pg_sz = 0; in set_hem_page_size()
2052 calc_pg_sz(caps->num_cqs, caps->cqc_entry_sz, caps->cqc_hop_num, in set_hem_page_size()
2053 caps->cqc_bt_num, &caps->cqc_buf_pg_sz, &caps->cqc_ba_pg_sz, in set_hem_page_size()
2055 calc_pg_sz(caps->max_cqes, caps->cqe_sz, caps->cqe_hop_num, in set_hem_page_size()
2056 1, &caps->cqe_buf_pg_sz, &caps->cqe_ba_pg_sz, HEM_TYPE_CQE); in set_hem_page_size()
2059 if (caps->flags & HNS_ROCE_CAP_FLAG_SRQ) { in set_hem_page_size()
2060 caps->srqc_ba_pg_sz = 0; in set_hem_page_size()
2061 caps->srqc_buf_pg_sz = 0; in set_hem_page_size()
2062 caps->srqwqe_ba_pg_sz = 0; in set_hem_page_size()
2063 caps->srqwqe_buf_pg_sz = 0; in set_hem_page_size()
2064 caps->idx_ba_pg_sz = 0; in set_hem_page_size()
2065 caps->idx_buf_pg_sz = 0; in set_hem_page_size()
2066 calc_pg_sz(caps->num_srqs, caps->srqc_entry_sz, in set_hem_page_size()
2067 caps->srqc_hop_num, caps->srqc_bt_num, in set_hem_page_size()
2068 &caps->srqc_buf_pg_sz, &caps->srqc_ba_pg_sz, in set_hem_page_size()
2070 calc_pg_sz(caps->num_srqwqe_segs, caps->mtt_entry_sz, in set_hem_page_size()
2071 caps->srqwqe_hop_num, 1, &caps->srqwqe_buf_pg_sz, in set_hem_page_size()
2072 &caps->srqwqe_ba_pg_sz, HEM_TYPE_SRQWQE); in set_hem_page_size()
2073 calc_pg_sz(caps->num_idx_segs, caps->idx_entry_sz, in set_hem_page_size()
2074 caps->idx_hop_num, 1, &caps->idx_buf_pg_sz, in set_hem_page_size()
2075 &caps->idx_ba_pg_sz, HEM_TYPE_IDX); in set_hem_page_size()
2079 caps->gmv_ba_pg_sz = 0; in set_hem_page_size()
2080 caps->gmv_buf_pg_sz = 0; in set_hem_page_size()
2083 /* Apply all loaded caps before setting to hardware */
2087 struct hns_roce_caps *caps = &hr_dev->caps; in apply_func_caps() local
2091 caps->qpc_timer_entry_sz = HNS_ROCE_V2_QPC_TIMER_ENTRY_SZ; in apply_func_caps()
2092 caps->cqc_timer_entry_sz = HNS_ROCE_V2_CQC_TIMER_ENTRY_SZ; in apply_func_caps()
2093 caps->mtt_entry_sz = HNS_ROCE_V2_MTT_ENTRY_SZ; in apply_func_caps()
2095 caps->pbl_hop_num = HNS_ROCE_PBL_HOP_NUM; in apply_func_caps()
2096 caps->qpc_timer_hop_num = HNS_ROCE_HOP_NUM_0; in apply_func_caps()
2097 caps->cqc_timer_hop_num = HNS_ROCE_HOP_NUM_0; in apply_func_caps()
2099 caps->num_srqwqe_segs = HNS_ROCE_V2_MAX_SRQWQE_SEGS; in apply_func_caps()
2100 caps->num_idx_segs = HNS_ROCE_V2_MAX_IDX_SEGS; in apply_func_caps()
2102 if (!caps->num_comp_vectors) in apply_func_caps()
2103 caps->num_comp_vectors = in apply_func_caps()
2104 min_t(u32, caps->eqc_bt_num - HNS_ROCE_V2_AEQE_VEC_NUM, in apply_func_caps()
2109 caps->eqe_hop_num = HNS_ROCE_V3_EQE_HOP_NUM; in apply_func_caps()
2110 caps->ceqe_size = HNS_ROCE_V3_EQE_SIZE; in apply_func_caps()
2111 caps->aeqe_size = HNS_ROCE_V3_EQE_SIZE; in apply_func_caps()
2114 caps->qpc_sz = HNS_ROCE_V3_QPC_SZ; in apply_func_caps()
2115 caps->cqe_sz = HNS_ROCE_V3_CQE_SIZE; in apply_func_caps()
2116 caps->sccc_sz = HNS_ROCE_V3_SCCC_SZ; in apply_func_caps()
2119 caps->gmv_entry_sz = HNS_ROCE_V3_GMV_ENTRY_SZ; in apply_func_caps()
2121 caps->gmv_hop_num = HNS_ROCE_HOP_NUM_0; in apply_func_caps()
2127 caps->gid_table_len[0] = min_t(u32, MAX_GID_TBL_LEN, in apply_func_caps()
2128 caps->gmv_bt_num * in apply_func_caps()
2129 (HNS_HW_PAGE_SIZE / caps->gmv_entry_sz)); in apply_func_caps()
2131 caps->gmv_entry_num = caps->gmv_bt_num * (HNS_HW_PAGE_SIZE / in apply_func_caps()
2132 caps->gmv_entry_sz); in apply_func_caps()
2136 caps->eqe_hop_num = HNS_ROCE_V2_EQE_HOP_NUM; in apply_func_caps()
2137 caps->ceqe_size = HNS_ROCE_CEQE_SIZE; in apply_func_caps()
2138 caps->aeqe_size = HNS_ROCE_AEQE_SIZE; in apply_func_caps()
2139 caps->gid_table_len[0] /= func_num; in apply_func_caps()
2143 caps->default_aeq_arm_st = 0x3; in apply_func_caps()
2144 caps->default_ceq_arm_st = 0x3; in apply_func_caps()
2145 caps->default_ceq_max_cnt = 0x1; in apply_func_caps()
2146 caps->default_ceq_period = 0x10; in apply_func_caps()
2147 caps->default_aeq_max_cnt = 0x1; in apply_func_caps()
2148 caps->default_aeq_period = 0x10; in apply_func_caps()
2157 struct hns_roce_caps *caps = &hr_dev->caps; in hns_roce_query_caps() local
2190 caps->local_ca_ack_delay = resp_a->local_ca_ack_delay; in hns_roce_query_caps()
2191 caps->max_sq_sg = le16_to_cpu(resp_a->max_sq_sg); in hns_roce_query_caps()
2192 caps->max_sq_inline = le16_to_cpu(resp_a->max_sq_inline); in hns_roce_query_caps()
2193 caps->max_rq_sg = le16_to_cpu(resp_a->max_rq_sg); in hns_roce_query_caps()
2194 caps->max_rq_sg = roundup_pow_of_two(caps->max_rq_sg); in hns_roce_query_caps()
2195 caps->max_srq_sges = le16_to_cpu(resp_a->max_srq_sges); in hns_roce_query_caps()
2196 caps->max_srq_sges = roundup_pow_of_two(caps->max_srq_sges); in hns_roce_query_caps()
2197 caps->num_aeq_vectors = resp_a->num_aeq_vectors; in hns_roce_query_caps()
2198 caps->num_other_vectors = resp_a->num_other_vectors; in hns_roce_query_caps()
2199 caps->max_sq_desc_sz = resp_a->max_sq_desc_sz; in hns_roce_query_caps()
2200 caps->max_rq_desc_sz = resp_a->max_rq_desc_sz; in hns_roce_query_caps()
2202 caps->mtpt_entry_sz = resp_b->mtpt_entry_sz; in hns_roce_query_caps()
2203 caps->irrl_entry_sz = resp_b->irrl_entry_sz; in hns_roce_query_caps()
2204 caps->trrl_entry_sz = resp_b->trrl_entry_sz; in hns_roce_query_caps()
2205 caps->cqc_entry_sz = resp_b->cqc_entry_sz; in hns_roce_query_caps()
2206 caps->srqc_entry_sz = resp_b->srqc_entry_sz; in hns_roce_query_caps()
2207 caps->idx_entry_sz = resp_b->idx_entry_sz; in hns_roce_query_caps()
2208 caps->sccc_sz = resp_b->sccc_sz; in hns_roce_query_caps()
2209 caps->max_mtu = resp_b->max_mtu; in hns_roce_query_caps()
2210 caps->min_cqes = resp_b->min_cqes; in hns_roce_query_caps()
2211 caps->min_wqes = resp_b->min_wqes; in hns_roce_query_caps()
2212 caps->page_size_cap = le32_to_cpu(resp_b->page_size_cap); in hns_roce_query_caps()
2213 caps->pkey_table_len[0] = resp_b->pkey_table_len; in hns_roce_query_caps()
2214 caps->phy_num_uars = resp_b->phy_num_uars; in hns_roce_query_caps()
2218 caps->num_pds = 1 << hr_reg_read(resp_c, PF_CAPS_C_NUM_PDS); in hns_roce_query_caps()
2220 caps->flags = hr_reg_read(resp_c, PF_CAPS_C_CAP_FLAGS); in hns_roce_query_caps()
2221 caps->flags |= le16_to_cpu(resp_d->cap_flags_ex) << in hns_roce_query_caps()
2224 caps->num_cqs = 1 << hr_reg_read(resp_c, PF_CAPS_C_NUM_CQS); in hns_roce_query_caps()
2225 caps->gid_table_len[0] = hr_reg_read(resp_c, PF_CAPS_C_MAX_GID); in hns_roce_query_caps()
2226 caps->max_cqes = 1 << hr_reg_read(resp_c, PF_CAPS_C_CQ_DEPTH); in hns_roce_query_caps()
2227 caps->num_xrcds = 1 << hr_reg_read(resp_c, PF_CAPS_C_NUM_XRCDS); in hns_roce_query_caps()
2228 caps->num_mtpts = 1 << hr_reg_read(resp_c, PF_CAPS_C_NUM_MRWS); in hns_roce_query_caps()
2229 caps->num_qps = 1 << hr_reg_read(resp_c, PF_CAPS_C_NUM_QPS); in hns_roce_query_caps()
2230 caps->max_qp_init_rdma = hr_reg_read(resp_c, PF_CAPS_C_MAX_ORD); in hns_roce_query_caps()
2231 caps->max_qp_dest_rdma = caps->max_qp_init_rdma; in hns_roce_query_caps()
2232 caps->max_wqes = 1 << le16_to_cpu(resp_c->sq_depth); in hns_roce_query_caps()
2234 caps->num_srqs = 1 << hr_reg_read(resp_d, PF_CAPS_D_NUM_SRQS); in hns_roce_query_caps()
2235 caps->cong_cap = hr_reg_read(resp_d, PF_CAPS_D_CONG_CAP); in hns_roce_query_caps()
2236 caps->max_srq_wrs = 1 << le16_to_cpu(resp_d->srq_depth); in hns_roce_query_caps()
2237 caps->ceqe_depth = 1 << hr_reg_read(resp_d, PF_CAPS_D_CEQ_DEPTH); in hns_roce_query_caps()
2238 caps->num_comp_vectors = hr_reg_read(resp_d, PF_CAPS_D_NUM_CEQS); in hns_roce_query_caps()
2239 caps->aeqe_depth = 1 << hr_reg_read(resp_d, PF_CAPS_D_AEQ_DEPTH); in hns_roce_query_caps()
2240 caps->default_cong_type = hr_reg_read(resp_d, PF_CAPS_D_DEFAULT_ALG); in hns_roce_query_caps()
2241 caps->reserved_pds = hr_reg_read(resp_d, PF_CAPS_D_RSV_PDS); in hns_roce_query_caps()
2242 caps->num_uars = 1 << hr_reg_read(resp_d, PF_CAPS_D_NUM_UARS); in hns_roce_query_caps()
2243 caps->reserved_qps = hr_reg_read(resp_d, PF_CAPS_D_RSV_QPS); in hns_roce_query_caps()
2244 caps->reserved_uars = hr_reg_read(resp_d, PF_CAPS_D_RSV_UARS); in hns_roce_query_caps()
2246 caps->reserved_mrws = hr_reg_read(resp_e, PF_CAPS_E_RSV_MRWS); in hns_roce_query_caps()
2247 caps->chunk_sz = 1 << hr_reg_read(resp_e, PF_CAPS_E_CHUNK_SIZE_SHIFT); in hns_roce_query_caps()
2248 caps->reserved_cqs = hr_reg_read(resp_e, PF_CAPS_E_RSV_CQS); in hns_roce_query_caps()
2249 caps->reserved_xrcds = hr_reg_read(resp_e, PF_CAPS_E_RSV_XRCDS); in hns_roce_query_caps()
2250 caps->reserved_srqs = hr_reg_read(resp_e, PF_CAPS_E_RSV_SRQS); in hns_roce_query_caps()
2251 caps->reserved_lkey = hr_reg_read(resp_e, PF_CAPS_E_RSV_LKEYS); in hns_roce_query_caps()
2253 caps->qpc_hop_num = ctx_hop_num; in hns_roce_query_caps()
2254 caps->sccc_hop_num = ctx_hop_num; in hns_roce_query_caps()
2255 caps->srqc_hop_num = ctx_hop_num; in hns_roce_query_caps()
2256 caps->cqc_hop_num = ctx_hop_num; in hns_roce_query_caps()
2257 caps->mpt_hop_num = ctx_hop_num; in hns_roce_query_caps()
2258 caps->mtt_hop_num = pbl_hop_num; in hns_roce_query_caps()
2259 caps->cqe_hop_num = pbl_hop_num; in hns_roce_query_caps()
2260 caps->srqwqe_hop_num = pbl_hop_num; in hns_roce_query_caps()
2261 caps->idx_hop_num = pbl_hop_num; in hns_roce_query_caps()
2262 caps->wqe_sq_hop_num = hr_reg_read(resp_d, PF_CAPS_D_SQWQE_HOP_NUM); in hns_roce_query_caps()
2263 caps->wqe_sge_hop_num = hr_reg_read(resp_d, PF_CAPS_D_EX_SGE_HOP_NUM); in hns_roce_query_caps()
2264 caps->wqe_rq_hop_num = hr_reg_read(resp_d, PF_CAPS_D_RQWQE_HOP_NUM); in hns_roce_query_caps()
2266 if (!(caps->page_size_cap & PAGE_SIZE)) in hns_roce_query_caps()
2267 caps->page_size_cap = HNS_ROCE_V2_PAGE_SIZE_SUPPORTED; in hns_roce_query_caps()
2270 caps->cqe_sz = resp_a->cqe_sz; in hns_roce_query_caps()
2271 caps->qpc_sz = le16_to_cpu(resp_b->qpc_sz); in hns_roce_query_caps()
2272 caps->default_aeq_arm_st = in hns_roce_query_caps()
2274 caps->default_ceq_arm_st = in hns_roce_query_caps()
2276 caps->default_ceq_max_cnt = le16_to_cpu(resp_e->ceq_max_cnt); in hns_roce_query_caps()
2277 caps->default_ceq_period = le16_to_cpu(resp_e->ceq_period); in hns_roce_query_caps()
2278 caps->default_aeq_max_cnt = le16_to_cpu(resp_e->aeq_max_cnt); in hns_roce_query_caps()
2279 caps->default_aeq_period = le16_to_cpu(resp_e->aeq_period); in hns_roce_query_caps()
2301 struct hns_roce_caps *caps = &hr_dev->caps; in hns_roce_config_entry_size() local
2308 caps->qpc_sz); in hns_roce_config_entry_size()
2315 caps->sccc_sz); in hns_roce_config_entry_size()
2331 dev_err(dev, "failed to query VF caps, ret = %d.\n", ret); in hns_roce_v2_vf_profile()
2375 dev_err(dev, "failed to query PF caps, ret = %d.\n", ret); in hns_roce_v2_pf_profile()
2487 u16 total_sl = hr_dev->caps.sl_num * hr_dev->func_num; in alloc_link_table_buf()
2493 pg_shift = hr_dev->caps.llm_buf_pg_sz + PAGE_SHIFT; in alloc_link_table_buf()
2494 size = hr_dev->caps.num_qps * hr_dev->func_num * in alloc_link_table_buf()
2877 for (gmv_count = 0; gmv_count < hr_dev->caps.gmv_entry_num; in get_hem_table()
2888 for (qpc_count = 0; qpc_count < hr_dev->caps.qpc_timer_bt_num; in get_hem_table()
2899 for (cqc_count = 0; cqc_count < hr_dev->caps.cqc_timer_bt_num; in get_hem_table()
2930 for (i = 0; i < hr_dev->caps.gmv_entry_num; i++) in put_hem_table()
2936 for (i = 0; i < hr_dev->caps.qpc_timer_bt_num; i++) in put_hem_table()
2939 for (i = 0; i < hr_dev->caps.cqc_timer_bt_num; i++) in put_hem_table()
3602 if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_STASH) in hns_roce_v2_write_cqc()
3609 hr_reg_write(cq_context, CQC_CQE_HOP_NUM, hr_dev->caps.cqe_hop_num == in hns_roce_v2_write_cqc()
3610 HNS_ROCE_HOP_NUM_0 ? 0 : hr_dev->caps.cqe_hop_num); in hns_roce_v2_write_cqc()
4062 u32 idx = obj / (HNS_HW_PAGE_SIZE / hr_dev->caps.gmv_entry_sz); in config_gmv_ba_to_hw()
4209 qpc_size = hr_dev->caps.qpc_sz; in hns_roce_v2_qp_modify()
4328 if (hr_dev->caps.qpc_sz < HNS_ROCE_V3_QPC_SZ) in modify_qp_reset_to_init()
4331 if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_STASH) in modify_qp_reset_to_init()
4399 to_hr_hem_hopnum(hr_dev->caps.wqe_sq_hop_num, in config_qp_rq_buf()
4404 to_hr_hem_hopnum(hr_dev->caps.wqe_sge_hop_num, in config_qp_rq_buf()
4409 to_hr_hem_hopnum(hr_dev->caps.wqe_rq_hop_num, in config_qp_rq_buf()
4637 hr_dev->caps.flags & in modify_qp_init_to_rtr()
4646 hr_dev->caps.flags & in modify_qp_init_to_rtr()
4719 *tail = (*tail == hr_dev->caps.num_qps - 1) ? 0 : (*tail + 1); in get_dip_ctx_idx()
4739 *head = (*head == hr_dev->caps.num_qps - 1) ? 0 : (*head + 1); in get_dip_ctx_idx()
4882 max_sl = min_t(u32, MAX_SERVICE_LEVEL, hr_dev->caps.sl_num - 1); in check_sl_valid()
4987 if (grh->sgid_index >= hr_dev->caps.gid_table_len[hr_port]) { in hns_roce_v2_set_path()
4989 grh->sgid_index, hr_dev->caps.gid_table_len[hr_port]); in hns_roce_v2_set_path()
5070 memset(qpc_mask, 0, hr_dev->caps.qpc_sz); in hns_roce_v2_set_abs_fields()
5298 memset(context, 0, hr_dev->caps.qpc_sz); in hns_roce_v2_modify_qp()
5299 memset(qpc_mask, 0xff, hr_dev->caps.qpc_sz); in hns_roce_v2_modify_qp()
5374 memcpy(buffer, mailbox->buf, hr_dev->caps.qpc_sz); in hns_roce_v2_query_qpc()
5697 to_hr_hem_hopnum(hr_dev->caps.idx_hop_num, srq->wqe_cnt)); in hns_roce_v2_write_srqc_index_queue()
5755 to_hr_hem_hopnum(hr_dev->caps.srqwqe_hop_num, in hns_roce_v2_write_srqc()
6415 if (eqn < hr_dev->caps.num_comp_vectors) in hns_roce_v2_destroy_eqc()
6505 if (hr_dev->caps.eqe_hop_num == HNS_ROCE_HOP_NUM_0) in alloc_eq_buf()
6508 eq->hop_num = hr_dev->caps.eqe_hop_num; in alloc_eq_buf()
6510 buf_attr.page_shift = hr_dev->caps.eqe_buf_pg_sz + PAGE_SHIFT; in alloc_eq_buf()
6516 hr_dev->caps.eqe_ba_pg_sz + PAGE_SHIFT, NULL, in alloc_eq_buf()
6570 while (ceqe && ceqe_num < hr_dev->caps.ceqe_depth) { in hns_roce_ceq_work()
6672 eq_num = hr_dev->caps.num_comp_vectors + hr_dev->caps.num_aeq_vectors; in __hns_roce_free_irq()
6673 irq_num = eq_num + hr_dev->caps.num_other_vectors; in __hns_roce_free_irq()
6675 for (i = 0; i < hr_dev->caps.num_other_vectors; i++) in __hns_roce_free_irq()
6680 if (i < hr_dev->caps.num_comp_vectors) in __hns_roce_free_irq()
6702 other_num = hr_dev->caps.num_other_vectors; in hns_roce_v2_init_eq_table()
6703 comp_num = hr_dev->caps.num_comp_vectors; in hns_roce_v2_init_eq_table()
6704 aeq_num = hr_dev->caps.num_aeq_vectors; in hns_roce_v2_init_eq_table()
6722 eq->entries = hr_dev->caps.ceqe_depth; in hns_roce_v2_init_eq_table()
6723 eq->eqe_size = hr_dev->caps.ceqe_size; in hns_roce_v2_init_eq_table()
6731 eq->entries = hr_dev->caps.aeqe_depth; in hns_roce_v2_init_eq_table()
6732 eq->eqe_size = hr_dev->caps.aeqe_size; in hns_roce_v2_init_eq_table()
6783 eq_num = hr_dev->caps.num_comp_vectors + hr_dev->caps.num_aeq_vectors; in hns_roce_v2_cleanup_eq_table()
6881 hr_dev->caps.num_ports = 1; in hns_roce_hw_v2_get_cfg()