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()
73 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_query_version() local
81 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), sizeof(resp), 0); in bnxt_qplib_query_version()
82 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_query_version()
93 struct bnxt_qplib_dev_attr *attr = rcfw->res->dattr; in bnxt_qplib_get_dev_attr()
95 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_get_dev_attr() local
104 cctx = rcfw->res->cctx; in bnxt_qplib_get_dev_attr()
110 sbuf.sb = dma_alloc_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_get_dev_attr()
113 return -ENOMEM; in bnxt_qplib_get_dev_attr()
116 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, &sbuf, sizeof(req), in bnxt_qplib_get_dev_attr()
118 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_get_dev_attr()
123 attr->max_qp = le32_to_cpu(sb->max_qp); in bnxt_qplib_get_dev_attr()
125 attr->max_qp += 1; in bnxt_qplib_get_dev_attr()
126 attr->max_qp_rd_atom = in bnxt_qplib_get_dev_attr()
127 sb->max_qp_rd_atom > BNXT_QPLIB_MAX_OUT_RD_ATOM ? in bnxt_qplib_get_dev_attr()
128 BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_rd_atom; in bnxt_qplib_get_dev_attr()
129 attr->max_qp_init_rd_atom = in bnxt_qplib_get_dev_attr()
130 sb->max_qp_init_rd_atom > BNXT_QPLIB_MAX_OUT_RD_ATOM ? in bnxt_qplib_get_dev_attr()
131 BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_init_rd_atom; in bnxt_qplib_get_dev_attr()
132 attr->max_qp_wqes = le16_to_cpu(sb->max_qp_wr) - 1; in bnxt_qplib_get_dev_attr()
133 if (!bnxt_qplib_is_chip_gen_p5_p7(rcfw->res->cctx)) { in bnxt_qplib_get_dev_attr()
136 * reporting the max number on legacy devices in bnxt_qplib_get_dev_attr()
138 attr->max_qp_wqes -= BNXT_QPLIB_RESERVED_QP_WRS + 1; in bnxt_qplib_get_dev_attr()
142 if (cctx->modes.wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE) in bnxt_qplib_get_dev_attr()
143 attr->max_qp_wqes = BNXT_VAR_MAX_WQE - 1; in bnxt_qplib_get_dev_attr()
145 attr->max_qp_sges = cctx->modes.wqe_mode == BNXT_QPLIB_WQE_MODE_VARIABLE ? in bnxt_qplib_get_dev_attr()
146 min_t(u32, sb->max_sge_var_wqe, BNXT_VAR_MAX_SGE) : 6; in bnxt_qplib_get_dev_attr()
147 attr->max_cq = le32_to_cpu(sb->max_cq); in bnxt_qplib_get_dev_attr()
148 attr->max_cq_wqes = le32_to_cpu(sb->max_cqe); in bnxt_qplib_get_dev_attr()
149 if (!bnxt_qplib_is_chip_gen_p7(rcfw->res->cctx)) in bnxt_qplib_get_dev_attr()
150 attr->max_cq_wqes = min_t(u32, BNXT_QPLIB_MAX_CQ_WQES, attr->max_cq_wqes); in bnxt_qplib_get_dev_attr()
151 attr->max_cq_sges = attr->max_qp_sges; in bnxt_qplib_get_dev_attr()
152 attr->max_mr = le32_to_cpu(sb->max_mr); in bnxt_qplib_get_dev_attr()
153 attr->max_mw = le32_to_cpu(sb->max_mw); in bnxt_qplib_get_dev_attr()
155 attr->max_mr_size = le64_to_cpu(sb->max_mr_size); in bnxt_qplib_get_dev_attr()
156 attr->max_pd = 64 * 1024; in bnxt_qplib_get_dev_attr()
157 attr->max_raw_ethy_qp = le32_to_cpu(sb->max_raw_eth_qp); in bnxt_qplib_get_dev_attr()
158 attr->max_ah = le32_to_cpu(sb->max_ah); in bnxt_qplib_get_dev_attr()
160 attr->max_srq = le16_to_cpu(sb->max_srq); in bnxt_qplib_get_dev_attr()
161 attr->max_srq_wqes = le32_to_cpu(sb->max_srq_wr) - 1; in bnxt_qplib_get_dev_attr()
162 attr->max_srq_sges = sb->max_srq_sge; in bnxt_qplib_get_dev_attr()
163 attr->max_pkey = 1; in bnxt_qplib_get_dev_attr()
164 attr->max_inline_data = le32_to_cpu(sb->max_inline_data); in bnxt_qplib_get_dev_attr()
165 if (!bnxt_qplib_is_chip_gen_p7(rcfw->res->cctx)) in bnxt_qplib_get_dev_attr()
166 attr->l2_db_size = (sb->l2_db_space_size + 1) * in bnxt_qplib_get_dev_attr()
169 * Read the max gid supported by HW. in bnxt_qplib_get_dev_attr()
174 attr->max_sgid = le32_to_cpu(sb->max_gid); in bnxt_qplib_get_dev_attr()
175 attr->max_sgid = min_t(u32, BNXT_QPLIB_NUM_GIDS_SUPPORTED, 2 * attr->max_sgid); in bnxt_qplib_get_dev_attr()
176 attr->dev_cap_flags = le16_to_cpu(sb->dev_cap_flags); in bnxt_qplib_get_dev_attr()
177 attr->dev_cap_flags2 = le16_to_cpu(sb->dev_cap_ext_flags_2); in bnxt_qplib_get_dev_attr()
179 if (_is_max_srq_ext_supported(attr->dev_cap_flags2)) in bnxt_qplib_get_dev_attr()
180 attr->max_srq += le16_to_cpu(sb->max_srq_ext); in bnxt_qplib_get_dev_attr()
182 bnxt_qplib_query_version(rcfw, attr->fw_ver); in bnxt_qplib_get_dev_attr()
185 temp = le32_to_cpu(sb->tqm_alloc_reqs[i]); in bnxt_qplib_get_dev_attr()
187 attr->tqm_alloc_reqs[i * 4] = *tqm_alloc; in bnxt_qplib_get_dev_attr()
188 attr->tqm_alloc_reqs[i * 4 + 1] = *(++tqm_alloc); in bnxt_qplib_get_dev_attr()
189 attr->tqm_alloc_reqs[i * 4 + 2] = *(++tqm_alloc); in bnxt_qplib_get_dev_attr()
190 attr->tqm_alloc_reqs[i * 4 + 3] = *(++tqm_alloc); in bnxt_qplib_get_dev_attr()
193 if (rcfw->res->cctx->hwrm_intf_ver >= HWRM_VERSION_DEV_ATTR_MAX_DPI) in bnxt_qplib_get_dev_attr()
194 attr->max_dpi = le32_to_cpu(sb->max_dpi); in bnxt_qplib_get_dev_attr()
196 attr->is_atomic = bnxt_qplib_is_atomic_cap(rcfw); in bnxt_qplib_get_dev_attr()
198 dma_free_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_get_dev_attr()
209 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_set_func_resources() local
216 req.number_of_qp = cpu_to_le32(ctx->qpc_count); in bnxt_qplib_set_func_resources()
217 req.number_of_mrw = cpu_to_le32(ctx->mrw_count); in bnxt_qplib_set_func_resources()
218 req.number_of_srq = cpu_to_le32(ctx->srqc_count); in bnxt_qplib_set_func_resources()
219 req.number_of_cq = cpu_to_le32(ctx->cq_count); in bnxt_qplib_set_func_resources()
221 req.max_qp_per_vf = cpu_to_le32(ctx->vf_res.max_qp_per_vf); in bnxt_qplib_set_func_resources()
222 req.max_mrw_per_vf = cpu_to_le32(ctx->vf_res.max_mrw_per_vf); in bnxt_qplib_set_func_resources()
223 req.max_srq_per_vf = cpu_to_le32(ctx->vf_res.max_srq_per_vf); in bnxt_qplib_set_func_resources()
224 req.max_cq_per_vf = cpu_to_le32(ctx->vf_res.max_cq_per_vf); in bnxt_qplib_set_func_resources()
225 req.max_gid_per_vf = cpu_to_le32(ctx->vf_res.max_gid_per_vf); in bnxt_qplib_set_func_resources()
227 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_set_func_resources()
229 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_set_func_resources()
231 dev_err(&res->pdev->dev, "Failed to set function resources\n"); in bnxt_qplib_set_func_resources()
241 if (index >= sgid_tbl->max) { in bnxt_qplib_get_sgid()
242 dev_err(&res->pdev->dev, in bnxt_qplib_get_sgid()
243 "Index %d exceeded SGID table max (%d)\n", in bnxt_qplib_get_sgid()
244 index, sgid_tbl->max); in bnxt_qplib_get_sgid()
245 return -EINVAL; in bnxt_qplib_get_sgid()
247 memcpy(gid, &sgid_tbl->tbl[index].gid, sizeof(*gid)); in bnxt_qplib_get_sgid()
257 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_del_sgid()
261 if (!sgid_tbl->active) { in bnxt_qplib_del_sgid()
262 dev_err(&res->pdev->dev, "SGID table has no active entries\n"); in bnxt_qplib_del_sgid()
263 return -ENOMEM; in bnxt_qplib_del_sgid()
265 for (index = 0; index < sgid_tbl->max; index++) { in bnxt_qplib_del_sgid()
266 if (!memcmp(&sgid_tbl->tbl[index].gid, gid, sizeof(*gid)) && in bnxt_qplib_del_sgid()
267 vlan_id == sgid_tbl->tbl[index].vlan_id) in bnxt_qplib_del_sgid()
270 if (index == sgid_tbl->max) { in bnxt_qplib_del_sgid()
271 dev_warn(&res->pdev->dev, "GID not found in the SGID table\n"); in bnxt_qplib_del_sgid()
277 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_del_sgid() local
284 if (sgid_tbl->hw_id[index] == 0xFFFF) { in bnxt_qplib_del_sgid()
285 dev_err(&res->pdev->dev, in bnxt_qplib_del_sgid()
287 return -EINVAL; in bnxt_qplib_del_sgid()
289 req.gid_index = cpu_to_le16(sgid_tbl->hw_id[index]); in bnxt_qplib_del_sgid()
290 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_del_sgid()
292 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_del_sgid()
296 memcpy(&sgid_tbl->tbl[index].gid, &bnxt_qplib_gid_zero, in bnxt_qplib_del_sgid()
298 sgid_tbl->tbl[index].vlan_id = 0xFFFF; in bnxt_qplib_del_sgid()
299 sgid_tbl->vlan[index] = 0; in bnxt_qplib_del_sgid()
300 sgid_tbl->active--; in bnxt_qplib_del_sgid()
301 dev_dbg(&res->pdev->dev, in bnxt_qplib_del_sgid()
303 index, sgid_tbl->hw_id[index], sgid_tbl->active); in bnxt_qplib_del_sgid()
304 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()
377 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_add_sgid()
379 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_add_sgid()
382 sgid_tbl->hw_id[free_idx] = le32_to_cpu(resp.xid); in bnxt_qplib_add_sgid()
385 memcpy(&sgid_tbl->tbl[free_idx], gid, sizeof(*gid)); in bnxt_qplib_add_sgid()
386 sgid_tbl->tbl[free_idx].vlan_id = vlan_id; in bnxt_qplib_add_sgid()
387 sgid_tbl->active++; in bnxt_qplib_add_sgid()
389 sgid_tbl->vlan[free_idx] = 1; in bnxt_qplib_add_sgid()
391 dev_dbg(&res->pdev->dev, in bnxt_qplib_add_sgid()
393 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_update_sgid()
409 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_update_sgid() local
417 req.gid[0] = cpu_to_be32(((u32 *)gid->data)[3]); in bnxt_qplib_update_sgid()
418 req.gid[1] = cpu_to_be32(((u32 *)gid->data)[2]); in bnxt_qplib_update_sgid()
419 req.gid[2] = cpu_to_be32(((u32 *)gid->data)[1]); in bnxt_qplib_update_sgid()
420 req.gid[3] = cpu_to_be32(((u32 *)gid->data)[0]); in bnxt_qplib_update_sgid()
421 if (res->prio) { in bnxt_qplib_update_sgid()
434 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_update_sgid()
436 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_update_sgid()
444 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_create_ah()
446 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_create_ah() local
456 memcpy(temp32, ah->dgid.data, sizeof(struct bnxt_qplib_gid)); in bnxt_qplib_create_ah()
462 req.type = ah->nw_type; in bnxt_qplib_create_ah()
463 req.hop_limit = ah->hop_limit; in bnxt_qplib_create_ah()
464 req.sgid_index = cpu_to_le16(res->sgid_tbl.hw_id[ah->sgid_index]); in bnxt_qplib_create_ah()
465 req.dest_vlan_id_flow_label = cpu_to_le32((ah->flow_label & in bnxt_qplib_create_ah()
468 req.pd_id = cpu_to_le32(ah->pd->id); in bnxt_qplib_create_ah()
469 req.traffic_class = ah->traffic_class; in bnxt_qplib_create_ah()
472 memcpy(temp16, ah->dmac, 6); in bnxt_qplib_create_ah()
477 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_create_ah()
479 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_create_ah()
483 ah->id = le32_to_cpu(resp.xid); in bnxt_qplib_create_ah()
490 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_destroy_ah()
492 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_destroy_ah() local
501 req.ah_cid = cpu_to_le32(ah->id); in bnxt_qplib_destroy_ah()
503 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_destroy_ah()
505 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_destroy_ah()
513 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_free_mrw()
515 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_free_mrw() local
518 if (mrw->lkey == 0xFFFFFFFF) { in bnxt_qplib_free_mrw()
519 dev_info(&res->pdev->dev, "SP: Free a reserved lkey MRW\n"); in bnxt_qplib_free_mrw()
527 req.mrw_flags = mrw->type; in bnxt_qplib_free_mrw()
529 if ((mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE1) || in bnxt_qplib_free_mrw()
530 (mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2A) || in bnxt_qplib_free_mrw()
531 (mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2B)) in bnxt_qplib_free_mrw()
532 req.key = cpu_to_le32(mrw->rkey); in bnxt_qplib_free_mrw()
534 req.key = cpu_to_le32(mrw->lkey); in bnxt_qplib_free_mrw()
536 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_free_mrw()
538 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_free_mrw()
543 if (mrw->hwq.max_elements) in bnxt_qplib_free_mrw()
544 bnxt_qplib_free_hwq(res, &mrw->hwq); in bnxt_qplib_free_mrw()
551 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_alloc_mrw()
553 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_alloc_mrw() local
562 req.pd_id = cpu_to_le32(mrw->pd->id); in bnxt_qplib_alloc_mrw()
563 req.mrw_flags = mrw->type; in bnxt_qplib_alloc_mrw()
564 if ((mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_PMR && in bnxt_qplib_alloc_mrw()
565 mrw->access_flags & BNXT_QPLIB_FR_PMR) || in bnxt_qplib_alloc_mrw()
566 mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2A || in bnxt_qplib_alloc_mrw()
567 mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2B) in bnxt_qplib_alloc_mrw()
572 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_alloc_mrw()
574 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_alloc_mrw()
578 if ((mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE1) || in bnxt_qplib_alloc_mrw()
579 (mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2A) || in bnxt_qplib_alloc_mrw()
580 (mrw->type == CMDQ_ALLOCATE_MRW_MRW_FLAGS_MW_TYPE2B)) in bnxt_qplib_alloc_mrw()
581 mrw->rkey = le32_to_cpu(resp.xid); in bnxt_qplib_alloc_mrw()
583 mrw->lkey = le32_to_cpu(resp.xid); in bnxt_qplib_alloc_mrw()
590 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_dereg_mrw()
592 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_dereg_mrw() local
600 req.lkey = cpu_to_le32(mrw->lkey); in bnxt_qplib_dereg_mrw()
601 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_dereg_mrw()
603 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_dereg_mrw()
608 if (mrw->hwq.max_elements) { in bnxt_qplib_dereg_mrw()
609 mrw->va = 0; in bnxt_qplib_dereg_mrw()
610 mrw->total_size = 0; in bnxt_qplib_dereg_mrw()
611 bnxt_qplib_free_hwq(res, &mrw->hwq); in bnxt_qplib_dereg_mrw()
620 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_reg_mr()
624 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_reg_mr() local
632 /* Allocate memory for the non-leaf pages to store buf ptrs. in bnxt_qplib_reg_mr()
633 * Non-leaf pages always uses system PAGE_SIZE in bnxt_qplib_reg_mr()
636 if (mr->hwq.max_elements) in bnxt_qplib_reg_mr()
637 bnxt_qplib_free_hwq(res, &mr->hwq); in bnxt_qplib_reg_mr()
643 hwq_attr.sginfo->umem = umem; in bnxt_qplib_reg_mr()
644 hwq_attr.sginfo->npages = pages; in bnxt_qplib_reg_mr()
645 hwq_attr.sginfo->pgsize = buf_pg_size; in bnxt_qplib_reg_mr()
646 hwq_attr.sginfo->pgshft = ilog2(buf_pg_size); in bnxt_qplib_reg_mr()
647 rc = bnxt_qplib_alloc_init_hwq(&mr->hwq, &hwq_attr); in bnxt_qplib_reg_mr()
649 dev_err(&res->pdev->dev, in bnxt_qplib_reg_mr()
651 return -ENOMEM; in bnxt_qplib_reg_mr()
660 if (mr->hwq.level == PBL_LVL_MAX) { in bnxt_qplib_reg_mr()
666 level = mr->hwq.level; in bnxt_qplib_reg_mr()
667 req.pbl = cpu_to_le64(mr->hwq.pbl[PBL_LVL_0].pg_map_arr[0]); in bnxt_qplib_reg_mr()
677 req.access = (mr->access_flags & 0xFFFF); in bnxt_qplib_reg_mr()
678 req.va = cpu_to_le64(mr->va); in bnxt_qplib_reg_mr()
679 req.key = cpu_to_le32(mr->lkey); in bnxt_qplib_reg_mr()
680 if (_is_alloc_mr_unified(res->dattr->dev_cap_flags)) in bnxt_qplib_reg_mr()
681 req.key = cpu_to_le32(mr->pd->id); in bnxt_qplib_reg_mr()
682 req.flags = cpu_to_le16(mr->flags); in bnxt_qplib_reg_mr()
683 req.mr_size = cpu_to_le64(mr->total_size); in bnxt_qplib_reg_mr()
685 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, NULL, sizeof(req), in bnxt_qplib_reg_mr()
687 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_reg_mr()
691 if (_is_alloc_mr_unified(res->dattr->dev_cap_flags)) { in bnxt_qplib_reg_mr()
692 mr->lkey = le32_to_cpu(resp.xid); in bnxt_qplib_reg_mr()
693 mr->rkey = mr->lkey; in bnxt_qplib_reg_mr()
699 if (mr->hwq.max_elements) in bnxt_qplib_reg_mr()
700 bnxt_qplib_free_hwq(res, &mr->hwq); in bnxt_qplib_reg_mr()
712 /* Re-calculate the max to fit the HWQ allocation model */ in bnxt_qplib_alloc_fast_reg_page_list()
719 return -ENOMEM; in bnxt_qplib_alloc_fast_reg_page_list()
729 rc = bnxt_qplib_alloc_init_hwq(&frpl->hwq, &hwq_attr); in bnxt_qplib_alloc_fast_reg_page_list()
731 frpl->max_pg_ptrs = pg_ptrs; in bnxt_qplib_alloc_fast_reg_page_list()
739 bnxt_qplib_free_hwq(res, &frpl->hwq); in bnxt_qplib_free_fast_reg_page_list()
749 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_get_roce_stats() local
758 sbuf.sb = dma_alloc_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_get_roce_stats()
761 return -ENOMEM; in bnxt_qplib_get_roce_stats()
765 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, &sbuf, sizeof(req), in bnxt_qplib_get_roce_stats()
767 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_get_roce_stats()
771 stats->to_retransmits = le64_to_cpu(sb->to_retransmits); in bnxt_qplib_get_roce_stats()
772 stats->seq_err_naks_rcvd = le64_to_cpu(sb->seq_err_naks_rcvd); in bnxt_qplib_get_roce_stats()
773 stats->max_retry_exceeded = le64_to_cpu(sb->max_retry_exceeded); in bnxt_qplib_get_roce_stats()
774 stats->rnr_naks_rcvd = le64_to_cpu(sb->rnr_naks_rcvd); in bnxt_qplib_get_roce_stats()
775 stats->missing_resp = le64_to_cpu(sb->missing_resp); in bnxt_qplib_get_roce_stats()
776 stats->unrecoverable_err = le64_to_cpu(sb->unrecoverable_err); in bnxt_qplib_get_roce_stats()
777 stats->bad_resp_err = le64_to_cpu(sb->bad_resp_err); in bnxt_qplib_get_roce_stats()
778 stats->local_qp_op_err = le64_to_cpu(sb->local_qp_op_err); in bnxt_qplib_get_roce_stats()
779 stats->local_protection_err = le64_to_cpu(sb->local_protection_err); in bnxt_qplib_get_roce_stats()
780 stats->mem_mgmt_op_err = le64_to_cpu(sb->mem_mgmt_op_err); in bnxt_qplib_get_roce_stats()
781 stats->remote_invalid_req_err = le64_to_cpu(sb->remote_invalid_req_err); in bnxt_qplib_get_roce_stats()
782 stats->remote_access_err = le64_to_cpu(sb->remote_access_err); in bnxt_qplib_get_roce_stats()
783 stats->remote_op_err = le64_to_cpu(sb->remote_op_err); in bnxt_qplib_get_roce_stats()
784 stats->dup_req = le64_to_cpu(sb->dup_req); in bnxt_qplib_get_roce_stats()
785 stats->res_exceed_max = le64_to_cpu(sb->res_exceed_max); in bnxt_qplib_get_roce_stats()
786 stats->res_length_mismatch = le64_to_cpu(sb->res_length_mismatch); in bnxt_qplib_get_roce_stats()
787 stats->res_exceeds_wqe = le64_to_cpu(sb->res_exceeds_wqe); in bnxt_qplib_get_roce_stats()
788 stats->res_opcode_err = le64_to_cpu(sb->res_opcode_err); in bnxt_qplib_get_roce_stats()
789 stats->res_rx_invalid_rkey = le64_to_cpu(sb->res_rx_invalid_rkey); in bnxt_qplib_get_roce_stats()
790 stats->res_rx_domain_err = le64_to_cpu(sb->res_rx_domain_err); in bnxt_qplib_get_roce_stats()
791 stats->res_rx_no_perm = le64_to_cpu(sb->res_rx_no_perm); in bnxt_qplib_get_roce_stats()
792 stats->res_rx_range_err = le64_to_cpu(sb->res_rx_range_err); in bnxt_qplib_get_roce_stats()
793 stats->res_tx_invalid_rkey = le64_to_cpu(sb->res_tx_invalid_rkey); in bnxt_qplib_get_roce_stats()
794 stats->res_tx_domain_err = le64_to_cpu(sb->res_tx_domain_err); in bnxt_qplib_get_roce_stats()
795 stats->res_tx_no_perm = le64_to_cpu(sb->res_tx_no_perm); in bnxt_qplib_get_roce_stats()
796 stats->res_tx_range_err = le64_to_cpu(sb->res_tx_range_err); in bnxt_qplib_get_roce_stats()
797 stats->res_irrq_oflow = le64_to_cpu(sb->res_irrq_oflow); in bnxt_qplib_get_roce_stats()
798 stats->res_unsup_opcode = le64_to_cpu(sb->res_unsup_opcode); in bnxt_qplib_get_roce_stats()
799 stats->res_unaligned_atomic = le64_to_cpu(sb->res_unaligned_atomic); in bnxt_qplib_get_roce_stats()
800 stats->res_rem_inv_err = le64_to_cpu(sb->res_rem_inv_err); in bnxt_qplib_get_roce_stats()
801 stats->res_mem_error = le64_to_cpu(sb->res_mem_error); in bnxt_qplib_get_roce_stats()
802 stats->res_srq_err = le64_to_cpu(sb->res_srq_err); in bnxt_qplib_get_roce_stats()
803 stats->res_cmp_err = le64_to_cpu(sb->res_cmp_err); in bnxt_qplib_get_roce_stats()
804 stats->res_invalid_dup_rkey = le64_to_cpu(sb->res_invalid_dup_rkey); in bnxt_qplib_get_roce_stats()
805 stats->res_wqe_format_err = le64_to_cpu(sb->res_wqe_format_err); in bnxt_qplib_get_roce_stats()
806 stats->res_cq_load_err = le64_to_cpu(sb->res_cq_load_err); in bnxt_qplib_get_roce_stats()
807 stats->res_srq_load_err = le64_to_cpu(sb->res_srq_load_err); in bnxt_qplib_get_roce_stats()
808 stats->res_tx_pci_err = le64_to_cpu(sb->res_tx_pci_err); in bnxt_qplib_get_roce_stats()
809 stats->res_rx_pci_err = le64_to_cpu(sb->res_rx_pci_err); in bnxt_qplib_get_roce_stats()
810 if (!rcfw->init_oos_stats) { in bnxt_qplib_get_roce_stats()
811 rcfw->oos_prev = le64_to_cpu(sb->res_oos_drop_count); in bnxt_qplib_get_roce_stats()
812 rcfw->init_oos_stats = 1; in bnxt_qplib_get_roce_stats()
814 stats->res_oos_drop_count += in bnxt_qplib_get_roce_stats()
815 (le64_to_cpu(sb->res_oos_drop_count) - in bnxt_qplib_get_roce_stats()
816 rcfw->oos_prev) & BNXT_QPLIB_OOS_COUNT_MASK; in bnxt_qplib_get_roce_stats()
817 rcfw->oos_prev = le64_to_cpu(sb->res_oos_drop_count); in bnxt_qplib_get_roce_stats()
821 dma_free_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_get_roce_stats()
832 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_qext_stat() local
837 sbuf.sb = dma_alloc_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_qext_stat()
840 return -ENOMEM; in bnxt_qplib_qext_stat()
852 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, &sbuf, sizeof(req), in bnxt_qplib_qext_stat()
854 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_qext_stat()
858 estat->tx_atomic_req = le64_to_cpu(sb->tx_atomic_req_pkts); in bnxt_qplib_qext_stat()
859 estat->tx_read_req = le64_to_cpu(sb->tx_read_req_pkts); in bnxt_qplib_qext_stat()
860 estat->tx_read_res = le64_to_cpu(sb->tx_read_res_pkts); in bnxt_qplib_qext_stat()
861 estat->tx_write_req = le64_to_cpu(sb->tx_write_req_pkts); in bnxt_qplib_qext_stat()
862 estat->tx_send_req = le64_to_cpu(sb->tx_send_req_pkts); in bnxt_qplib_qext_stat()
863 estat->tx_roce_pkts = le64_to_cpu(sb->tx_roce_pkts); in bnxt_qplib_qext_stat()
864 estat->tx_roce_bytes = le64_to_cpu(sb->tx_roce_bytes); in bnxt_qplib_qext_stat()
865 estat->rx_atomic_req = le64_to_cpu(sb->rx_atomic_req_pkts); in bnxt_qplib_qext_stat()
866 estat->rx_read_req = le64_to_cpu(sb->rx_read_req_pkts); in bnxt_qplib_qext_stat()
867 estat->rx_read_res = le64_to_cpu(sb->rx_read_res_pkts); in bnxt_qplib_qext_stat()
868 estat->rx_write_req = le64_to_cpu(sb->rx_write_req_pkts); in bnxt_qplib_qext_stat()
869 estat->rx_send_req = le64_to_cpu(sb->rx_send_req_pkts); in bnxt_qplib_qext_stat()
870 estat->rx_roce_pkts = le64_to_cpu(sb->rx_roce_pkts); in bnxt_qplib_qext_stat()
871 estat->rx_roce_bytes = le64_to_cpu(sb->rx_roce_bytes); in bnxt_qplib_qext_stat()
872 estat->rx_roce_good_pkts = le64_to_cpu(sb->rx_roce_good_pkts); in bnxt_qplib_qext_stat()
873 estat->rx_roce_good_bytes = le64_to_cpu(sb->rx_roce_good_bytes); in bnxt_qplib_qext_stat()
874 estat->rx_out_of_buffer = le64_to_cpu(sb->rx_out_of_buffer_pkts); in bnxt_qplib_qext_stat()
875 estat->rx_out_of_sequence = le64_to_cpu(sb->rx_out_of_sequence_pkts); in bnxt_qplib_qext_stat()
876 estat->tx_cnp = le64_to_cpu(sb->tx_cnp_pkts); in bnxt_qplib_qext_stat()
877 estat->rx_cnp = le64_to_cpu(sb->rx_cnp_pkts); in bnxt_qplib_qext_stat()
878 estat->rx_ecn_marked = le64_to_cpu(sb->rx_ecn_marked_pkts); in bnxt_qplib_qext_stat()
881 dma_free_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_qext_stat()
889 ext_req->modify_mask = cpu_to_le64(cc_ext->ext_mask); in bnxt_qplib_fill_cc_gen1()
890 cc_ext->ext_mask = 0; in bnxt_qplib_fill_cc_gen1()
891 ext_req->inactivity_th_hi = cpu_to_le16(cc_ext->inact_th_hi); in bnxt_qplib_fill_cc_gen1()
892 ext_req->min_time_between_cnps = cpu_to_le16(cc_ext->min_delta_cnp); in bnxt_qplib_fill_cc_gen1()
893 ext_req->init_cp = cpu_to_le16(cc_ext->init_cp); in bnxt_qplib_fill_cc_gen1()
894 ext_req->tr_update_mode = cc_ext->tr_update_mode; in bnxt_qplib_fill_cc_gen1()
895 ext_req->tr_update_cycles = cc_ext->tr_update_cyls; in bnxt_qplib_fill_cc_gen1()
896 ext_req->fr_num_rtts = cc_ext->fr_rtt; in bnxt_qplib_fill_cc_gen1()
897 ext_req->ai_rate_increase = cc_ext->ai_rate_incr; in bnxt_qplib_fill_cc_gen1()
898 ext_req->reduction_relax_rtts_th = cpu_to_le16(cc_ext->rr_rtt_th); in bnxt_qplib_fill_cc_gen1()
899 ext_req->additional_relax_cr_th = cpu_to_le16(cc_ext->ar_cr_th); in bnxt_qplib_fill_cc_gen1()
900 ext_req->cr_min_th = cpu_to_le16(cc_ext->cr_min_th); in bnxt_qplib_fill_cc_gen1()
901 ext_req->bw_avg_weight = cc_ext->bw_avg_weight; in bnxt_qplib_fill_cc_gen1()
902 ext_req->actual_cr_factor = cc_ext->cr_factor; in bnxt_qplib_fill_cc_gen1()
903 ext_req->max_cp_cr_th = cpu_to_le16(cc_ext->cr_th_max_cp); in bnxt_qplib_fill_cc_gen1()
904 ext_req->cp_bias_en = cc_ext->cp_bias_en; in bnxt_qplib_fill_cc_gen1()
905 ext_req->cp_bias = cc_ext->cp_bias; in bnxt_qplib_fill_cc_gen1()
906 ext_req->cnp_ecn = cc_ext->cnp_ecn; in bnxt_qplib_fill_cc_gen1()
907 ext_req->rtt_jitter_en = cc_ext->rtt_jitter_en; in bnxt_qplib_fill_cc_gen1()
908 ext_req->link_bytes_per_usec = cpu_to_le16(cc_ext->bytes_per_usec); in bnxt_qplib_fill_cc_gen1()
909 ext_req->reset_cc_cr_th = cpu_to_le16(cc_ext->cc_cr_reset_th); in bnxt_qplib_fill_cc_gen1()
910 ext_req->cr_width = cc_ext->cr_width; in bnxt_qplib_fill_cc_gen1()
911 ext_req->quota_period_min = cc_ext->min_quota; in bnxt_qplib_fill_cc_gen1()
912 ext_req->quota_period_max = cc_ext->max_quota; in bnxt_qplib_fill_cc_gen1()
913 ext_req->quota_period_abs_max = cc_ext->abs_max_quota; in bnxt_qplib_fill_cc_gen1()
914 ext_req->tr_lower_bound = cpu_to_le16(cc_ext->tr_lb); in bnxt_qplib_fill_cc_gen1()
915 ext_req->cr_prob_factor = cc_ext->cr_prob_fac; in bnxt_qplib_fill_cc_gen1()
916 ext_req->tr_prob_factor = cc_ext->tr_prob_fac; in bnxt_qplib_fill_cc_gen1()
917 ext_req->fairness_cr_th = cpu_to_le16(cc_ext->fair_cr_th); in bnxt_qplib_fill_cc_gen1()
918 ext_req->red_div = cc_ext->red_div; in bnxt_qplib_fill_cc_gen1()
919 ext_req->cnp_ratio_th = cc_ext->cnp_ratio_th; in bnxt_qplib_fill_cc_gen1()
920 ext_req->exp_ai_rtts = cpu_to_le16(cc_ext->ai_ext_rtt); in bnxt_qplib_fill_cc_gen1()
921 ext_req->exp_ai_cr_cp_ratio = cc_ext->exp_crcp_ratio; in bnxt_qplib_fill_cc_gen1()
922 ext_req->use_rate_table = cc_ext->low_rate_en; in bnxt_qplib_fill_cc_gen1()
923 ext_req->cp_exp_update_th = cpu_to_le16(cc_ext->cpcr_update_th); in bnxt_qplib_fill_cc_gen1()
924 ext_req->high_exp_ai_rtts_th1 = cpu_to_le16(cc_ext->ai_rtt_th1); in bnxt_qplib_fill_cc_gen1()
925 ext_req->high_exp_ai_rtts_th2 = cpu_to_le16(cc_ext->ai_rtt_th2); in bnxt_qplib_fill_cc_gen1()
926 ext_req->actual_cr_cong_free_rtts_th = cpu_to_le16(cc_ext->cf_rtt_th); in bnxt_qplib_fill_cc_gen1()
927 ext_req->severe_cong_cr_th1 = cpu_to_le16(cc_ext->sc_cr_th1); in bnxt_qplib_fill_cc_gen1()
928 ext_req->severe_cong_cr_th2 = cpu_to_le16(cc_ext->sc_cr_th2); in bnxt_qplib_fill_cc_gen1()
929 ext_req->link64B_per_rtt = cpu_to_le32(cc_ext->l64B_per_rtt); in bnxt_qplib_fill_cc_gen1()
930 ext_req->cc_ack_bytes = cc_ext->cc_ack_bytes; in bnxt_qplib_fill_cc_gen1()
938 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_modify_cc() local
950 req->modify_mask = cpu_to_le32(cc_param->mask); in bnxt_qplib_modify_cc()
951 req->enable_cc = cc_param->enable; in bnxt_qplib_modify_cc()
952 req->g = cc_param->g; in bnxt_qplib_modify_cc()
953 req->num_phases_per_state = cc_param->nph_per_state; in bnxt_qplib_modify_cc()
954 req->time_per_phase = cc_param->time_pph; in bnxt_qplib_modify_cc()
955 req->pkts_per_phase = cc_param->pkts_pph; in bnxt_qplib_modify_cc()
956 req->init_cr = cpu_to_le16(cc_param->init_cr); in bnxt_qplib_modify_cc()
957 req->init_tr = cpu_to_le16(cc_param->init_tr); in bnxt_qplib_modify_cc()
958 req->tos_dscp_tos_ecn = (cc_param->tos_dscp << CMDQ_MODIFY_ROCE_CC_TOS_DSCP_SFT) | in bnxt_qplib_modify_cc()
959 (cc_param->tos_ecn & CMDQ_MODIFY_ROCE_CC_TOS_ECN_MASK); in bnxt_qplib_modify_cc()
960 req->alt_vlan_pcp = cc_param->alt_vlan_pcp; in bnxt_qplib_modify_cc()
961 req->alt_tos_dscp = cpu_to_le16(cc_param->alt_tos_dscp); in bnxt_qplib_modify_cc()
962 req->rtt = cpu_to_le16(cc_param->rtt); in bnxt_qplib_modify_cc()
963 req->tcp_cp = cpu_to_le16(cc_param->tcp_cp); in bnxt_qplib_modify_cc()
964 req->cc_mode = cc_param->cc_mode; in bnxt_qplib_modify_cc()
965 req->inactivity_th = cpu_to_le16(cc_param->inact_th); in bnxt_qplib_modify_cc()
968 if (bnxt_qplib_is_chip_gen_p5_p7(res->cctx)) { in bnxt_qplib_modify_cc()
982 payload = sizeof(struct cmdq_modify_roce_cc_gen1_tlv) - in bnxt_qplib_modify_cc()
985 bnxt_qplib_fill_cc_gen1(&tlv_req.ext_req, &cc_param->cc_ext); in bnxt_qplib_modify_cc()
988 bnxt_qplib_fill_cmdqmsg(&msg, cmd, &resp, NULL, req_size, in bnxt_qplib_modify_cc()
990 rc = bnxt_qplib_rcfw_send_message(res->rcfw, &msg); in bnxt_qplib_modify_cc()
998 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_read_context() local
1004 sbuf.sb = dma_alloc_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_read_context()
1007 return -ENOMEM; in bnxt_qplib_read_context()
1017 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, &sbuf, sizeof(req), in bnxt_qplib_read_context()
1019 rc = bnxt_qplib_rcfw_send_message(rcfw, &msg); in bnxt_qplib_read_context()
1025 dma_free_coherent(&rcfw->pdev->dev, sbuf.size, sbuf.sb, sbuf.dma_addr); in bnxt_qplib_read_context()
1032 cc_ext->inact_th_hi = le16_to_cpu(sb->inactivity_th_hi); in bnxt_qplib_read_cc_gen1()
1033 cc_ext->min_delta_cnp = le16_to_cpu(sb->min_time_between_cnps); in bnxt_qplib_read_cc_gen1()
1034 cc_ext->init_cp = le16_to_cpu(sb->init_cp); in bnxt_qplib_read_cc_gen1()
1035 cc_ext->tr_update_mode = sb->tr_update_mode; in bnxt_qplib_read_cc_gen1()
1036 cc_ext->tr_update_cyls = sb->tr_update_cycles; in bnxt_qplib_read_cc_gen1()
1037 cc_ext->fr_rtt = sb->fr_num_rtts; in bnxt_qplib_read_cc_gen1()
1038 cc_ext->ai_rate_incr = sb->ai_rate_increase; in bnxt_qplib_read_cc_gen1()
1039 cc_ext->rr_rtt_th = le16_to_cpu(sb->reduction_relax_rtts_th); in bnxt_qplib_read_cc_gen1()
1040 cc_ext->ar_cr_th = le16_to_cpu(sb->additional_relax_cr_th); in bnxt_qplib_read_cc_gen1()
1041 cc_ext->cr_min_th = le16_to_cpu(sb->cr_min_th); in bnxt_qplib_read_cc_gen1()
1042 cc_ext->bw_avg_weight = sb->bw_avg_weight; in bnxt_qplib_read_cc_gen1()
1043 cc_ext->cr_factor = sb->actual_cr_factor; in bnxt_qplib_read_cc_gen1()
1044 cc_ext->cr_th_max_cp = le16_to_cpu(sb->max_cp_cr_th); in bnxt_qplib_read_cc_gen1()
1045 cc_ext->cp_bias_en = sb->cp_bias_en; in bnxt_qplib_read_cc_gen1()
1046 cc_ext->cp_bias = sb->cp_bias; in bnxt_qplib_read_cc_gen1()
1047 cc_ext->cnp_ecn = sb->cnp_ecn; in bnxt_qplib_read_cc_gen1()
1048 cc_ext->rtt_jitter_en = sb->rtt_jitter_en; in bnxt_qplib_read_cc_gen1()
1049 cc_ext->bytes_per_usec = le16_to_cpu(sb->link_bytes_per_usec); in bnxt_qplib_read_cc_gen1()
1050 cc_ext->cc_cr_reset_th = le16_to_cpu(sb->reset_cc_cr_th); in bnxt_qplib_read_cc_gen1()
1051 cc_ext->cr_width = sb->cr_width; in bnxt_qplib_read_cc_gen1()
1052 cc_ext->min_quota = sb->quota_period_min; in bnxt_qplib_read_cc_gen1()
1053 cc_ext->max_quota = sb->quota_period_max; in bnxt_qplib_read_cc_gen1()
1054 cc_ext->abs_max_quota = sb->quota_period_abs_max; in bnxt_qplib_read_cc_gen1()
1055 cc_ext->tr_lb = le16_to_cpu(sb->tr_lower_bound); in bnxt_qplib_read_cc_gen1()
1056 cc_ext->cr_prob_fac = sb->cr_prob_factor; in bnxt_qplib_read_cc_gen1()
1057 cc_ext->tr_prob_fac = sb->tr_prob_factor; in bnxt_qplib_read_cc_gen1()
1058 cc_ext->fair_cr_th = le16_to_cpu(sb->fairness_cr_th); in bnxt_qplib_read_cc_gen1()
1059 cc_ext->red_div = sb->red_div; in bnxt_qplib_read_cc_gen1()
1060 cc_ext->cnp_ratio_th = sb->cnp_ratio_th; in bnxt_qplib_read_cc_gen1()
1061 cc_ext->ai_ext_rtt = le16_to_cpu(sb->exp_ai_rtts); in bnxt_qplib_read_cc_gen1()
1062 cc_ext->exp_crcp_ratio = sb->exp_ai_cr_cp_ratio; in bnxt_qplib_read_cc_gen1()
1063 cc_ext->low_rate_en = sb->use_rate_table; in bnxt_qplib_read_cc_gen1()
1064 cc_ext->cpcr_update_th = le16_to_cpu(sb->cp_exp_update_th); in bnxt_qplib_read_cc_gen1()
1065 cc_ext->ai_rtt_th1 = le16_to_cpu(sb->high_exp_ai_rtts_th1); in bnxt_qplib_read_cc_gen1()
1066 cc_ext->ai_rtt_th2 = le16_to_cpu(sb->high_exp_ai_rtts_th2); in bnxt_qplib_read_cc_gen1()
1067 cc_ext->cf_rtt_th = le16_to_cpu(sb->actual_cr_cong_free_rtts_th); in bnxt_qplib_read_cc_gen1()
1068 cc_ext->sc_cr_th1 = le16_to_cpu(sb->severe_cong_cr_th1); in bnxt_qplib_read_cc_gen1()
1069 cc_ext->sc_cr_th2 = le16_to_cpu(sb->severe_cong_cr_th2); in bnxt_qplib_read_cc_gen1()
1070 cc_ext->l64B_per_rtt = le32_to_cpu(sb->link64B_per_rtt); in bnxt_qplib_read_cc_gen1()
1071 cc_ext->cc_ack_bytes = sb->cc_ack_bytes; in bnxt_qplib_read_cc_gen1()
1072 cc_ext->reduce_cf_rtt_th = le16_to_cpu(sb->reduce_init_cong_free_rtts_th); in bnxt_qplib_read_cc_gen1()
1079 struct bnxt_qplib_rcfw *rcfw = res->rcfw; in bnxt_qplib_query_cc_param()
1082 struct bnxt_qplib_cmdqmsg msg = {}; in bnxt_qplib_query_cc_param() local
1091 if (bnxt_qplib_is_chip_gen_p5_p7(res->cctx)) in bnxt_qplib_query_cc_param()
1097 sbuf.sb = dma_alloc_coherent(&rcfw->pdev->dev, sbuf.size, in bnxt_qplib_query_cc_param()
1100 return -ENOMEM; in bnxt_qplib_query_cc_param()
1103 bnxt_qplib_fill_cmdqmsg(&msg, &req, &resp, &sbuf, sizeof(req), in bnxt_qplib_query_cc_param()
1105 rc = bnxt_qplib_rcfw_send_message(res->rcfw, &msg); in bnxt_qplib_query_cc_param()
1110 sb = bnxt_qplib_is_chip_gen_p5_p7(res->cctx) ? &ext_sb->base_sb : in bnxt_qplib_query_cc_param()
1113 cc_param->enable = sb->enable_cc & CREQ_QUERY_ROCE_CC_RESP_SB_ENABLE_CC; in bnxt_qplib_query_cc_param()
1114 cc_param->tos_ecn = (sb->tos_dscp_tos_ecn & in bnxt_qplib_query_cc_param()
1117 cc_param->tos_dscp = (sb->tos_dscp_tos_ecn & in bnxt_qplib_query_cc_param()
1120 cc_param->alt_tos_dscp = sb->alt_tos_dscp; in bnxt_qplib_query_cc_param()
1121 cc_param->alt_vlan_pcp = sb->alt_vlan_pcp; in bnxt_qplib_query_cc_param()
1123 cc_param->g = sb->g; in bnxt_qplib_query_cc_param()
1124 cc_param->nph_per_state = sb->num_phases_per_state; in bnxt_qplib_query_cc_param()
1125 cc_param->init_cr = le16_to_cpu(sb->init_cr); in bnxt_qplib_query_cc_param()
1126 cc_param->init_tr = le16_to_cpu(sb->init_tr); in bnxt_qplib_query_cc_param()
1127 cc_param->cc_mode = sb->cc_mode; in bnxt_qplib_query_cc_param()
1128 cc_param->inact_th = le16_to_cpu(sb->inactivity_th); in bnxt_qplib_query_cc_param()
1129 cc_param->rtt = le16_to_cpu(sb->rtt); in bnxt_qplib_query_cc_param()
1130 cc_param->tcp_cp = le16_to_cpu(sb->tcp_cp); in bnxt_qplib_query_cc_param()
1131 cc_param->time_pph = sb->time_per_phase; in bnxt_qplib_query_cc_param()
1132 cc_param->pkts_pph = sb->pkts_per_phase; in bnxt_qplib_query_cc_param()
1133 if (bnxt_qplib_is_chip_gen_p5_p7(res->cctx)) { in bnxt_qplib_query_cc_param()
1134 bnxt_qplib_read_cc_gen1(&cc_param->cc_ext, &ext_sb->gen1_sb); in bnxt_qplib_query_cc_param()
1135 cc_param->inact_th |= (cc_param->cc_ext.inact_th_hi & 0x3F) << 16; in bnxt_qplib_query_cc_param()
1138 dma_free_coherent(&rcfw->pdev->dev, sbuf.size, sbuf.sb, sbuf.dma_addr); in bnxt_qplib_query_cc_param()