Skip to content

Commit

Permalink
libqedr: Add EDPM mode type for user-fw compatibility
Browse files Browse the repository at this point in the history
In older FW versions the completion flag was treated as the ack flag
in edpm messages.

This patch fixes the ack flag initialization and initializes the appropriate
flag in the ucontext alloc to notify the qedr driver that the fixed edpm mode
is used.

Signed-off-by: Yuval Bason <yuval.bason@cavium.com>
Signed-off-by: Michal Kalderon <michal.kalderon@marvell.com>
  • Loading branch information
yuvalbason authored and Michal Kalderon committed Jul 26, 2020
1 parent 02262dd commit ebdfec7
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
10 changes: 6 additions & 4 deletions providers/qedr/common_hsi.h
Expand Up @@ -1010,12 +1010,14 @@ struct db_roce_dpm_params
#define DB_ROCE_DPM_PARAMS_WQE_SIZE_SHIFT 16
#define DB_ROCE_DPM_PARAMS_RESERVED0_MASK 0x1
#define DB_ROCE_DPM_PARAMS_RESERVED0_SHIFT 27
#define DB_ROCE_DPM_PARAMS_COMPLETION_FLG_MASK 0x1 /* RoCE completion flag */
#define DB_ROCE_DPM_PARAMS_COMPLETION_FLG_SHIFT 28
#define DB_ROCE_DPM_PARAMS_ACK_REQUEST_MASK 0x1 /* RoCE ack request (will be set to 1) */
#define DB_ROCE_DPM_PARAMS_ACK_REQUEST_SHIFT 28
#define DB_ROCE_DPM_PARAMS_S_FLG_MASK 0x1 /* RoCE S flag */
#define DB_ROCE_DPM_PARAMS_S_FLG_SHIFT 29
#define DB_ROCE_DPM_PARAMS_RESERVED1_MASK 0x3
#define DB_ROCE_DPM_PARAMS_RESERVED1_SHIFT 30
#define DB_ROCE_DPM_PARAMS_COMPLETION_FLG_MASK 0x1 /* RoCE completion flag for FW use */
#define DB_ROCE_DPM_PARAMS_COMPLETION_FLG_SHIFT 30
#define DB_ROCE_DPM_PARAMS_RESERVED1_MASK 0x1
#define DB_ROCE_DPM_PARAMS_RESERVED1_SHIFT 31
};

/*
Expand Down
6 changes: 4 additions & 2 deletions providers/qedr/qelr.h
Expand Up @@ -123,8 +123,9 @@ struct qelr_device {
};

enum qelr_dpm_flags {
QELR_DPM_FLAGS_ENHANCED = (1 << 0),
QELR_DPM_FLAGS_LEGACY = (1 << 1),
QELR_DPM_FLAGS_ENHANCED = (1 << 0),
QELR_DPM_FLAGS_LEGACY = (1 << 1),
QELR_DPM_FLAGS_EDPM_MODE = (1 << 2),
};

struct qelr_devctx {
Expand Down Expand Up @@ -290,6 +291,7 @@ struct qelr_qp {
int sq_sig_all;
int atomic_supported;
uint8_t edpm_disabled;
uint8_t edpm_mode;
struct qelr_srq *srq;
};

Expand Down
6 changes: 5 additions & 1 deletion providers/qedr/qelr_main.c
Expand Up @@ -168,7 +168,7 @@ static struct verbs_context *qelr_alloc_context(struct ibv_device *ibdev,
void *private_data)
{
struct qelr_devctx *ctx;
struct qelr_alloc_context cmd;
struct qelr_alloc_context cmd = {};
struct qelr_alloc_context_resp resp;

ctx = verbs_init_and_alloc_context(ibdev, cmd_fd, ctx, ibv_ctx,
Expand All @@ -182,6 +182,7 @@ static struct verbs_context *qelr_alloc_context(struct ibv_device *ibdev,
qelr_set_debug_mask();

cmd.context_flags = QEDR_ALLOC_UCTX_DB_REC | QEDR_SUPPORT_DPM_SIZES;
cmd.context_flags |= QEDR_ALLOC_UCTX_EDPM_MODE;
if (ibv_cmd_get_context(&ctx->ibv_ctx, &cmd.ibv_cmd, sizeof(cmd),
&resp.ibv_resp, sizeof(resp)))
goto cmd_err;
Expand All @@ -199,6 +200,9 @@ static struct verbs_context *qelr_alloc_context(struct ibv_device *ibdev,

if (resp.dpm_flags & QEDR_DPM_TYPE_ROCE_LEGACY)
ctx->dpm_flags |= QELR_DPM_FLAGS_LEGACY;

if (resp.dpm_flags & QEDR_DPM_TYPE_ROCE_EDPM_MODE)
ctx->dpm_flags |= QELR_DPM_FLAGS_EDPM_MODE;
} else {
if (resp.dpm_flags & QEDR_DPM_TYPE_IWARP_LEGACY)
ctx->dpm_flags = QELR_DPM_FLAGS_LEGACY;
Expand Down
8 changes: 8 additions & 0 deletions providers/qedr/qelr_verbs.c
Expand Up @@ -666,6 +666,8 @@ static inline int qelr_configure_qp(struct qelr_devctx *cxt, struct qelr_qp *qp,
qp->state = QELR_QPS_RST;
qp->sq_sig_all = attrs->sq_sig_all;
qp->atomic_supported = resp->atomic_supported;
if (cxt->dpm_flags & QELR_DPM_FLAGS_EDPM_MODE)
qp->edpm_mode = 1;

rc = qelr_configure_qp_sq(cxt, qp, attrs, resp);
if (rc)
Expand Down Expand Up @@ -1135,11 +1137,17 @@ static inline void qelr_edpm_set_msg_data(struct qelr_qp *qp,
uint8_t comp)
{
uint32_t wqe_size, dpm_size, params;
/* edpm mode - 0 : ack field is treated by old FW as "completion"
* edpm mode - 1 : ack field is treated by new FW as ack which is
* always required.
*/
uint8_t ack = (qp->edpm_mode) ? 1 : comp;

params = 0;
wqe_size = length + (QELR_IS_IMM_OR_INV(opcode) ? sizeof(uint32_t) : 0);
dpm_size = wqe_size + sizeof(struct db_roce_dpm_data);

SET_FIELD(params, DB_ROCE_DPM_PARAMS_ACK_REQUEST, ack);
SET_FIELD(params, DB_ROCE_DPM_PARAMS_DPM_TYPE, DPM_ROCE);
SET_FIELD(params, DB_ROCE_DPM_PARAMS_OPCODE, opcode);
SET_FIELD(params, DB_ROCE_DPM_PARAMS_WQE_SIZE, wqe_size);
Expand Down

0 comments on commit ebdfec7

Please sign in to comment.