Pktgen-DPDK install 安裝部署_intel

來源:互聯網
上載者:User

聲明:此文檔只做學習交流使用,請勿用作其他商業用途 author:朝陽_tony
E-mail : linzhaolover@gmail.com
Create Date: 2013-7-10 13:59:31 Wednesday
Last Change: 2013-7-14 22:53:11 Sunday

轉載請註明出處:http://blog.csdn.net/linzhaolover


此文中源碼可以去http://dpdk.org/dev 網頁中下載;更多官方文檔請訪問http://dpdk.org


Pktgen-DPDK介紹

Pktgen-DPDK是6wind基於intel dpdk開發的一個發包工具;用於測試dpdk的包轉寄能力;

可以在https://github.com/Pktgen/Pktgen-DPDK看到其詳細資料;


我的測試環境為REHL6.2系統;


 下載源碼方式

git  clone  http://github.com/Pktgen/Pktgen-DPDK.git


 安裝編譯源碼;

下載源碼後進入Pktgen-DPDK/dpdk目錄,執行安裝;

make install T=x86_64-wr-linuxapp-gcc

如遇下面的變數名重複定義錯誤;

In file included from /home/linzh/repo/Pktgen-DPDK/dpdk/lib/libwr_mcos/rte_mcos.c:81:/home/linzh/repo/Pktgen-DPDK/dpdk/lib/libwr_mcos/rte_mcos.h:321: error: redefinition of typedef ‘mcos_master_t’/home/linzh/repo/Pktgen-DPDK/dpdk/lib/libwr_mcos/rte_mcos_debug.h:114: note: previous declaration of ‘mcos_master_t’ was here/home/linzh/repo/Pktgen-DPDK/dpdk/lib/libwr_mcos/rte_mcos.h:385: error: redefinition of typedef ‘mInfo_t’/home/linzh/repo/Pktgen-DPDK/dpdk/lib/libwr_mcos/rte_mcos_debug.h:113: note: previous declaration of ‘mInfo_t’ was here
需要自己去修改一下檔案變數定義,我只是臨時做了一下修改;

vim /home/linzh/repo/Pktgen-DPDK/dpdk/lib/libwr_mcos/rte_mcos_debug.h

%s/mInfo_t/mInfo_t_bak/g%s/mcos_master_t/mcos_master_t_bak/g
將rte_mcos_debug.h檔案中的mInfo_t 更名為mInfo_t_bak   ,   將mcos_master_t 更名為mcos_master_t_bak ;

設定環境變數;

export RTE_SDK=`pwd`export RTE_TARGET=x86_64-wr-linuxapp-gcc

執行指令碼進行安裝配置;

./tools/setup.sh
運行指令碼後分別運行

[6] Insert IGB UIO module[7] Insert KNI module[8] Setup hugepage mappings for non-NUMA systems
安裝新的intel網卡驅動;

設定hugepage 資訊,我輸入了1024,也就是分配1024個2M的記憶體,等於2G的記憶體空間;

運行11,進行一下dpdk的測試;在11中如果一個core源碼,如果輸入  F 敲斷行符號, 也就是用 0至3這幾個core去測試;

[11] Run testpmd application in interactive mode ($RTE_TARGET/app/testpmd)
Option: 11  Enter hex bitmask of cores to execute testpmd app on  Example: to execute app on cores 0 to 7, enter 0xffbitmask:F

輸入F敲斷行符號後,

顯示下面的部分資訊,說明成功了

Interactive-mode selectedConfiguring Port 0PMD: To improve 1G driver performance, consider setting the TX WTHRESH value to 4, 8, or 16.Configuring Port 1PMD: To improve 1G driver performance, consider setting the TX WTHRESH value to 4, 8, or 16.Configuring Port 2PMD: To improve 1G driver performance, consider setting the TX WTHRESH value to 4, 8, or 16.Configuring Port 3PMD: To improve 1G driver performance, consider setting the TX WTHRESH value to 4, 8, or 16.Checking link statuses...Port 0 Link Up - speed 1000 Mbps - full-duplexPort 1 Link Up - speed 1000 Mbps - full-duplexPort 2 Link Up - speed 1000 Mbps - full-duplexPort 3 Link Up - speed 1000 Mbps - full-duplexDonetestpmd>


然後在分別運行start 和 stop命令試試;

testpmd> start  io packet forwarding - CRC stripping disabled - packets/burst=16  nb forwarding cores=1 - nb forwarding ports=4  RX queues=1 - RX desc=128 - RX free threshold=0  RX threshold registers: pthresh=8 hthresh=8 wthresh=4  TX queues=1 - TX desc=512 - TX free threshold=0  TX threshold registers: pthresh=36 hthresh=0 wthresh=0  TX RS bit threshold=0 - TXQ flags=0x0testpmd> stopTelling cores to stop...Waiting for lcores to finish...  ---------------------- Forward statistics for port 0  ----------------------  RX-packets: 24             RX-dropped: 0             RX-total: 24  TX-packets: 0              TX-dropped: 0             TX-total: 0  ----------------------------------------------------------------------------  ---------------------- Forward statistics for port 1  ----------------------  RX-packets: 24             RX-dropped: 0             RX-total: 24  TX-packets: 0              TX-dropped: 0             TX-total: 0  ----------------------------------------------------------------------------  ---------------------- Forward statistics for port 2  ----------------------  RX-packets: 24             RX-dropped: 0             RX-total: 24  TX-packets: 0              TX-dropped: 0             TX-total: 0  ----------------------------------------------------------------------------  ---------------------- Forward statistics for port 3  ----------------------  RX-packets: 24             RX-dropped: 0             RX-total: 24  TX-packets: 0              TX-dropped: 0             TX-total: 0  ----------------------------------------------------------------------------  +++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++  RX-packets: 96             RX-dropped: 0             RX-total: 96  TX-packets: 0              TX-dropped: 0             TX-total: 0  ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++Done.testpmd>

