Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp5309079pxv; Wed, 21 Jul 2021 02:18:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwm1lnrwv0GgG4vunJwO7P5PM2SwX75cymXLsmw1QQ8Vi8Qjj9obFrxwCVyKG1noxWmI3Bd X-Received: by 2002:a05:6638:1356:: with SMTP id u22mr30455553jad.39.1626859082127; Wed, 21 Jul 2021 02:18:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626859082; cv=none; d=google.com; s=arc-20160816; b=h5eE5MMKWd+f4MtDH8pN3uyJF2syPgPkDPDH5uJSzOaybnGYUNBBhhhtbiAM2Go66+ 0qB3kPOdEv7L03hicjELho3PC+sGFQJ6oZ6UlorVzdNduWU6HjiNMWIVUWruJJdenFIS CqQpU/2qLdHNy9MYtjEjCTksj9WT+CKOlHPvoi36K4ak4yI6ST51MPQMPP97NT9j5Atl 6NVUvvc6mLmfRqQMvMrks6Tk9eT0C5dcNU6GTsCRqJcNQZmj4Vo1O8NmQx8OSwDPDPQU 1V6a1aawj31arRInXSHdCeOILJwp6cfnWs2oL2cjMIbIr4OxyHtTn7SmnfL9vepkRn76 EDxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=pkixVt0NTeQwI7F6FFOFdPqiGjr2g8g8+s1FjY7eJ2U=; b=fqI6/ZnPkLhEIgImpZlRb0y2S8iNdPQ8OjF68dhlEU0/2C4LTOJyykDIC4dWao8B9z KDM6EGmOP/kDLFDFd3BcJQMiM0MP69YByXRmeu/WwgsxJ3emx3qdTPNesSj9vVCGSZtX 2xVvu67bTZvSBnYgrFrtaU48rD58Sw4L+8LCp+WYma6mUXmO/+VYFUkiBN0P5+xzhZls z4DP4Sbhs9fwQ1spgklgR/IRVyuE2/Ji6YCxoeUiwyQ7MhJXTFxVrpfTe7EHrR3fSEaw 0j+2+5kMJHldJufRNDmaduISjYBAlESF3ZKesJb5afQ0kIqH4kGaRibYgXbxoChT6vq7 eO2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HKuytsVc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z12si24935168iln.160.2021.07.21.02.17.50; Wed, 21 Jul 2021 02:18:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HKuytsVc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237657AbhGUIej (ORCPT + 99 others); Wed, 21 Jul 2021 04:34:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:56502 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235639AbhGUI0z (ORCPT ); Wed, 21 Jul 2021 04:26:55 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EEF156120A; Wed, 21 Jul 2021 09:07:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1626858452; bh=CEJyO9Yy4FU8TKYwWIP+VJYoiy0mqOrVsLitic27HE0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HKuytsVcsjFrYCOqDzC4ZXEtPz6apdzNdEMD8vpK7ElSsMFuqVMAIxBvu4Ed9pSNj JEXUNFqsJDO/erOTTPLpKb2BakayZH/EPoZ7+jT1yslZNDpbvHrElM5IbRx1NNFqN7 w6JcMSHOm4tbs4NU/47squxnz1SLOaOr62TqRam7CPEsULy5/kT/miDiv4OaFhpspU r3r+eT2RA2vu10kIGWkLRQFmm2SV0WONbZwSMctUPT5d8SkWRq/I0h6XBiRI2E1n21 xCAjSJ5L0XWxoqHeoMG6os/mObZASqXvwUL6QWQ4LSmCbRLn5R934EB2pd8jAafyqm Jm8QpnF8rF4vw== From: Leon Romanovsky To: Doug Ledford , Jason Gunthorpe Cc: Leon Romanovsky , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Mark Zhang , Christoph Hellwig Subject: [PATCH rdma-next v1 2/7] RDMA/core: Delete duplicated and unreachable code Date: Wed, 21 Jul 2021 12:07:05 +0300 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Leon Romanovsky The ib_create_named_qp() is kernel verb and no kernel users exist that use XRC_INI QP. Hence such QP path is not reachable. In addition, delete duplicated assignments of QP attributes from the initialization structure. Signed-off-by: Leon Romanovsky --- drivers/infiniband/core/core_priv.h | 1 + drivers/infiniband/core/verbs.c | 22 ++++------------------ 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/drivers/infiniband/core/core_priv.h b/drivers/infiniband/core/core_priv.h index 5dfa1190e3ea..cc54d74930d6 100644 --- a/drivers/infiniband/core/core_priv.h +++ b/drivers/infiniband/core/core_priv.h @@ -342,6 +342,7 @@ _ib_create_qp(struct ib_device *dev, struct ib_pd *pd, qp->rwq_ind_tbl = attr->rwq_ind_tbl; qp->event_handler = attr->event_handler; qp->port = attr->port_num; + qp->qp_context = attr->qp_context; spin_lock_init(&qp->mr_lock); INIT_LIST_HEAD(&qp->rdma_mrs); diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c index 89c6987cb5eb..635642a3ecbc 100644 --- a/drivers/infiniband/core/verbs.c +++ b/drivers/infiniband/core/verbs.c @@ -1257,28 +1257,14 @@ struct ib_qp *ib_create_named_qp(struct ib_pd *pd, return xrc_qp; } - qp->event_handler = qp_init_attr->event_handler; - qp->qp_context = qp_init_attr->qp_context; - if (qp_init_attr->qp_type == IB_QPT_XRC_INI) { - qp->recv_cq = NULL; - qp->srq = NULL; - } else { - qp->recv_cq = qp_init_attr->recv_cq; - if (qp_init_attr->recv_cq) - atomic_inc(&qp_init_attr->recv_cq->usecnt); - qp->srq = qp_init_attr->srq; - if (qp->srq) - atomic_inc(&qp_init_attr->srq->usecnt); - } - - qp->send_cq = qp_init_attr->send_cq; - qp->xrcd = NULL; + if (qp_init_attr->recv_cq) + atomic_inc(&qp_init_attr->recv_cq->usecnt); + if (qp->srq) + atomic_inc(&qp_init_attr->srq->usecnt); atomic_inc(&pd->usecnt); if (qp_init_attr->send_cq) atomic_inc(&qp_init_attr->send_cq->usecnt); - if (qp_init_attr->rwq_ind_tbl) - atomic_inc(&qp->rwq_ind_tbl->usecnt); if (qp_init_attr->cap.max_rdma_ctxs) { ret = rdma_rw_init_mrs(qp, qp_init_attr); -- 2.31.1