PCI_IOV not visible in driver code

Hi,
I am compiling a driver for sr-iov.

The /usr/src/sys/amd64/conf/GENERIC has the PCI_IOV option specified by default.
Code:
options         PCI_IOV                 # PCI SR-IOV support

I have the following in the driver code
C:
#ifdef PCI_IOV
#include <sys/nv.h>
#include <sys/iov_schema.h>
#include <dev/pci/pci_iov.h>
#endif
...
C:
static device_method_t DRE_pciDevMethods[] =
{
    /* Device interface */
...
    DEVMETHOD(device_attach,    DRV_devAttach),
...
    DEVMETHOD(device_suspend, DRV_pmSuspend),
    DEVMETHOD(device_resume,   DRV_pmResume),
...
    {NULL, NULL}
};

The method
DRV_devAttach(device_t dev), has the following code section:

C:
#ifdef PCI_IOV
{
    nvlist_t *pf_schema, *vf_schema;
    int error=0;
    pf_schema = pci_iov_schema_alloc_node();
    vf_schema = pci_iov_schema_alloc_node();
    error = pci_iov_attach_name(dev, pf_schema, vf_schema, "%s", device_get_nameunit(dev));
    if (error) {
        device_printf(dev, "Failed to initialize SR-IOV: %d\n", error);
        return (0);
    }
}
#endif

The code enclosed within PCI_IOV is not being executed.
Note that with the #ifdef PCI_IOV / #endif lines removed, the call to pci_iov_attach_name() executes without any error and sets the /dev/iov entry.
The intention to enclose within PCI_IOV is to enable the code on systems that has the option set in the kernel config.
Why is the option not visible even though it is defined in the config?

Running on: FreeBSD 13.0-RELEASE

Thanks.
 
Back
Top