下面測試pktgen

進入Pktgen-DPDK/dpdk/wr-examples/pktgen目錄;

執行make去編譯pktgen;

運行setup指令碼,去配置一下環境,這個指令碼其實是配置了一下hugepage,和從新安裝了一下intel網卡的驅動;

./setup


運行doit去測試pktgen;

./doit

如果發現報錯;

EAL: coremask set to eEAL: Auto-detected process type: PRIMARYEAL: Detected lcore 1 as core 1 on socket 0EAL: Detected lcore 2 as core 2 on socket 0EAL: Detected lcore 3 as core 8 on socket 0EAL: Setting up hugepage memory...EAL: Ask a virtual area of 0x80000000 bytesEAL: Virtual area found at 0x7f1a14e00000 (size = 0x80000000)EAL: Not enough memory available on socket 1! Requested: 128MB, available: 0MBPANIC in rte_eal_init():Cannot init memory6: [./app/build/pktgen() [0x4038b9]]5: [/lib64/libc.so.6(__libc_start_main+0xfd) [0x7f1a95368cdd]]4: [./app/build/pktgen() [0x41595f]]3: [./app/build/pktgen() [0x49aabb]]2: [./app/build/pktgen() [0x49fea0]]1: [./app/build/pktgen() [0x49fd86]]./doit: line 8:  3445 Aborted                 (core dumped) ./app/build/pktgen -c e -n 3 --proc-type auto --socket-mem 128,128 --file-prefix pg -- -p 0x14 -P -m "2.0, 3.1" -f test/set_seq.cmd

這應該是執行程式是,傳入測參數報錯;
--socket-mem 128,128
這參數有問題,我暫時沒有解決方案,也不理解這個參數的具體用途 ;將後面的128去掉再運行;

./app/build/pktgen -c e -n 3 --proc-type auto --socket-mem 128 --file-prefix pg -- -p 0x14 -P -m "2.0, 3.1" -f test/set_seq.cmd

-c 是指選擇的core的掩碼, e  等於  1110  也就是選擇  1 、 2 、3 號core;  

--proc-type  選擇的auto  ,如果是當前系統第一執行的dpdk相關的程式,選擇primary模式,如果是第二是 secondary 模式;

--file-prefix  pg   設定/mnt/huge/記憶體配置模組的檔案名稱首碼;

-p  0x14     0x14 等於    00010100  , 選擇你當前系統的其中2塊intel相關網卡連接埠;

-P  使能網路混裝模式,

-m "2.0, 3.1"   這是指一個矩陣模型,2.0  是指,在2號lcore上綁定的連接埠0 ,  3.1  是指在 lcore3 上綁定連接埠1

-f test/set_seq.cmd  最後匯入pktgen的執行設定檔;在執行pktgen時,利用配置產生資料包;


最終出現下面的介面;可以更具官方提供的README.pktgen檔案,執行一些配置,和相關的測試;

| Ports 0-1 of 2   ** Main Page **  Copyright (c) <2010-2013>, Wind River Systems, Inc., Powered by Intel DPDK  Flags:Port     :      P---------:0      P---------:1Link State       :      <UP-1000-FD>      <UP-1000-FD>                                       ---TotalRate---Pkts/s  Rx       :                 6                 6                                                    12        Tx       :                 0                 0                                                     0MBits/s Rx/Tx    :               0/0               0/0                                                   0/0Broadcast        :                 0                 0Multicast        :                 0                 0  64 Bytes       :                 0                 0  65-127         :                 0                 0  128-255        :                 0                 0  256-511        :                 0                 0  512-1023       :                 0                 0  1024-1518      :                 0                 0Runts/Jumbos     :               0/0               0/0Errors Rx/Tx     :               0/0               0/0Total Rx Pkts    :                39                13      Tx Pkts    :                 0                 0      Rx MBs     :                 0                 0      Tx MBs     :                 0                 0ARP/ICMP Pkts    :               0/0               0/0Tx Failed        :                 0                 0                 :          229386/1          229386/1Tx Count/% Rate  :      Forever/100%      Forever/100%PktSize/Tx Burst :            64/128            64/128Src/Dest Port    :         1234/5678         1234/5678Pkt Type:VLAN ID :     IPv4/TCP:0001     IPv4/TCP:0001Dst  IP Address  :       192.168.1.1       192.168.0.1Src  IP Address  :    192.168.0.1/24    192.168.1.1/24Dst MAC Address  :    0016:31ff:d074    0016:31ff:d01aSrc MAC Address  :    0016:31ff:d01a    0016:31ff:d074-- Pktgen Ver:2.1.3(DPDK-1.3.0) -------------------------------------------------------------------------------------pktgen> # *** Executing file (test/set_seq.cmd)pktgen> *** Unable to find file (test/set_seq.cmd) or invalid callpktgen>


技術水平有待提高,如有不對的地方希望讀者指正,互相學習;O(∩_∩)O~





聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.