光纤通道 PF 驱动程序要添加对 SR-IOV 的支持,必须调用 ddi_cb_register() 并包括 DDI_CB_FLAG_SRIOV 标志。有关更多信息,请参见Driver Callbacks部分。
已注册 SR-IOV 回调的光纤通道 PF 驱动程序将会收到 action 参数为 DDI_CB_PCIV_CLASS_CONFIG 的回调。该回调包括 cbarg 参数,即指向 fciov_conf_t 结构的指针:
typedef struct fciov_conf { fciov_config_cmd_t fci_cmd; /* configuration op to be performed */ uint16_t fci_vf_id; /* Index of the VF to be configured */ fciov_cfg_flags fci_flags; /* Flags, indicate which info is valid */ uint8_t fci_node_wwn[8];/* node WWN for the VF */ uint8_t fci_port_wwn[8];/* port WWN for the VF */ uint16_t fci_bandwidth; /* percentile bandwidth for the VF */ } fciov_conf_t;
表示针对指定的 VF 要执行的操作。有效值的定义如下所示:
typedef enum { FCIOV_VF_CONFIG = 0x1, /* Configure a FC VF */ FCIOV_VF_UPDCONFIG = 0x2,/* Update configuration of FC VF */ FCIOV_VF_UNCONFIG = 0x4 /* Unconfigure a FC VF*/ }fciov_config_cmd_t;
接收回调的 PF 的 VF 索引编号。此字段的有效值为 0 至 N-1,其中 N 为接收 PF 中启用的虚拟功能数。
表示包含的哪些数据字段有效的位掩码。支持的值的定义如下所示:
typedef enum { FCIOV_NODE_WWN = 0x1, /* node WWN info is valid */ FCIOV_PORT_WWN = 0x2, /* port WWN info is valid */ FCIOV_BANDWIDTH = 0x4 /* bandwidth info is valid */ }fciov_cfg_flags;
指定 VF 的节点全局名称 (world wide name, WWN)。
指定 VF 的端口全局名称 (world wide name, WWN)。
表示需要分配至虚拟功能的带宽百分点。有关详细信息,请参见Bandwidth Configuration for Fibre Channel Virtual Functions。