in pci_lib/pci_lib.py [0:0]
def express_aer(self):
"""
Retrieve the device's PCIe Advanced Error Reporting (AER) statistics,
if the device is AER capable and the kernel provides the corresponding
pseudo fs interface under /sys/bus/pci/devices/. The information is
gleaned from the following files, when present:
For devices:
/sys/bus/pci/devices/<dev>/aer_dev_correctable
/sys/bus/pci/devices/<dev>/aer_dev_fatal
/sys/bus/pci/devices/<dev>/aer_dev_nonfatal
along with the following for Root Port error counts:
/sys/bus/pci/devices/<dev>/aer_rootport_total_err_cor
/sys/bus/pci/devices/<dev>/aer_rootport_total_err_fatal
/sys/bus/pci/devices/<dev>/aer_rootport_total_err_nonfatal
Returns a dictionary with device and rootport dictionaries containing
various key/value pairs or counts provided via the pseudo fs files.
Empty device/rootport dictionaries are not included and None is
returned when no AER information has been found.
"""
if self.express_type is None:
return None
aer = {}
dev_stats = aer_dev_stats(self.device_name, ['aer_dev_correctable',
'aer_dev_fatal',
'aer_dev_nonfatal'])
if dev_stats is not None:
aer["device"] = dev_stats
if self.express_type == 'root_port':
rp_counts = aer_rootport_counts(self.device_name,
['aer_rootport_total_err_cor',
'aer_rootport_total_err_fatal',
'aer_rootport_total_err_nonfatal'])
if rp_counts is not None:
aer["rootport"] = rp_counts
if len(aer) == 0:
return None
return aer