Skip to content
This repository has been archived by the owner on Jun 21, 2021. It is now read-only.

Commit

Permalink
libibmad/dump.c: Add HDR support for PortInfo LinkSpeedExt* fields
Browse files Browse the repository at this point in the history
Per MgtWG comments #9364-9366

Signed-off-by: Hal Rosenstock <hal@mellanox.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
  • Loading branch information
Hal Rosenstock authored and weiny2 committed Dec 4, 2017
1 parent 2e2f557 commit 93e2448
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion libibmad/src/dump.c
Expand Up @@ -336,6 +336,9 @@ void mad_dump_linkspeedext(char *buf, int bufsz, void *val, int valsz)
case 2:
snprintf(buf, bufsz, "25.78125 Gbps");
break;
case 4:
snprintf(buf, bufsz, "53.125 Gbps");
break;
default:
snprintf(buf, bufsz, "undefined (%d)", speed);
break;
Expand All @@ -355,13 +358,16 @@ static void dump_linkspeedext(char *buf, int bufsz, int speed)
n += snprintf(buf + n, bufsz - n, "14.0625 Gbps or ");
if (n < bufsz && speed & 0x2)
n += snprintf(buf + n, bufsz - n, "25.78125 Gbps or ");
if (n < bufsz && speed & 0x4)
n += snprintf(buf + n, bufsz - n, "53.125 Gbps or ");

if (n >= bufsz) {
if (bufsz > 3)
buf[n - 4] = '\0';
return;
}

if (speed >> 2) {
if (speed >> 3) {
n += snprintf(buf + n, bufsz - n, "undefined (%d)", speed);
return;
} else if (bufsz > 3)
Expand Down

0 comments on commit 93e2448

Please sign in to comment.