LCOV - code coverage report
Current view: top level - disco/net/iavf - fd_iavf.h (source / functions) Hit Total Coverage
Test: cov.lcov Lines: 0 4 0.0 %
Date: 2026-11-11 12:40:43 Functions: 0 0 -

          Line data    Source code
       1             : #ifndef HEADER_fd_src_disco_net_iavf_fd_iavf_h
       2             : #define HEADER_fd_src_disco_net_iavf_fd_iavf_h
       3             : 
       4             : #define FD_IAVF_QUEUE_DEPTH_MIN (64U)
       5             : #define FD_IAVF_QUEUE_DEPTH_MAX (4096U)
       6             : 
       7             : #if defined(__linux__)
       8             : #include "../../../util/bits/fd_bits.h"
       9             : #include <net/if.h>
      10             : 
      11           0 : #define FD_IAVF_PCI_ADDR_SZ     (13UL)
      12           0 : #define FD_IAVF_DRIVER_NAME_MAX (32UL)
      13           0 : #define FD_IAVF_MEMBER_MAX      (16UL)
      14           0 : #define FD_IAVF_TILE_MAX        (8UL)
      15             : 
      16             : /* fd_iavf_pci_info describes a validated Intel Ethernet Virtual Function. */
      17             : struct fd_iavf_pci_info {
      18             :   char   pci_addr[ FD_IAVF_PCI_ADDR_SZ ];
      19             :   char   pf_pci_addr[ FD_IAVF_PCI_ADDR_SZ ];
      20             :   char   driver[ FD_IAVF_DRIVER_NAME_MAX ];
      21             :   uint   iommu_group;
      22             :   ushort device_id;
      23             : };
      24             : typedef struct fd_iavf_pci_info fd_iavf_pci_info_t;
      25             : 
      26             : FD_PROTOTYPES_BEGIN
      27             : 
      28             : /* fd_iavf_vfio_avail returns 1 if the vfio-pci driver is registered with
      29             :    the kernel, or 0 otherwise. Does not load the module. */
      30             : int
      31             : fd_iavf_vfio_avail( void );
      32             : 
      33             : /* fd_iavf_vfio_api_check checks the VFIO API version and TYPE1v2 IOMMU
      34             :    support through /dev/vfio/vfio
      35             :    Returns 0 on success or -1 with errno set
      36             :    If diagnostic is non-NULL, sets it to NULL on success or a static
      37             :    error message on failure */
      38             : int
      39             : fd_iavf_vfio_api_check( char const ** diagnostic );
      40             : 
      41             : /* fd_iavf_member_interfaces lists PFs for VF creation on interface or its
      42             :    802.3ad bond members. Writes names to members and count to member_cnt.
      43             :    Each PF must use ice or i40e. Returns 0 on success or -1 with errno set.
      44             :    Outputs are valid only on success. Some bond sysfs errors terminate
      45             :    the process. */
      46             : int
      47             : fd_iavf_member_interfaces( char const * interface,
      48             :                            char         members[ FD_IAVF_MEMBER_MAX ][ IF_NAMESIZE ],
      49             :                            ulong *      member_cnt );
      50             : 
      51             : /* fd_iavf_sriov_bios_guide returns a static BIOS setup explanation for the
      52             :    detected manufacturer and CPU, with a vendor URL when available.
      53             :    Otherwise returns generic advice, or NULL if vendor_only is nonzero */
      54             : char const *
      55             : fd_iavf_sriov_bios_guide( int vendor_only );
      56             : 
      57             : /* fd_iavf_iommu_check checks whether pf_if is in an IOMMU group.
      58             :    The iavf provider requires an IOMMU to restrict which memory the NIC
      59             :    can access. Returns 0 on success or -1 with errno set.
      60             :    If diagnostic is non-NULL, sets it to NULL on success or a static
      61             :    explanation on failure. */
      62             : int
      63             : fd_iavf_iommu_check( char const *  pf_if,
      64             :                      char const ** diagnostic );
      65             : 
      66             : /* fd_iavf_ari_check requires ARI forwarding on pf_if's PCI bus.
      67             :    Reads ari_enabled and returns 0 on success or -1 with errno set,
      68             :    including EOPNOTSUPP when disabled. Does not log failures. */
      69             : int
      70             : fd_iavf_ari_check( char const * pf_if );
      71             : 
      72             : /* fd_iavf_numvfs_get reads pf_if's enabled VF count from sriov_numvfs.
      73             :    A count of zero is valid. Returns 0 on success or -1 with errno set,
      74             :    leaving numvfs unchanged on failure. Does not log failures. */
      75             : int
      76             : fd_iavf_numvfs_get( char const * pf_if,
      77             :                     uint *       numvfs );
      78             : 
      79             : /* fd_iavf_sriov_resources_check requires a PCI bus number for VF 0 and
      80             :    assigned VF BAR0 and BAR3 memory ranges. Returns 0 on success or -1
      81             :    on failure. Only reads sysfs and does not log failures or create VFs. */
      82             : int
      83             : fd_iavf_sriov_resources_check( char const * pf_if );
      84             : 
      85             : /* fd_iavf_get_last_vf returns the PCI address of the highest enabled VF on pf_if.
      86             :    If vfio_only is set, selects the highest index VF bound to vfio-pci.
      87             :    Returns 0 on success or -1 with errno set, including ENOENT for no matching VF.
      88             :    vf_idx is optional and outputs are valid only on success */
      89             : int
      90             : fd_iavf_get_last_vf( char const * pf_if,
      91             :                      uint *       vf_idx,
      92             :                      char         vf_pci_addr[ FD_IAVF_PCI_ADDR_SZ ],
      93             :                      int          vfio_only );
      94             : 
      95             : /* fd_iavf_pci_probe checks for a supported Intel Ethernet VF and requires
      96             :    it to be alone in its IOMMU group so VFIO access cannot include another
      97             :    device. Returns 0 on success or -1 with errno set on failure,
      98             :    clearing info when non-NULL. Records the current driver, empty if unbound.
      99             :    The VF need not use vfio-pci until fd_iavf_vfio_init. */
     100             : int
     101             : fd_iavf_pci_probe( fd_iavf_pci_info_t * info,
     102             :                    char const *         pci_addr );
     103             : 
     104             : FD_PROTOTYPES_END
     105             : #endif
     106             : #endif

Generated by: LCOV version 1.14