l 2 fwdテスト

8130 ワード

環境は次のとおりです.
  • Ubuntu 16.04
  • cpu 4 core
  • Intel Corporation 82545 EMGigabit Ethernet Control*2個
  • dpdk-17.02.1

  • ヒント:テストにはrootの権限が必要です

    一.dpdk環境構築


    1.1. コンパイルdpdk

    cd dpdk
    make config T=x86_64-native-linuxapp-gcc
    make
    make install T=x86_64-native-linuxapp-gcc

    1.2. 環境変数の設定


    編集.profileまたは.bashrc、追加:
    export RTE_SDK=/root/dpdk
    export RTE_TARGET=x86_64-native-linuxapp-gcc

    1.3. カーネルモジュールのロード

    modprobe uio
    insmod x86_64-native-linuxapp-gcc/kmod/igb_uio.ko

    1.4. hugepageの設定

    mkdir -p /mnt/huge
    mount -t hugetlbfs nodev /mnt/huge
    echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages

    1.5. NICのバインド


    まずNICの状態を確認し、NICがdown状態であることを確認します.
    root@zengxl:/root/dpdk# ./usertools/dpdk-devbind.py --status
    
    Network devices using DPDK-compatible driver
    ============================================
    
    
    Network devices using kernel driver
    ===================================
    0000:02:01.0 '82545EM Gigabit Ethernet Controller (Copper)' if=ens33 drv=e1000 unused=igb_uio *Active*
    0000:02:06.0 '82545EM Gigabit Ethernet Controller (Copper)' if=ens38 drv=e1000 unused=igb_uio 
    0000:02:07.0 '82545EM Gigabit Ethernet Controller (Copper)' if=ens39 drv=e1000 unused=igb_uio 
    
    Other network devices
    =====================
    
    
    Crypto devices using DPDK-compatible driver
    ===========================================
    
    
    Crypto devices using kernel driver
    ==================================
    
    
    Other crypto devices
    ====================
    

    バインディング
    root@zengxl:/root/dpdk# ./usertools/dpdk-devbind.py --bind=igb_uio ens38
    root@zengxl:/root/dpdk# ./usertools/dpdk-devbind.py --bind=igb_uio ens39

    二.テスト

    ./build/l2fwd -c 0xc -n 2 -- -q 1 -p 0x3
    EAL: Detected 4 lcore(s)
    EAL: No free hugepages reported in hugepages-1048576kB
    EAL: Probing VFIO support...
    EAL: PCI device 0000:02:01.0 on NUMA socket -1
    EAL:   probe driver: 8086:100f net_e1000_em
    EAL: PCI device 0000:02:06.0 on NUMA socket -1
    EAL:   probe driver: 8086:100f net_e1000_em
    EAL: PCI device 0000:02:07.0 on NUMA socket -1
    EAL:   probe driver: 8086:100f net_e1000_em
    MAC updating enabled
    Lcore 2: RX port 0
    Lcore 3: RX port 1
    Initializing port 0... done: 
    Port 0, MAC address: 00:0C:29:75:1E:19
    
    Initializing port 1... done: 
    Port 1, MAC address: 00:0C:29:75:1E:23
    
    
    Checking link statusdone
    Port 0 Link Up - speed 1000 Mbps - full-duplex
    Port 1 Link Up - speed 1000 Mbps - full-duplex
    L2FWD: entering main loop on lcore 3
    L2FWD:  -- lcoreid=3 portid=1
    L2FWD: entering main loop on lcore 2
    L2FWD:  -- lcoreid=2 portid=0
    
    
    Port statistics ====================================
    Statistics for port 0 ------------------------------
    Packets sent:                   301034
    Packets received:               336559
    Packets dropped:                     0
    Statistics for port 1 ------------------------------
    Packets sent:                   336559
    Packets received:               301034
    Packets dropped:                     0
    Aggregate statistics ===============================
    Total packets sent:             637593
    Total packets received:         637593
    Total packets dropped:               0
    ====================================================
    ^C
    
    Signal 2 received, preparing to exit...
    Closing port 0... Done
    Closing port 1... Done
    Bye...

    リファレンス


    http://dpdk.org/doc