Lines Matching refs:ctxm

3420 static void bnxt_init_ctx_mem(struct bnxt_ctx_mem_type *ctxm, void *p, int len)  in bnxt_init_ctx_mem()  argument
3422 u8 init_val = ctxm->init_value; in bnxt_init_ctx_mem()
3423 u16 offset = ctxm->init_offset; in bnxt_init_ctx_mem()
3433 for (i = 0; i < len; i += ctxm->entry_size) in bnxt_init_ctx_mem()
8196 static void bnxt_init_ctx_initializer(struct bnxt_ctx_mem_type *ctxm, in bnxt_init_ctx_initializer() argument
8200 ctxm->init_value = init_val; in bnxt_init_ctx_initializer()
8201 ctxm->init_offset = BNXT_CTX_INIT_INVALID_OFFSET; in bnxt_init_ctx_initializer()
8203 ctxm->init_offset = init_offset * 4; in bnxt_init_ctx_initializer()
8205 ctxm->init_value = 0; in bnxt_init_ctx_initializer()
8214 struct bnxt_ctx_mem_type *ctxm = &ctx->ctx_arr[type]; in bnxt_alloc_all_ctx_pg_info() local
8217 if (!ctxm->max_entries) in bnxt_alloc_all_ctx_pg_info()
8220 if (ctxm->instance_bmap) in bnxt_alloc_all_ctx_pg_info()
8221 n = hweight32(ctxm->instance_bmap); in bnxt_alloc_all_ctx_pg_info()
8222 ctxm->pg_info = kcalloc(n, sizeof(*ctxm->pg_info), GFP_KERNEL); in bnxt_alloc_all_ctx_pg_info()
8223 if (!ctxm->pg_info) in bnxt_alloc_all_ctx_pg_info()
8253 struct bnxt_ctx_mem_type *ctxm = &ctx->ctx_arr[type]; in bnxt_hwrm_func_backing_store_qcaps_v2() local
8267 ctxm->type = le16_to_cpu(resp->type); in bnxt_hwrm_func_backing_store_qcaps_v2()
8268 ctxm->entry_size = le16_to_cpu(resp->entry_size); in bnxt_hwrm_func_backing_store_qcaps_v2()
8269 ctxm->flags = flags; in bnxt_hwrm_func_backing_store_qcaps_v2()
8270 ctxm->instance_bmap = le32_to_cpu(resp->instance_bit_map); in bnxt_hwrm_func_backing_store_qcaps_v2()
8271 ctxm->entry_multiple = resp->entry_multiple; in bnxt_hwrm_func_backing_store_qcaps_v2()
8272 ctxm->max_entries = le32_to_cpu(resp->max_num_entries); in bnxt_hwrm_func_backing_store_qcaps_v2()
8273 ctxm->min_entries = le32_to_cpu(resp->min_num_entries); in bnxt_hwrm_func_backing_store_qcaps_v2()
8276 bnxt_init_ctx_initializer(ctxm, init_val, init_off, in bnxt_hwrm_func_backing_store_qcaps_v2()
8278 ctxm->split_entry_cnt = min_t(u8, resp->subtype_valid_cnt, in bnxt_hwrm_func_backing_store_qcaps_v2()
8280 for (i = 0, p = &resp->split_entry_0; i < ctxm->split_entry_cnt; in bnxt_hwrm_func_backing_store_qcaps_v2()
8282 ctxm->split[i] = le32_to_cpu(*p); in bnxt_hwrm_func_backing_store_qcaps_v2()
8310 struct bnxt_ctx_mem_type *ctxm; in bnxt_hwrm_func_backing_store_qcaps() local
8327 ctxm = &ctx->ctx_arr[BNXT_CTX_QP]; in bnxt_hwrm_func_backing_store_qcaps()
8328 ctxm->max_entries = le32_to_cpu(resp->qp_max_entries); in bnxt_hwrm_func_backing_store_qcaps()
8329 ctxm->qp_qp1_entries = le16_to_cpu(resp->qp_min_qp1_entries); in bnxt_hwrm_func_backing_store_qcaps()
8330 ctxm->qp_l2_entries = le16_to_cpu(resp->qp_max_l2_entries); in bnxt_hwrm_func_backing_store_qcaps()
8331 ctxm->qp_fast_qpmd_entries = le16_to_cpu(resp->fast_qpmd_qp_num_entries); in bnxt_hwrm_func_backing_store_qcaps()
8332 ctxm->entry_size = le16_to_cpu(resp->qp_entry_size); in bnxt_hwrm_func_backing_store_qcaps()
8333 bnxt_init_ctx_initializer(ctxm, init_val, resp->qp_init_offset, in bnxt_hwrm_func_backing_store_qcaps()
8336 ctxm = &ctx->ctx_arr[BNXT_CTX_SRQ]; in bnxt_hwrm_func_backing_store_qcaps()
8337 ctxm->srq_l2_entries = le16_to_cpu(resp->srq_max_l2_entries); in bnxt_hwrm_func_backing_store_qcaps()
8338 ctxm->max_entries = le32_to_cpu(resp->srq_max_entries); in bnxt_hwrm_func_backing_store_qcaps()
8339 ctxm->entry_size = le16_to_cpu(resp->srq_entry_size); in bnxt_hwrm_func_backing_store_qcaps()
8340 bnxt_init_ctx_initializer(ctxm, init_val, resp->srq_init_offset, in bnxt_hwrm_func_backing_store_qcaps()
8343 ctxm = &ctx->ctx_arr[BNXT_CTX_CQ]; in bnxt_hwrm_func_backing_store_qcaps()
8344 ctxm->cq_l2_entries = le16_to_cpu(resp->cq_max_l2_entries); in bnxt_hwrm_func_backing_store_qcaps()
8345 ctxm->max_entries = le32_to_cpu(resp->cq_max_entries); in bnxt_hwrm_func_backing_store_qcaps()
8346 ctxm->entry_size = le16_to_cpu(resp->cq_entry_size); in bnxt_hwrm_func_backing_store_qcaps()
8347 bnxt_init_ctx_initializer(ctxm, init_val, resp->cq_init_offset, in bnxt_hwrm_func_backing_store_qcaps()
8350 ctxm = &ctx->ctx_arr[BNXT_CTX_VNIC]; in bnxt_hwrm_func_backing_store_qcaps()
8351 ctxm->vnic_entries = le16_to_cpu(resp->vnic_max_vnic_entries); in bnxt_hwrm_func_backing_store_qcaps()
8352 ctxm->max_entries = ctxm->vnic_entries + in bnxt_hwrm_func_backing_store_qcaps()
8354 ctxm->entry_size = le16_to_cpu(resp->vnic_entry_size); in bnxt_hwrm_func_backing_store_qcaps()
8355 bnxt_init_ctx_initializer(ctxm, init_val, in bnxt_hwrm_func_backing_store_qcaps()
8359 ctxm = &ctx->ctx_arr[BNXT_CTX_STAT]; in bnxt_hwrm_func_backing_store_qcaps()
8360 ctxm->max_entries = le32_to_cpu(resp->stat_max_entries); in bnxt_hwrm_func_backing_store_qcaps()
8361 ctxm->entry_size = le16_to_cpu(resp->stat_entry_size); in bnxt_hwrm_func_backing_store_qcaps()
8362 bnxt_init_ctx_initializer(ctxm, init_val, in bnxt_hwrm_func_backing_store_qcaps()
8366 ctxm = &ctx->ctx_arr[BNXT_CTX_STQM]; in bnxt_hwrm_func_backing_store_qcaps()
8367 ctxm->entry_size = le16_to_cpu(resp->tqm_entry_size); in bnxt_hwrm_func_backing_store_qcaps()
8368 ctxm->min_entries = le32_to_cpu(resp->tqm_min_entries_per_ring); in bnxt_hwrm_func_backing_store_qcaps()
8369 ctxm->max_entries = le32_to_cpu(resp->tqm_max_entries_per_ring); in bnxt_hwrm_func_backing_store_qcaps()
8370 ctxm->entry_multiple = resp->tqm_entries_multiple; in bnxt_hwrm_func_backing_store_qcaps()
8371 if (!ctxm->entry_multiple) in bnxt_hwrm_func_backing_store_qcaps()
8372 ctxm->entry_multiple = 1; in bnxt_hwrm_func_backing_store_qcaps()
8374 memcpy(&ctx->ctx_arr[BNXT_CTX_FTQM], ctxm, sizeof(*ctxm)); in bnxt_hwrm_func_backing_store_qcaps()
8376 ctxm = &ctx->ctx_arr[BNXT_CTX_MRAV]; in bnxt_hwrm_func_backing_store_qcaps()
8377 ctxm->max_entries = le32_to_cpu(resp->mrav_max_entries); in bnxt_hwrm_func_backing_store_qcaps()
8378 ctxm->entry_size = le16_to_cpu(resp->mrav_entry_size); in bnxt_hwrm_func_backing_store_qcaps()
8379 ctxm->mrav_num_entries_units = in bnxt_hwrm_func_backing_store_qcaps()
8381 bnxt_init_ctx_initializer(ctxm, init_val, in bnxt_hwrm_func_backing_store_qcaps()
8385 ctxm = &ctx->ctx_arr[BNXT_CTX_TIM]; in bnxt_hwrm_func_backing_store_qcaps()
8386 ctxm->entry_size = le16_to_cpu(resp->tim_entry_size); in bnxt_hwrm_func_backing_store_qcaps()
8387 ctxm->max_entries = le32_to_cpu(resp->tim_max_entries); in bnxt_hwrm_func_backing_store_qcaps()
8395 ctxm = &ctx->ctx_arr[BNXT_CTX_FTQM]; in bnxt_hwrm_func_backing_store_qcaps()
8396 memcpy(ctxm, &ctx->ctx_arr[BNXT_CTX_STQM], sizeof(*ctxm)); in bnxt_hwrm_func_backing_store_qcaps()
8397 ctxm->instance_bmap = (1 << ctx->tqm_fp_rings_count) - 1; in bnxt_hwrm_func_backing_store_qcaps()
8438 struct bnxt_ctx_mem_type *ctxm; in bnxt_hwrm_func_backing_store_cfg() local
8460 ctxm = &ctx->ctx_arr[BNXT_CTX_QP]; in bnxt_hwrm_func_backing_store_cfg()
8461 ctx_pg = ctxm->pg_info; in bnxt_hwrm_func_backing_store_cfg()
8463 req->qp_num_qp1_entries = cpu_to_le16(ctxm->qp_qp1_entries); in bnxt_hwrm_func_backing_store_cfg()
8464 req->qp_num_l2_entries = cpu_to_le16(ctxm->qp_l2_entries); in bnxt_hwrm_func_backing_store_cfg()
8465 req->qp_entry_size = cpu_to_le16(ctxm->entry_size); in bnxt_hwrm_func_backing_store_cfg()
8471 req->qp_num_fast_qpmd_entries = cpu_to_le16(ctxm->qp_fast_qpmd_entries); in bnxt_hwrm_func_backing_store_cfg()
8474 ctxm = &ctx->ctx_arr[BNXT_CTX_SRQ]; in bnxt_hwrm_func_backing_store_cfg()
8475 ctx_pg = ctxm->pg_info; in bnxt_hwrm_func_backing_store_cfg()
8477 req->srq_num_l2_entries = cpu_to_le16(ctxm->srq_l2_entries); in bnxt_hwrm_func_backing_store_cfg()
8478 req->srq_entry_size = cpu_to_le16(ctxm->entry_size); in bnxt_hwrm_func_backing_store_cfg()
8484 ctxm = &ctx->ctx_arr[BNXT_CTX_CQ]; in bnxt_hwrm_func_backing_store_cfg()
8485 ctx_pg = ctxm->pg_info; in bnxt_hwrm_func_backing_store_cfg()
8487 req->cq_num_l2_entries = cpu_to_le16(ctxm->cq_l2_entries); in bnxt_hwrm_func_backing_store_cfg()
8488 req->cq_entry_size = cpu_to_le16(ctxm->entry_size); in bnxt_hwrm_func_backing_store_cfg()
8494 ctxm = &ctx->ctx_arr[BNXT_CTX_VNIC]; in bnxt_hwrm_func_backing_store_cfg()
8495 ctx_pg = ctxm->pg_info; in bnxt_hwrm_func_backing_store_cfg()
8496 req->vnic_num_vnic_entries = cpu_to_le16(ctxm->vnic_entries); in bnxt_hwrm_func_backing_store_cfg()
8498 cpu_to_le16(ctxm->max_entries - ctxm->vnic_entries); in bnxt_hwrm_func_backing_store_cfg()
8499 req->vnic_entry_size = cpu_to_le16(ctxm->entry_size); in bnxt_hwrm_func_backing_store_cfg()
8505 ctxm = &ctx->ctx_arr[BNXT_CTX_STAT]; in bnxt_hwrm_func_backing_store_cfg()
8506 ctx_pg = ctxm->pg_info; in bnxt_hwrm_func_backing_store_cfg()
8507 req->stat_num_entries = cpu_to_le32(ctxm->max_entries); in bnxt_hwrm_func_backing_store_cfg()
8508 req->stat_entry_size = cpu_to_le16(ctxm->entry_size); in bnxt_hwrm_func_backing_store_cfg()
8516 ctxm = &ctx->ctx_arr[BNXT_CTX_MRAV]; in bnxt_hwrm_func_backing_store_cfg()
8517 ctx_pg = ctxm->pg_info; in bnxt_hwrm_func_backing_store_cfg()
8519 units = ctxm->mrav_num_entries_units; in bnxt_hwrm_func_backing_store_cfg()
8521 u32 num_mr, num_ah = ctxm->mrav_av_entries; in bnxt_hwrm_func_backing_store_cfg()
8529 req->mrav_entry_size = cpu_to_le16(ctxm->entry_size); in bnxt_hwrm_func_backing_store_cfg()
8535 ctxm = &ctx->ctx_arr[BNXT_CTX_TIM]; in bnxt_hwrm_func_backing_store_cfg()
8536 ctx_pg = ctxm->pg_info; in bnxt_hwrm_func_backing_store_cfg()
8538 req->tim_entry_size = cpu_to_le16(ctxm->entry_size); in bnxt_hwrm_func_backing_store_cfg()
8543 ctxm = &ctx->ctx_arr[BNXT_CTX_STQM]; in bnxt_hwrm_func_backing_store_cfg()
8548 ctx_pg = ctxm->pg_info; in bnxt_hwrm_func_backing_store_cfg()
8555 req->tqm_entry_size = cpu_to_le16(ctxm->entry_size); in bnxt_hwrm_func_backing_store_cfg()
8579 u8 depth, struct bnxt_ctx_mem_type *ctxm) in bnxt_alloc_ctx_pg_tbls() argument
8617 rmem->ctx_mem = ctxm; in bnxt_alloc_ctx_pg_tbls()
8632 rmem->ctx_mem = ctxm; in bnxt_alloc_ctx_pg_tbls()
8668 struct bnxt_ctx_mem_type *ctxm, u32 entries, in bnxt_setup_ctxm_pg_tbls() argument
8671 struct bnxt_ctx_pg_info *ctx_pg = ctxm->pg_info; in bnxt_setup_ctxm_pg_tbls()
8675 if (!ctxm->entry_size || !ctx_pg) in bnxt_setup_ctxm_pg_tbls()
8677 if (ctxm->instance_bmap) in bnxt_setup_ctxm_pg_tbls()
8678 n = hweight32(ctxm->instance_bmap); in bnxt_setup_ctxm_pg_tbls()
8679 if (ctxm->entry_multiple) in bnxt_setup_ctxm_pg_tbls()
8680 entries = roundup(entries, ctxm->entry_multiple); in bnxt_setup_ctxm_pg_tbls()
8681 entries = clamp_t(u32, entries, ctxm->min_entries, ctxm->max_entries); in bnxt_setup_ctxm_pg_tbls()
8682 mem_size = entries * ctxm->entry_size; in bnxt_setup_ctxm_pg_tbls()
8686 ctxm->init_value ? ctxm : NULL); in bnxt_setup_ctxm_pg_tbls()
8692 struct bnxt_ctx_mem_type *ctxm, in bnxt_hwrm_func_backing_store_cfg_v2() argument
8696 u32 instance_bmap = ctxm->instance_bmap; in bnxt_hwrm_func_backing_store_cfg_v2()
8700 if (!(ctxm->flags & BNXT_CTX_MEM_TYPE_VALID) || !ctxm->pg_info) in bnxt_hwrm_func_backing_store_cfg_v2()
8704 n = hweight32(ctxm->instance_bmap); in bnxt_hwrm_func_backing_store_cfg_v2()
8712 req->type = cpu_to_le16(ctxm->type); in bnxt_hwrm_func_backing_store_cfg_v2()
8713 req->entry_size = cpu_to_le16(ctxm->entry_size); in bnxt_hwrm_func_backing_store_cfg_v2()
8714 req->subtype_valid_cnt = ctxm->split_entry_cnt; in bnxt_hwrm_func_backing_store_cfg_v2()
8715 for (i = 0, p = &req->split_entry_0; i < ctxm->split_entry_cnt; i++) in bnxt_hwrm_func_backing_store_cfg_v2()
8716 p[i] = cpu_to_le32(ctxm->split[i]); in bnxt_hwrm_func_backing_store_cfg_v2()
8723 ctx_pg = &ctxm->pg_info[j++]; in bnxt_hwrm_func_backing_store_cfg_v2()
8742 struct bnxt_ctx_mem_type *ctxm; in bnxt_backing_store_cfg_v2() local
8756 ctxm = &ctx->ctx_arr[type]; in bnxt_backing_store_cfg_v2()
8758 rc = bnxt_hwrm_func_backing_store_cfg_v2(bp, ctxm, ctxm->last); in bnxt_backing_store_cfg_v2()
8774 struct bnxt_ctx_mem_type *ctxm = &ctx->ctx_arr[type]; in bnxt_free_ctx_mem() local
8775 struct bnxt_ctx_pg_info *ctx_pg = ctxm->pg_info; in bnxt_free_ctx_mem()
8780 if (ctxm->instance_bmap) in bnxt_free_ctx_mem()
8781 n = hweight32(ctxm->instance_bmap); in bnxt_free_ctx_mem()
8786 ctxm->pg_info = NULL; in bnxt_free_ctx_mem()
8796 struct bnxt_ctx_mem_type *ctxm; in bnxt_alloc_ctx_mem() local
8818 ctxm = &ctx->ctx_arr[BNXT_CTX_QP]; in bnxt_alloc_ctx_mem()
8819 l2_qps = ctxm->qp_l2_entries; in bnxt_alloc_ctx_mem()
8820 qp1_qps = ctxm->qp_qp1_entries; in bnxt_alloc_ctx_mem()
8821 fast_qpmd_qps = ctxm->qp_fast_qpmd_entries; in bnxt_alloc_ctx_mem()
8822 max_qps = ctxm->max_entries; in bnxt_alloc_ctx_mem()
8823 ctxm = &ctx->ctx_arr[BNXT_CTX_SRQ]; in bnxt_alloc_ctx_mem()
8824 srqs = ctxm->srq_l2_entries; in bnxt_alloc_ctx_mem()
8825 max_srqs = ctxm->max_entries; in bnxt_alloc_ctx_mem()
8837 ctxm = &ctx->ctx_arr[BNXT_CTX_QP]; in bnxt_alloc_ctx_mem()
8838 rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm, l2_qps + qp1_qps + extra_qps, in bnxt_alloc_ctx_mem()
8843 ctxm = &ctx->ctx_arr[BNXT_CTX_SRQ]; in bnxt_alloc_ctx_mem()
8844 rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm, srqs + extra_srqs, pg_lvl); in bnxt_alloc_ctx_mem()
8848 ctxm = &ctx->ctx_arr[BNXT_CTX_CQ]; in bnxt_alloc_ctx_mem()
8849 rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm, ctxm->cq_l2_entries + in bnxt_alloc_ctx_mem()
8854 ctxm = &ctx->ctx_arr[BNXT_CTX_VNIC]; in bnxt_alloc_ctx_mem()
8855 rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm, ctxm->max_entries, 1); in bnxt_alloc_ctx_mem()
8859 ctxm = &ctx->ctx_arr[BNXT_CTX_STAT]; in bnxt_alloc_ctx_mem()
8860 rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm, ctxm->max_entries, 1); in bnxt_alloc_ctx_mem()
8867 ctxm = &ctx->ctx_arr[BNXT_CTX_MRAV]; in bnxt_alloc_ctx_mem()
8871 num_mr = min_t(u32, ctxm->max_entries / 2, 1024 * 256); in bnxt_alloc_ctx_mem()
8873 ctxm->split_entry_cnt = BNXT_CTX_MRAV_AV_SPLIT_ENTRY + 1; in bnxt_alloc_ctx_mem()
8874 if (!ctxm->mrav_av_entries || ctxm->mrav_av_entries > num_ah) in bnxt_alloc_ctx_mem()
8875 ctxm->mrav_av_entries = num_ah; in bnxt_alloc_ctx_mem()
8877 rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm, num_mr + num_ah, 2); in bnxt_alloc_ctx_mem()
8882 ctxm = &ctx->ctx_arr[BNXT_CTX_TIM]; in bnxt_alloc_ctx_mem()
8883 rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm, l2_qps + qp1_qps + extra_qps, 1); in bnxt_alloc_ctx_mem()
8889 ctxm = &ctx->ctx_arr[BNXT_CTX_STQM]; in bnxt_alloc_ctx_mem()
8890 min = ctxm->min_entries; in bnxt_alloc_ctx_mem()
8893 rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm, entries_sp, 2); in bnxt_alloc_ctx_mem()
8897 ctxm = &ctx->ctx_arr[BNXT_CTX_FTQM]; in bnxt_alloc_ctx_mem()
8899 rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm, entries, 2); in bnxt_alloc_ctx_mem()