SR-IOV的简单理解
来源:互联网 发布:声乐分几种唱法 知乎 编辑:程序博客网 时间:2024/05/16 07:40
SR-IOV的全程是single root I/O virtualization。物理的设备被叫做physical function(PV),一个PF 可以虚拟出virtual devices(VF)。当开启VF是,每一个VF都有自己的配置空间,VF 最后的作用就相当一个传统的PCI devices.
如果一个PCIe设备有SR-IOV的功能,则在PF的probe函数中调用pci_enable_sriov(dev, NR_VIRTFN); 就可以是能VF功能。下面是一个例子:
static int dev_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
pci_enable_sriov(dev, NR_VIRTFN);
...
return 0;
}
static void dev_remove(struct pci_dev *dev)
{
pci_disable_sriov(dev);
...
}
static int dev_suspend(struct pci_dev *dev, pm_message_t state)
{
...
return 0;
}
static int dev_resume(struct pci_dev *dev)
{
...
return 0;
}
static void dev_shutdown(struct pci_dev *dev)
{
...
}
static int dev_sriov_configure(struct pci_dev *dev, int numvfs)
{
if (numvfs > 0) {
...
pci_enable_sriov(dev, numvfs);
...
return numvfs;
}
if (numvfs == 0) {
....
pci_disable_sriov(dev);
...
return 0;
}
}
static struct pci_driver dev_driver = {
.name = "SR-IOV Physical Function driver",
.id_table = dev_id_table,
.probe = dev_probe,
.remove = dev_remove,
.suspend = dev_suspend,
.resume = dev_resume,
.shutdown = dev_shutdown,
.sriov_configure = dev_sriov_configure,
};
以82599为例的话ixgbe_probe->ixgbe_enable_sriov->ixgbe_enable_sriov
static struct pci_driver ixgbe_driver = {
.name = ixgbe_driver_name,
.id_table = ixgbe_pci_tbl,
.probe = ixgbe_probe,
.remove = ixgbe_remove,
#ifdef CONFIG_PM
.suspend = ixgbe_suspend,
.resume = ixgbe_resume,
#endif
.shutdown = ixgbe_shutdown,
.sriov_configure = ixgbe_pci_sriov_configure,
.err_handler = &ixgbe_err_handler
};
如果一个PCIe设备有SR-IOV的功能,则在PF的probe函数中调用pci_enable_sriov(dev, NR_VIRTFN); 就可以是能VF功能。下面是一个例子:
static int dev_probe(struct pci_dev *dev, const struct pci_device_id *id)
{
pci_enable_sriov(dev, NR_VIRTFN);
...
return 0;
}
static void dev_remove(struct pci_dev *dev)
{
pci_disable_sriov(dev);
...
}
static int dev_suspend(struct pci_dev *dev, pm_message_t state)
{
...
return 0;
}
static int dev_resume(struct pci_dev *dev)
{
...
return 0;
}
static void dev_shutdown(struct pci_dev *dev)
{
...
}
static int dev_sriov_configure(struct pci_dev *dev, int numvfs)
{
if (numvfs > 0) {
...
pci_enable_sriov(dev, numvfs);
...
return numvfs;
}
if (numvfs == 0) {
....
pci_disable_sriov(dev);
...
return 0;
}
}
static struct pci_driver dev_driver = {
.name = "SR-IOV Physical Function driver",
.id_table = dev_id_table,
.probe = dev_probe,
.remove = dev_remove,
.suspend = dev_suspend,
.resume = dev_resume,
.shutdown = dev_shutdown,
.sriov_configure = dev_sriov_configure,
};
以82599为例的话ixgbe_probe->ixgbe_enable_sriov->ixgbe_enable_sriov
static struct pci_driver ixgbe_driver = {
.name = ixgbe_driver_name,
.id_table = ixgbe_pci_tbl,
.probe = ixgbe_probe,
.remove = ixgbe_remove,
#ifdef CONFIG_PM
.suspend = ixgbe_suspend,
.resume = ixgbe_resume,
#endif
.shutdown = ixgbe_shutdown,
.sriov_configure = ixgbe_pci_sriov_configure,
.err_handler = &ixgbe_err_handler
};
0 0
- SR-IOV的简单理解
- SR-IOV
- SR-IOV
- SR-IOV
- SR-IOV详解
- SR-IOV 简介
- SR-IOV-Presentation
- SR-IOV 简介
- virtio sr-iov
- 初识SR-IOV
- SR-IOV配置
- SR-IOV 简介
- I/O设备虚拟化技术SR-IOV的好处
- 虚拟化中的SR-IOV
- sr-iov和HP服务器
- Single-Root I/O Virtualization (SR-IOV)
- 英特尔SR-IOV实现PCI硬件资源共享
- 英特尔SR-IOV实现PCI硬件资源共享
- oracle表空间不足
- 通过文件头标识判断图片格式
- 为什么DSP处理器中有两个片内的SRAM
- macOS+iOS:Safari和Webkit停止支持SHA-1证书了
- Sql Server与Oracle函数对比
- SR-IOV的简单理解
- 模式匹配之BF(Brute Force)暴力算法
- Java中equals()与hashCode()方法详解
- [拦截器]关于拦截方法调用其他内部方法无法被拦截问题的解决
- 关于Struts2的Action是单例还是多例,是否可以进行配置
- 那些,我需要想明白的那些
- bufbomb实验心得及详细步骤
- EmpireCMS-此栏目暂无任何新增信息
- C--显示十六进制数字