From patchwork Mon Jun 12 09:48:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selvin Xavier X-Patchwork-Id: 13276240 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 6A8A8C7EE23 for ; Mon, 12 Jun 2023 10:23:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232626AbjFLKXR (ORCPT ); Mon, 12 Jun 2023 06:23:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232740AbjFLKW7 (ORCPT ); Mon, 12 Jun 2023 06:22:59 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17B0A28F82 for ; Mon, 12 Jun 2023 03:02:07 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1b3ce6607cbso7130205ad.2 for ; Mon, 12 Jun 2023 03:02:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1686564050; x=1689156050; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=8Dc8mbnpA8Mr4PAhmA8qfq/4tH+ykpvLIvGt/UZdWzA=; b=KEEw9C1HRB9QCpDqq7W0EAyCftg1j8hNgmOQUwZdKEiR9/DEwSL6N8N1flzEiLtxbr HtQ/stAlqKaTppY67DPWbFR+ZLAWVca8PbQFMV/h7x4lnJkR45PJLht8Ijv9EFtYk/qa TtsopEZcCwe4u3Q4Nx1BBbP+ktEF9UxA4o6R8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686564050; x=1689156050; 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=8Dc8mbnpA8Mr4PAhmA8qfq/4tH+ykpvLIvGt/UZdWzA=; b=lQD3hFrgpJ6rwTMWobCwRVS0fjqM3Zicee5hFGy+jc2C+v8537Ev8rIex49Hi5cmd3 zd9l/ch0frqekksUF/mu/u1tlJlm19ZhszyM1baN6ef0Ugs48RX1SU6q7tK57ZFWDz2p +hIdLVYRnHYMKbiWvk5HlN5cNG8ufyoWJlYpP17brSXRQUcxPi9O2XgX5M0OWOs1Qufr M+Nu2gLEoRVYMM0kZYv8R4m6ctxHn1ZXZV0rRpSFBrYI9YAsJKNKYdguJtG5TaRXAK37 5POIWPBWT0/Hf6B+A0VpCN3xrVpx3vNjFf9vtr1v6vPNZUZMwUgaHopsTvDFXzxLZxmT KB8g== X-Gm-Message-State: AC+VfDymAd0X2TdxlkuSiraOTgbiNQglPNLuSw0GWcXmY6ZpqnME0FVw yOGJjg9jJz4s8bmOBElQtFcdww== X-Google-Smtp-Source: ACHHUZ4JLgnIcBt85F7sh0h2lbxPq5NTgkdISFzUOzfZ5RFVRFIx1OTKq8xVav3cOdo08uTyiW/hjQ== X-Received: by 2002:a17:903:22c5:b0:1b0:5c0a:3f80 with SMTP id y5-20020a17090322c500b001b05c0a3f80mr7986883plg.44.1686564050399; Mon, 12 Jun 2023 03:00:50 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id q16-20020a170902dad000b001ae2b94701fsm7792050plx.21.2023.06.12.03.00.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Jun 2023 03:00:49 -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 v5 for-next 4/7] RDMA/bnxt_re: Query function capabilities from firmware Date: Mon, 12 Jun 2023 02:48:59 -0700 Message-Id: <1686563342-15233-5-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1686563342-15233-1-git-send-email-selvin.xavier@broadcom.com> References: <1686563342-15233-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) {