Skip to content

librte_pmd_virtio :Fix: virtio_pci.h non-existent virtio feature bit-flag tested

Alan Carew dpdk-dev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest4 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4igb_uio: Add interrupt_mode sysfs entry for igb_uio deviceslib/librte_eal/common/include/rte_pci_dev_feature_defs.h lib/librte_eal/common/include/rte_pci_dev_features.h lib/librte_eal/linuxapp/igb_uio/igb_uio.c+193 -101 reply
2/4eal_pci: Add interrupt mode to rte_pci_device and parsing to eal_pcilib/librte_eal/common/Makefile lib/librte_eal/common/include/rte_pci.h lib/librte_eal/linuxapp/eal/eal_pci.c+81 -00 replies
3/4FreeBSD: Adds the equivalent interrupt mode setting and parsinglib/librte_eal/bsdapp/eal/eal_pci.c lib/librte_eal/bsdapp/nic_uio/nic_uio.c+59 -00 replies
4/4virtio: Fixes the VIRTIO_PCI_CONFIG macro to use the correct offset to the Virtio headerlib/librte_pmd_virtio/virtio_ethdev.c lib/librte_pmd_virtio/virtio_pci.h+4 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/4] librte_pmd_virtio :Fix: virtio_pci.h non-existent virtio feature bit-flag tested

This series addresses an issue with librte_pmd_virtio where the offset to the virtio device specific header may be incorrect depending on whether MSI-X has been enabled or not.

If MSI-X is configured the device specific header is placed at byte offset 24 relative to the IO base address.
If MSI-X is not configured the device specific header is placed at byte offset 20.

The following macro defined in virtio_pci.h is used to test the
presence of the MSI-X header and determine the correct offset:
#define VIRTIO_PCI_CONFIG(hw) (((hw)->guest_features & VIRTIO_PCI_FLAG_MSIX) ? 24 : 20)

However, VIRTIO_PCI_FLAG_MSIX is not a guest_feature nor is it part of the Virtio Specification and resolves to the VIRTIO_NET_F_MAC feature as both are #defined as 0x20.

VIRTIO_PCI_FLAG_MSIX or similar flag should instead be set by the kernel driver allocating resources and passed to user space for testing.
i.e.
#define VIRTIO_PCI_CONFIG(hw) (((hw)->intr_mode & IGBUIO_MSIX_INTR_MODE) ? 24 : 20)

To enable this testing of interrupt mode, this series allows for the kernel driver(igb_uio) to place the configured interrupt mode into a sysfs entry. sysfs is then parsed by eal_pci to determine the configured mode, which allows all user space devices to correctly determine the interrupt mode, including virtio_ethdev.

This series should be applied prior to Anatoly Burakov's [VFIO] Add VFIO support to DPDK series

Alan Carew (4):
igb_uio: Add interrupt_mode sysfs entry for igb_uio devices
eal_pci: Add interrupt mode to rte_pci_device and parsing to eal_pci
FreeBSD: Adds the equivalent interrupt mode setting and parsing
virtio: Fixes the VIRTIO_PCI_CONFIG macro to use the correct offset
to the Virtio header

 lib/librte_eal/bsdapp/eal/eal_pci.c                |   44 ++++++++++
 lib/librte_eal/bsdapp/nic_uio/nic_uio.c            |   14 +++
 lib/librte_eal/common/Makefile                     |    1 +
 lib/librte_eal/common/include/rte_pci.h            |    2 +
 .../common/include/rte_pci_dev_feature_defs.h      |   85 ++++++++++++++++++++
 .../common/include/rte_pci_dev_features.h          |   70 ++++++++++++++++
 lib/librte_eal/linuxapp/eal/eal_pci.c              |   78 ++++++++++++++++++
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c          |   48 +++++++++---
 lib/librte_pmd_virtio/virtio_ethdev.c              |    1 +
 lib/librte_pmd_virtio/virtio_pci.h                 |    4 +-
 10 files changed, 336 insertions(+), 11 deletions(-)
 create mode 100755 lib/librte_eal/common/include/rte_pci_dev_feature_defs.h
 create mode 100755 lib/librte_eal/common/include/rte_pci_dev_features.h