From 14e8bd8f4e30abdaabbe7ffc3a19e4381b4130fe Mon Sep 17 00:00:00 2001 From: Chengchang Tang Date: Wed, 24 May 2023 10:34:07 +0800 Subject: [PATCH 1/2] libhns: Remove unnecessary QP checks mainline inclusion from mainline-v47.0 commit 4ea9a4f77ac8c174d1ae4cf551a2e5abea13516f category: cleanup bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/I7NT3M CVE: NA Reference: https://github.com/linux-rdma/rdma-core/commit/4ea9a4f77ac8c174d1ae4cf551a2e5abea13516f ---------------------------------------------------------------------- It is not necessary to check the type of the queue on post_send and post_recv since the QP type that cannot be supported will be rejected when it is created. Check for srq in post_recv has also been removed, because the RQ of QP bound to srq is empty and will return immediate error in post_recv. Besides, remove the unused parameter ctx. Signed-off-by: Chengchang Tang Signed-off-by: Junxian Huang Signed-off-by: Juan Zhou --- providers/hns/hns_roce_u_hw_v2.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c index ee2fffe..688eff8 100644 --- a/providers/hns/hns_roce_u_hw_v2.c +++ b/providers/hns/hns_roce_u_hw_v2.c @@ -908,11 +908,6 @@ static int check_qp_send(struct hns_roce_qp *qp, struct hns_roce_context *ctx) struct ibv_qp *ibvqp = &qp->verbs_qp.qp; int ret = 0; - if (unlikely(ibvqp->qp_type != IBV_QPT_RC && - ibvqp->qp_type != IBV_QPT_UD) && - ibvqp->qp_type != IBV_QPT_XRC_SEND) - return -EINVAL; - if (unlikely(ibvqp->state == IBV_QPS_RESET || ibvqp->state == IBV_QPS_INIT || ibvqp->state == IBV_QPS_RTR)) @@ -1516,11 +1511,7 @@ static int check_qp_recv(struct hns_roce_qp *qp, struct hns_roce_context *ctx) struct ibv_qp *ibvqp = &qp->verbs_qp.qp; int ret = 0; - if (unlikely(ibvqp->qp_type != IBV_QPT_RC && - ibvqp->qp_type != IBV_QPT_UD)) - return -EINVAL; - - if (ibvqp->state == IBV_QPS_RESET || ibvqp->srq) + if (ibvqp->state == IBV_QPS_RESET) return -EINVAL; if (check_dca_attach_enable(qp)) { -- 2.25.1