Skip to content

Commit 2934ea8

Browse files
committed
separate number of modules and max number of ports (including split)
1 parent f993194 commit 2934ea8

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

ibswinfo.sh

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,7 @@ add_idx="" add_tmp_idx=""
307307
${mft_cur//./} -lt 4210 ]] && rid[MGIR]="module_base=0x0"
308308
[[ ${mft_cur//./} -ge 4230 ]] && rid[SPZR]="router_entity=0x0,"
309309
[[ ${mft_cur//./} -ge 4301 ]] && add_tmp_idx="asic_index=0x0,ig=0x0,i=0x0,"
310+
rid[MGPIR]+="slot_index=0x0"
310311
rid[MSCI]+="index=0x0" # handle main CPLD only
311312
rid[SPZR]+="swid=0x0"
312313
rid[MTMP]+="sensor_index=0x0${add_idx:+,$add_idx}${add_tmp_idx:+,$add_tmp_idx}"
@@ -404,13 +405,11 @@ done <<< "$_regs"
404405
# vitals and status
405406
[[ ! $out =~ inventory ]] && {
406407
# number of modules
407-
_np=$(awk '/num_of_modules / {printf $NF}' <<< "${reg[MGPIR]}")
408-
if [[ $_np =~ ^0x ]]; then
409-
np=$(htod "$_np")
410-
else # try to get that from the SM
411-
_s=$(smpquery NI -G "${guid:-}" | awk -F. '/NumPorts/ {print $NF}')
412-
np=$((_s%2==0?_s:_s-1))
413-
fi
408+
nm=$(htod "$(awk '/num_of_modules_per_system / {printf $NF}' <<< "${reg[MGPIR]}")")
409+
[[ $nm == 0 ]] && \
410+
nm=$(htod "$(awk '/num_of_modules / {printf $NF}' <<< "${reg[MGPIR]}")")
411+
# max number of ports
412+
np=$(htod "$(awk '/num_ports / {printf $NF}' <<< "${reg[MGIR]}")")
414413

415414
# uptime
416415
h_uptime=$(awk '/^uptime / {print $NF}' <<< "${reg[MGIR]}")
@@ -427,7 +426,7 @@ done <<< "$_regs"
427426

428427
# optionally get modules temperature
429428
[[ "$opt_T" == "1" ]] && {
430-
_qtps=$(for q in $(seq 1 $np); do
429+
_qtps=$(for q in $(seq 1 "$nm"); do
431430
i=$(dtoh $((q+63)))
432431
r="sensor_index=0x$i${add_idx:+,$add_idx}"
433432
r+=${add_tmp_idx:+,$add_tmp_idx}
@@ -546,7 +545,7 @@ case $out in
546545
out_kv "cur.temp (C)" "${tp}"
547546
out_kv "max.temp (C)" "${mt}"
548547
[[ "$opt_T" == "1" ]] && {
549-
for q in $(seq 1 $np); do
548+
for q in $(seq 1 "$nm"); do
550549
out_kv "module#$(printf "%02d" "$q").temp (C)" "${qt[$q]}"
551550
done
552551
}
@@ -566,7 +565,8 @@ out_kv "part number" "$pn"
566565
out_kv "serial number" "$sn"
567566
out_kv "product name" "$cn"
568567
out_kv "revision" "$rv"
569-
out_kv "modules" "$np"
568+
out_kv "modules" "$nm"
569+
out_kv "max ports" "$np"
570570
out_kv "PSID" "$psid"
571571
out_kv "GUID" "$guid"
572572
out_kv "firmware version" "$(printf "%d.%04d.%04d" "$maj" "$min" "$sub")"
@@ -589,7 +589,7 @@ out_kv "temperature (C)" "${tp}"
589589
out_kv "max temp (C)" "${mt}"
590590
out_kv "warn threshold (C)" "$twl/$twh (low/high)"
591591
[[ "$opt_T" == "1" ]] && {
592-
for q in $(seq 1 $np); do
592+
for q in $(seq 1 "$nm"); do
593593
out_kv "module#$(printf "%02d" "$q") (C) " "${qt[$q]}"
594594
done
595595
}

0 commit comments

Comments
 (0)