From patchwork Thu Jun 1 11:10: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: 13263548 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 AFC9BC7EE2A for ; Thu, 1 Jun 2023 11:22:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232571AbjFALWe (ORCPT ); Thu, 1 Jun 2023 07:22:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231929AbjFALWe (ORCPT ); Thu, 1 Jun 2023 07:22:34 -0400 Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9920124 for ; Thu, 1 Jun 2023 04:22:32 -0700 (PDT) Received: by mail-pg1-x530.google.com with SMTP id 41be03b00d2f7-53fbb3a013dso686878a12.1 for ; Thu, 01 Jun 2023 04:22:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1685618552; x=1688210552; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=oV6mqxGwsLHduIxeJ/ilcXMIVBgVY3Dar+udXp641dY=; b=gH3H31NDxeZJT1RCvW5wsLOkCHOjMXGbX71wEJzv+JBmFAiQ3YPZTyOYF4CqZFOyhQ rB+jhWM6s9TRN/pxHfSKNqLeeXR+84ANo/brvjVnjipd9EE//5HRa16ier7hVBMOTxuB T8eQPjmVmnL0AffzaCz0EmbkKe3atlpZurHL0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685618552; x=1688210552; 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=oV6mqxGwsLHduIxeJ/ilcXMIVBgVY3Dar+udXp641dY=; b=Cxc0UAQ/Obu2yYQVLIOSAMtnegbT+Bph+wg+6Rn5zH61XdLwg5lGLAjaHpcbO8LQjy hn9ECgm1UotN5WDNKVal3p5a1zrQTDUd/RbVWSf8Oqeacc6p/KibycExKEpE3JZTVJ/c qADhx3kd6l26pQ+Bg/tPgpeG4phzYz3dkfRWOCXGVP6ZKiOIFdy+vmEoGP1eDKZD3S6H BnQowr6tx+PxYUnIXixR2J78yQRmLawqr2tJQrUWFkpvy0AUMXzYlAJIYPZTWLyuwVTE MLj3XlAtpJ+0aKYk5CiOi5xvmcSRzav9yunxSuiUItb3S32w5EktadkpIm1eRZgNjPKS M09Q== X-Gm-Message-State: AC+VfDyEhu7NqaHBgOu3bHTS7QoAp3gsMpJRobNUsPXjK23VT9qoBB6E LLS18gX1RvwLa92gbGQ8gReDXA== X-Google-Smtp-Source: ACHHUZ6490dz6a+3hFNEP0n0XbTwuUDDZ7z4Yaho1voNoYeb6BK0vQpWMm31uT2AQ5uK2z9nRa11Hw== X-Received: by 2002:a17:903:2292:b0:1a3:cd4c:8d08 with SMTP id b18-20020a170903229200b001a3cd4c8d08mr10307153plh.38.1685618552317; Thu, 01 Jun 2023 04:22:32 -0700 (PDT) Received: from dhcp-10-192-206-197.iig.avagotech.net.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id n3-20020a170902e54300b001ac55a5e5eesm3216496plf.121.2023.06.01.04.22.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Jun 2023 04:22:31 -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 v4 for-next 3/6] RDMA/bnxt_re: Query function capabilities from firmware Date: Thu, 1 Jun 2023 04:10:34 -0700 Message-Id: <1685617837-15725-4-git-send-email-selvin.xavier@broadcom.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1685617837-15725-1-git-send-email-selvin.xavier@broadcom.com> References: <1685617837-15725-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 | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/drivers/infiniband/hw/bnxt_re/main.c b/drivers/infiniband/hw/bnxt_re/main.c index 9cc652e..da99f69 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) @@ -340,6 +344,25 @@ 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; + + 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); + 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) {