From patchwork Mon Apr 10 11:11:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13206288 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 B230DC77B61 for ; Mon, 10 Apr 2023 11:12:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229682AbjDJLMs (ORCPT ); Mon, 10 Apr 2023 07:12:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229574AbjDJLMr (ORCPT ); Mon, 10 Apr 2023 07:12:47 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 955966EB3 for ; Mon, 10 Apr 2023 04:12:18 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id 98e67ed59e1d1-2467761dfabso122317a91.3 for ; Mon, 10 Apr 2023 04:12:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1681125137; x=1683717137; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=BgYCgBLOcbEhjFjd/3zd0i3BoMWsZaNwOxvv7D4yAhU=; b=AlpFBsZV51u1OJdMNcB/9dV0B26eiSyb2C54ENQ6NheNgE8NzbGM7+gzVoqEIjQ7jb VlriqcLbDRVuSNhlUcMYTb5AHkhtPIWO8XzNIPKig38uN99wDFMWwVeT3KlfIpdEJsP0 Zrg+t45fOdSy7iwA4V3XeE4ilTc/aXZno3Pmg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681125137; x=1683717137; 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=BgYCgBLOcbEhjFjd/3zd0i3BoMWsZaNwOxvv7D4yAhU=; b=HiNOT3LqoloW9BhO8TIvMbbcbEmRVyToViPZEf3elGf3uj97NQfbygD4E3M1obArXZ I8eCRsDeoBRjuKdPLyA7SfSykqpga2wv+2qPriIHxowZsR8PJdcTjkZuIz+ECV/WCaKB SSq1emWZlFWtdR8O8YEiegyJHz3uaBYLeAgWCdKCS7SUS/GYqaHbXPxTVeG5LD9RFV4D VTFZZWAlcECy7LMAlEDahxb4hT+nVsqibSxevnE7y0BeKe5TnxYO3nXAaCvGwMfPF7ws IQt6U/LlTI41gLcVyX5ZxFPxq7qNEEhTH0o+UsLeECp52orTq3hTnFw0GWl5Qx6r0STO BJjA== X-Gm-Message-State: AAQBX9cqbQEM2AX0KAz0ylXUNl9xZKfvE7u8OlyTMYWlMua51kBfGo1h 2ZCZij1jyoPp4bNKk9vKpz3+jQ== X-Google-Smtp-Source: AKy350bTPOxaFwlVtze32XwNNbEqzF+jPGHQ/I9qN6XA8WlDcDecFTckyexb+CP44Uz6VYpHR3M7fQ== X-Received: by 2002:a62:1c8f:0:b0:628:1852:8431 with SMTP id c137-20020a621c8f000000b0062818528431mr9921556pfc.30.1681125137474; Mon, 10 Apr 2023 04:12:17 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id y10-20020aa7854a000000b005ded4825201sm7641875pfn.112.2023.04.10.04.12.15 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Apr 2023 04:12:16 -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 for-next 3/6] RDMA/bnxt_re: Query function capabilities from firmware Date: Mon, 10 Apr 2023 04:11:52 -0700 Message-Id: <1681125115-7127-4-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1681125115-7127-1-git-send-email-selvin.xavier@broadcom.com> References: <1681125115-7127-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 | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index a866951..1b69198 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) @@ -334,6 +338,32 @@ 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 = {0}; + struct hwrm_func_qcaps_input req = {0}; + struct bnxt_qplib_chip_ctx *cctx; + struct bnxt_fw_msg fw_msg; + int rc; + + cctx = rdev->chip_ctx; + memset(&fw_msg, 0, sizeof(fw_msg)); + bnxt_re_init_hwrm_hdr(rdev, (void *)&req, + HWRM_FUNC_QCAPS, -1, -1); + 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); + rc = bnxt_send_msg(en_dev, &fw_msg); + if (rc) { + dev_err(rdev_to_dev(rdev), + "Failed to query capabilities, rc = %#x", rc); + return rc; + } + return 0; +} + static int bnxt_re_net_ring_free(struct bnxt_re_dev *rdev, u16 fw_ring_id, int type) {