Detecting If the PCIe function is a physical function or a virtual function

Hi Guys,

I am writing a KMDF driver for SRIOV device and the driver capabilities needs to be different for PF or a VF. I want to same driver binary to work on both and the logic to differentiate between the PF and VF is contained in the driver. One way to detect if a function on which the driver is loading is a PF is by scanning the capabilities chain and see if we find the SRIOV capabilities. That looks like a lot of work to me to do this at initial load time.

Is there a better way to do this?

Thanks
Aj-

scanning the capabilities chain and see if we find the SRIOV capabilities. That looks like a lot of work to me to do this at initial load time

It’s not such a lot of work. You walk a table… it’s very simple. Lots of drivers do it, for various reasons,

Peter