一是可以在啓動testpmd時,通過命令參數txq和rxq分別制定發送和接收隊列的數量。
# ./build/app/testpmd -l 0-3 -n 4 -- -i --txq=8 --rxq=8
...
testpmd> show port info all
Driver name: net_i40e
...
Current number of RX queues: 8
Max possible RX queues: 192
Current number of TX queues: 8
Max possible TX queues: 192
另外,可在啓動testpmd之後,進入交互模式,通過以下命令進行修改,如下所示,這要求先停止所有的接口。
testpmd> port config all txq 1
Please stop all ports first
如下命令,停止所有接口。
testpmd> port stop all
Stopping ports...
Done
再次設置txq數量爲1,如下所示,發送隊列數量還是8,貌似修改沒有生效。
testpmd> show port info all
Driver name: net_i40e
...
Current number of RX queues: 8
Max possible RX queues: 192
Current number of TX queues: 8
Max possible TX queues: 192
此時,重新啓動之前停止的所有接口。
testpmd> port start all
Configuring Port 0 (socket 0)
...
Checking link statuses...
Done
再次查看接口信息,可見發送隊列長度已經修改過來,數量爲1。
testpmd> show port info all
Driver name: net_i40e
Current number of RX queues: 1
Max possible RX queues: 192
Current number of TX queues: 1
Max possible TX queues: 192
原本打算測試l2fwd程序,在多隊列網卡,多核心情況下的性能,但是l2fwd程序固定了接口的隊列數量爲1,只能等以後進行相應的修改再測試了。