rte_virtio: move pci_dump_json_config out of #ifdef
pci_dump_json_config() is used for both legacy and modern PCI virtio devices, so move it out of the #ifdef PCI_LEGACY_SUPPORT so it is available when building against older DPDK versions. Change-Id: I986f9e6a81abda64d77f954b15807d06e35d1748 Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-on: https://review.gerrithub.io/383487 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com>
This commit is contained in:
parent
79745b8c8b
commit
f26983fa07
@ -88,6 +88,25 @@ free_virtio_hw(struct virtio_dev *dev)
|
||||
free(hw);
|
||||
}
|
||||
|
||||
static void
|
||||
pci_dump_json_config(struct virtio_dev *dev, struct spdk_json_write_ctx *w)
|
||||
{
|
||||
struct virtio_hw *hw = virtio_dev_get_hw(dev);
|
||||
struct spdk_pci_addr pci_addr = spdk_pci_device_get_addr((struct spdk_pci_device *)hw->pci_dev);
|
||||
char addr[32];
|
||||
|
||||
spdk_json_write_name(w, "type");
|
||||
if (dev->modern) {
|
||||
spdk_json_write_string(w, "pci-modern");
|
||||
} else {
|
||||
spdk_json_write_string(w, "pci-legacy");
|
||||
}
|
||||
|
||||
spdk_json_write_name(w, "pci_address");
|
||||
spdk_pci_addr_fmt(addr, sizeof(addr), &pci_addr);
|
||||
spdk_json_write_string(w, addr);
|
||||
}
|
||||
|
||||
#ifdef PCI_LEGACY_SUPPORT
|
||||
|
||||
static struct rte_pci_ioport *
|
||||
@ -240,25 +259,6 @@ legacy_notify_queue(struct virtio_dev *dev, struct virtqueue *vq)
|
||||
VIRTIO_PCI_QUEUE_NOTIFY);
|
||||
}
|
||||
|
||||
static void
|
||||
pci_dump_json_config(struct virtio_dev *dev, struct spdk_json_write_ctx *w)
|
||||
{
|
||||
struct virtio_hw *hw = virtio_dev_get_hw(dev);
|
||||
struct spdk_pci_addr pci_addr = spdk_pci_device_get_addr((struct spdk_pci_device *)hw->pci_dev);
|
||||
char addr[32];
|
||||
|
||||
spdk_json_write_name(w, "type");
|
||||
if (dev->modern) {
|
||||
spdk_json_write_string(w, "pci-modern");
|
||||
} else {
|
||||
spdk_json_write_string(w, "pci-legacy");
|
||||
}
|
||||
|
||||
spdk_json_write_name(w, "pci_address");
|
||||
spdk_pci_addr_fmt(addr, sizeof(addr), &pci_addr);
|
||||
spdk_json_write_string(w, addr);
|
||||
}
|
||||
|
||||
const struct virtio_pci_ops legacy_ops = {
|
||||
.read_dev_cfg = legacy_read_dev_config,
|
||||
.write_dev_cfg = legacy_write_dev_config,
|
||||
|
Loading…
Reference in New Issue
Block a user