From patchwork Wed Aug 2 09:32:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13337941 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 69B87C001DE for ; Wed, 2 Aug 2023 09:44:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232146AbjHBJoX (ORCPT ); Wed, 2 Aug 2023 05:44:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231868AbjHBJoW (ORCPT ); Wed, 2 Aug 2023 05:44:22 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0B2B6E5C for ; Wed, 2 Aug 2023 02:44:21 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-56487a5401bso30827a12.3 for ; Wed, 02 Aug 2023 02:44:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1690969460; x=1691574260; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=RK5NOuvCbXHxZ9vgKJghGyJRNfx7i3NkG2Mn7R4j0Pg=; b=AMy5LD5y5owfnuQ33qyjyD9qUqnT6G4WY25R+veIs+U63N2u/UBsS4FHOAU9k74xpO C0J2KxRSU4+S5Q4IDowW9Q4M7lDapmFNe3NWkqx16rN2qhyewldp49Ty9YifD4w9UfqM hwtCud92UiqgzuoB020az2vfFKNwmzyAAkAcA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690969460; x=1691574260; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=RK5NOuvCbXHxZ9vgKJghGyJRNfx7i3NkG2Mn7R4j0Pg=; b=Fqg3onLgXnS4387nFtH3Xh/NSCqTAXNh+P55G7W2vleTN85sjfe1Uqk6DOZ3SGHs7l eeaFupyQyOglhafOPhlHUj2VtbHz32ndaOoadCLnbbZjDq2N5LVflTxu4Oxan5a4Yhw6 gfSo8x5iXMv/buI5BwskFdTO4bCUnf1TsMQTxaMYWm7uhbsp5Ct7xbL4A1yQOSmvyOt3 OBA4Gm1ZD95fv3Sh9mljHM/kdVFG/2sg/gF8846w+0HRo6bUcyjrqL4moJ31faBKWPd+ fmp+dBYreKz97zpfqkVeR412MRFF+X41PGkK6Pblu1Vq0Q4MvXaa/N3YVGlusgnGYXlZ 49Qw== X-Gm-Message-State: ABy/qLaAm8GBTV60stXfjM5t2E4Z/RTSo34wVuJ5XV7V7wd5ewz+9j9B DsSjAs5cU5V0Kd65KkzaQoCX2Q== X-Google-Smtp-Source: APBJJlFW51McUJi+DhWCsTJvIAuT2XbXrtiUkLTLzHiH5yIXwJKxFcFwDkI8M6SXQGfl3N6gtFxXBw== X-Received: by 2002:a17:90b:17c5:b0:268:4807:eab9 with SMTP id me5-20020a17090b17c500b002684807eab9mr12659002pjb.16.1690969460366; Wed, 02 Aug 2023 02:44:20 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id 5-20020a17090a000500b00263dfe9b972sm848790pja.0.2023.08.02.02.44.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Aug 2023 02:44:19 -0700 (PDT) From: Selvin Xavier To: jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, Kalesh AP , Saravanan Vajravel , Selvin Xavier Subject: [PATCH for-next 1/6] RDMA/bnxt_re: Fix max_qp count for virtual functions Date: Wed, 2 Aug 2023 02:32:34 -0700 Message-Id: <1690968759-9142-2-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1690968759-9142-1-git-send-email-selvin.xavier@broadcom.com> References: <1690968759-9142-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org From: Kalesh AP Driver has not accounted QP1 for virtual functions when fetching device attributes and hence max_qp count is one less than active_qp count. Fixed driver so that it counts QP1 for virtual functions as well while fetching device attributes Fixes: ccd9d0d3dffc ("RDMA/bnxt_re: Enable RoCE on virtual functions") Signed-off-by: Saravanan Vajravel Signed-off-by: Kalesh AP Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/main.c | 6 ++---- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 7 +++---- drivers/infiniband/hw/bnxt_re/qplib_sp.h | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index d658e67..bbda694 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -1152,8 +1152,7 @@ static int bnxt_re_alloc_res(struct bnxt_re_dev *rdev) /* Configure and allocate resources for qplib */ rdev->qplib_res.rcfw = &rdev->rcfw; - rc = bnxt_qplib_get_dev_attr(&rdev->rcfw, &rdev->dev_attr, - rdev->is_virtfn); + rc = bnxt_qplib_get_dev_attr(&rdev->rcfw, &rdev->dev_attr); if (rc) goto fail; @@ -1531,8 +1530,7 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 wqe_mode) rdev->pacing.dbr_pacing = false; } } - rc = bnxt_qplib_get_dev_attr(&rdev->rcfw, &rdev->dev_attr, - rdev->is_virtfn); + rc = bnxt_qplib_get_dev_attr(&rdev->rcfw, &rdev->dev_attr); if (rc) goto disable_rcfw; diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.c b/drivers/infiniband/hw/bnxt_re/qplib_sp.c index 7e57faa..b77928a 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_sp.c +++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.c @@ -89,7 +89,7 @@ static void bnxt_qplib_query_version(struct bnxt_qplib_rcfw *rcfw, } int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, - struct bnxt_qplib_dev_attr *attr, bool vf) + struct bnxt_qplib_dev_attr *attr) { struct creq_query_func_resp resp = {}; struct bnxt_qplib_cmdqmsg msg = {}; @@ -121,9 +121,8 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, /* Extract the context from the side buffer */ attr->max_qp = le32_to_cpu(sb->max_qp); - /* max_qp value reported by FW for PF doesn't include the QP1 for PF */ - if (!vf) - attr->max_qp += 1; + /* max_qp value reported by FW doesn't include the QP1 */ + attr->max_qp += 1; attr->max_qp_rd_atom = sb->max_qp_rd_atom > BNXT_QPLIB_MAX_OUT_RD_ATOM ? BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_rd_atom; diff --git a/drivers/infiniband/hw/bnxt_re/qplib_sp.h b/drivers/infiniband/hw/bnxt_re/qplib_sp.h index 264ef3c..d33c78b 100644 --- a/drivers/infiniband/hw/bnxt_re/qplib_sp.h +++ b/drivers/infiniband/hw/bnxt_re/qplib_sp.h @@ -322,7 +322,7 @@ int bnxt_qplib_update_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl, struct bnxt_qplib_gid *gid, u16 gid_idx, const u8 *smac); int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, - struct bnxt_qplib_dev_attr *attr, bool vf); + struct bnxt_qplib_dev_attr *attr); int bnxt_qplib_set_func_resources(struct bnxt_qplib_res *res, struct bnxt_qplib_rcfw *rcfw, struct bnxt_qplib_ctx *ctx);