[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/5] pcie: add helper function to get number of VFs
From: |
Sriram Yagnaraman |
Subject: |
[PATCH 1/5] pcie: add helper function to get number of VFs |
Date: |
Thu, 22 Dec 2022 12:41:16 +0100 |
Signed-off-by: Sriram Yagnaraman <sriram.yagnaraman@est.tech>
---
hw/pci/pcie_sriov.c | 6 ++++++
include/hw/pci/pcie_sriov.h | 5 +++++
2 files changed, 11 insertions(+)
diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
index 8e3faf1f59..88ba642a20 100644
--- a/hw/pci/pcie_sriov.c
+++ b/hw/pci/pcie_sriov.c
@@ -300,3 +300,9 @@ PCIDevice *pcie_sriov_get_vf_at_index(PCIDevice *dev, int n)
}
return NULL;
}
+
+int pcie_sriov_get_num_vfs(PCIDevice *dev)
+{
+ assert(!pci_is_vf(dev));
+ return dev->exp.sriov_pf.num_vfs;
+}
diff --git a/include/hw/pci/pcie_sriov.h b/include/hw/pci/pcie_sriov.h
index 80f5c84e75..8e9367a03a 100644
--- a/include/hw/pci/pcie_sriov.h
+++ b/include/hw/pci/pcie_sriov.h
@@ -74,4 +74,9 @@ PCIDevice *pcie_sriov_get_pf(PCIDevice *dev);
*/
PCIDevice *pcie_sriov_get_vf_at_index(PCIDevice *dev, int n);
+/*
+ * Get the number of VFs created for this physical function.
+ */
+int pcie_sriov_get_num_vfs(PCIDevice *dev);
+
#endif /* QEMU_PCIE_SRIOV_H */
--
2.34.1
- [PATCH 0/5] hw/net/igb: emulated network device with SR-IOV, Sriram Yagnaraman, 2022/12/22
- [PATCH 4/5] hw/net/igb: emulated intel IGB (82576EB) network device, Sriram Yagnaraman, 2022/12/22
- [PATCH 5/5] hw/net/igb: build support for igb/igbvf devices, Sriram Yagnaraman, 2022/12/22
- [PATCH 3/5] hw/net/igb: register definitions, Sriram Yagnaraman, 2022/12/22
- [PATCH 2/5] hw/net/net_tx_pkt: helper function to get l2 hdr, Sriram Yagnaraman, 2022/12/22
- [PATCH 1/5] pcie: add helper function to get number of VFs,
Sriram Yagnaraman <=
- Re: [PATCH 0/5] hw/net/igb: emulated network device with SR-IOV, Jason Wang, 2022/12/22