diff options
author | Roland Dreier <rolandd@cisco.com> | 2005-09-29 19:31:34 +0000 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-11-09 19:57:03 -0800 |
commit | f2d0a53e12948aada45fad6608650f22beea2646 (patch) | |
tree | eeb95983d4f053896952205f33b1d0bac0b05aeb | |
parent | 2cd40ff12498825b1687b263afcc8660733f312c (diff) | |
download | libmthca-f2d0a53e12948aada45fad6608650f22beea2646.tar.gz |
Move formatting of device's firmware version into device-specific code
Signed-off-by: Roland Dreier <rolandd@cisco.com>
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/verbs.c | 17 |
2 files changed, 21 insertions, 1 deletions
@@ -1,3 +1,8 @@ +2005-09-29 Roland Dreier <roland@cisco.com> + + * src/verbs.c (mthca_query_device): Update to match new libibverbs + API that requires device-specific libraries to format firmware version. + 2005-09-25 Roland Dreier <roland@cisco.com> * src/cq.c, src/mthca.c, src/mthca.h, src/verbs.c: Update to match diff --git a/src/verbs.c b/src/verbs.c index 80239ce..f5555d1 100644 --- a/src/verbs.c +++ b/src/verbs.c @@ -38,6 +38,7 @@ #endif /* HAVE_CONFIG_H */ #include <stdlib.h> +#include <stdio.h> #include <strings.h> #include <pthread.h> #include <netinet/in.h> @@ -48,8 +49,22 @@ int mthca_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; + int ret; + + ret = ibv_cmd_query_device(context, attr, &raw_fw_ver, &cmd, sizeof cmd); + if (ret) + return ret; - return ibv_cmd_query_device(context, attr, &cmd, sizeof cmd); + major = (raw_fw_ver >> 32) & 0xffff; + minor = (raw_fw_ver >> 16) & 0xffff; + sub_minor = raw_fw_ver & 0xffff; + + snprintf(attr->fw_ver, sizeof attr->fw_ver, + "%d.%d.%d", major, minor, sub_minor); + + return 0; } int mthca_query_port(struct ibv_context *context, uint8_t port, |