DPDK 16.11.2 LTS (newest update 2017/05/02)
1. IP fragmentation. 封包切割
The application does L3 forwarding with IPv4 and IPv6 packet fragmentation.
舉例:
有一個進來的IPv4封包,目的地(有match到)是100.10.1.1,封包長度是9198 bytes。
會被分割成7個IPv4封包從Port#0出去,其中六個封包長度是 1500 bytes,最後一個封包長度是318 bytes。
2. 用 Longest Prefix Match(LPM objects)來判定IP,若封包符合預設IP則切割後轉送到對應的Port,若都不符合則原Port送回。
3. 進:frame sizes up to 9.5 KB are supported
出:1500 bytes
4. Function l3fwd_simple_forward
解封裝===> 檢查是否IPv4封包===> 擷取封包dst_ip資訊===> 跟Lookup key做比對,若符合則依照事先設定的對應Port出去===> 傳送封包出去
4. 執行結果:
linux@linux-SYS-7048A-T:~/dpdk/dpdk-stable-16.11.2/examples/ip_fragmentation$ sudo ./build/ip_fragmentation -l 2,4 -n 3 -- -p 0x3 -q 2
[sudo] password for linux:
EAL: Detected 32 lcore(s)
EAL: No free hugepages reported in hugepages-1048576kB
EAL: Probing VFIO support...
EAL: PCI device 0000:03:00.0 on NUMA socket 0
EAL: probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:03:00.1 on NUMA socket 0
EAL: probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:05:00.0 on NUMA socket 0
EAL: probe driver: 8086:1533 net_e1000_igb
EAL: PCI device 0000:06:00.0 on NUMA socket 0
EAL: probe driver: 8086:1533 net_e1000_igb
EAL: PCI device 0000:07:00.0 on NUMA socket 0
EAL: probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:07:00.1 on NUMA socket 0
EAL: probe driver: 8086:10fb net_ixgbe
IP_FRAG: Creating direct mempool on socket 0
IP_FRAG: Creating indirect mempool on socket 0
IP_FRAG: Creating LPM table on socket 0
IP_FRAG: Creating LPM6 table on socket 0
Initializing port 0 on lcore 2... Address:00:1B:2B:1C:2D:10
txq=2,0 txq=4,1
Initializing port 1 on lcore 2... Address:00:1B:2B:1C:2D:11
txq=2,0 txq=4,1
Add Rx callback funciton to detect L3 packet type by SW : port = 0
Add Rx callback funciton to detect L3 packet type by SW : port = 1
IP_FRAG: Socket 0: adding route 100.10.0.0/16 (port 0)
IP_FRAG: Socket 0: adding route 100.20.0.0/16 (port 1)
IP_FRAG: Socket 0: adding route 100.30.0.0/16 (port 2)
IP_FRAG: Socket 0: adding route 100.40.0.0/16 (port 3)
IP_FRAG: Socket 0: adding route 100.50.0.0/16 (port 4)
IP_FRAG: Socket 0: adding route 100.60.0.0/16 (port 5)
IP_FRAG: Socket 0: adding route 100.70.0.0/16 (port 6)
IP_FRAG: Socket 0: adding route 100.80.0.0/16 (port 7)
IP_FRAG: Socket 0: adding route 0101:0101:0101:0101:0101:0101:0101:0101/48 (port 0)
IP_FRAG: Socket 0: adding route 0201:0101:0101:0101:0101:0101:0101:0101/48 (port 1)
IP_FRAG: Socket 0: adding route 0301:0101:0101:0101:0101:0101:0101:0101/48 (port 2)
IP_FRAG: Socket 0: adding route 0401:0101:0101:0101:0101:0101:0101:0101/48 (port 3)
IP_FRAG: Socket 0: adding route 0501:0101:0101:0101:0101:0101:0101:0101/48 (port 4)
IP_FRAG: Socket 0: adding route 0601:0101:0101:0101:0101:0101:0101:0101/48 (port 5)
IP_FRAG: Socket 0: adding route 0701:0101:0101:0101:0101:0101:0101:0101/48 (port 6)
IP_FRAG: Socket 0: adding route 0801:0101:0101:0101:0101:0101:0101:0101/48 (port 7)
Checking link status
done
Port 0 Link Up - speed 10000 Mbps - full-duplex
Port 1 Link Up - speed 10000 Mbps - full-duplex
IP_FRAG: lcore 4 has nothing to do
IP_FRAG: entering main loop on lcore 2
IP_FRAG: -- lcoreid=2 portid=0
IP_FRAG: -- lcoreid=2 portid=1
ip_dst: 154.54.13.245
ip_src: 132.158.160.177
total_length: 64
ip_dst: 236.12.252.98
ip_src: 254.134.90.46
total_length: 1420
ip_dst: 174.14.114.211
ip_src: 48.1.137.202
total_length: 1500
ip_dst: 83.254.102.45
ip_src: 83.110.2.241
total_length: 216
ip_dst: 162.248.220.142
ip_src: 39.226.58.105
total_length: 48
ip_dst: 167.251.255.84
ip_src: 54.144.158.17
total_length: 40
ip_dst: 210.18.187.109
ip_src: 179.115.126.233
total_length: 1500
ip_dst: 48.2.69.124
ip_src: 223.185.98.153
total_length: 1500
ip_dst: 247.124.16.187
ip_src: 61.167.139.150
total_length: 1061
ip_dst: 48.140.172.159
ip_src: 176.231.108.214
total_length: 1500
ip_dst: 174.14.114.211
ip_src: 48.1.137.202
total_length: 1500
ip_dst: 60.55.151.58
ip_src: 151.93.50.120
total_length: 40
ip_dst: 173.161.35.247
ip_src: 32.247.74.124
total_length: 1394