Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: July 2017
 
 

pciv_vf_config(9F)

Name

pciv_vf_config - obtain and configure VF configuration parameters for a device driver instance

Synopsis

#include <sys/sunddi.h>

int pciv_vf_config(dev_info_t *dip, pciv_config_vf_t *vfcfg_p);

Parameters

dip

pointer to a dev_info structure

vfcfg_p

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;
cmd

pre/post VF Enable/Disable

num_vf

number of VFs to be used

first_vf_offset

offset between 1st VF and PF

vf_stride

distance between VFs

ari_cap

ARI-capable hierarchy

page_size

system page size

Description

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.

Return Values

The pciv_vf_config() function returns:

DDI_SUCCESS

The request was accepted and this PF's VFs are enabled.

DDI_INVAL

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.

DDI_FAILURE

Implementation-specific failures occurred.

Context

The pciv_vf_config() function can be called from kernel non-interrupt context.

Attributes

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Interface Stability
Uncommitted
MT-Level
Unsafe

See Also

attributes(5), ddi_cb_register(9F), pci_param_get(9F)