mer*_*011 3 linux virtualization networking nic dpdk
我的机器上有两个物理NIC。根据这篇文章,似乎dpdk应该能够使用虚拟NIC。
因此,我在Linux中使用以下命令创建了3个虚拟接口,其中,这eno1d1是我的物理NIC的名称。
sudo ifconfig eno1d1:0 10.10.1.107
sudo ifconfig eno1d1:1 10.10.1.207
sudo ifconfig eno1d1:2 10.10.2.107
但是,当我运行dpdk应用程序时,该函数rte_eth_dev_count仍仅返回2。
我需要做什么才能使Dpdk识别虚拟NIC?
这是有关我的DPDK版本的一些信息,该信息记录在应用程序的开头。
Using DPDK version DPDK 16.11.0
DPDK: EAL: Detected 16 lcore(s)
DPDK: EAL: Probing VFIO support...
DPDK: EAL: PCI device 0000:09:00.0 on NUMA socket 0
DPDK: EAL:   probe driver: 15b3:1007 net_mlx4
DPDK: PMD: net_mlx4: PCI information matches, using device "mlx4_0" (VF: false)
DPDK: PMD: net_mlx4: 2 port(s) detected
DPDK: PMD: net_mlx4: port 1 MAC address is ec:b1:d7:85:3a:12
DPDK: PMD: net_mlx4: port 2 MAC address is ec:b1:d7:85:3a:13
DPDK: PMD: net_mlx4: 0xae6000: TX queues number update: 0 -> 1
DPDK: PMD: net_mlx4: 0xae6000: RX queues number update: 0 -> 1
这是ifconfig我机器上的输出。
eno1      Link encap:Ethernet  HWaddr ec:b1:d7:85:1a:12  
          inet addr:128.110.153.148  Bcast:128.110.155.255  Mask:255.255.252.0
          inet6 addr: fe80::eeb1:d7ff:fe85:1a12/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15241610 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11238825 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4530541723 (4.5 GB)  TX bytes:8168066799 (8.1 GB)
eno1d1    Link encap:Ethernet  HWaddr ec:b1:d7:85:1a:13  
          inet addr:10.10.1.7  Bcast:10.10.1.255  Mask:255.255.255.0
          inet6 addr: fe80::eeb1:d7ff:fe85:1a13/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3787661978 errors:0 dropped:66084 overruns:0 frame:0
          TX packets:4758273664 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:1905977969665 (1.9 TB)  TX bytes:3897938668285 (3.8 TB)
eno1d1:0  Link encap:Ethernet  HWaddr ec:b1:d7:85:1a:13  
          inet addr:10.10.1.107  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
eno1d1:1  Link encap:Ethernet  HWaddr ec:b1:d7:85:1a:13  
          inet addr:10.10.1.207  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
eno1d1:2  Link encap:Ethernet  HWaddr ec:b1:d7:85:1a:13  
          inet addr:10.10.2.107  Bcast:10.255.255.255  Mask:255.0.0.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:62313 errors:0 dropped:0 overruns:0 frame:0
          TX packets:62313 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:3557508 (3.5 MB)  TX bytes:3557508 (3.5 MB)
eno1d1:0链接encap:以太网HWaddr ec:b1:d7:85:1a:13
这些不是虚拟NIC,而是网络别名,即,不同的Linux内核netdev引用相同的NIC。由于DPDK不使用Linux内核,因此我们不能使用这些别名来运行DPDK应用程序。
但是,在不使用物理网卡的情况下,我们几乎没有选择来运行DPDK应用程序:
有关更多信息,请查看用于仿真Virtio NIC的DPDK轮询模式驱动程序。
num_vfs给MLX4内核模块驱动程序的主机NIC上配置一些虚拟功能。vfio-pci有关更多信息,请查看DPDK MLX4轮询模式驱动程序以及如何为ConnectX-3配置SR-IOV
有关SR-IOV的一般说明,您可能会找到有用的DPDK Intel虚拟功能驱动程序。请注意,Mellanox内核模块的配置略有不同,您应该使用num_vfs上面链接中所述的。
libpcap支持下编译DPDK 。像往常一样运行DPDK应用程序,但是传递几个--vdev参数来创建几个虚拟设备,例如:
testpmd -l 0-3 -n 4 \ --vdev'net_pcap0,iface = tun0'--vdev'net_pcap1,iface = tun1'...
有关更多信息,请查看DPDK libpcap轮询模式驱动程序。
希望这些选项之一适合您的需求。