MCPcopy Create free account
hub / github.com/F-Stack/f-stack / scrub_pci_ids

Function scrub_pci_ids

dpdk/usertools/dpdk-pmdinfo.py:147–162  ·  view source on GitHub ↗

Convert numerical ids to hex strings. Strip empty pci_ids lists. Strip wildcard 0xFFFF ids.

(info: dict)

Source from the content-addressed store, hash-verified

145
146
147def scrub_pci_ids(info: dict):
148 """
149 Convert numerical ids to hex strings.
150 Strip empty pci_ids lists.
151 Strip wildcard 0xFFFF ids.
152 """
153 pci_ids = []
154 for pci_fields in info.pop("pci_ids"):
155 pci = {}
156 for name, value in zip(PCI_FIELDS, pci_fields):
157 if value != 0xFFFF:
158 pci[name] = f"{value:04x}"
159 if pci:
160 pci_ids.append(pci)
161 if pci_ids:
162 info["pci_ids"] = pci_ids
163
164
165# ----------------------------------------------------------------------------

Callers 1

parse_pmdinfoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected