Lines Matching +full:max +full:- +full:msg

2  * Broadcom NetXtreme-E RoCE driver.
4 * Copyright (c) 2016 - 2017, Broadcom. All rights reserved. The term
62 if (!bnxt_qplib_is_chip_gen_p5_p7(rcfw->res->cctx)) in bnxt_qplib_is_atomic_cap()
65 pcie_capability_read_word(rcfw->pdev, PCI_EXP_DEVCTL2, &pcie_ctl2); in bnxt_qplib_is_atomic_cap()
72 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_query_version() local
77 attr = rcfw->res->dattr; in bnxt_qplib_query_version()
82 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), sizeof(resp), 0); in bnxt_qplib_query_version()
83 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_query_version()
86 attr->fw_ver[0] = resp.fw_maj; in bnxt_qplib_query_version()
87 attr->fw_ver[1] = resp.fw_minor; in bnxt_qplib_query_version()
88 attr->fw_ver[2] = resp.fw_bld; in bnxt_qplib_query_version()
89 attr->fw_ver[3] = resp.fw_rsvd; in bnxt_qplib_query_version()
94 struct bnxt_qplib_dev_attr *attr = rcfw->res->dattr; in bnxt_qplib_get_dev_attr()
96 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_get_dev_attr() local
105 cctx = rcfw->res->cctx; in bnxt_qplib_get_dev_attr()
111 sbuf.sb = dma_alloc_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_get_dev_attr()
114 return -ENOMEM; in bnxt_qplib_get_dev_attr()
117 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, &sbuf, sizeof(req), in bnxt_qplib_get_dev_attr()
119 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_get_dev_attr()
124 attr->max_qp = le32_to_cpu(sb->max_qp); in bnxt_qplib_get_dev_attr()
126 attr->max_qp += 1; in bnxt_qplib_get_dev_attr()
127 attr->max_qp_rd_atom = in bnxt_qplib_get_dev_attr()
128 sb->max_qp_rd_atom > BNXT_QPLIB_MAX_OUT_RD_ATOM ? in bnxt_qplib_get_dev_attr()
129 BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_rd_atom; in bnxt_qplib_get_dev_attr()
130 attr->max_qp_init_rd_atom = in bnxt_qplib_get_dev_attr()
131 sb->max_qp_init_rd_atom > BNXT_QPLIB_MAX_OUT_RD_ATOM ? in bnxt_qplib_get_dev_attr()
132 BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_init_rd_atom; in bnxt_qplib_get_dev_attr()
133 attr->max_qp_wqes = le16_to_cpu(sb->max_qp_wr) - 1; in bnxt_qplib_get_dev_attr()
134 if (!bnxt_qplib_is_chip_gen_p5_p7(rcfw->res->cctx)) { in bnxt_qplib_get_dev_attr()
137 * reporting the max number on legacy devices in bnxt_qplib_get_dev_attr()
139 attr->max_qp_wqes -= BNXT_QPLIB_RESERVED_QP_WRS + 1; in bnxt_qplib_get_dev_attr()
143 if (cctx->modes.wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE) in bnxt_qplib_get_dev_attr()
144 attr->max_qp_wqes = BNXT_VAR_MAX_WQE - 1; in bnxt_qplib_get_dev_attr()
146 attr->max_qp_sges = cctx->modes.wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE ? in bnxt_qplib_get_dev_attr()
147 min_t(u32, sb->max_sge_var_wqe, BNXT_VAR_MAX_SGE) : 6; in bnxt_qplib_get_dev_attr()
148 attr->max_cq = le32_to_cpu(sb->max_cq); in bnxt_qplib_get_dev_attr()
149 attr->max_cq_wqes = le32_to_cpu(sb->max_cqe); in bnxt_qplib_get_dev_attr()
150 if (!bnxt_qplib_is_chip_gen_p7(rcfw->res->cctx)) in bnxt_qplib_get_dev_attr()
151 attr->max_cq_wqes = min_t(u32, BNXT_QPLIB_MAX_CQ_WQES, attr->max_cq_wqes); in bnxt_qplib_get_dev_attr()
152 attr->max_cq_sges = attr->max_qp_sges; in bnxt_qplib_get_dev_attr()
153 attr->max_mr = le32_to_cpu(sb->max_mr); in bnxt_qplib_get_dev_attr()
154 attr->max_mw = le32_to_cpu(sb->max_mw); in bnxt_qplib_get_dev_attr()
156 attr->max_mr_size = le64_to_cpu(sb->max_mr_size); in bnxt_qplib_get_dev_attr()
157 attr->max_pd = 64 * 1024; in bnxt_qplib_get_dev_attr()
158 attr->max_raw_ethy_qp = le32_to_cpu(sb->max_raw_eth_qp); in bnxt_qplib_get_dev_attr()
159 attr->max_ah = le32_to_cpu(sb->max_ah); in bnxt_qplib_get_dev_attr()
161 attr->max_srq = le16_to_cpu(sb->max_srq); in bnxt_qplib_get_dev_attr()
162 attr->max_srq_wqes = le32_to_cpu(sb->max_srq_wr) - 1; in bnxt_qplib_get_dev_attr()
163 attr->max_srq_sges = sb->max_srq_sge; in bnxt_qplib_get_dev_attr()
164 attr->max_pkey = 1; in bnxt_qplib_get_dev_attr()
165 attr->max_inline_data = attr->max_qp_sges * sizeof(struct sq_sge); in bnxt_qplib_get_dev_attr()
166 if (!bnxt_qplib_is_chip_gen_p7(rcfw->res->cctx)) in bnxt_qplib_get_dev_attr()
167 attr->l2_db_size = (sb->l2_db_space_size + 1) * in bnxt_qplib_get_dev_attr()
170 * Read the max gid supported by HW. in bnxt_qplib_get_dev_attr()
175 attr->max_sgid = le32_to_cpu(sb->max_gid); in bnxt_qplib_get_dev_attr()
176 attr->max_sgid = min_t(u32, BNXT_QPLIB_NUM_GIDS_SUPPORTED, 2 * attr->max_sgid); in bnxt_qplib_get_dev_attr()
177 attr->dev_cap_flags = le16_to_cpu(sb->dev_cap_flags); in bnxt_qplib_get_dev_attr()
178 attr->dev_cap_flags2 = le16_to_cpu(sb->dev_cap_ext_flags_2); in bnxt_qplib_get_dev_attr()
180 if (_is_max_srq_ext_supported(attr->dev_cap_flags2)) in bnxt_qplib_get_dev_attr()
181 attr->max_srq += le16_to_cpu(sb->max_srq_ext); in bnxt_qplib_get_dev_attr()
184 temp = le32_to_cpu(sb->tqm_alloc_reqs[i]); in bnxt_qplib_get_dev_attr()
186 attr->tqm_alloc_reqs[i * 4] = *tqm_alloc; in bnxt_qplib_get_dev_attr()
187 attr->tqm_alloc_reqs[i * 4 + 1] = *(++tqm_alloc); in bnxt_qplib_get_dev_attr()
188 attr->tqm_alloc_reqs[i * 4 + 2] = *(++tqm_alloc); in bnxt_qplib_get_dev_attr()
189 attr->tqm_alloc_reqs[i * 4 + 3] = *(++tqm_alloc); in bnxt_qplib_get_dev_attr()
192 if (rcfw->res->cctx->hwrm_intf_ver >= HWRM_VERSION_DEV_ATTR_MAX_DPI) in bnxt_qplib_get_dev_attr()
193 attr->max_dpi = le32_to_cpu(sb->max_dpi); in bnxt_qplib_get_dev_attr()
195 attr->is_atomic = bnxt_qplib_is_atomic_cap(rcfw); in bnxt_qplib_get_dev_attr()
197 dma_free_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_get_dev_attr()
208 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_set_func_resources() local
215 req.number_of_qp = cpu_to_le32(ctx->qpc_count); in bnxt_qplib_set_func_resources()
216 req.number_of_mrw = cpu_to_le32(ctx->mrw_count); in bnxt_qplib_set_func_resources()
217 req.number_of_srq = cpu_to_le32(ctx->srqc_count); in bnxt_qplib_set_func_resources()
218 req.number_of_cq = cpu_to_le32(ctx->cq_count); in bnxt_qplib_set_func_resources()
220 req.max_qp_per_vf = cpu_to_le32(ctx->vf_res.max_qp_per_vf); in bnxt_qplib_set_func_resources()
221 req.max_mrw_per_vf = cpu_to_le32(ctx->vf_res.max_mrw_per_vf); in bnxt_qplib_set_func_resources()
222 req.max_srq_per_vf = cpu_to_le32(ctx->vf_res.max_srq_per_vf); in bnxt_qplib_set_func_resources()
223 req.max_cq_per_vf = cpu_to_le32(ctx->vf_res.max_cq_per_vf); in bnxt_qplib_set_func_resources()
224 req.max_gid_per_vf = cpu_to_le32(ctx->vf_res.max_gid_per_vf); in bnxt_qplib_set_func_resources()
226 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_set_func_resources()
228 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_set_func_resources()
230 dev_err(&res->pdev->dev, "Failed to set function resources\n"); in bnxt_qplib_set_func_resources()
240 if (index >= sgid_tbl->max) { in bnxt_qplib_get_sgid()
241 dev_err(&res->pdev->dev, in bnxt_qplib_get_sgid()
242 "Index %d exceeded SGID table max (%d)\n", in bnxt_qplib_get_sgid()
243 index, sgid_tbl->max); in bnxt_qplib_get_sgid()
244 return -EINVAL; in bnxt_qplib_get_sgid()
246 memcpy(gid, &sgid_tbl->tbl[index].gid, sizeof(*gid)); in bnxt_qplib_get_sgid()
256 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_del_sgid()
260 if (!sgid_tbl->active) { in bnxt_qplib_del_sgid()
261 dev_err(&res->pdev->dev, "SGID table has no active entries\n"); in bnxt_qplib_del_sgid()
262 return -ENOMEM; in bnxt_qplib_del_sgid()
264 for (index = 0; index < sgid_tbl->max; index++) { in bnxt_qplib_del_sgid()
265 if (!memcmp(&sgid_tbl->tbl[index].gid, gid, sizeof(*gid)) && in bnxt_qplib_del_sgid()
266 vlan_id == sgid_tbl->tbl[index].vlan_id) in bnxt_qplib_del_sgid()
269 if (index == sgid_tbl->max) { in bnxt_qplib_del_sgid()
270 dev_warn(&res->pdev->dev, "GID not found in the SGID table\n"); in bnxt_qplib_del_sgid()
276 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_del_sgid() local
283 if (sgid_tbl->hw_id[index] == 0xFFFF) { in bnxt_qplib_del_sgid()
284 dev_err(&res->pdev->dev, in bnxt_qplib_del_sgid()
286 return -EINVAL; in bnxt_qplib_del_sgid()
288 req.gid_index = cpu_to_le16(sgid_tbl->hw_id[index]); in bnxt_qplib_del_sgid()
289 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_del_sgid()
291 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_del_sgid()
295 memcpy(&sgid_tbl->tbl[index].gid, &bnxt_qplib_gid_zero, in bnxt_qplib_del_sgid()
297 sgid_tbl->tbl[index].vlan_id = 0xFFFF; in bnxt_qplib_del_sgid()
298 sgid_tbl->vlan[index] = 0; in bnxt_qplib_del_sgid()
299 sgid_tbl->active--; in bnxt_qplib_del_sgid()
300 dev_dbg(&res->pdev->dev, in bnxt_qplib_del_sgid()
302 index, sgid_tbl->hw_id[index], sgid_tbl->active); in bnxt_qplib_del_sgid()
303 sgid_tbl->hw_id[index] = (u16)-1; in bnxt_qplib_del_sgid()
317 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_add_sgid()
321 if (sgid_tbl->active == sgid_tbl->max) { in bnxt_qplib_add_sgid()
322 dev_err(&res->pdev->dev, "SGID table is full\n"); in bnxt_qplib_add_sgid()
323 return -ENOMEM; in bnxt_qplib_add_sgid()
325 free_idx = sgid_tbl->max; in bnxt_qplib_add_sgid()
326 for (i = 0; i < sgid_tbl->max; i++) { in bnxt_qplib_add_sgid()
327 if (!memcmp(&sgid_tbl->tbl[i], gid, sizeof(*gid)) && in bnxt_qplib_add_sgid()
328 sgid_tbl->tbl[i].vlan_id == vlan_id) { in bnxt_qplib_add_sgid()
329 dev_dbg(&res->pdev->dev, in bnxt_qplib_add_sgid()
332 return -EALREADY; in bnxt_qplib_add_sgid()
333 } else if (!memcmp(&sgid_tbl->tbl[i], &bnxt_qplib_gid_zero, in bnxt_qplib_add_sgid()
335 free_idx == sgid_tbl->max) { in bnxt_qplib_add_sgid()
339 if (free_idx == sgid_tbl->max) { in bnxt_qplib_add_sgid()
340 dev_err(&res->pdev->dev, in bnxt_qplib_add_sgid()
341 "SGID table is FULL but count is not MAX??\n"); in bnxt_qplib_add_sgid()
342 return -ENOMEM; in bnxt_qplib_add_sgid()
346 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_add_sgid() local
354 req.gid[0] = cpu_to_be32(((u32 *)gid->data)[3]); in bnxt_qplib_add_sgid()
355 req.gid[1] = cpu_to_be32(((u32 *)gid->data)[2]); in bnxt_qplib_add_sgid()
356 req.gid[2] = cpu_to_be32(((u32 *)gid->data)[1]); in bnxt_qplib_add_sgid()
357 req.gid[3] = cpu_to_be32(((u32 *)gid->data)[0]); in bnxt_qplib_add_sgid()
360 * tagged if RoCE traffic is running on non-zero VLAN ID or in bnxt_qplib_add_sgid()
361 * RoCE traffic is running on non-zero Priority. in bnxt_qplib_add_sgid()
363 if ((vlan_id != 0xFFFF) || res->prio) { in bnxt_qplib_add_sgid()
380 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_add_sgid()
382 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_add_sgid()
385 sgid_tbl->hw_id[free_idx] = le32_to_cpu(resp.xid); in bnxt_qplib_add_sgid()
388 memcpy(&sgid_tbl->tbl[free_idx], gid, sizeof(*gid)); in bnxt_qplib_add_sgid()
389 sgid_tbl->tbl[free_idx].vlan_id = vlan_id; in bnxt_qplib_add_sgid()
390 sgid_tbl->active++; in bnxt_qplib_add_sgid()
392 sgid_tbl->vlan[free_idx] = 1; in bnxt_qplib_add_sgid()
394 dev_dbg(&res->pdev->dev, in bnxt_qplib_add_sgid()
396 free_idx, sgid_tbl->hw_id[free_idx], sgid_tbl->active); in bnxt_qplib_add_sgid()
407 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_create_ah()
409 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_create_ah() local
419 memcpy(temp32, ah->dgid.data, sizeof(struct bnxt_qplib_gid)); in bnxt_qplib_create_ah()
425 req.type = ah->nw_type; in bnxt_qplib_create_ah()
426 req.hop_limit = ah->hop_limit; in bnxt_qplib_create_ah()
427 req.sgid_index = cpu_to_le16(res->sgid_tbl.hw_id[ah->sgid_index]); in bnxt_qplib_create_ah()
428 req.dest_vlan_id_flow_label = cpu_to_le32((ah->flow_label & in bnxt_qplib_create_ah()
431 req.pd_id = cpu_to_le32(ah->pd->id); in bnxt_qplib_create_ah()
432 req.traffic_class = ah->traffic_class; in bnxt_qplib_create_ah()
435 memcpy(temp16, ah->dmac, 6); in bnxt_qplib_create_ah()
440 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_create_ah()
442 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_create_ah()
446 ah->id = le32_to_cpu(resp.xid); in bnxt_qplib_create_ah()
453 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_destroy_ah()
455 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_destroy_ah() local
464 req.ah_cid = cpu_to_le32(ah->id); in bnxt_qplib_destroy_ah()
466 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_destroy_ah()
468 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_destroy_ah()
476 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_free_mrw()
478 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_free_mrw() local
481 if (mrw->lkey == 0xFFFFFFFF) { in bnxt_qplib_free_mrw()
482 dev_info(&res->pdev->dev, "SP: Free a reserved lkey MRW\n"); in bnxt_qplib_free_mrw()
490 req.mrw_flags = mrw->type; in bnxt_qplib_free_mrw()
492 if ((mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE1) || in bnxt_qplib_free_mrw()
493 (mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2A) || in bnxt_qplib_free_mrw()
494 (mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2B)) in bnxt_qplib_free_mrw()
495 req.key = cpu_to_le32(mrw->rkey); in bnxt_qplib_free_mrw()
497 req.key = cpu_to_le32(mrw->lkey); in bnxt_qplib_free_mrw()
499 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_free_mrw()
501 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_free_mrw()
506 if (mrw->hwq.max_elements) in bnxt_qplib_free_mrw()
507 bnxt_qplib_free_hwq(res, &mrw->hwq); in bnxt_qplib_free_mrw()
514 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_alloc_mrw()
516 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_alloc_mrw() local
525 req.pd_id = cpu_to_le32(mrw->pd->id); in bnxt_qplib_alloc_mrw()
526 req.mrw_flags = mrw->type; in bnxt_qplib_alloc_mrw()
527 if ((mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_PMR && in bnxt_qplib_alloc_mrw()
528 mrw->access_flags & BNXT_QPLIB_FR_PMR) || in bnxt_qplib_alloc_mrw()
529 mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2A || in bnxt_qplib_alloc_mrw()
530 mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2B) in bnxt_qplib_alloc_mrw()
535 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_alloc_mrw()
537 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_alloc_mrw()
541 if ((mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE1) || in bnxt_qplib_alloc_mrw()
542 (mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2A) || in bnxt_qplib_alloc_mrw()
543 (mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2B)) in bnxt_qplib_alloc_mrw()
544 mrw->rkey = le32_to_cpu(resp.xid); in bnxt_qplib_alloc_mrw()
546 mrw->lkey = le32_to_cpu(resp.xid); in bnxt_qplib_alloc_mrw()
553 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_dereg_mrw()
555 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_dereg_mrw() local
563 req.lkey = cpu_to_le32(mrw->lkey); in bnxt_qplib_dereg_mrw()
564 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_dereg_mrw()
566 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_dereg_mrw()
571 if (mrw->hwq.max_elements) { in bnxt_qplib_dereg_mrw()
572 mrw->va = 0; in bnxt_qplib_dereg_mrw()
573 mrw->total_size = 0; in bnxt_qplib_dereg_mrw()
574 bnxt_qplib_free_hwq(res, &mrw->hwq); in bnxt_qplib_dereg_mrw()
583 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_reg_mr()
587 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_reg_mr() local
595 /* Allocate memory for the non-leaf pages to store buf ptrs. in bnxt_qplib_reg_mr()
596 * Non-leaf pages always uses system PAGE_SIZE in bnxt_qplib_reg_mr()
599 if (mr->hwq.max_elements) in bnxt_qplib_reg_mr()
600 bnxt_qplib_free_hwq(res, &mr->hwq); in bnxt_qplib_reg_mr()
606 hwq_attr.sginfo->umem = umem; in bnxt_qplib_reg_mr()
607 hwq_attr.sginfo->npages = pages; in bnxt_qplib_reg_mr()
608 hwq_attr.sginfo->pgsize = buf_pg_size; in bnxt_qplib_reg_mr()
609 hwq_attr.sginfo->pgshft = ilog2(buf_pg_size); in bnxt_qplib_reg_mr()
610 rc = bnxt_qplib_alloc_init_hwq(&mr->hwq, &hwq_attr); in bnxt_qplib_reg_mr()
612 dev_err(&res->pdev->dev, in bnxt_qplib_reg_mr()
614 return -ENOMEM; in bnxt_qplib_reg_mr()
623 if (mr->hwq.level == PBL_LVL_MAX) { in bnxt_qplib_reg_mr()
629 level = mr->hwq.level; in bnxt_qplib_reg_mr()
630 req.pbl = cpu_to_le64(mr->hwq.pbl[PBL_LVL_0].pg_map_arr[0]); in bnxt_qplib_reg_mr()
640 req.access = (mr->access_flags & BNXT_QPLIB_MR_ACCESS_MASK); in bnxt_qplib_reg_mr()
641 req.va = cpu_to_le64(mr->va); in bnxt_qplib_reg_mr()
642 req.key = cpu_to_le32(mr->lkey); in bnxt_qplib_reg_mr()
644 req.key = cpu_to_le32(mr->pd->id); in bnxt_qplib_reg_mr()
645 req.flags = cpu_to_le16(mr->flags); in bnxt_qplib_reg_mr()
646 req.mr_size = cpu_to_le64(mr->total_size); in bnxt_qplib_reg_mr()
648 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_reg_mr()
650 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_reg_mr()
655 mr->lkey = le32_to_cpu(resp.xid); in bnxt_qplib_reg_mr()
656 mr->rkey = mr->lkey; in bnxt_qplib_reg_mr()
662 if (mr->hwq.max_elements) in bnxt_qplib_reg_mr()
663 bnxt_qplib_free_hwq(res, &mr->hwq); in bnxt_qplib_reg_mr()
675 /* Re-calculate the max to fit the HWQ allocation model */ in bnxt_qplib_alloc_fast_reg_page_list()
682 return -ENOMEM; in bnxt_qplib_alloc_fast_reg_page_list()
692 rc = bnxt_qplib_alloc_init_hwq(&frpl->hwq, &hwq_attr); in bnxt_qplib_alloc_fast_reg_page_list()
694 frpl->max_pg_ptrs = pg_ptrs; in bnxt_qplib_alloc_fast_reg_page_list()
702 bnxt_qplib_free_hwq(res, &frpl->hwq); in bnxt_qplib_free_fast_reg_page_list()
712 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_get_roce_stats() local
721 sbuf.sb = dma_alloc_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_get_roce_stats()
724 return -ENOMEM; in bnxt_qplib_get_roce_stats()
728 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, &sbuf, sizeof(req), in bnxt_qplib_get_roce_stats()
730 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_get_roce_stats()
734 stats->to_retransmits = le64_to_cpu(sb->to_retransmits); in bnxt_qplib_get_roce_stats()
735 stats->seq_err_naks_rcvd = le64_to_cpu(sb->seq_err_naks_rcvd); in bnxt_qplib_get_roce_stats()
736 stats->max_retry_exceeded = le64_to_cpu(sb->max_retry_exceeded); in bnxt_qplib_get_roce_stats()
737 stats->rnr_naks_rcvd = le64_to_cpu(sb->rnr_naks_rcvd); in bnxt_qplib_get_roce_stats()
738 stats->missing_resp = le64_to_cpu(sb->missing_resp); in bnxt_qplib_get_roce_stats()
739 stats->unrecoverable_err = le64_to_cpu(sb->unrecoverable_err); in bnxt_qplib_get_roce_stats()
740 stats->bad_resp_err = le64_to_cpu(sb->bad_resp_err); in bnxt_qplib_get_roce_stats()
741 stats->local_qp_op_err = le64_to_cpu(sb->local_qp_op_err); in bnxt_qplib_get_roce_stats()
742 stats->local_protection_err = le64_to_cpu(sb->local_protection_err); in bnxt_qplib_get_roce_stats()
743 stats->mem_mgmt_op_err = le64_to_cpu(sb->mem_mgmt_op_err); in bnxt_qplib_get_roce_stats()
744 stats->remote_invalid_req_err = le64_to_cpu(sb->remote_invalid_req_err); in bnxt_qplib_get_roce_stats()
745 stats->remote_access_err = le64_to_cpu(sb->remote_access_err); in bnxt_qplib_get_roce_stats()
746 stats->remote_op_err = le64_to_cpu(sb->remote_op_err); in bnxt_qplib_get_roce_stats()
747 stats->dup_req = le64_to_cpu(sb->dup_req); in bnxt_qplib_get_roce_stats()
748 stats->res_exceed_max = le64_to_cpu(sb->res_exceed_max); in bnxt_qplib_get_roce_stats()
749 stats->res_length_mismatch = le64_to_cpu(sb->res_length_mismatch); in bnxt_qplib_get_roce_stats()
750 stats->res_exceeds_wqe = le64_to_cpu(sb->res_exceeds_wqe); in bnxt_qplib_get_roce_stats()
751 stats->res_opcode_err = le64_to_cpu(sb->res_opcode_err); in bnxt_qplib_get_roce_stats()
752 stats->res_rx_invalid_rkey = le64_to_cpu(sb->res_rx_invalid_rkey); in bnxt_qplib_get_roce_stats()
753 stats->res_rx_domain_err = le64_to_cpu(sb->res_rx_domain_err); in bnxt_qplib_get_roce_stats()
754 stats->res_rx_no_perm = le64_to_cpu(sb->res_rx_no_perm); in bnxt_qplib_get_roce_stats()
755 stats->res_rx_range_err = le64_to_cpu(sb->res_rx_range_err); in bnxt_qplib_get_roce_stats()
756 stats->res_tx_invalid_rkey = le64_to_cpu(sb->res_tx_invalid_rkey); in bnxt_qplib_get_roce_stats()
757 stats->res_tx_domain_err = le64_to_cpu(sb->res_tx_domain_err); in bnxt_qplib_get_roce_stats()
758 stats->res_tx_no_perm = le64_to_cpu(sb->res_tx_no_perm); in bnxt_qplib_get_roce_stats()
759 stats->res_tx_range_err = le64_to_cpu(sb->res_tx_range_err); in bnxt_qplib_get_roce_stats()
760 stats->res_irrq_oflow = le64_to_cpu(sb->res_irrq_oflow); in bnxt_qplib_get_roce_stats()
761 stats->res_unsup_opcode = le64_to_cpu(sb->res_unsup_opcode); in bnxt_qplib_get_roce_stats()
762 stats->res_unaligned_atomic = le64_to_cpu(sb->res_unaligned_atomic); in bnxt_qplib_get_roce_stats()
763 stats->res_rem_inv_err = le64_to_cpu(sb->res_rem_inv_err); in bnxt_qplib_get_roce_stats()
764 stats->res_mem_error = le64_to_cpu(sb->res_mem_error); in bnxt_qplib_get_roce_stats()
765 stats->res_srq_err = le64_to_cpu(sb->res_srq_err); in bnxt_qplib_get_roce_stats()
766 stats->res_cmp_err = le64_to_cpu(sb->res_cmp_err); in bnxt_qplib_get_roce_stats()
767 stats->res_invalid_dup_rkey = le64_to_cpu(sb->res_invalid_dup_rkey); in bnxt_qplib_get_roce_stats()
768 stats->res_wqe_format_err = le64_to_cpu(sb->res_wqe_format_err); in bnxt_qplib_get_roce_stats()
769 stats->res_cq_load_err = le64_to_cpu(sb->res_cq_load_err); in bnxt_qplib_get_roce_stats()
770 stats->res_srq_load_err = le64_to_cpu(sb->res_srq_load_err); in bnxt_qplib_get_roce_stats()
771 stats->res_tx_pci_err = le64_to_cpu(sb->res_tx_pci_err); in bnxt_qplib_get_roce_stats()
772 stats->res_rx_pci_err = le64_to_cpu(sb->res_rx_pci_err); in bnxt_qplib_get_roce_stats()
773 if (!rcfw->init_oos_stats) { in bnxt_qplib_get_roce_stats()
774 rcfw->oos_prev = le64_to_cpu(sb->res_oos_drop_count); in bnxt_qplib_get_roce_stats()
775 rcfw->init_oos_stats = 1; in bnxt_qplib_get_roce_stats()
777 stats->res_oos_drop_count += in bnxt_qplib_get_roce_stats()
778 (le64_to_cpu(sb->res_oos_drop_count) - in bnxt_qplib_get_roce_stats()
779 rcfw->oos_prev) & BNXT_QPLIB_OOS_COUNT_MASK; in bnxt_qplib_get_roce_stats()
780 rcfw->oos_prev = le64_to_cpu(sb->res_oos_drop_count); in bnxt_qplib_get_roce_stats()
784 dma_free_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_get_roce_stats()
795 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_qext_stat() local
800 sbuf.sb = dma_alloc_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_qext_stat()
803 return -ENOMEM; in bnxt_qplib_qext_stat()
812 if (bnxt_qplib_is_chip_gen_p7(rcfw->res->cctx) && rcfw->res->is_vf) in bnxt_qplib_qext_stat()
820 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, &sbuf, sizeof(req), in bnxt_qplib_qext_stat()
822 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_qext_stat()
826 estat->tx_atomic_req = le64_to_cpu(sb->tx_atomic_req_pkts); in bnxt_qplib_qext_stat()
827 estat->tx_read_req = le64_to_cpu(sb->tx_read_req_pkts); in bnxt_qplib_qext_stat()
828 estat->tx_read_res = le64_to_cpu(sb->tx_read_res_pkts); in bnxt_qplib_qext_stat()
829 estat->tx_write_req = le64_to_cpu(sb->tx_write_req_pkts); in bnxt_qplib_qext_stat()
830 estat->tx_send_req = le64_to_cpu(sb->tx_send_req_pkts); in bnxt_qplib_qext_stat()
831 estat->tx_roce_pkts = le64_to_cpu(sb->tx_roce_pkts); in bnxt_qplib_qext_stat()
832 estat->tx_roce_bytes = le64_to_cpu(sb->tx_roce_bytes); in bnxt_qplib_qext_stat()
833 estat->rx_atomic_req = le64_to_cpu(sb->rx_atomic_req_pkts); in bnxt_qplib_qext_stat()
834 estat->rx_read_req = le64_to_cpu(sb->rx_read_req_pkts); in bnxt_qplib_qext_stat()
835 estat->rx_read_res = le64_to_cpu(sb->rx_read_res_pkts); in bnxt_qplib_qext_stat()
836 estat->rx_write_req = le64_to_cpu(sb->rx_write_req_pkts); in bnxt_qplib_qext_stat()
837 estat->rx_send_req = le64_to_cpu(sb->rx_send_req_pkts); in bnxt_qplib_qext_stat()
838 estat->rx_roce_pkts = le64_to_cpu(sb->rx_roce_pkts); in bnxt_qplib_qext_stat()
839 estat->rx_roce_bytes = le64_to_cpu(sb->rx_roce_bytes); in bnxt_qplib_qext_stat()
840 estat->rx_roce_good_pkts = le64_to_cpu(sb->rx_roce_good_pkts); in bnxt_qplib_qext_stat()
841 estat->rx_roce_good_bytes = le64_to_cpu(sb->rx_roce_good_bytes); in bnxt_qplib_qext_stat()
842 estat->rx_out_of_buffer = le64_to_cpu(sb->rx_out_of_buffer_pkts); in bnxt_qplib_qext_stat()
843 estat->rx_out_of_sequence = le64_to_cpu(sb->rx_out_of_sequence_pkts); in bnxt_qplib_qext_stat()
844 estat->tx_cnp = le64_to_cpu(sb->tx_cnp_pkts); in bnxt_qplib_qext_stat()
845 estat->rx_cnp = le64_to_cpu(sb->rx_cnp_pkts); in bnxt_qplib_qext_stat()
846 estat->rx_ecn_marked = le64_to_cpu(sb->rx_ecn_marked_pkts); in bnxt_qplib_qext_stat()
849 dma_free_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_qext_stat()
857 ext_req->modify_mask = cpu_to_le64(cc_ext->ext_mask); in bnxt_qplib_fill_cc_gen1()
858 cc_ext->ext_mask = 0; in bnxt_qplib_fill_cc_gen1()
859 ext_req->inactivity_th_hi = cpu_to_le16(cc_ext->inact_th_hi); in bnxt_qplib_fill_cc_gen1()
860 ext_req->min_time_between_cnps = cpu_to_le16(cc_ext->min_delta_cnp); in bnxt_qplib_fill_cc_gen1()
861 ext_req->init_cp = cpu_to_le16(cc_ext->init_cp); in bnxt_qplib_fill_cc_gen1()
862 ext_req->tr_update_mode = cc_ext->tr_update_mode; in bnxt_qplib_fill_cc_gen1()
863 ext_req->tr_update_cycles = cc_ext->tr_update_cyls; in bnxt_qplib_fill_cc_gen1()
864 ext_req->fr_num_rtts = cc_ext->fr_rtt; in bnxt_qplib_fill_cc_gen1()
865 ext_req->ai_rate_increase = cc_ext->ai_rate_incr; in bnxt_qplib_fill_cc_gen1()
866 ext_req->reduction_relax_rtts_th = cpu_to_le16(cc_ext->rr_rtt_th); in bnxt_qplib_fill_cc_gen1()
867 ext_req->additional_relax_cr_th = cpu_to_le16(cc_ext->ar_cr_th); in bnxt_qplib_fill_cc_gen1()
868 ext_req->cr_min_th = cpu_to_le16(cc_ext->cr_min_th); in bnxt_qplib_fill_cc_gen1()
869 ext_req->bw_avg_weight = cc_ext->bw_avg_weight; in bnxt_qplib_fill_cc_gen1()
870 ext_req->actual_cr_factor = cc_ext->cr_factor; in bnxt_qplib_fill_cc_gen1()
871 ext_req->max_cp_cr_th = cpu_to_le16(cc_ext->cr_th_max_cp); in bnxt_qplib_fill_cc_gen1()
872 ext_req->cp_bias_en = cc_ext->cp_bias_en; in bnxt_qplib_fill_cc_gen1()
873 ext_req->cp_bias = cc_ext->cp_bias; in bnxt_qplib_fill_cc_gen1()
874 ext_req->cnp_ecn = cc_ext->cnp_ecn; in bnxt_qplib_fill_cc_gen1()
875 ext_req->rtt_jitter_en = cc_ext->rtt_jitter_en; in bnxt_qplib_fill_cc_gen1()
876 ext_req->link_bytes_per_usec = cpu_to_le16(cc_ext->bytes_per_usec); in bnxt_qplib_fill_cc_gen1()
877 ext_req->reset_cc_cr_th = cpu_to_le16(cc_ext->cc_cr_reset_th); in bnxt_qplib_fill_cc_gen1()
878 ext_req->cr_width = cc_ext->cr_width; in bnxt_qplib_fill_cc_gen1()
879 ext_req->quota_period_min = cc_ext->min_quota; in bnxt_qplib_fill_cc_gen1()
880 ext_req->quota_period_max = cc_ext->max_quota; in bnxt_qplib_fill_cc_gen1()
881 ext_req->quota_period_abs_max = cc_ext->abs_max_quota; in bnxt_qplib_fill_cc_gen1()
882 ext_req->tr_lower_bound = cpu_to_le16(cc_ext->tr_lb); in bnxt_qplib_fill_cc_gen1()
883 ext_req->cr_prob_factor = cc_ext->cr_prob_fac; in bnxt_qplib_fill_cc_gen1()
884 ext_req->tr_prob_factor = cc_ext->tr_prob_fac; in bnxt_qplib_fill_cc_gen1()
885 ext_req->fairness_cr_th = cpu_to_le16(cc_ext->fair_cr_th); in bnxt_qplib_fill_cc_gen1()
886 ext_req->red_div = cc_ext->red_div; in bnxt_qplib_fill_cc_gen1()
887 ext_req->cnp_ratio_th = cc_ext->cnp_ratio_th; in bnxt_qplib_fill_cc_gen1()
888 ext_req->exp_ai_rtts = cpu_to_le16(cc_ext->ai_ext_rtt); in bnxt_qplib_fill_cc_gen1()
889 ext_req->exp_ai_cr_cp_ratio = cc_ext->exp_crcp_ratio; in bnxt_qplib_fill_cc_gen1()
890 ext_req->use_rate_table = cc_ext->low_rate_en; in bnxt_qplib_fill_cc_gen1()
891 ext_req->cp_exp_update_th = cpu_to_le16(cc_ext->cpcr_update_th); in bnxt_qplib_fill_cc_gen1()
892 ext_req->high_exp_ai_rtts_th1 = cpu_to_le16(cc_ext->ai_rtt_th1); in bnxt_qplib_fill_cc_gen1()
893 ext_req->high_exp_ai_rtts_th2 = cpu_to_le16(cc_ext->ai_rtt_th2); in bnxt_qplib_fill_cc_gen1()
894 ext_req->actual_cr_cong_free_rtts_th = cpu_to_le16(cc_ext->cf_rtt_th); in bnxt_qplib_fill_cc_gen1()
895 ext_req->severe_cong_cr_th1 = cpu_to_le16(cc_ext->sc_cr_th1); in bnxt_qplib_fill_cc_gen1()
896 ext_req->severe_cong_cr_th2 = cpu_to_le16(cc_ext->sc_cr_th2); in bnxt_qplib_fill_cc_gen1()
897 ext_req->link64B_per_rtt = cpu_to_le32(cc_ext->l64B_per_rtt); in bnxt_qplib_fill_cc_gen1()
898 ext_req->cc_ack_bytes = cc_ext->cc_ack_bytes; in bnxt_qplib_fill_cc_gen1()
906 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_modify_cc() local
918 req->modify_mask = cpu_to_le32(cc_param->mask); in bnxt_qplib_modify_cc()
919 req->enable_cc = cc_param->enable; in bnxt_qplib_modify_cc()
920 req->g = cc_param->g; in bnxt_qplib_modify_cc()
921 req->num_phases_per_state = cc_param->nph_per_state; in bnxt_qplib_modify_cc()
922 req->time_per_phase = cc_param->time_pph; in bnxt_qplib_modify_cc()
923 req->pkts_per_phase = cc_param->pkts_pph; in bnxt_qplib_modify_cc()
924 req->init_cr = cpu_to_le16(cc_param->init_cr); in bnxt_qplib_modify_cc()
925 req->init_tr = cpu_to_le16(cc_param->init_tr); in bnxt_qplib_modify_cc()
926 req->tos_dscp_tos_ecn = (cc_param->tos_dscp << CMDQ_MODIFY_ROCE_CC_TOS_DSCP_SFT) | in bnxt_qplib_modify_cc()
927 (cc_param->tos_ecn & CMDQ_MODIFY_ROCE_CC_TOS_ECN_MASK); in bnxt_qplib_modify_cc()
928 req->alt_vlan_pcp = cc_param->alt_vlan_pcp; in bnxt_qplib_modify_cc()
929 req->alt_tos_dscp = cpu_to_le16(cc_param->alt_tos_dscp); in bnxt_qplib_modify_cc()
930 req->rtt = cpu_to_le16(cc_param->rtt); in bnxt_qplib_modify_cc()
931 req->tcp_cp = cpu_to_le16(cc_param->tcp_cp); in bnxt_qplib_modify_cc()
932 req->cc_mode = cc_param->cc_mode; in bnxt_qplib_modify_cc()
933 req->inactivity_th = cpu_to_le16(cc_param->inact_th); in bnxt_qplib_modify_cc()
936 if (bnxt_qplib_is_chip_gen_p5_p7(res->cctx)) { in bnxt_qplib_modify_cc()
950 payload = sizeof(struct cmdq_modify_roce_cc_gen1_tlv) - in bnxt_qplib_modify_cc()
953 bnxt_qplib_fill_cc_gen1(&tlv_req.ext_req, &cc_param->cc_ext); in bnxt_qplib_modify_cc()
956 bnxt_qplib_fill_cmdqmsg(&msg, cmd, &resp, NULL, req_size, in bnxt_qplib_modify_cc()
958 rc = bnxt_qplib_rcfw_send_message(res->rcfw, &msg); in bnxt_qplib_modify_cc()
966 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_read_context() local
972 sbuf.sb = dma_alloc_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_read_context()
975 return -ENOMEM; in bnxt_qplib_read_context()
985 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, &sbuf, sizeof(req), in bnxt_qplib_read_context()
987 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_read_context()
993 dma_free_coherent(&rcfw->pdev->dev, sbuf.size, sbuf.sb, sbuf.dma_addr); in bnxt_qplib_read_context()
1000 cc_ext->inact_th_hi = le16_to_cpu(sb->inactivity_th_hi); in bnxt_qplib_read_cc_gen1()
1001 cc_ext->min_delta_cnp = le16_to_cpu(sb->min_time_between_cnps); in bnxt_qplib_read_cc_gen1()
1002 cc_ext->init_cp = le16_to_cpu(sb->init_cp); in bnxt_qplib_read_cc_gen1()
1003 cc_ext->tr_update_mode = sb->tr_update_mode; in bnxt_qplib_read_cc_gen1()
1004 cc_ext->tr_update_cyls = sb->tr_update_cycles; in bnxt_qplib_read_cc_gen1()
1005 cc_ext->fr_rtt = sb->fr_num_rtts; in bnxt_qplib_read_cc_gen1()
1006 cc_ext->ai_rate_incr = sb->ai_rate_increase; in bnxt_qplib_read_cc_gen1()
1007 cc_ext->rr_rtt_th = le16_to_cpu(sb->reduction_relax_rtts_th); in bnxt_qplib_read_cc_gen1()
1008 cc_ext->ar_cr_th = le16_to_cpu(sb->additional_relax_cr_th); in bnxt_qplib_read_cc_gen1()
1009 cc_ext->cr_min_th = le16_to_cpu(sb->cr_min_th); in bnxt_qplib_read_cc_gen1()
1010 cc_ext->bw_avg_weight = sb->bw_avg_weight; in bnxt_qplib_read_cc_gen1()
1011 cc_ext->cr_factor = sb->actual_cr_factor; in bnxt_qplib_read_cc_gen1()
1012 cc_ext->cr_th_max_cp = le16_to_cpu(sb->max_cp_cr_th); in bnxt_qplib_read_cc_gen1()
1013 cc_ext->cp_bias_en = sb->cp_bias_en; in bnxt_qplib_read_cc_gen1()
1014 cc_ext->cp_bias = sb->cp_bias; in bnxt_qplib_read_cc_gen1()
1015 cc_ext->cnp_ecn = sb->cnp_ecn; in bnxt_qplib_read_cc_gen1()
1016 cc_ext->rtt_jitter_en = sb->rtt_jitter_en; in bnxt_qplib_read_cc_gen1()
1017 cc_ext->bytes_per_usec = le16_to_cpu(sb->link_bytes_per_usec); in bnxt_qplib_read_cc_gen1()
1018 cc_ext->cc_cr_reset_th = le16_to_cpu(sb->reset_cc_cr_th); in bnxt_qplib_read_cc_gen1()
1019 cc_ext->cr_width = sb->cr_width; in bnxt_qplib_read_cc_gen1()
1020 cc_ext->min_quota = sb->quota_period_min; in bnxt_qplib_read_cc_gen1()
1021 cc_ext->max_quota = sb->quota_period_max; in bnxt_qplib_read_cc_gen1()
1022 cc_ext->abs_max_quota = sb->quota_period_abs_max; in bnxt_qplib_read_cc_gen1()
1023 cc_ext->tr_lb = le16_to_cpu(sb->tr_lower_bound); in bnxt_qplib_read_cc_gen1()
1024 cc_ext->cr_prob_fac = sb->cr_prob_factor; in bnxt_qplib_read_cc_gen1()
1025 cc_ext->tr_prob_fac = sb->tr_prob_factor; in bnxt_qplib_read_cc_gen1()
1026 cc_ext->fair_cr_th = le16_to_cpu(sb->fairness_cr_th); in bnxt_qplib_read_cc_gen1()
1027 cc_ext->red_div = sb->red_div; in bnxt_qplib_read_cc_gen1()
1028 cc_ext->cnp_ratio_th = sb->cnp_ratio_th; in bnxt_qplib_read_cc_gen1()
1029 cc_ext->ai_ext_rtt = le16_to_cpu(sb->exp_ai_rtts); in bnxt_qplib_read_cc_gen1()
1030 cc_ext->exp_crcp_ratio = sb->exp_ai_cr_cp_ratio; in bnxt_qplib_read_cc_gen1()
1031 cc_ext->low_rate_en = sb->use_rate_table; in bnxt_qplib_read_cc_gen1()
1032 cc_ext->cpcr_update_th = le16_to_cpu(sb->cp_exp_update_th); in bnxt_qplib_read_cc_gen1()
1033 cc_ext->ai_rtt_th1 = le16_to_cpu(sb->high_exp_ai_rtts_th1); in bnxt_qplib_read_cc_gen1()
1034 cc_ext->ai_rtt_th2 = le16_to_cpu(sb->high_exp_ai_rtts_th2); in bnxt_qplib_read_cc_gen1()
1035 cc_ext->cf_rtt_th = le16_to_cpu(sb->actual_cr_cong_free_rtts_th); in bnxt_qplib_read_cc_gen1()
1036 cc_ext->sc_cr_th1 = le16_to_cpu(sb->severe_cong_cr_th1); in bnxt_qplib_read_cc_gen1()
1037 cc_ext->sc_cr_th2 = le16_to_cpu(sb->severe_cong_cr_th2); in bnxt_qplib_read_cc_gen1()
1038 cc_ext->l64B_per_rtt = le32_to_cpu(sb->link64B_per_rtt); in bnxt_qplib_read_cc_gen1()
1039 cc_ext->cc_ack_bytes = sb->cc_ack_bytes; in bnxt_qplib_read_cc_gen1()
1040 cc_ext->reduce_cf_rtt_th = le16_to_cpu(sb->reduce_init_cong_free_rtts_th); in bnxt_qplib_read_cc_gen1()
1047 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_query_cc_param()
1050 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_query_cc_param() local
1059 if (bnxt_qplib_is_chip_gen_p5_p7(res->cctx)) in bnxt_qplib_query_cc_param()
1065 sbuf.sb = dma_alloc_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_query_cc_param()
1068 return -ENOMEM; in bnxt_qplib_query_cc_param()
1071 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, &sbuf, sizeof(req), in bnxt_qplib_query_cc_param()
1073 rc = bnxt_qplib_rcfw_send_message(res->rcfw, &msg); in bnxt_qplib_query_cc_param()
1078 sb = bnxt_qplib_is_chip_gen_p5_p7(res->cctx) ? &ext_sb->base_sb : in bnxt_qplib_query_cc_param()
1081 cc_param->enable = sb->enable_cc & CREQ_QUERY_ROCE_CC_RESP_SB_ENABLE_CC; in bnxt_qplib_query_cc_param()
1082 cc_param->tos_ecn = (sb->tos_dscp_tos_ecn & in bnxt_qplib_query_cc_param()
1085 cc_param->tos_dscp = (sb->tos_dscp_tos_ecn & in bnxt_qplib_query_cc_param()
1088 cc_param->alt_tos_dscp = sb->alt_tos_dscp; in bnxt_qplib_query_cc_param()
1089 cc_param->alt_vlan_pcp = sb->alt_vlan_pcp; in bnxt_qplib_query_cc_param()
1091 cc_param->g = sb->g; in bnxt_qplib_query_cc_param()
1092 cc_param->nph_per_state = sb->num_phases_per_state; in bnxt_qplib_query_cc_param()
1093 cc_param->init_cr = le16_to_cpu(sb->init_cr); in bnxt_qplib_query_cc_param()
1094 cc_param->init_tr = le16_to_cpu(sb->init_tr); in bnxt_qplib_query_cc_param()
1095 cc_param->cc_mode = sb->cc_mode; in bnxt_qplib_query_cc_param()
1096 cc_param->inact_th = le16_to_cpu(sb->inactivity_th); in bnxt_qplib_query_cc_param()
1097 cc_param->rtt = le16_to_cpu(sb->rtt); in bnxt_qplib_query_cc_param()
1098 cc_param->tcp_cp = le16_to_cpu(sb->tcp_cp); in bnxt_qplib_query_cc_param()
1099 cc_param->time_pph = sb->time_per_phase; in bnxt_qplib_query_cc_param()
1100 cc_param->pkts_pph = sb->pkts_per_phase; in bnxt_qplib_query_cc_param()
1101 if (bnxt_qplib_is_chip_gen_p5_p7(res->cctx)) { in bnxt_qplib_query_cc_param()
1102 bnxt_qplib_read_cc_gen1(&cc_param->cc_ext, &ext_sb->gen1_sb); in bnxt_qplib_query_cc_param()
1103 cc_param->inact_th |= (cc_param->cc_ext.inact_th_hi & 0x3F) << 16; in bnxt_qplib_query_cc_param()
1106 dma_free_coherent(&rcfw->pdev->dev, sbuf.size, sbuf.sb, sbuf.dma_addr); in bnxt_qplib_query_cc_param()
1113 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_create_flow()
1115 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_create_flow() local
1123 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_create_flow()
1125 return bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_create_flow()
1131 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_destroy_flow()
1133 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_destroy_flow() local
1141 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_destroy_flow()
1144 return bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_destroy_flow()