[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170118091641.GV32481@mtr-leonro.local>
Date: Wed, 18 Jan 2017 11:16:41 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Selvin Xavier <selvin.xavier@...adcom.com>
Cc: dledford@...hat.com, linux-rdma@...r.kernel.org,
netdev@...r.kernel.org, michael.chan@...adcom.com,
Eddie Wai <eddie.wai@...adcom.com>,
Devesh Sharma <devesh.sharma@...adcom.com>,
Somnath Kotur <somnath.kotur@...adcom.com>,
Sriharsha Basavapatna <sriharsha.basavapatna@...adcom.com>
Subject: Re: [PATCH for bnxt_re V4 13/21] RDMA/bnxt_re: Support QP verbs
On Wed, Dec 21, 2016 at 03:42:02AM -0800, Selvin Xavier wrote:
> This patch implements create_qp, destroy_qp, query_qp and modify_qp verbs.
>
> v2: Fixed sparse warnings
> v3: Splits __filter_modify_flags function to avoid nested switch cases.
> Removes unwanted macros. Also, fix the endianness related issues
> reported by sparse.
>
> Signed-off-by: Eddie Wai <eddie.wai@...adcom.com>
> Signed-off-by: Devesh Sharma <devesh.sharma@...adcom.com>
> Signed-off-by: Somnath Kotur <somnath.kotur@...adcom.com>
> Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@...adcom.com>
> Signed-off-by: Selvin Xavier <selvin.xavier@...adcom.com>
> ---
<snip>
> +
> +static u8 __from_ib_qp_type(enum ib_qp_type type)
> +{
> + switch (type) {
> + case IB_QPT_GSI:
> + return CMDQ_CREATE_QP1_TYPE_GSI;
> + case IB_QPT_RC:
> + return CMDQ_CREATE_QP_TYPE_RC;
> + case IB_QPT_UD:
> + return CMDQ_CREATE_QP_TYPE_UD;
> + case IB_QPT_RAW_ETHERTYPE:
> + return CMDQ_CREATE_QP_TYPE_RAW_ETHERTYPE;
> + default:
> + return IB_QPT_MAX;
> + }
> +}
> +
<snip>
> +static u8 __from_ib_qp_state(enum ib_qp_state state)
> +{
> + switch (state) {
> + case IB_QPS_RESET:
> + return CMDQ_MODIFY_QP_NEW_STATE_RESET;
> + case IB_QPS_INIT:
> + return CMDQ_MODIFY_QP_NEW_STATE_INIT;
> + case IB_QPS_RTR:
> + return CMDQ_MODIFY_QP_NEW_STATE_RTR;
> + case IB_QPS_RTS:
> + return CMDQ_MODIFY_QP_NEW_STATE_RTS;
> + case IB_QPS_SQD:
> + return CMDQ_MODIFY_QP_NEW_STATE_SQD;
> + case IB_QPS_SQE:
> + return CMDQ_MODIFY_QP_NEW_STATE_SQE;
> + case IB_QPS_ERR:
> + default:
> + return CMDQ_MODIFY_QP_NEW_STATE_ERR;
> + }
> +}
> +
> +static enum ib_qp_state __to_ib_qp_state(u8 state)
> +{
> + switch (state) {
> + case CMDQ_MODIFY_QP_NEW_STATE_RESET:
> + return IB_QPS_RESET;
> + case CMDQ_MODIFY_QP_NEW_STATE_INIT:
> + return IB_QPS_INIT;
> + case CMDQ_MODIFY_QP_NEW_STATE_RTR:
> + return IB_QPS_RTR;
> + case CMDQ_MODIFY_QP_NEW_STATE_RTS:
> + return IB_QPS_RTS;
> + case CMDQ_MODIFY_QP_NEW_STATE_SQD:
> + return IB_QPS_SQD;
> + case CMDQ_MODIFY_QP_NEW_STATE_SQE:
> + return IB_QPS_SQE;
> + case CMDQ_MODIFY_QP_NEW_STATE_ERR:
> + default:
> + return IB_QPS_ERR;
> + }
> +}
> +
> +static u32 __from_ib_mtu(enum ib_mtu mtu)
> +{
> + switch (mtu) {
> + case IB_MTU_256:
> + return CMDQ_MODIFY_QP_PATH_MTU_MTU_256;
> + case IB_MTU_512:
> + return CMDQ_MODIFY_QP_PATH_MTU_MTU_512;
> + case IB_MTU_1024:
> + return CMDQ_MODIFY_QP_PATH_MTU_MTU_1024;
> + case IB_MTU_2048:
> + return CMDQ_MODIFY_QP_PATH_MTU_MTU_2048;
> + case IB_MTU_4096:
> + return CMDQ_MODIFY_QP_PATH_MTU_MTU_4096;
> + default:
> + return CMDQ_MODIFY_QP_PATH_MTU_MTU_2048;
> + }
> +}
> +
> +static enum ib_mtu __to_ib_mtu(u32 mtu)
> +{
> + switch (mtu & CREQ_QUERY_QP_RESP_SB_PATH_MTU_MASK) {
> + case CMDQ_MODIFY_QP_PATH_MTU_MTU_256:
> + return IB_MTU_256;
> + case CMDQ_MODIFY_QP_PATH_MTU_MTU_512:
> + return IB_MTU_512;
> + case CMDQ_MODIFY_QP_PATH_MTU_MTU_1024:
> + return IB_MTU_1024;
> + case CMDQ_MODIFY_QP_PATH_MTU_MTU_2048:
> + return IB_MTU_2048;
> + case CMDQ_MODIFY_QP_PATH_MTU_MTU_4096:
> + return IB_MTU_4096;
> + default:
> + return IB_MTU_2048;
> + }
> +}
Why do you you need these functions? These translations to<->from look
redundant.
Thanks
Download attachment "signature.asc" of type "application/pgp-signature" (834 bytes)
Powered by blists - more mailing lists