pcie: Introduce pcie_sriov_num_vfs
authorAkihiko Odaki <akihiko.odaki@daynix.com>
Thu, 23 Feb 2023 10:50:50 +0000 (19:50 +0900)
committerJason Wang <jasowang@redhat.com>
Fri, 10 Mar 2023 07:35:38 +0000 (15:35 +0800)
igb can use this function to change its behavior depending on the
number of virtual functions currently enabled.

Signed-off-by: Gal Hammer <gal.hammer@sap.com>
Signed-off-by: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Jason Wang <jasowang@redhat.com>
hw/pci/pcie_sriov.c
include/hw/pci/pcie_sriov.h

index f0bd72e069e0f7f651f072bc55640c3928cd9d9b..aa5a757b1125b6f90ffd6e28a3007d403eaa0afa 100644 (file)
@@ -300,3 +300,8 @@ PCIDevice *pcie_sriov_get_vf_at_index(PCIDevice *dev, int n)
     }
     return NULL;
 }
+
+uint16_t pcie_sriov_num_vfs(PCIDevice *dev)
+{
+    return dev->exp.sriov_pf.num_vfs;
+}
index 96cc7433091bd41e9c78ed70176d3b97c99d9e29..095fb0c9edf939089d43022d80339a166d083cb1 100644 (file)
@@ -76,4 +76,7 @@ PCIDevice *pcie_sriov_get_pf(PCIDevice *dev);
  */
 PCIDevice *pcie_sriov_get_vf_at_index(PCIDevice *dev, int n);
 
+/* Returns the current number of virtual functions. */
+uint16_t pcie_sriov_num_vfs(PCIDevice *dev);
+
 #endif /* QEMU_PCIE_SRIOV_H */