]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
RDMA/bnxt_re: Query HWRM Interface version from FW
authorSelvin Xavier <selvin.xavier@broadcom.com>
Wed, 12 Dec 2018 09:56:23 +0000 (01:56 -0800)
committerJason Gunthorpe <jgg@mellanox.com>
Wed, 19 Dec 2018 23:37:32 +0000 (16:37 -0700)
Get HWRM interface major, minor, build and patch version from FW for
checking the FW/Driver compatibility.

Signed-off-by: Selvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
drivers/infiniband/hw/bnxt_re/main.c
drivers/infiniband/hw/bnxt_re/qplib_res.h

index 31cbef57a19b3fff8c53363a86baae8d91358b51..1d18b77940f21e0652ef16523babc4f79f3d4026 100644 (file)
@@ -1197,6 +1197,35 @@ static int bnxt_re_setup_qos(struct bnxt_re_dev *rdev)
        return 0;
 }
 
+static void bnxt_re_query_hwrm_intf_version(struct bnxt_re_dev *rdev)
+{
+       struct bnxt_en_dev *en_dev = rdev->en_dev;
+       struct hwrm_ver_get_output resp = {0};
+       struct hwrm_ver_get_input req = {0};
+       struct bnxt_fw_msg fw_msg;
+       int rc = 0;
+
+       memset(&fw_msg, 0, sizeof(fw_msg));
+       bnxt_re_init_hwrm_hdr(rdev, (void *)&req,
+                             HWRM_VER_GET, -1, -1);
+       req.hwrm_intf_maj = HWRM_VERSION_MAJOR;
+       req.hwrm_intf_min = HWRM_VERSION_MINOR;
+       req.hwrm_intf_upd = HWRM_VERSION_UPDATE;
+       bnxt_re_fill_fw_msg(&fw_msg, (void *)&req, sizeof(req), (void *)&resp,
+                           sizeof(resp), DFLT_HWRM_CMD_TIMEOUT);
+       rc = en_dev->en_ops->bnxt_send_fw_msg(en_dev, BNXT_ROCE_ULP, &fw_msg);
+       if (rc) {
+               dev_err(rdev_to_dev(rdev),
+                       "Failed to query HW version, rc = 0x%x", rc);
+               return;
+       }
+       rdev->qplib_ctx.hwrm_intf_ver =
+               (u64)resp.hwrm_intf_major << 48 |
+               (u64)resp.hwrm_intf_minor << 32 |
+               (u64)resp.hwrm_intf_build << 16 |
+               resp.hwrm_intf_patch;
+}
+
 static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev)
 {
        int rc;
@@ -1279,6 +1308,8 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)
        }
        set_bit(BNXT_RE_FLAG_GOT_MSIX, &rdev->flags);
 
+       bnxt_re_query_hwrm_intf_version(rdev);
+
        /* Establish RCFW Communication Channel to initialize the context
         * memory for the function and all child VFs
         */
index 2e5c052da5a99c94a061dbe1e214110e17bea4c4..1e80aa7bbcce72d619ccf812769b066ef4dd2707 100644 (file)
@@ -177,6 +177,7 @@ struct bnxt_qplib_ctx {
        struct bnxt_qplib_hwq           tqm_tbl[MAX_TQM_ALLOC_REQ];
        struct bnxt_qplib_stats         stats;
        struct bnxt_qplib_vf_res        vf_res;
+       u64                             hwrm_intf_ver;
 };
 
 struct bnxt_qplib_res {