From patchwork Thu Aug 3 08:45:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13339557 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 075BEC001DF for ; Thu, 3 Aug 2023 08:57:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231526AbjHCI5L (ORCPT ); Thu, 3 Aug 2023 04:57:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234876AbjHCI5K (ORCPT ); Thu, 3 Aug 2023 04:57:10 -0400 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0995F1716 for ; Thu, 3 Aug 2023 01:57:09 -0700 (PDT) Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-68336d06620so632666b3a.1 for ; Thu, 03 Aug 2023 01:57:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1691053028; x=1691657828; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=l/owDq69CLzMJZAEsvBkDVVPfidzNLIVX2EnZeatcIU=; b=XiUlHqkq4pnhJ7ldeNZiqs2SwvJlsaPwlRK3171/kwshItPv184CG6zUV/CQIDHXZz K1nwME1C/kDySQK25KKqeF9zkGoSuhSdmFwTLVh11AX8eORpCP/j15+WmNIObx1ySQDZ UFmr12B+u6LNbkbLc4C7dbxuN9L9ykRv4JxWE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691053028; x=1691657828; 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=l/owDq69CLzMJZAEsvBkDVVPfidzNLIVX2EnZeatcIU=; b=W2eatESGzceGeEIWUo96btrb3s/Al0HQY8yHU7Ik9l+gi6gEG3qFVP60ExqCk8OvGh HNZ+7LskpzKjyj5z0RRPgdcnhpRRkEXBnmgpDiJRrcI9jHXKqBjwlkOuZZ5EPtQorxYY qrgjO8p2GVOoxRl9kRecTbj3R4xoE5al3Hbe1UbX0479VT1tVjeCtezYLPO1n5LJSg7q +2AgJqmAUv1vAnXtGf8HL4lCLMDAGA+5e0jTtWUbPzfvrLQJpcrw+Ba/gKfSfjIPIbbd 5ArvgMBBdoH0rtC4d+xzPxDn0PIYC98p136AF4ApblCLt0YMWJBMuSSwCYyYSVw7QpsT Tn6Q== X-Gm-Message-State: ABy/qLZjp591dp8RU2giRDJL6MHDtgySJsiavKiTlVcgUU/rgogSroLK zBkYKoUwJ0S2nOVi6Vb6uy84Qw== X-Google-Smtp-Source: APBJJlHyaGLr9oLprXXz9a6mQ1fSUHK4Cjoi1mFDZQabD+MkpM0mExHu3j1mroWP7OuxkF3IM7ySug== X-Received: by 2002:a05:6a00:1481:b0:687:1aa6:8821 with SMTP id v1-20020a056a00148100b006871aa68821mr19469807pfu.9.1691053028405; Thu, 03 Aug 2023 01:57:08 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id x42-20020a056a000bea00b0068713008f98sm10289035pfu.129.2023.08.03.01.57.05 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 03 Aug 2023 01:57:07 -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 v2 1/6] RDMA/bnxt_re: Fix max_qp count for virtual functions Date: Thu, 3 Aug 2023 01:45:21 -0700 Message-Id: <1691052326-32143-2-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1691052326-32143-1-git-send-email-selvin.xavier@broadcom.com> References: <1691052326-32143-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);