[dpdk] 熟悉SDK与初步使用 (一)(qemu搭建实验环境)

时间:2021-07-20 14:45:59

搭建实验环境:

troubleshoot

第一步加载驱动

第二步切换驱动

使用了所有qemu支持的卡

[tong@T7:~/VM/dpdk]
% cat start.sh
sudo qemu-system-x86_64 -nographic -vnc 127.0.0.1: -enable-kvm \
-m 2G -cpu Nehalem -smp cores=,threads=,sockets= \
-numa node,mem=1G,cpus=-,nodeid= \
-numa node,mem=1G,cpus=-,nodeid= \
-drive file=disk.img,if=virtio \
-net nic,vlan=,model=virtio,macaddr='00:00:00:01:00:00' \
-net nic,vlan=,model=ne2k_pci,macaddr='00:00:00:01:00:01' \
-net nic,vlan=,model=i82551,macaddr='00:00:00:01:00:02' \
-net nic,vlan=,model=i82557b,macaddr='00:00:00:01:00:03' \
-net nic,vlan=,model=i82559er,macaddr='00:00:00:01:00:04' \
-net nic,vlan=,model=rtl8139,macaddr='00:00:00:01:00:05' \
-net nic,vlan=,model=e1000,macaddr='00:00:00:01:00:06' \
-net nic,vlan=,model=pcnet,macaddr='00:00:00:01:00:07' \
-net tap,vlan=,ifname=tap-dpdk-control \
-net tap,vlan=,ifname=tap-dpdk-,script=no,downscript=no \
-net tap,vlan=,ifname=tap-dpdk-,script=no,downscript=no &
# -device vfio-pci,host='0000:00:19.0' \
#ne2k_pci,i82551,i82557b,i82559er,rtl8139,e1000,pcnet,virtio
[tong@T7:~/VM/dpdk]

只有virtio是对队列的

[root@dpdk ~]# lspci -vv |grep -E '^00|MSI'
:00.0 Host bridge: Intel Corporation 440FX - 82441FX PMC [Natoma] (rev )
:01.0 ISA bridge: Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
:01.1 IDE interface: Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II] (prog-if [Master])
:01.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev )
:02.0 VGA compatible controller: Device : (rev ) (prog-if [VGA controller])
:03.0 Ethernet controller: Red Hat, Inc Virtio network device
Capabilities: [] MSI-X: Enable+ Count= Masked-
:04.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-(AS)
:05.0 Ethernet controller: Intel Corporation 8255xER/82551IT Fast Ethernet Controller (rev 0f)
:06.0 Ethernet controller: Intel Corporation //// Ethernet Pro (rev )
:07.0 Ethernet controller: Intel Corporation 8255xER/82551IT Fast Ethernet Controller (rev )
:08.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-/8101L/ PCI Fast Ethernet Adapter (rev )
:09.0 Ethernet controller: Intel Corporation 82540EM Gigabit Ethernet Controller (rev )
:0a. Ethernet controller: Advanced Micro Devices, Inc. [AMD] 79c970 [PCnet32 LANCE] (rev )
:0b. SCSI storage controller: Red Hat, Inc Virtio block device
Capabilities: [] MSI-X: Enable+ Count= Masked-
[root@dpdk ~]#

xxx

[root@dpdk tools]# ./dpdk-devbind.py -b igb_uio eth1
[root@dpdk tools]# ./dpdk-devbind.py -b igb_uio eth2
[root@dpdk tools]# ./dpdk-devbind.py -s Network devices using DPDK-compatible driver
============================================
::04.0 'Virtio network device' drv=igb_uio unused=
::05.0 'Virtio network device' drv=igb_uio unused= Network devices using kernel driver
===================================
::03.0 'Virtio network device' if=eth0 drv=virtio-pci unused=igb_uio *Active* Other network devices
=====================
<none>
[root@dpdk tools]#

qemu的所有nic都可以使用uio

[root@dpdk tools]# ./dpdk-devbind.py -s

Network devices using DPDK-compatible driver
============================================
<none> Network devices using kernel driver
===================================
::03.0 'Virtio network device' if=eth0 drv=virtio-pci unused=igb_uio *Active*
::08.0 'RTL-8100/8101L/8139 PCI Fast Ethernet Adapter' if=ens8 drv=8139cp unused=igb_uio
::09.0 '82540EM Gigabit Ethernet Controller' if=ens9 drv=e1000 unused=igb_uio Other network devices
=====================
::04.0 'RTL-8029(AS)' unused=igb_uio
::05.0 '8255xER/82551IT Fast Ethernet Controller' unused=igb_uio
::06.0 '82557/8/9/0/1 Ethernet Pro 100' unused=igb_uio
::07.0 '8255xER/82551IT Fast Ethernet Controller' unused=igb_uio
::0a. '79c970 [PCnet32 LANCE]' unused=igb_uio
[root@dpdk tools]#