mpsutil: Fix device speed reporting.

Report controller SAS phy speed only for directly attached devices.
For others try to read and report parent expander phy speed.

MFC after:	1 week
This commit is contained in:
Alexander Motin 2022-05-09 17:57:29 -04:00
parent 53c184cf06
commit bce02a0ea4

View File

@ -577,9 +577,12 @@ show_devices(int ac, char **av)
type = get_device_type(le32toh(device->DeviceInfo));
if (device->DeviceInfo & 0x800) { /* Direct Attached */
if (device->PhyNum < nphys) {
phydata = &sas0->PhyData[device->PhyNum];
speed = get_device_speed(phydata->NegotiatedLinkRate);
} else
speed = "";
} else if (device->ParentDevHandle > 0) {
exp1 = mps_read_extended_config_page(fd,
MPI2_CONFIG_EXTPAGETYPE_SAS_EXPANDER,
@ -597,13 +600,13 @@ show_devices(int ac, char **av)
free(device);
return (error);
}
speed = " ";
speed = "";
} else {
speed = get_device_speed(exp1->NegotiatedLinkRate);
free(exp1);
}
} else
speed = " ";
speed = "";
if (device->EnclosureHandle != 0) {
snprintf(enchandle, sizeof(enchandle), "%04x", le16toh(device->EnclosureHandle));