Commit e576adf5 authored by Selvin Xavier's avatar Selvin Xavier Committed by Leon Romanovsky

RDMA/bnxt_re: Convert RCFW_CMD_PREP macro to static inline function

Convert RCFW_CMD_PREP macro to static inline function.
Also, remove the cmd_flags passed as none of the functions
are using it.
Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
Link: https://lore.kernel.org/r/1680169540-10029-4-git-send-email-selvin.xavier@broadcom.comSigned-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent b400acee
...@@ -577,10 +577,11 @@ void bnxt_qplib_destroy_srq(struct bnxt_qplib_res *res, ...@@ -577,10 +577,11 @@ void bnxt_qplib_destroy_srq(struct bnxt_qplib_res *res,
struct bnxt_qplib_rcfw *rcfw = res->rcfw; struct bnxt_qplib_rcfw *rcfw = res->rcfw;
struct cmdq_destroy_srq req; struct cmdq_destroy_srq req;
struct creq_destroy_srq_resp resp; struct creq_destroy_srq_resp resp;
u16 cmd_flags = 0;
int rc; int rc;
RCFW_CMD_PREP(req, DESTROY_SRQ, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_DESTROY_SRQ,
sizeof(req));
/* Configure the request */ /* Configure the request */
req.srq_cid = cpu_to_le32(srq->id); req.srq_cid = cpu_to_le32(srq->id);
...@@ -601,7 +602,6 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res, ...@@ -601,7 +602,6 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res,
struct creq_create_srq_resp resp; struct creq_create_srq_resp resp;
struct cmdq_create_srq req; struct cmdq_create_srq req;
struct bnxt_qplib_pbl *pbl; struct bnxt_qplib_pbl *pbl;
u16 cmd_flags = 0;
u16 pg_sz_lvl; u16 pg_sz_lvl;
int rc, idx; int rc, idx;
...@@ -621,7 +621,9 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res, ...@@ -621,7 +621,9 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res,
goto fail; goto fail;
} }
RCFW_CMD_PREP(req, CREATE_SRQ, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_CREATE_SRQ,
sizeof(req));
/* Configure the request */ /* Configure the request */
req.dpi = cpu_to_le32(srq->dpi->dpi); req.dpi = cpu_to_le32(srq->dpi->dpi);
...@@ -698,10 +700,11 @@ int bnxt_qplib_query_srq(struct bnxt_qplib_res *res, ...@@ -698,10 +700,11 @@ int bnxt_qplib_query_srq(struct bnxt_qplib_res *res,
struct creq_query_srq_resp resp; struct creq_query_srq_resp resp;
struct bnxt_qplib_rcfw_sbuf *sbuf; struct bnxt_qplib_rcfw_sbuf *sbuf;
struct creq_query_srq_resp_sb *sb; struct creq_query_srq_resp_sb *sb;
u16 cmd_flags = 0;
int rc = 0; int rc = 0;
RCFW_CMD_PREP(req, QUERY_SRQ, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_QUERY_SRQ,
sizeof(req));
/* Configure the request */ /* Configure the request */
sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb)); sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb));
...@@ -810,13 +813,14 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) ...@@ -810,13 +813,14 @@ int bnxt_qplib_create_qp1(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
struct creq_create_qp1_resp resp; struct creq_create_qp1_resp resp;
struct cmdq_create_qp1 req; struct cmdq_create_qp1 req;
struct bnxt_qplib_pbl *pbl; struct bnxt_qplib_pbl *pbl;
u16 cmd_flags = 0;
u32 qp_flags = 0; u32 qp_flags = 0;
u8 pg_sz_lvl; u8 pg_sz_lvl;
u32 tbl_indx; u32 tbl_indx;
int rc; int rc;
RCFW_CMD_PREP(req, CREATE_QP1, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_CREATE_QP1,
sizeof(req));
/* General */ /* General */
req.type = qp->type; req.type = qp->type;
...@@ -953,13 +957,14 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) ...@@ -953,13 +957,14 @@ int bnxt_qplib_create_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
struct bnxt_qplib_hwq *xrrq; struct bnxt_qplib_hwq *xrrq;
struct bnxt_qplib_pbl *pbl; struct bnxt_qplib_pbl *pbl;
struct cmdq_create_qp req; struct cmdq_create_qp req;
u16 cmd_flags = 0;
u32 qp_flags = 0; u32 qp_flags = 0;
u8 pg_sz_lvl; u8 pg_sz_lvl;
u32 tbl_indx; u32 tbl_indx;
u16 nsge; u16 nsge;
RCFW_CMD_PREP(req, CREATE_QP, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_CREATE_QP,
sizeof(req));
/* General */ /* General */
req.type = qp->type; req.type = qp->type;
...@@ -1227,12 +1232,13 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) ...@@ -1227,12 +1232,13 @@ int bnxt_qplib_modify_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
struct bnxt_qplib_rcfw *rcfw = res->rcfw; struct bnxt_qplib_rcfw *rcfw = res->rcfw;
struct cmdq_modify_qp req; struct cmdq_modify_qp req;
struct creq_modify_qp_resp resp; struct creq_modify_qp_resp resp;
u16 cmd_flags = 0;
u32 temp32[4]; u32 temp32[4];
u32 bmask; u32 bmask;
int rc; int rc;
RCFW_CMD_PREP(req, MODIFY_QP, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_MODIFY_QP,
sizeof(req));
/* Filter out the qp_attr_mask based on the state->new transition */ /* Filter out the qp_attr_mask based on the state->new transition */
__filter_modify_flags(qp); __filter_modify_flags(qp);
...@@ -1333,11 +1339,12 @@ int bnxt_qplib_query_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp) ...@@ -1333,11 +1339,12 @@ int bnxt_qplib_query_qp(struct bnxt_qplib_res *res, struct bnxt_qplib_qp *qp)
struct creq_query_qp_resp resp; struct creq_query_qp_resp resp;
struct bnxt_qplib_rcfw_sbuf *sbuf; struct bnxt_qplib_rcfw_sbuf *sbuf;
struct creq_query_qp_resp_sb *sb; struct creq_query_qp_resp_sb *sb;
u16 cmd_flags = 0;
u32 temp32[4]; u32 temp32[4];
int i, rc = 0; int i, rc = 0;
RCFW_CMD_PREP(req, QUERY_QP, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_QUERY_QP,
sizeof(req));
sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb)); sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb));
if (!sbuf) if (!sbuf)
...@@ -1456,7 +1463,6 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, ...@@ -1456,7 +1463,6 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res,
struct bnxt_qplib_rcfw *rcfw = res->rcfw; struct bnxt_qplib_rcfw *rcfw = res->rcfw;
struct cmdq_destroy_qp req; struct cmdq_destroy_qp req;
struct creq_destroy_qp_resp resp; struct creq_destroy_qp_resp resp;
u16 cmd_flags = 0;
u32 tbl_indx; u32 tbl_indx;
int rc; int rc;
...@@ -1464,7 +1470,9 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res, ...@@ -1464,7 +1470,9 @@ int bnxt_qplib_destroy_qp(struct bnxt_qplib_res *res,
rcfw->qp_tbl[tbl_indx].qp_id = BNXT_QPLIB_QP_ID_INVALID; rcfw->qp_tbl[tbl_indx].qp_id = BNXT_QPLIB_QP_ID_INVALID;
rcfw->qp_tbl[tbl_indx].qp_handle = NULL; rcfw->qp_tbl[tbl_indx].qp_handle = NULL;
RCFW_CMD_PREP(req, DESTROY_QP, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_DESTROY_QP,
sizeof(req));
req.qp_cid = cpu_to_le32(qp->id); req.qp_cid = cpu_to_le32(qp->id);
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
...@@ -2033,7 +2041,6 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) ...@@ -2033,7 +2041,6 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq)
struct creq_create_cq_resp resp; struct creq_create_cq_resp resp;
struct bnxt_qplib_pbl *pbl; struct bnxt_qplib_pbl *pbl;
struct cmdq_create_cq req; struct cmdq_create_cq req;
u16 cmd_flags = 0;
u32 pg_sz_lvl; u32 pg_sz_lvl;
int rc; int rc;
...@@ -2046,7 +2053,9 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) ...@@ -2046,7 +2053,9 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq)
if (rc) if (rc)
goto exit; goto exit;
RCFW_CMD_PREP(req, CREATE_CQ, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_CREATE_CQ,
sizeof(req));
if (!cq->dpi) { if (!cq->dpi) {
dev_err(&rcfw->pdev->dev, dev_err(&rcfw->pdev->dev,
...@@ -2110,10 +2119,11 @@ int bnxt_qplib_resize_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq, ...@@ -2110,10 +2119,11 @@ int bnxt_qplib_resize_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq,
struct cmdq_resize_cq req = {}; struct cmdq_resize_cq req = {};
struct bnxt_qplib_pbl *pbl; struct bnxt_qplib_pbl *pbl;
u32 pg_sz, lvl, new_sz; u32 pg_sz, lvl, new_sz;
u16 cmd_flags = 0;
int rc; int rc;
RCFW_CMD_PREP(req, RESIZE_CQ, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_RESIZE_CQ,
sizeof(req));
hwq_attr.sginfo = &cq->sg_info; hwq_attr.sginfo = &cq->sg_info;
hwq_attr.res = res; hwq_attr.res = res;
hwq_attr.depth = new_cqes; hwq_attr.depth = new_cqes;
...@@ -2144,10 +2154,11 @@ int bnxt_qplib_destroy_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) ...@@ -2144,10 +2154,11 @@ int bnxt_qplib_destroy_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq)
struct cmdq_destroy_cq req; struct cmdq_destroy_cq req;
struct creq_destroy_cq_resp resp; struct creq_destroy_cq_resp resp;
u16 total_cnq_events; u16 total_cnq_events;
u16 cmd_flags = 0;
int rc; int rc;
RCFW_CMD_PREP(req, DESTROY_CQ, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_DESTROY_CQ,
sizeof(req));
req.cq_cid = cpu_to_le32(cq->id); req.cq_cid = cpu_to_le32(cq->id);
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
......
...@@ -454,10 +454,11 @@ int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw) ...@@ -454,10 +454,11 @@ int bnxt_qplib_deinit_rcfw(struct bnxt_qplib_rcfw *rcfw)
{ {
struct cmdq_deinitialize_fw req; struct cmdq_deinitialize_fw req;
struct creq_deinitialize_fw_resp resp; struct creq_deinitialize_fw_resp resp;
u16 cmd_flags = 0;
int rc; int rc;
RCFW_CMD_PREP(req, DEINITIALIZE_FW, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_DEINITIALIZE_FW,
sizeof(req));
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp, rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, (void *)&resp,
NULL, 0); NULL, 0);
if (rc) if (rc)
...@@ -472,11 +473,12 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw, ...@@ -472,11 +473,12 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,
{ {
struct creq_initialize_fw_resp resp; struct creq_initialize_fw_resp resp;
struct cmdq_initialize_fw req; struct cmdq_initialize_fw req;
u16 cmd_flags = 0;
u8 pgsz, lvl; u8 pgsz, lvl;
int rc; int rc;
RCFW_CMD_PREP(req, INITIALIZE_FW, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_INITIALIZE_FW,
sizeof(req));
/* Supply (log-base-2-of-host-page-size - base-page-shift) /* Supply (log-base-2-of-host-page-size - base-page-shift)
* to bono to adjust the doorbell page sizes. * to bono to adjust the doorbell page sizes.
*/ */
......
...@@ -51,25 +51,26 @@ ...@@ -51,25 +51,26 @@
#define RCFW_DBR_PCI_BAR_REGION 2 #define RCFW_DBR_PCI_BAR_REGION 2
#define RCFW_DBR_BASE_PAGE_SHIFT 12 #define RCFW_DBR_BASE_PAGE_SHIFT 12
#define RCFW_CMD_PREP(req, CMD, cmd_flags) \
do { \
memset(&(req), 0, sizeof((req))); \
(req).opcode = CMDQ_BASE_OPCODE_##CMD; \
(req).cmd_size = sizeof((req)); \
(req).flags = cpu_to_le16(cmd_flags); \
} while (0)
#define RCFW_CMD_WAIT_TIME_MS 20000 /* 20 Seconds timeout */
/* Cmdq contains a fix number of a 16-Byte slots */ /* Cmdq contains a fix number of a 16-Byte slots */
struct bnxt_qplib_cmdqe { struct bnxt_qplib_cmdqe {
u8 data[16]; u8 data[16];
}; };
#define BNXT_QPLIB_CMDQE_UNITS sizeof(struct bnxt_qplib_cmdqe)
static inline void bnxt_qplib_rcfw_cmd_prep(struct cmdq_base *req,
u8 opcode, u8 cmd_size)
{
memset(req, 0, cmd_size);
req->opcode = opcode;
req->cmd_size = cmd_size;
}
#define RCFW_CMD_WAIT_TIME_MS 20000 /* 20 Seconds timeout */
/* CMDQ elements */ /* CMDQ elements */
#define BNXT_QPLIB_CMDQE_MAX_CNT_256 256 #define BNXT_QPLIB_CMDQE_MAX_CNT_256 256
#define BNXT_QPLIB_CMDQE_MAX_CNT_8192 8192 #define BNXT_QPLIB_CMDQE_MAX_CNT_8192 8192
#define BNXT_QPLIB_CMDQE_UNITS sizeof(struct bnxt_qplib_cmdqe)
#define BNXT_QPLIB_CMDQE_BYTES(depth) ((depth) * BNXT_QPLIB_CMDQE_UNITS) #define BNXT_QPLIB_CMDQE_BYTES(depth) ((depth) * BNXT_QPLIB_CMDQE_UNITS)
static inline u32 bnxt_qplib_cmdqe_npages(u32 depth) static inline u32 bnxt_qplib_cmdqe_npages(u32 depth)
......
...@@ -70,10 +70,11 @@ static void bnxt_qplib_query_version(struct bnxt_qplib_rcfw *rcfw, ...@@ -70,10 +70,11 @@ static void bnxt_qplib_query_version(struct bnxt_qplib_rcfw *rcfw,
{ {
struct cmdq_query_version req; struct cmdq_query_version req;
struct creq_query_version_resp resp; struct creq_query_version_resp resp;
u16 cmd_flags = 0;
int rc = 0; int rc = 0;
RCFW_CMD_PREP(req, QUERY_VERSION, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_QUERY_VERSION,
sizeof(req));
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
(void *)&resp, NULL, 0); (void *)&resp, NULL, 0);
...@@ -88,16 +89,17 @@ static void bnxt_qplib_query_version(struct bnxt_qplib_rcfw *rcfw, ...@@ -88,16 +89,17 @@ static void bnxt_qplib_query_version(struct bnxt_qplib_rcfw *rcfw,
int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
struct bnxt_qplib_dev_attr *attr, bool vf) struct bnxt_qplib_dev_attr *attr, bool vf)
{ {
struct cmdq_query_func req;
struct creq_query_func_resp resp;
struct bnxt_qplib_rcfw_sbuf *sbuf;
struct creq_query_func_resp_sb *sb; struct creq_query_func_resp_sb *sb;
u16 cmd_flags = 0; struct bnxt_qplib_rcfw_sbuf *sbuf;
u32 temp; struct creq_query_func_resp resp;
struct cmdq_query_func req;
u8 *tqm_alloc; u8 *tqm_alloc;
int i, rc = 0; int i, rc = 0;
u32 temp;
RCFW_CMD_PREP(req, QUERY_FUNC, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_QUERY_FUNC,
sizeof(req));
sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb)); sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb));
if (!sbuf) { if (!sbuf) {
...@@ -176,10 +178,11 @@ int bnxt_qplib_set_func_resources(struct bnxt_qplib_res *res, ...@@ -176,10 +178,11 @@ int bnxt_qplib_set_func_resources(struct bnxt_qplib_res *res,
{ {
struct cmdq_set_func_resources req; struct cmdq_set_func_resources req;
struct creq_set_func_resources_resp resp; struct creq_set_func_resources_resp resp;
u16 cmd_flags = 0;
int rc = 0; int rc = 0;
RCFW_CMD_PREP(req, SET_FUNC_RESOURCES, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_SET_FUNC_RESOURCES,
sizeof(req));
req.number_of_qp = cpu_to_le32(ctx->qpc_count); req.number_of_qp = cpu_to_le32(ctx->qpc_count);
req.number_of_mrw = cpu_to_le32(ctx->mrw_count); req.number_of_mrw = cpu_to_le32(ctx->mrw_count);
...@@ -247,10 +250,11 @@ int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, ...@@ -247,10 +250,11 @@ int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,
if (update) { if (update) {
struct cmdq_delete_gid req; struct cmdq_delete_gid req;
struct creq_delete_gid_resp resp; struct creq_delete_gid_resp resp;
u16 cmd_flags = 0;
int rc; int rc;
RCFW_CMD_PREP(req, DELETE_GID, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_DELETE_GID,
sizeof(req));
if (sgid_tbl->hw_id[index] == 0xFFFF) { if (sgid_tbl->hw_id[index] == 0xFFFF) {
dev_err(&res->pdev->dev, dev_err(&res->pdev->dev,
"GID entry contains an invalid HW id\n"); "GID entry contains an invalid HW id\n");
...@@ -317,10 +321,11 @@ int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, ...@@ -317,10 +321,11 @@ int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,
if (update) { if (update) {
struct cmdq_add_gid req; struct cmdq_add_gid req;
struct creq_add_gid_resp resp; struct creq_add_gid_resp resp;
u16 cmd_flags = 0;
int rc; int rc;
RCFW_CMD_PREP(req, ADD_GID, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_ADD_GID,
sizeof(req));
req.gid[0] = cpu_to_be32(((u32 *)gid->data)[3]); req.gid[0] = cpu_to_be32(((u32 *)gid->data)[3]);
req.gid[1] = cpu_to_be32(((u32 *)gid->data)[2]); req.gid[1] = cpu_to_be32(((u32 *)gid->data)[2]);
...@@ -378,9 +383,10 @@ int bnxt_qplib_update_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, ...@@ -378,9 +383,10 @@ int bnxt_qplib_update_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,
struct creq_modify_gid_resp resp; struct creq_modify_gid_resp resp;
struct cmdq_modify_gid req; struct cmdq_modify_gid req;
int rc; int rc;
u16 cmd_flags = 0;
RCFW_CMD_PREP(req, MODIFY_GID, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_MODIFY_GID,
sizeof(req));
req.gid[0] = cpu_to_be32(((u32 *)gid->data)[3]); req.gid[0] = cpu_to_be32(((u32 *)gid->data)[3]);
req.gid[1] = cpu_to_be32(((u32 *)gid->data)[2]); req.gid[1] = cpu_to_be32(((u32 *)gid->data)[2]);
...@@ -411,12 +417,13 @@ int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah, ...@@ -411,12 +417,13 @@ int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
struct bnxt_qplib_rcfw *rcfw = res->rcfw; struct bnxt_qplib_rcfw *rcfw = res->rcfw;
struct cmdq_create_ah req; struct cmdq_create_ah req;
struct creq_create_ah_resp resp; struct creq_create_ah_resp resp;
u16 cmd_flags = 0;
u32 temp32[4]; u32 temp32[4];
u16 temp16[3]; u16 temp16[3];
int rc; int rc;
RCFW_CMD_PREP(req, CREATE_AH, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_CREATE_AH,
sizeof(req));
memcpy(temp32, ah->dgid.data, sizeof(struct bnxt_qplib_gid)); memcpy(temp32, ah->dgid.data, sizeof(struct bnxt_qplib_gid));
req.dgid[0] = cpu_to_le32(temp32[0]); req.dgid[0] = cpu_to_le32(temp32[0]);
...@@ -454,10 +461,11 @@ void bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah, ...@@ -454,10 +461,11 @@ void bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah,
struct bnxt_qplib_rcfw *rcfw = res->rcfw; struct bnxt_qplib_rcfw *rcfw = res->rcfw;
struct cmdq_destroy_ah req; struct cmdq_destroy_ah req;
struct creq_destroy_ah_resp resp; struct creq_destroy_ah_resp resp;
u16 cmd_flags = 0;
/* Clean up the AH table in the device */ /* Clean up the AH table in the device */
RCFW_CMD_PREP(req, DESTROY_AH, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_DESTROY_AH,
sizeof(req));
req.ah_cid = cpu_to_le32(ah->id); req.ah_cid = cpu_to_le32(ah->id);
...@@ -471,7 +479,6 @@ int bnxt_qplib_free_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw) ...@@ -471,7 +479,6 @@ int bnxt_qplib_free_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw)
struct bnxt_qplib_rcfw *rcfw = res->rcfw; struct bnxt_qplib_rcfw *rcfw = res->rcfw;
struct cmdq_deallocate_key req; struct cmdq_deallocate_key req;
struct creq_deallocate_key_resp resp; struct creq_deallocate_key_resp resp;
u16 cmd_flags = 0;
int rc; int rc;
if (mrw->lkey == 0xFFFFFFFF) { if (mrw->lkey == 0xFFFFFFFF) {
...@@ -479,7 +486,9 @@ int bnxt_qplib_free_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw) ...@@ -479,7 +486,9 @@ int bnxt_qplib_free_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw)
return 0; return 0;
} }
RCFW_CMD_PREP(req, DEALLOCATE_KEY, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_DEALLOCATE_KEY,
sizeof(req));
req.mrw_flags = mrw->type; req.mrw_flags = mrw->type;
...@@ -507,11 +516,12 @@ int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw) ...@@ -507,11 +516,12 @@ int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw)
struct bnxt_qplib_rcfw *rcfw = res->rcfw; struct bnxt_qplib_rcfw *rcfw = res->rcfw;
struct cmdq_allocate_mrw req; struct cmdq_allocate_mrw req;
struct creq_allocate_mrw_resp resp; struct creq_allocate_mrw_resp resp;
u16 cmd_flags = 0;
unsigned long tmp; unsigned long tmp;
int rc; int rc;
RCFW_CMD_PREP(req, ALLOCATE_MRW, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_ALLOCATE_MRW,
sizeof(req));
req.pd_id = cpu_to_le32(mrw->pd->id); req.pd_id = cpu_to_le32(mrw->pd->id);
req.mrw_flags = mrw->type; req.mrw_flags = mrw->type;
...@@ -543,10 +553,11 @@ int bnxt_qplib_dereg_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw, ...@@ -543,10 +553,11 @@ int bnxt_qplib_dereg_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw,
struct bnxt_qplib_rcfw *rcfw = res->rcfw; struct bnxt_qplib_rcfw *rcfw = res->rcfw;
struct cmdq_deregister_mr req; struct cmdq_deregister_mr req;
struct creq_deregister_mr_resp resp; struct creq_deregister_mr_resp resp;
u16 cmd_flags = 0;
int rc; int rc;
RCFW_CMD_PREP(req, DEREGISTER_MR, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_DEREGISTER_MR,
sizeof(req));
req.lkey = cpu_to_le32(mrw->lkey); req.lkey = cpu_to_le32(mrw->lkey);
rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req, rc = bnxt_qplib_rcfw_send_message(rcfw, (void *)&req,
...@@ -572,9 +583,9 @@ int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr, ...@@ -572,9 +583,9 @@ int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr,
struct bnxt_qplib_sg_info sginfo = {}; struct bnxt_qplib_sg_info sginfo = {};
struct creq_register_mr_resp resp; struct creq_register_mr_resp resp;
struct cmdq_register_mr req; struct cmdq_register_mr req;
u16 cmd_flags = 0, level;
int pages, rc; int pages, rc;
u32 pg_size; u32 pg_size;
u16 level;
if (num_pbls) { if (num_pbls) {
pages = roundup_pow_of_two(num_pbls); pages = roundup_pow_of_two(num_pbls);
...@@ -602,7 +613,9 @@ int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr, ...@@ -602,7 +613,9 @@ int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr,
} }
} }
RCFW_CMD_PREP(req, REGISTER_MR, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_REGISTER_MR,
sizeof(req));
/* Configure the request */ /* Configure the request */
if (mr->hwq.level == PBL_LVL_MAX) { if (mr->hwq.level == PBL_LVL_MAX) {
...@@ -686,10 +699,11 @@ int bnxt_qplib_get_roce_stats(struct bnxt_qplib_rcfw *rcfw, ...@@ -686,10 +699,11 @@ int bnxt_qplib_get_roce_stats(struct bnxt_qplib_rcfw *rcfw,
struct creq_query_roce_stats_resp resp; struct creq_query_roce_stats_resp resp;
struct bnxt_qplib_rcfw_sbuf *sbuf; struct bnxt_qplib_rcfw_sbuf *sbuf;
struct creq_query_roce_stats_resp_sb *sb; struct creq_query_roce_stats_resp_sb *sb;
u16 cmd_flags = 0;
int rc = 0; int rc = 0;
RCFW_CMD_PREP(req, QUERY_ROCE_STATS, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_BASE_OPCODE_QUERY_ROCE_STATS,
sizeof(req));
sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb)); sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb));
if (!sbuf) { if (!sbuf) {
...@@ -766,7 +780,6 @@ int bnxt_qplib_qext_stat(struct bnxt_qplib_rcfw *rcfw, u32 fid, ...@@ -766,7 +780,6 @@ int bnxt_qplib_qext_stat(struct bnxt_qplib_rcfw *rcfw, u32 fid,
struct creq_query_roce_stats_ext_resp_sb *sb; struct creq_query_roce_stats_ext_resp_sb *sb;
struct cmdq_query_roce_stats_ext req = {}; struct cmdq_query_roce_stats_ext req = {};
struct bnxt_qplib_rcfw_sbuf *sbuf; struct bnxt_qplib_rcfw_sbuf *sbuf;
u16 cmd_flags = 0;
int rc; int rc;
sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb)); sbuf = bnxt_qplib_rcfw_alloc_sbuf(rcfw, sizeof(*sb));
...@@ -776,7 +789,9 @@ int bnxt_qplib_qext_stat(struct bnxt_qplib_rcfw *rcfw, u32 fid, ...@@ -776,7 +789,9 @@ int bnxt_qplib_qext_stat(struct bnxt_qplib_rcfw *rcfw, u32 fid,
return -ENOMEM; return -ENOMEM;
} }
RCFW_CMD_PREP(req, QUERY_ROCE_STATS_EXT, cmd_flags); bnxt_qplib_rcfw_cmd_prep((struct cmdq_base *)&req,
CMDQ_QUERY_ROCE_STATS_EXT_OPCODE_QUERY_ROCE_STATS,
sizeof(req));
req.resp_size = ALIGN(sizeof(*sb), BNXT_QPLIB_CMDQE_UNITS); req.resp_size = ALIGN(sizeof(*sb), BNXT_QPLIB_CMDQE_UNITS);
req.resp_addr = cpu_to_le64(sbuf->dma_addr); req.resp_addr = cpu_to_le64(sbuf->dma_addr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment