一: 多队列及中断信息收集

[root@T185 ~]# ethtool -g eth0
Ring parameters for eth0:
Pre-set maximums:
RX:
RX Mini:
RX Jumbo:
TX:
Current hardware settings:
RX:
RX Mini:
RX Jumbo:
TX:
[root@T185 ~]# ls /sys/class/net/eth0/queues/
rx- rx- rx- rx- rx- rx- rx- rx- rx- rx- rx- rx- tx- tx- tx- tx- tx- tx- tx- tx- tx- tx- tx- tx-
rx- rx- rx- rx- rx- rx- rx- rx- rx- rx- rx- rx- tx- tx- tx- tx- tx- tx- tx- tx- tx- tx- tx- tx-
[root@T185 ~]# cat /proc/interrupts |less -S
[root@T185 ~]# cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3 CPU4 CPU5 CPU6 CPU7 CPU8 CPU9 CPU10 CPU11 CPU12 CPU13 CPU14 CPU15 CPU16 CPU17 CPU18 CPU19 CPU20 CPU21 CPU22 CPU23
: IR-IO-APIC-edge timer
: IR-IO-APIC-edge i8042
: IR-IO-APIC-edge rtc0
: IR-IO-APIC-fasteoi acpi
: IR-IO-APIC-edge i8042
: IR-IO-APIC-fasteoi ehci_hcd:usb1
: IR-IO-APIC-fasteoi ehci_hcd:usb2
: DMAR_MSI-edge dmar0
: DMAR_MSI-edge dmar1
: IR-PCI-MSI-edge aerdrv
: IR-PCI-MSI-edge aerdrv
: IR-PCI-MSI-edge aerdrv
: IR-PCI-MSI-edge aerdrv
: IR-PCI-MSI-edge aerdrv
: IR-PCI-MSI-edge aerdrv
: IR-PCI-MSI-edge aerdrv
: IR-PCI-MSI-edge aerdrv
: IR-PCI-MSI-edge aerdrv
: IR-PCI-MSI-edge aerdrv
: IR-PCI-MSI-edge aerdrv
: IR-PCI-MSI-edge aerdrv
: IR-PCI-MSI-edge aerdrv
: IR-PCI-MSI-edge ahci
: IR-PCI-MSI-edge isci-msix
: IR-PCI-MSI-edge isci-msix
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0-TxRx-
: IR-PCI-MSI-edge eth0
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1-TxRx-
: IR-PCI-MSI-edge eth1
: IR-PCI-MSI-edge eth3
NMI: Non-maskable interrupts
LOC: Local timer interrupts
SPU: Spurious interrupts
PMI: Performance monitoring interrupts
IWI: IRQ work interrupts
RTR: APIC ICR read retries
RES: Rescheduling interrupts
CAL: Function call interrupts
TLB: TLB shootdowns
TRM: Thermal event interrupts
THR: Threshold APIC interrupts
MCE: Machine check exceptions
MCP: Machine check polls
ERR:
MIS:
[root@T185 ~]#

interrupts

二: 设置CPU隔离

在grub.conf 中,增加isolcpus参数。

三: 修改收发包队列数

[root@T185 tong]# ethtool -g eth0
Ring parameters for eth0:
Pre-set maximums:
RX:
RX Mini:
RX Jumbo:
TX:
Current hardware settings:
RX:
RX Mini:
RX Jumbo:
TX: [root@T185 tong]# ethtool -G eth0 rx tx
[root@T185 tong]# ethtool -g eth0
Ring parameters for eth0:
Pre-set maximums:
RX:
RX Mini:
RX Jumbo:
TX:
Current hardware settings:
RX:
RX Mini:
RX Jumbo:
TX:

ethtool

不能设成1, 最小64.所以,对于中断并没有什么影响.这好像不对,不知道这是什么鬼。

下载最新的驱动,https://downloadcenter.intel.com/download/14687 并查看README

Command Line Parameters
-----------------------
If the driver is built as a module, the following optional parameters are used
by entering them on the command line with the modprobe command using this
syntax:
modprobe ixgbe [<option>=<VAL1>,<VAL2>,...] There needs to be a <VAL#> for each network port in the system supported by
this driver. The values will be applied to each instance, in function order.
For example:
modprobe ixgbe InterruptThrottleRate=, 。。。 。。。 Multiqueue
----------
Valid Range:
,
= Disables Multiple Queue support
= Enabled Multiple Queue support (a prerequisite for RSS)

README

README里给的参数竟然不对,尼玛

[root@T185 tong]# modprobe -r ixgbe
[root@T185 tong]# modprobe ixgbe MQ=,
[root@T185 tong]# ls /sys/class/net/eth0/queues/
rx- rx- rx- rx- rx- rx- rx- rx- rx- rx- rx- rx- tx- tx- tx- tx- tx- tx- tx- tx- tx- tx- tx- tx-
rx- rx- rx- rx- rx- rx- rx- rx- rx- rx- rx- rx- tx- tx- tx- tx- tx- tx- tx- tx- tx- tx- tx- tx-
[root@T185 tong]# ls /sys/class/net/eth1/queues/
rx- tx-
[root@T185 tong]#

