Re: [PATCH V5 for-next 16/21] RDMA/bnxt_re: Support poll_cq verb

Leon Romanovsky
2017-02-12T14:30:51Z

[-- Attachment #1: Type: text/plain, Size: 4230 bytes --]

On Fri, Feb 10, 2017 at 03:19:48AM -0800, Selvin Xavier wrote:
> Enables the fastpath ib_poll_cq verb.
>
> v2: Fixed sparse warnings
> v3: Fixes endianness related warnings reported by sparse. Also, fixes
> smatch and checkpatch warnings
> v5: Uses ETH_P_IBOE macro for RoCE ethertype
>
> Signed-off-by: Eddie Wai <eddie.wai-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Somnath Kotur <somnath.kotur-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> Signed-off-by: Selvin Xavier <selvin.xavier-dY08KVG/lbpWk0Htik3J/w@public.gmane.org>
> ---
> drivers/infiniband/hw/bnxt_re/ib_verbs.c | 522 ++++++++++++++++++++++++++++
> drivers/infiniband/hw/bnxt_re/ib_verbs.h | 1 +
> drivers/infiniband/hw/bnxt_re/main.c | 22 +-
> drivers/infiniband/hw/bnxt_re/qplib_fp.c | 560 ++++++++++++++++++++++++++++++-
> drivers/infiniband/hw/bnxt_re/qplib_fp.h | 7 +-
> 5 files changed, 1107 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/hw/bnxt_re/ib_verbs.c b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> index 54d85bc..33af2e3 100644
> --- a/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> +++ b/drivers/infiniband/hw/bnxt_re/ib_verbs.c
> @@ -2230,6 +2230,528 @@ struct ib_cq *bnxt_re_create_cq(struct ib_device *ibdev,
> return ERR_PTR(rc);
> }
>
> +static u8 __req_to_ib_wc_status(u8 qstatus)
> +{
> + switch (qstatus) {
> + case CQ_REQ_STATUS_OK:
> + return IB_WC_SUCCESS;
> + case CQ_REQ_STATUS_BAD_RESPONSE_ERR:
> + return IB_WC_BAD_RESP_ERR;
> + case CQ_REQ_STATUS_LOCAL_LENGTH_ERR:
> + return IB_WC_LOC_LEN_ERR;
> + case CQ_REQ_STATUS_LOCAL_QP_OPERATION_ERR:
> + return IB_WC_LOC_QP_OP_ERR;
> + case CQ_REQ_STATUS_LOCAL_PROTECTION_ERR:
> + return IB_WC_LOC_PROT_ERR;
> + case CQ_REQ_STATUS_MEMORY_MGT_OPERATION_ERR:
> + return IB_WC_GENERAL_ERR;
> + case CQ_REQ_STATUS_REMOTE_INVALID_REQUEST_ERR:
> + return IB_WC_REM_INV_REQ_ERR;
> + case CQ_REQ_STATUS_REMOTE_ACCESS_ERR:
> + return IB_WC_REM_ACCESS_ERR;
> + case CQ_REQ_STATUS_REMOTE_OPERATION_ERR:
> + return IB_WC_REM_OP_ERR;
> + case CQ_REQ_STATUS_RNR_NAK_RETRY_CNT_ERR:
> + return IB_WC_RNR_RETRY_EXC_ERR;
> + case CQ_REQ_STATUS_TRANSPORT_RETRY_CNT_ERR:
> + return IB_WC_RETRY_EXC_ERR;
> + case CQ_REQ_STATUS_WORK_REQUEST_FLUSHED_ERR:
> + return IB_WC_WR_FLUSH_ERR;
> + default:
> + return IB_WC_GENERAL_ERR;
> + }
> + return 0;
> +}
> +
> +static u8 __rawqp1_to_ib_wc_status(u8 qstatus)
> +{
> + switch (qstatus) {
> + case CQ_RES_RAWETH_QP1_STATUS_OK:
> + return IB_WC_SUCCESS;
> + case CQ_RES_RAWETH_QP1_STATUS_LOCAL_ACCESS_ERROR:
> + return IB_WC_LOC_ACCESS_ERR;
> + case CQ_RES_RAWETH_QP1_STATUS_HW_LOCAL_LENGTH_ERR:
> + return IB_WC_LOC_LEN_ERR;
> + case CQ_RES_RAWETH_QP1_STATUS_LOCAL_PROTECTION_ERR:
> + return IB_WC_LOC_PROT_ERR;
> + case CQ_RES_RAWETH_QP1_STATUS_LOCAL_QP_OPERATION_ERR:
> + return IB_WC_LOC_QP_OP_ERR;
> + case CQ_RES_RAWETH_QP1_STATUS_MEMORY_MGT_OPERATION_ERR:
> + return IB_WC_GENERAL_ERR;
> + case CQ_RES_RAWETH_QP1_STATUS_WORK_REQUEST_FLUSHED_ERR:
> + return IB_WC_WR_FLUSH_ERR;
> + case CQ_RES_RAWETH_QP1_STATUS_HW_FLUSH_ERR:
> + return IB_WC_WR_FLUSH_ERR;
> + default:
> + return IB_WC_GENERAL_ERR;
> + }
> +}
> +
> +static u8 __rc_to_ib_wc_status(u8 qstatus)
> +{
> + switch (qstatus) {
> + case CQ_RES_RC_STATUS_OK:
> + return IB_WC_SUCCESS;
> + case CQ_RES_RC_STATUS_LOCAL_ACCESS_ERROR:
> + return IB_WC_LOC_ACCESS_ERR;
> + case CQ_RES_RC_STATUS_LOCAL_LENGTH_ERR:
> + return IB_WC_LOC_LEN_ERR;
> + case CQ_RES_RC_STATUS_LOCAL_PROTECTION_ERR:
> + return IB_WC_LOC_PROT_ERR;
> + case CQ_RES_RC_STATUS_LOCAL_QP_OPERATION_ERR:
> + return IB_WC_LOC_QP_OP_ERR;
> + case CQ_RES_RC_STATUS_MEMORY_MGT_OPERATION_ERR:
> + return IB_WC_GENERAL_ERR;
> + case CQ_RES_RC_STATUS_REMOTE_INVALID_REQUEST_ERR:
> + return IB_WC_REM_INV_REQ_ERR;
> + case CQ_RES_RC_STATUS_WORK_REQUEST_FLUSHED_ERR:
> + return IB_WC_WR_FLUSH_ERR;
> + case CQ_RES_RC_STATUS_HW_FLUSH_ERR:
> + return IB_WC_WR_FLUSH_ERR;
> + default:
> + return IB_WC_GENERAL_ERR;
> + }
> +}
> +

Why don't you use these defines directly?

Thanks

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]