diff mbox

libcxgb4: fix firmware version string

Message ID 20160922201503.CFB88E08CA@smtp.ogc.us (mailing list archive)
State Accepted
Headers show

Commit Message

Steve Wise Sept. 22, 2016, 7:29 p.m. UTC
c4iw_query_device() was incorrectly unpacking
the 64b version number from the driver.  This resulted
in ibv_devinfo showing garbage fw verion strings.

Signed-off-by: Steve Wise <swise@opengridcomputing.com>

---

Testing out the new process. :)

---
 libcxgb4/src/verbs.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

Comments

Leon Romanovsky Sept. 25, 2016, 9:19 a.m. UTC | #1
On Thu, Sep 22, 2016 at 12:29:55PM -0700, Steve Wise wrote:
> c4iw_query_device() was incorrectly unpacking
> the 64b version number from the driver.  This resulted
> in ibv_devinfo showing garbage fw verion strings.
>
> Signed-off-by: Steve Wise <swise@opengridcomputing.com>
>
> ---
>
> Testing out the new process. :)

Thanks, applied.
diff mbox

Patch

diff --git a/libcxgb4/src/verbs.c b/libcxgb4/src/verbs.c
index 3d46f0a..aed547d 100644
--- a/libcxgb4/src/verbs.c
+++ b/libcxgb4/src/verbs.c
@@ -52,7 +52,7 @@  int c4iw_query_device(struct ibv_context *context, struct ibv_device_attr *attr)
 {
 	struct ibv_query_device cmd;
 	uint64_t raw_fw_ver;
-	unsigned major, minor, sub_minor;
+	u8 major, minor, sub_minor, build;
 	int ret;
 
 	ret = ibv_cmd_query_device(context, attr, &raw_fw_ver, &cmd,
@@ -60,12 +60,13 @@  int c4iw_query_device(struct ibv_context *context, struct ibv_device_attr *attr)
 	if (ret)
 		return ret;
 
-	major = (raw_fw_ver >> 32) & 0xffff;
-	minor = (raw_fw_ver >> 16) & 0xffff;
-	sub_minor = raw_fw_ver & 0xffff;
+	major = (raw_fw_ver >> 24) & 0xff;
+	minor = (raw_fw_ver >> 16) & 0xff;
+	sub_minor = (raw_fw_ver >> 8) & 0xff;
+	build = raw_fw_ver & 0xff;
 
 	snprintf(attr->fw_ver, sizeof attr->fw_ver,
-		 "%d.%d.%d", major, minor, sub_minor);
+		 "%d.%d.%d.%d", major, minor, sub_minor, build);
 
 	return 0;
 }