dpdk运行及多进程运行,相关问题解决,pktgen, tcpdump应用

ifconfig -a

问题:解决是缺sudo
wlw@ubuntu:~/dpdk/dpdk-stable-18.02.2/usertools$ ./../examples/helloworld/build/helloworld
rte_virtio_pmd_init(): IOPL call failed - cannot use virtio PMD
EAL: Detected 40 lcore(s)
EAL: No free hugepages reported in hugepages-1048576kB
EAL: No free hugepages reported in hugepages-2048kB
EAL: FATAL: Cannot get hugepage information.
EAL: Cannot get hugepage information.
PANIC in main():
Cannot init EAL
5: [./../examples/helloworld/build/helloworld(_start+0x29) [0x44d7e9]]
4: [/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f1327250830]]
3: [./../examples/helloworld/build/helloworld() [0x44a21f]]
2: [./../examples/helloworld/build/helloworld(__rte_panic+0xc3) [0x442d33]]
1: [./../examples/helloworld/build/helloworld(rte_dump_stack+0x2b) [0x4ace8b]]
Aborted (core dumped)
wlw@ubuntu:~/dpdk/dpdk-stable-18.02.2/usertools$ ifconfig -a
enp61s0f0 Link encap:Ethernet  HWaddr 48:bd:3d:2e:92:8c
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:41801 errors:0 dropped:1903 overruns:0 frame:20971
          TX packets:81886 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7302032 (7.3 MB)  TX bytes:8841978 (8.8 MB)

ens1f0    Link encap:Ethernet  HWaddr 48:bd:3d:35:3b:29
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ens1f1    Link encap:Ethernet  HWaddr 48:bd:3d:35:3b:2b
          inet addr:192.168.1.196  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

ens3f0    Link encap:Ethernet  HWaddr 38:ad:8e:ea:e6:3b
          inet addr:192.168.102.178  Bcast:192.168.102.255  Mask:255.255.255.0
          inet6 addr: fe80::3aad:8eff:feea:e63b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1900673 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1930426 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:513011866 (513.0 MB)  TX bytes:569777099 (569.7 MB)
          Memory:a8800000-a8ffffff

ens3f1    Link encap:Ethernet  HWaddr 38:ad:8e:ea:e6:3c
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Memory:a8000000-a87fffff

ens3f2    Link encap:Ethernet  HWaddr 38:ad:8e:ea:e6:3d
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Memory:a7800000-a7ffffff

ens3f3    Link encap:Ethernet  HWaddr 38:ad:8e:ea:e6:3e
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Memory:a7000000-a77fffff

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:28523 errors:0 dropped:0 overruns:0 frame:0
          TX packets:28523 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:9693747 (9.6 MB)  TX bytes:9693747 (9.6 MB)

virbr0    Link encap:Ethernet  HWaddr 00:00:00:00:00:00
          inet addr:192.168.122.1  Bcast:192.168.122.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

virbr0-nic Link encap:Ethernet  HWaddr 52:54:00:11:25:3d
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlw@ubuntu:~/dpdk/dpdk-stable-18.02.2/usertools$
wlw@ubuntu:~/dpdk/dpdk-stable-18.02.2/usertools$ sudo ./../examples/helloworld/build/helloworld
EAL: Detected 40 lcore(s)
EAL: No free hugepages reported in hugepages-1048576kB
EAL: Multi-process socket /var/run/.rte_unix
EAL: Probing VFIO support...
EAL: PCI device 0000:19:00.0 on NUMA socket 0
EAL:   probe driver: 8086:1521 net_e1000_igb
EAL: PCI device 0000:19:00.1 on NUMA socket 0
EAL:   probe driver: 8086:1521 net_e1000_igb
EAL: PCI device 0000:19:00.2 on NUMA socket 0
EAL:   probe driver: 8086:1521 net_e1000_igb
EAL: PCI device 0000:19:00.3 on NUMA socket 0
EAL:   probe driver: 8086:1521 net_e1000_igb
EAL: PCI device 0000:3d:00.0 on NUMA socket 0
EAL:   probe driver: 8086:37d3 net_i40e
EAL: PCI device 0000:3d:00.1 on NUMA socket 0
EAL:   probe driver: 8086:37d3 net_i40e
PMD: Global register is changed during support QinQ parser
PMD: Global register is changed during configure hash input set
PMD: Global register is changed during configure fdir mask
PMD: Global register is changed during configure hash mask
PMD: Global register is changed during support QinQ cloud filter
PMD: Global register is changed during disable FDIR flexible payload
EAL: PCI device 0000:5f:00.0 on NUMA socket 0
EAL:   probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:5f:00.1 on NUMA socket 0
EAL:   probe driver: 8086:10fb net_ixgbe
hello from core 1
hello from core 2
hello from core 3
hello from core 4
hello from core 5
hello from core 6
hello from core 7
hello from core 8
hello from core 9
hello from core 10
hello from core 11
hello from core 12
hello from core 13
hello from core 14
hello from core 15
hello from core 16
hello from core 17
hello from core 18
hello from core 19
hello from core 21
hello from core 22
hello from core 20
hello from core 23
hello from core 24
hello from core 25
hello from core 26
hello from core 27
hello from core 28
hello from core 29
hello from core 30
hello from core 31
hello from core 32
hello from core 33
hello from core 34
hello from core 35
hello from core 36
hello from core 37
hello from core 38
hello from core 39
hello from core 0
wlw@ubuntu:~/dpdk/dpdk-stable-18.02.2/usertools$

