netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kalesh A P <kalesh-anakkur.purayil@broadcom.com>
To: davem@davemloft.net, kuba@kernel.org, jiri@nvidia.com
Cc: netdev@vger.kernel.org, edwin.peer@broadcom.com,
	michael.chan@broadcom.com
Subject: [PATCH net-next 2/2] bnxt_en: Add device capabilities to devlink info_get cb
Date: Mon,  2 Aug 2021 09:57:40 +0530	[thread overview]
Message-ID: <20210802042740.10355-3-kalesh-anakkur.purayil@broadcom.com> (raw)
In-Reply-To: <20210802042740.10355-1-kalesh-anakkur.purayil@broadcom.com>

From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>

HWRM_VER_GET and FUNC_QCAPS command response provides the support
to indicate various device capabilities.

Expose these details via the devlink info.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Edwin Peer <edwin.peer@broadcom.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 31 +++++++++++++++++++++--
 1 file changed, 29 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
index 64381be..0ae5f47 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
@@ -379,6 +379,25 @@ static int bnxt_hwrm_get_nvm_cfg_ver(struct bnxt *bp,
 	return rc;
 }
 
+static int bnxt_dl_dev_capability_info_put(struct bnxt *bp, struct devlink_info_req *req)
+{
+	int rc;
+
+	if (bp->fw_cap & BNXT_FW_CAP_HOT_RESET) {
+		rc = devlink_info_device_capability_put(req, "hot_reset");
+		if (rc)
+			return rc;
+	}
+
+	if (bp->fw_cap & BNXT_FW_CAP_ERROR_RECOVERY) {
+		rc = devlink_info_device_capability_put(req, "error_recovery");
+		if (rc)
+			return rc;
+	}
+
+	return 0;
+}
+
 static int bnxt_dl_info_put(struct bnxt *bp, struct devlink_info_req *req,
 			    enum bnxt_dl_version_type type, const char *key,
 			    char *buf)
@@ -557,8 +576,16 @@ static int bnxt_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
 	snprintf(roce_ver, FW_VER_STR_LEN, "%d.%d.%d.%d",
 		 nvm_dev_info.roce_fw_major, nvm_dev_info.roce_fw_minor,
 		 nvm_dev_info.roce_fw_build, nvm_dev_info.roce_fw_patch);
-	return bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED,
-				DEVLINK_INFO_VERSION_GENERIC_FW_ROCE, roce_ver);
+	rc = bnxt_dl_info_put(bp, req, BNXT_VERSION_STORED,
+			      DEVLINK_INFO_VERSION_GENERIC_FW_ROCE, roce_ver);
+	if (rc)
+		return rc;
+
+	rc = bnxt_dl_dev_capability_info_put(bp, req);
+	if (rc)
+		return rc;
+
+	return 0;
 }
 
 static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg,
-- 
2.10.1


  parent reply	other threads:[~2021-08-02  4:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-02  4:27 [PATCH net-next 0/2] devlink enhancements Kalesh A P
2021-08-02  4:27 ` [PATCH net-next 1/2] devlink: add device capability reporting to devlink info API Kalesh A P
2021-08-02  4:27 ` Kalesh A P [this message]
2021-08-02 16:36 ` [PATCH net-next 0/2] devlink enhancements Jakub Kicinski
2021-08-02 19:41   ` Keller, Jacob E

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210802042740.10355-3-kalesh-anakkur.purayil@broadcom.com \
    --to=kalesh-anakkur.purayil@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edwin.peer@broadcom.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).