Skip to content

Commit 26ea3d8

Browse files
committed
libibumad: Fix iteration index for switches
Updated start index from 1 to 0 in: - count_ports_by_guid - umad_get_smi_gsi_pairs - umad_find_active This fix should add support for switches (In HCA port 0 will be null and skipped) Fixes: be54b52 ("libibumad: Add new API to support SMI/GSI seperation") Signed-off-by: Asaf Mazor <[email protected]>
1 parent 1d80711 commit 26ea3d8

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

libibumad/umad.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -1444,9 +1444,9 @@ static int count_ports_by_guid(char legacy_ca_names[][UMAD_CA_NAME_LEN], size_t
14441444
if (umad_get_ca(legacy_ca_names[c_idx], &curr_ca) < 0)
14451445
continue;
14461446

1447-
size_t p_idx = 1;
1447+
size_t p_idx = 0;
14481448

1449-
for (p_idx = 1; p_idx < (size_t)curr_ca.numports + 1; ++p_idx) {
1449+
for (p_idx = 0; p_idx < (size_t)curr_ca.numports + 1; ++p_idx) {
14501450
umad_port_t *p_port = curr_ca.ports[p_idx];
14511451
size_t count_idx = 0;
14521452

@@ -1496,9 +1496,9 @@ int umad_get_smi_gsi_pairs(struct umad_ca_pair cas[], size_t max)
14961496
if (umad_get_ca(legacy_ca_names[c_idx], &curr_ca) < 0)
14971497
continue;
14981498

1499-
size_t p_idx = 1;
1499+
size_t p_idx = 0;
15001500

1501-
for (p_idx = 1; p_idx < (size_t)curr_ca.numports + 1; ++p_idx) {
1501+
for (p_idx = 0; p_idx < (size_t)curr_ca.numports + 1; ++p_idx) {
15021502
umad_port_t *p_port = curr_ca.ports[p_idx];
15031503
uint8_t guid_count = 0;
15041504

@@ -1558,7 +1558,7 @@ static int umad_find_active(struct umad_ca_pair *ca_pair, const umad_ca_t *ca, b
15581558
if (!ca_pair)
15591559
return 1;
15601560

1561-
for (i = 1; i < (size_t)ca->numports + 1; ++i) {
1561+
for (i = 0; i < (size_t)ca->numports + 1; ++i) {
15621562
if (!umad_check_active(ca, i)) {
15631563
*portnum_to_set = ca->ports[i]->portnum;
15641564
return 0;

0 commit comments

Comments
 (0)