Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b827ea1 authored by Selvin Xavier's avatar Selvin Xavier Committed by Jason Gunthorpe
Browse files

RDMA/bnxt_re: Query HWRM Interface version from FW



Get HWRM interface major, minor, build and patch version from FW for
checking the FW/Driver compatibility.

Signed-off-by: default avatarSelvin Xavier <selvin.xavier@broadcom.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 8036e90f
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -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
	 */
+1 −0
Original line number Diff line number Diff line
@@ -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 {