From patchwork Tue Jun 13 18:12:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13279145 X-Patchwork-Delegate: jgg@ziepe.ca 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 9405EEB64D7 for ; Tue, 13 Jun 2023 18:24:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239273AbjFMSYO (ORCPT ); Tue, 13 Jun 2023 14:24:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239242AbjFMSYN (ORCPT ); Tue, 13 Jun 2023 14:24:13 -0400 Received: from mail-pl1-x634.google.com (mail-pl1-x634.google.com [IPv6:2607:f8b0:4864:20::634]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B792710CB for ; Tue, 13 Jun 2023 11:24:12 -0700 (PDT) Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1b3d8aa2c17so13389765ad.3 for ; Tue, 13 Jun 2023 11:24:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686680652; x=1689272652; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=DioKl5VVD4/CDEyHj0B6+rJByxy0UsdHFeg9iAIZctE=; b=NRwtIVSSRrnz956LDr0HIPtGJvCsAQe2qh0AjyFz1QRW1jkJ24ar0qbGbWMvROxCOP Y6E9FMbOuiFjFWXj8KQHBqx3DpLHU7dRh3Q8MdmF8x//D+O5GEEMMz5icHx7pwDxQuIv +kKDP7A3xuOl1nXepgxBkyuI3t5le9M+DFUGk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686680652; x=1689272652; 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=DioKl5VVD4/CDEyHj0B6+rJByxy0UsdHFeg9iAIZctE=; b=Y4QMYjCvsIXnKMTFKoMM2tUY3neLlwXNVLdTKLcyJPd8/JW7jvZcEgrv8ciaXorhBU GaxEj2ZLhf564l5trjM1jau5AUEqp6L+reXUKj3Dh5iitlwK38G8E4sXq1mktAeQcElF 86wvaLKlhD4ls9yi4uk9mVqe7S+Ba2x9Ibb1nB/Mi+qTMxCl1eDzen11G9LbO7w1AxEM Rz76UAbSD1MDqPflKS/91AIL3KV4jwzk1cJexVMGqtoEhgUhNTy8+PpQI/hYyMOO5sTV n4sGDcf+Rvo4LjETdxHXlOZzkTkmPI2E2ugaDWCuMNw9DlX6vnQ2cBPd5XyZGX8b5W9T r62w== X-Gm-Message-State: AC+VfDzEoY3HMuUAbzMudXk2ZMLv+wmLTNEr2z55qIKWDf32d2xW819T 5y5Qs5Sv7mzBTeMQfpDJqNWjzg== X-Google-Smtp-Source: ACHHUZ65AMgzDvVC5iHMqH1TIgJK7StKxS26CCbSWKUe82DYteZ2gaHYgFIF9RIE0PQ4sozHNfbRKA== X-Received: by 2002:a17:902:ea0e:b0:1b0:3576:c2a9 with SMTP id s14-20020a170902ea0e00b001b03576c2a9mr10554656plg.33.1686680652165; Tue, 13 Jun 2023 11:24:12 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id iw21-20020a170903045500b001b3fb909f73sm285493plb.112.2023.06.13.11.24.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jun 2023 11:24:11 -0700 (PDT) From: Selvin Xavier To: jgg@ziepe.ca, leon@kernel.org Cc: linux-rdma@vger.kernel.org, andrew.gospodarek@broadcom.com, Selvin Xavier Subject: [PATCH v6 for-next 4/7] RDMA/bnxt_re: Query function capabilities from firmware Date: Tue, 13 Jun 2023 11:12:20 -0700 Message-Id: <1686679943-17117-5-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1686679943-17117-1-git-send-email-selvin.xavier@broadcom.com> References: <1686679943-17117-1-git-send-email-selvin.xavier@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org Query Function capabilities to enable advanced features. Signed-off-by: Selvin Xavier --- drivers/infiniband/hw/bnxt_re/main.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index 1b16c42..247f724 100644 --- a/drivers/infiniband/hw/bnxt_re/main.c +++ b/drivers/infiniband/hw/bnxt_re/main.c @@ -83,6 +83,7 @@ static int bnxt_re_netdev_event(struct notifier_block *notifier, unsigned long event, void *ptr); static struct bnxt_re_dev *bnxt_re_from_netdev(struct net_device *netdev); static void bnxt_re_dev_uninit(struct bnxt_re_dev *rdev); +static int bnxt_re_hwrm_qcaps(struct bnxt_re_dev *rdev); static void bnxt_re_set_drv_mode(struct bnxt_re_dev *rdev, u8 mode) { @@ -91,6 +92,9 @@ static void bnxt_re_set_drv_mode(struct bnxt_re_dev *rdev, u8 mode) cctx = rdev->chip_ctx; cctx->modes.wqe_mode = bnxt_qplib_is_chip_gen_p5(rdev->chip_ctx) ? mode : BNXT_QPLIB_WQE_MODE_STATIC; + if (bnxt_re_hwrm_qcaps(rdev)) + dev_err(rdev_to_dev(rdev), + "Failed to query hwrm qcaps\n"); } static void bnxt_re_destroy_chip_ctx(struct bnxt_re_dev *rdev) @@ -339,6 +343,23 @@ static void bnxt_re_fill_fw_msg(struct bnxt_fw_msg *fw_msg, void *msg, fw_msg->timeout = timeout; } +/* Query function capabilities using common hwrm */ +int bnxt_re_hwrm_qcaps(struct bnxt_re_dev *rdev) +{ + struct bnxt_en_dev *en_dev = rdev->en_dev; + struct hwrm_func_qcaps_output resp = {}; + struct hwrm_func_qcaps_input req = {}; + struct bnxt_qplib_chip_ctx *cctx; + struct bnxt_fw_msg fw_msg = {}; + + cctx = rdev->chip_ctx; + bnxt_re_init_hwrm_hdr((void *)&req, HWRM_FUNC_QCAPS); + req.fid = cpu_to_le16(0xffff); + bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp, + sizeof(resp), DFLT_HWRM_CMD_TIMEOUT); + return bnxt_send_msg(en_dev, &fw_msg); +} + static int bnxt_re_net_ring_free(struct bnxt_re_dev *rdev, u16 fw_ring_id, int type) {