dpdk中ctrl+z问题:
dpdk你调试是时候注意别按到  ctrl+z,属于程序异常退出,异常退出端口占用,没法继续使用。


二层转发实例:
export RTE_SDK=/home/wlw/dpdk/dpdk-stable-18.02.2/
export RTE_TARGET=x86_64-native-linuxapp-gcc
sudo ./examples/l2fwd/build/l2fwd -c 3 -n 2 -- -q 1 -p 1
    -p PORTMASK
    PORTMASK:一个十六进制位掩码表示分配的端口数量。 
    -q NQ
    NQ:表示分配给每个逻辑内核的收发队列数量。 
    -T t
    t: 表示打印统计数据到屏幕上的时间间隔,默认为10秒。 

dpdk多进程:
两种方式(一个是主dpdk进程/从dpdk进程方式,在相同网卡上运行;二是两个dpdk进程分别在不同的网卡上运行。)
今天成功验证了dpdk多进程的运行。
sudo ./build/l2fwd -c 1 -n 2 --proc-type auto \
--socket-mem 512 --file-prefix pg1 \
-w 0000:3d:00.0 \
-- -q 1 -p 1
因为dpdk的多进程运行有两个模式,一个是主进程,从进程,在--proc-type里指定,可以主,从,通信,例子是multi_process ;
一个是两个进程,分别运行,该域赋值auto。

socket-mem这个是指定运行在cpu上的内存的。普通的单进程也要指定,只是这里是独立分开的概念
file-prefix       这里指定huge,也是独立分开的概念。
-w                   这个厉害了,他后面接的是网卡的pci,他这个参数可以多次出现,比如绑定三个网卡,那你就-w三次就OK了。

 

linux上的应用pktgen发包(与pktgen-dpdk发包不同)

modprobe pktgen
cd /proc/net/pktgen/

echo rem_device_all>kpktgend_0
echo add_device enp61s0f0>kpktgend_0

echo count 1000>enp61s0f0
echo clone_skb 1000>enp61s0f0
echo pkt_size 1000>enp61s0f0
echo dst 10.11.11.11>enp61s0f0
echo dst_mac 48:bd:3d:2e:91:66>enp61s0f0
echo start>pgctrl

echo stop>pgctrl 

 

linux上的tcpdump应用
 sudo tcpdump -i enp61s0f0 -vv -s 1600 port 1001 -x 
 -i:指定监听的网络接口。
 -vv:输出详细的报文信息。
 -x/X:告诉tcpdump命令,需要把协议头和包内容都原原本本的显示出来(tcpdump会以16进制和ASCII的形式显示),
 这在进行协议分析时是绝对的利器。
 -s: snaplen snaplen表示从一个包中截取的字节数。0表示包不截断,抓完整的数据包。默认的话tcpdump只显示部分数据包,默认68字节。
 
 

你可能感兴趣的:(dpdk,dpdk,dpdk运行,dpdk多进程运行,tcpdump,pktgen)