diff options
| author | Yui Washizu <yui.washidu@gmail.com> | 2026-03-10 15:14:52 +0900 |
|---|---|---|
| committer | Michael S. Tsirkin <mst@redhat.com> | 2026-06-10 02:17:00 -0400 |
| commit | 82da84282c0746ae7c6d87dad7b8daba88f0d091 (patch) | |
| tree | 4c0ffc747b2c4843ecf74f7388a81029aa05f8f4 /drivers/phy/eswin/git@git.tavy.me:linux.git | |
| parent | 7222e8c8567e2aa1a2f1b4d3e40158d64ce538b6 (diff) | |
virtio: add num_vf callback to virtio_bus
Recent QEMU versions added support for virtio SR-IOV emulation,
allowing virtio devices to expose SR-IOV VFs to the guest.
However, virtio_bus does not implement the num_vf callback of bus_type,
causing dev_num_vf() to return 0 for virtio devices even when
SR-IOV VFs are active.
net/core/rtnetlink.c calls dev_num_vf(dev->dev.parent) to populate
IFLA_NUM_VF in RTM_GETLINK responses. For a virtio-net device,
dev.parent points to the virtio_device, whose busis virtio_bus.
Without num_vf, SR-IOV VF information is silently
omitted from tools that rely on rtnetlink, such as 'ip link show'.
Add a num_vf callback that delegates to dev_num_vf(dev->parent),
which in turn reaches the underlying transport (pci_bus_type for
virtio-pci) where the actual VF count is tracked. Non-PCI transports
are unaffected as dev_num_vf() returns 0 when no num_vf callback is
present.
Signed-off-by: Yui Washizu <yui.washidu@gmail.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Message-ID: <20260310061454.683894-1-yui.washidu@gmail.com>
Diffstat (limited to 'drivers/phy/eswin/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
