Skip to content

Commit

Permalink
Fixed a bug that would prevent transaction checks in the event of SCD…
Browse files Browse the repository at this point in the history
… hijacks
  • Loading branch information
assrinivasan committed May 9, 2024
1 parent 85c90c3 commit 0a3e223
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions sonic_platform_base/sonic_pcie/pcie_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,20 +97,18 @@ def check_pcie_deviceid(self, bus="", device="", fn="", id=""):
data = f.read(2)
hexstring = binascii.hexlify(data).decode('ascii')
procfs_id = str(hexstring[-2:] + hexstring[:2])
if id == procfs_id:
if id != procfs_id:
log.log_notice("PCIe YAML file device ID mismatch for {}:{}.{} - expected {}, got {}".format(bus, device, fn, id, procfs_id))

proc = subprocess.check_output(transaction_check)
output = subprocess.check_output(transaction_check)
transaction_check_result = output.decode('utf8').strip()

if procfs_id == transaction_check_result:
log.log_info("procfs_id = {} , transaction_check output = {}".format(procfs_id, transaction_check_result))
return True
else:
log.log_warning("PCIe transaction check device ID mismatch for {}:{}.{} - expected {}, got {}".format(bus, device, fn, procfs_id, transaction_check_result))
proc = subprocess.check_output(transaction_check)
output = subprocess.check_output(transaction_check)
transaction_check_result = output.decode('utf8').strip()

if procfs_id == transaction_check_result:
return True
else:
log.log_warning("PCIe device ID mismatch for {}:{}.{} - expected {}, got {}".format(bus, device, fn, id, procfs_id))
log.log_warning("PCIe transaction check device ID mismatch for {}:{}.{} - expected {}, got {}".format(bus, device, fn, procfs_id, transaction_check_result))

return False
except OSError as osex:
log.log_warning("Ecountered {} while trying to open {}".format(str(osex), current_file))
Expand Down

0 comments on commit 0a3e223

Please sign in to comment.