Skip to content

Commit 6cedcca

Browse files
committed
ibdiags_tools: Support XDR speeds decoding
Adding using new aggregation values of LinkSpeedExt & LinkSpeedExt2 mechaism Also added dependency to the ibnetdisc library Signed-off-by: Gregory Linschitz <gregoryl@nvidia.com>
1 parent 4ae25e4 commit 6cedcca

File tree

2 files changed

+25
-12
lines changed

2 files changed

+25
-12
lines changed

infiniband-diags/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ add_library(ibdiags_tools STATIC
1313
ibdiag_sa.c
1414
)
1515

16+
target_link_libraries(ibdiags_tools LINK_PRIVATE ibnetdisc
17+
)
18+
1619
function(ibdiag_programs)
1720
foreach(I ${ARGN})
1821
rdma_sbin_executable(${I} "${I}.c")

infiniband-diags/ibdiag_common.c

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,7 @@ void get_max_msg(char *width_msg, char *speed_msg, int msg_size, ibnd_port_t * p
781781
{
782782
char buf[64];
783783
uint32_t max_speed = 0;
784+
uint32_t espeed = 0, e2speed = 0;
784785
uint32_t cap_mask, rem_cap_mask, fdr10;
785786
uint8_t *info = NULL;
786787

@@ -844,22 +845,21 @@ void get_max_msg(char *width_msg, char *speed_msg, int msg_size, ibnd_port_t * p
844845
return;
845846

846847
check_ext_speed:
847-
if (mad_get_field(port->info, 0,
848-
IB_PORT_LINK_SPEED_EXT_SUPPORTED_F) == 0 ||
849-
mad_get_field(port->remoteport->info, 0,
850-
IB_PORT_LINK_SPEED_EXT_SUPPORTED_F) == 0)
848+
espeed = ibnd_get_agg_linkspeedextsup(port->info, port->info);
849+
e2speed = ibnd_get_agg_linkspeedextsup(port->remoteport->info,
850+
port->remoteport->info);
851+
852+
if (!espeed || !e2speed)
851853
goto check_fdr10_supp;
852-
max_speed = get_max(mad_get_field(port->info, 0,
853-
IB_PORT_LINK_SPEED_EXT_SUPPORTED_F)
854-
& mad_get_field(port->remoteport->info, 0,
855-
IB_PORT_LINK_SPEED_EXT_SUPPORTED_F));
856-
if ((max_speed & mad_get_field(port->info, 0,
857-
IB_PORT_LINK_SPEED_EXT_ACTIVE_F)) == 0)
854+
855+
max_speed = get_max(espeed & e2speed);
856+
espeed = ibnd_get_agg_linkspeedext(port->info, port->info);
857+
858+
if ((max_speed & espeed) == 0)
858859
// we are not at the max supported extended speed
859860
// print what we could be at.
860861
snprintf(speed_msg, msg_size, "Could be %s",
861-
mad_dump_val(IB_PORT_LINK_SPEED_EXT_ACTIVE_F,
862-
buf, 64, &max_speed));
862+
ibnd_dump_agg_linkspeedext(buf, 64, max_speed));
863863
return;
864864

865865
check_fdr10_active:
@@ -937,6 +937,16 @@ void dump_portinfo(void *pi, int tabs)
937937
return;
938938
printf("%s\n", buf);
939939
}
940+
941+
for (field = IB_PORT_LINK_SPEED_EXT_ACTIVE_2_F;
942+
field < IB_PORT_LINK_SPEED_EXT_2_LAST_F; field++) {
943+
for (i = 0; i < tabs; i++)
944+
printf("\t");
945+
mad_decode_field(pi, field, val);
946+
if (!mad_dump_field(field, buf, 1024, val))
947+
return;
948+
printf("%s\n", buf);
949+
}
940950
}
941951

942952
op_fn_t *match_op(const match_rec_t match_tbl[], char *name)

0 commit comments

Comments
 (0)