Send new PCI info for FPGA virtual devices as well

Currently on startup we reset the N3000 and then send new PCI
information to sysinv-conductor (and delete the old information
to remove stale entries after an address change).

We also need to do this for the virtual PCI devices that are
implemented on the FPGA itself.

Change-Id: I8cb75ad2298eb928c6600db0b7b6ab409d9288e1
Story: 2006740
Task:  40125
Signed-off-by: Chris Friesen <chris.friesen@windriver.com>
This commit is contained in:
Chris Friesen 2020-06-19 16:13:07 -06:00
parent 65166ff76e
commit 1ef8c8a069
3 changed files with 21 additions and 3 deletions

View File

@ -2585,7 +2585,7 @@ class ConductorManager(service.PeriodicService):
LOG.debug("looking at device %s, %s, %s" %
(device.pciaddr, device.pvendor_id, device.pdevice_id))
if (device.pvendor_id != fpga_constants.N3000_VENDOR or
device.pdevice_id != fpga_constants.N3000_DEVICE):
device.pdevice_id not in fpga_constants.N3000_DEVICES):
continue
if device.pciaddr not in update_addrs:
LOG.info("Deleting stale device at address %s" % device.pciaddr)

View File

@ -9,3 +9,16 @@
# device-specific information.
N3000_VENDOR = "8086"
N3000_DEVICE = "0b30"
# These are "virtual" PCI devices implemented by the FPGA user image.
N3000_DEFAULT_DEVICE = "0b32"
N3000_FEC_PF_DEVICE = "0d8f"
N3000_FEC_VF_DEVICE = "0d90"
# We don't care about the VFs here, as they get created after we reset the
# FPGA and fix up the PCI device entries in the DB.
N3000_DEVICES = [
N3000_DEVICE,
N3000_FEC_PF_DEVICE,
N3000_DEFAULT_DEVICE,
]

View File

@ -370,8 +370,13 @@ def get_n3000_pci_info():
pci_device_list = []
try:
pci_operator = pci.PCIOperator()
pci_devices = pci_operator.pci_devices_get(
vendor=constants.N3000_VENDOR, device=constants.N3000_DEVICE)
# We want to get updated info for the FPGA itself and any "virtual"
# PCI devices implemented by the FPGA. This loop isn't very
# efficient, but so far it's only a small number of devices.
pci_devices = []
for device in constants.N3000_DEVICES:
pci_devices.extend(pci_operator.pci_devices_get(
vendor=constants.N3000_VENDOR, device=device))
for pci_dev in pci_devices:
pci_dev_array = pci_operator.pci_get_device_attrs(
pci_dev.pciaddr)