四:中断绑定:

cpu结构:

[root@T185 tong]# ./cpu_layout.py
============================================================
Core and Socket Information (as reported by '/proc/cpuinfo')
============================================================ cores = [, , , , , ]
sockets = [, ] Socket Socket
-------- --------
Core [, ] [, ]
Core [, ] [, ]
Core [, ] [, ]
Core [, ] [, ]
Core [, ] [, ]
Core [, ] [, ]
[root@T185 tong]#

另外两个工具:lstopo,和hwloc。

中断绑定:

#! /bin/bash

function bind() # $lcpus, $irq_list, $set
{
for i in $
do
echo -n $i ": "
if [ $ -eq ]
then
echo $ > /proc/irq/$i/smp_affinity_list
echo "Done!"
else
cat /proc/irq/$i/smp_affinity_list
fi
done
} function usage()
{
echo "Usage:"
echo -e "\tirq_bind.sh 0(print)/1(set) "
echo
} if [ $# -ne ]
then
usage
exit
fi if [ \( "$1" != "" \) -a \( "$1" != "" \) ]
then
usage
exit
fi irq_list=`cat /proc/interrupts |grep eth0 |awk -F: '{print $1}'`
bind "1,13" "$irq_list" $ irq_list=`cat /proc/interrupts |grep eth1 |awk -F: '{print $1}'`
bind "2,14" "$irq_list" $

注意: 网卡驱动重新加载过了之后,需要重新对中断进行绑定。

五: 发包:

tcpreplay -i eth0 -l0 -L10000000 -p400000 -K syy/.pcap 

六: pktgen-dpdk

http://pktgen-dpdk.readthedocs.io/en/latest/

版本太多,版本间的修改又都比较大。最后pktgen和dpdk都用了当前的最新版本。重要编译通过了,且运行正常了。

tong@zw:~/src$ ls
dpdk-17.05 dpdk-17.05.tar.gz pktgen-3.3. pktgen-3.3..tar.gz

6.1  正常编译dpdk,并正确设置环境变量

make config T=x86_64-native-linuxapp-gcc O=x86_64-native-linuxapp-gcc
make
tong@zw:~/src$ tail -n2 ~/.bashrc
export RTE_SDK=~/src/dpdk-17.05/
export RTE_TARGET=x86_64-native-linuxapp-gcc

6.2   编译并设置 pktgen

make
sysctl -n vm.nr_hugepages=
vim cfg/default.cfg ./tools/run.py -s
hugepages per socket
Set /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages to
Bind devices to DPDK:
['03:00.3']
sudo mount -t hugetlbfs nodev /mnt/huge

6.3  运行

http://pktgen-dpdk.readthedocs.io/en/latest/usage_pktgen.html#usage-pktgen

最终配置如下:

tong@zw:~/src/pktgen-3.3.$ cat cfg/default.cfg
# Setup configuration
setup = {
'devices': [
'03:00.3'
], 'opts': [
'-b igb_uio'
]
} # Run command and options
run = {
'dpdk': [
'-l 4,5',
'-n 1',
'--proc-type auto',
'--log-level 7',
'--file-prefix pg'
], 'blacklist': [
], 'pktgen': [
'-T',
'-P',
'--crc-strip',
'-m [5].0',
], 'misc': [
'-f themes/black-yellow.theme'
]
}
tong@zw:~/src/pktgen-3.3.$

cfg/default.cfg

tong@zw:~/src/pktgen-3.3.$ ./tools/run.py cfg/default.cfg

6.4  使用

Pktgen:/> set  count
Pktgen:/> set size
Pktgen:/> start
Pktgen:/> set size
Pktgen:/> start
Pktgen:/> set size
Pktgen:/> start
Pktgen:/>

发了三次,每次五个包,长度分别为 64 / 512 / 70

详细的参数参考:http://pktgen-dpdk.readthedocs.io/en/latest/commands.html#runtime-options-and-commands

也可以在Pktgen的命令行里 help

还可以用LUA进行配置,但是我不会 http://pktgen-dpdk.readthedocs.io/en/latest/lua.html

6.5  其他

但是所有的 TCP包都是SYN的,不能握手。与我的测试目的还是有些区别。

6.6   发送pcap

  在命令行使用 -s P:PCAP_file 参数。

  在pktgen中使用如下命令:

Pktgen:/> enable  pcap

  使用page pcap命令可以查看pcap详细内容:

Pktgen:/> page pcap

  之后使用正常的命令,便可以发送数据包了。

七。 pktgen-linux

据说之支持 UDP,不支持TCP。

八。测试数据

[development][dpdk][pktgen] 网卡收发包性能测试-详细数据

九。 使用gprof查找性能瓶颈。

  9.1  使用gcc -pg编译

  9.2  正常运行程序,并正常退出,系统会生成一个gmon.out文件。

  9.3  使用如下命令查看输出

    gprof app_name gmon.out

  9.4  通过观察日志,找到性能瓶颈,是一个链表遍历查找的函数。

[development][dpdk][pktgen] 网卡收发包性能测试的更多相关文章

  1. [development][dpdk][pktgen] 网卡收发包性能测试-详细数据

    三层包测试 发包方式:192.168.20.205 发包工具:pktgen 发包网卡:i350 收包设备:1922.168.20.185 CPU:Intel(R) Xeon(R) CPU E5-262 ...

  2. DPDK收发包全景分析

    前言:DPDK收发包是基础核心模块,从网卡收到包到驱动把包拷贝到系统内存中,再到系统对这块数据包的内存管理,由于在处理过程中实现了零拷贝,数据包从接收到发送始终只有一份,对这个报文的管理在前面的mem ...

  3. dpdk网卡收包分析

    一个网络报文从网卡接收到被应用处理,中间主要需要经历两个阶段: 阶段一:网卡通过其DMA硬件将收到的报文写入到收包队列中(入队)阶段二:应用从收包队列中读取报文(出队)由于目前正在使用vpp/dpdk ...

  4. kernel笔记——网络收发包流程

    本文将介绍网络连接建立的过程.收发包流程,以及其中应用层.tcp层.ip层.设备层和驱动层各层发挥的作用. 应用层 对于使用socket进行网络连接的服务器端程序,我们会先调用socket函数创建一个 ...

  5. 代码学习-Linux内核网卡收包过程(NAPI)【转】

    转自:https://blog.csdn.net/crazycoder8848/article/details/46333761 版权声明:本文没有任何版权限制,任何人可以以任何方式使用本文. htt ...

  6. UDP收发buffer尺寸对收发包流量的影响

    下午验证一个高流量发包问题时,发现了一个值得记录的问题:socket的收发buffer尺寸是会影响收发包的效率的,高流量通讯时,若socket的收发buffer尺寸过小会一定程度降低收发包效率. 自己 ...

  7. 交换芯片收发包的 DMA 实现原理

    交换芯片支持:报文.计数.表项3种DMA类型,其中报文DMA包括系统从芯片到接收报文或发送报文到交换芯片,计数DMA用来从片上获取统计计数,表项DMA功能分为SLAM DMA(系统内存DMA到片上交换 ...

  8. Intel X710网卡VxLAN offload 性能测试

    Intel X710网卡VxLAN offload性能测试 1.  测试环境参数: 交换机:盛科E580 服务器: Intel(R) Xeon(R) CPU E5-2650 v3 @ 2.30GHz ...

  9. [development][dpdk][hugepage] 大页内存的挂载

    参考: [development][dpdk][hugepage] 为不同的结点分配不同大小的大页内存 完成了以上内容之后, 下一步需要做的是挂载, 大页内存只有被挂载了之后,才能被应用程序使用. 挂 ...

随机推荐

  1. 物联网架构成长之路(4)-EMQ插件创建

    1. 说明 以下用到的知识,是建立在我目前所知道的知识领域,以后如果随着知识的拓展,不一定会更新内容.由于不是EMQ公司的人,EMQ的文档又很少,很多知识点都是靠猜的.2. 一些资料 架构设计 htt ...

  2. MobaXterm 加装cygwin软件包

    上次在<MobaXterm: SSH/X远程客户端, Xmanager的最佳免费替代品>里面介绍了MobaXterm这个Windows上的便携 多合一unix工具箱,它基于Cygwin,集 ...

  3. 【emWin】例程十九:窗口对象——Checkbox

    简介: 复选框是选择各种不同选项的最常用小工具之一.用户可选中或取消选中复选框,并且可一次选中任意个框 触摸校准(上电可选择是否进入校准界面) CHECKBOX三状态模式 CHECKBOX设置字体颜色 ...

  4. Repeater数据控件的两个重要事件ItemDataBound 和 ItemCommand

    1 ItemDataBound:数据绑定的时候(正在进行时)发生. 2 ItemCommand :用来响应Item模板中的控件的事件. 如下代码 aspx代码: [html] view plain c ...

  5. ffmpeg 移植到 android 并使用

    同步更新至个人blog:http://dxjia.cn/2015/07/ffmpeg-porting-to-android/ 空闲做了个小应用,从视频里截图,然后再将截图拼接为一个gif动画: 起初使 ...

  6. java二叉树字典查询(qq 928900200)

    This assignment will help you practice and understand better the Binary Tree and Binary Search Tree ...

  7. [echarts] 横纵数据散点图

    需求:课程平均分(X)与课程通过率散点图 http://echarts.baidu.com/echarts2/doc/example/scatter1.html https://www.cnblogs ...

  8. FatTree拓扑结构

    FatTree拓扑结构是由MIT的Fares等人在改进传统树形结构性能的基础上提出的,属于switch-only型拓扑. 整个拓扑网络分为三个层次:自上而下分别为边缘层(edge).汇聚层(aggre ...

  9. 嵌入式开发之hi3519---lvds ,mipi,camera sensor,/DVI/HDMI Interface

    http://blog.csdn.net/mao0514/article/details/54015466

  10. 基于Java的数据采集(一)

    之前写过2篇关于PHP数据采集入库的文章: 基于PHP数据采集入库(一):http://www.cnblogs.com/lichenwei/p/3872307.html 基于PHP数据采集入库(二): ...