#include <sys/sunddi.h> int pciv_vf_config(dev_info_t *dip, pciv_config_vf_t *vfcfg_p);
pointer to a dev_info structure
pointer to a pciv_config_vf structure
typedef enum { PCIV_VFCFG_PARAM, PCIV_VF_ENABLE, PCIV_EVT_VFENABLE_PRE, PCIV_EVT_VFENABLE_POST, PCIV_EVT_VFDISABLE_PRE, PCIV_EVT_VFDISABLE_POST } pciv_vf_config_cmd;
typedef struct pciv_config_vf { int version; pciv_vf_config_cmd cmd; uint16_t num_vf; uint16_t first_vf_offset; uint16_t vf_stride; boolean_t ari_cap; uint32_t page_size; } pciv_config_vf_t;
pre/post VF Enable/Disable
number of VFs to be used
offset between 1st VF and PF
distance between VFs
ARI-capable hierarchy
system page size
The pciv_vf_config() function is used by SR-IOV (Single-Root IO Virtualization) device PF (Physical Function) drivers to obtain VF (Virtual Function) configuration parameters and to configure their VFs. When the cmd field in set as PCIV_VFCFG_PARAM the call returns with appropriate values in the rest of fields of pciv_config_vf_t.
The num_vf field indicates the number of VFs that is defined in the backend store such as MD or the /etc/pci.conf file for this device. The first_vf_offset, vf_stride, ari_cap, and page_size are the corresponding values retrieved from the SRIOV capability structure of the PF device.
After first calling pciv_vf_config() with cmd set to PCIV_VFCFG_PARAM, the caller can then call the interface again with cmd set to PCIV_VF_ENABLE to enable its VF devices, without modifying any of the num_vf, first_vf_offset, vf_stride, ari_cap, or page_size values that were returned when cmd was set as PCIV_VFCFG_PARAM.
The pciv_vf_config() function returns:
The request was accepted and this PF's VFs are enabled.
The command was other than PCIV_VFCFG_PARAM or PCIV_VF_ENABLE, the device is not IOV capable, num_vf was set to 0, and the call was made to enable the VF; or parameters of PCIV_VF_ENABLE do not correspond to the values returned by PCIV_VFCFG_PARAM.
Implementation-specific failures occurred.
The pciv_vf_config() function can be called from kernel non-interrupt context.
See attributes(5) for descriptions of the following attributes:
|