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

Method _load_pci_ids

dpdk/buildtools/pmdinfogen.py:163–189  ·  view source on GitHub ↗
(image, table_name_symbol)

Source from the content-addressed store, hash-verified

161
162 @staticmethod
163 def _load_pci_ids(image, table_name_symbol):
164 table_name = table_name_symbol.string_value
165 table_symbol = image.find_by_name(table_name)
166 if not table_symbol:
167 raise Exception("PCI table declared but not defined: %d" % table_name)
168
169 rte_pci_id = define_rte_pci_id(image.is_big_endian)
170
171 result = []
172 while True:
173 size = ctypes.sizeof(rte_pci_id)
174 offset = size * len(result)
175 data = table_symbol.get_value(offset, size)
176 if not data:
177 break
178 pci_id = rte_pci_id.from_buffer_copy(data)
179 if not pci_id.device_id:
180 break
181 result.append(
182 [
183 pci_id.vendor_id,
184 pci_id.device_id,
185 pci_id.subsystem_vendor_id,
186 pci_id.subsystem_device_id,
187 ]
188 )
189 return result
190
191 def dump(self, file):
192 dumped = json.dumps(self.__dict__)

Callers 1

loadMethod · 0.80

Calls 3

define_rte_pci_idFunction · 0.85
find_by_nameMethod · 0.45
get_valueMethod · 0.45

Tested by

no test coverage detected