[development][dpdk] 网卡收包性能测试

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

[[email protected] ~]# ethtool -g eth0
Ring parameters for eth0:
Pre-set maximums:
RX:             4096
RX Mini:        0
RX Jumbo:       0
TX:             4096
Current hardware settings:
RX:             512
RX Mini:        0
RX Jumbo:       0
TX:             512
[[email protected] ~]# ls /sys/class/net/eth0/queues/
rx-0  rx-10  rx-12  rx-14  rx-16  rx-18  rx-2   rx-21  rx-23  rx-4  rx-6  rx-8  tx-0  tx-10  tx-12  tx-14  tx-16  tx-18  tx-2   tx-21  tx-23  tx-4  tx-6  tx-8
rx-1  rx-11  rx-13  rx-15  rx-17  rx-19  rx-20  rx-22  rx-3   rx-5  rx-7  rx-9  tx-1  tx-11  tx-13  tx-15  tx-17  tx-19  tx-20  tx-22  tx-3   tx-5  tx-7  tx-9

[[email protected] ~]# cat /proc/interrupts |less -S
[[email protected] ~]# 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
   0:        186          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC-edge      timer
   1:          3          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC-edge      i8042
   8:          1          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC-edge      rtc0
   9:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC-fasteoi   acpi
  12:          4          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC-edge      i8042
  16:        256          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC-fasteoi   ehci_hcd:usb1
  23:        298          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-IO-APIC-fasteoi   ehci_hcd:usb2
  88:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  DMAR_MSI-edge      dmar0
  89:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  DMAR_MSI-edge      dmar1
  90:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      aerdrv
  91:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      aerdrv
  92:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      aerdrv
  93:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      aerdrv
  94:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      aerdrv
  95:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      aerdrv
  96:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      aerdrv
  97:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      aerdrv
  98:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      aerdrv
  99:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      aerdrv
 100:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      aerdrv
 101:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      aerdrv
 102:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      aerdrv
 103:      24847          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      ahci
 104:          1          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      isci-msix
 105:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      isci-msix
 106:    3319852          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-0
 107:     981541          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-1
 108:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-2
 109:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-3
 110:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-4
 111:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-5
 112:     669706          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-6
 113:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-7
 114:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-8
 115:      28009          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-9
 116:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-10
 117:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-11
 118:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-12
 119:      28069          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-13
 120:     338786          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-14
 121:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-15
 122:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-16
 123:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-17
 124:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-18
 125:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-19
 126:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-20
 127:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-21
 128:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-22
 129:      28004          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0-TxRx-23
 130:         59          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth0
 131:      85702          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-0
 132:      84484          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-1
 133:      89210          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-2
 134:      86210          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-3
 135:      86086          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-4
 136:      89464          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-5
 137:      94737          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-6
 138:      86082          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-7
 139:      84812          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-8
 140:      86437          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-9
 141:      83901          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-10
 142:      90394          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-11
 143:      86578          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-12
 144:      89534          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-13
 145:      92897          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-14
 146:      97958          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-15
 147:      26913          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-16
 148:      26913          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-17
 149:      26913          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-18
 150:      26913          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-19
 151:      26913          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-20
 152:      26913          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-21
 153:      26913          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-22
 154:      26913          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1-TxRx-23
 155:          2          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth1
 157:      97476          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0  IR-PCI-MSI-edge      eth3
 NMI:        736         48          9          4          2          1        133          2         14          4         13         12          6        102         67          2          1          1          1        163          3        640        550       2718   Non-maskable interrupts
 LOC:     892399      69189      85565      60959      35207      24688     159437      24227     114514      64519      50015      24473      19392     198772     108184      34002      21177      18652      18684     250274      43307   42755165   42680063    2737380   Local timer interrupts
 SPU:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0   Spurious interrupts
 PMI:        736         48          9          4          2          1        133          2         14          4         13         12          6        102         67          2          1          1          1        163          3        640        550       2718   Performance monitoring interrupts
 IWI:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0   IRQ work interrupts
 RTR:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0   APIC ICR read retries
 RES:    2281297     404101       4908        813        277        323        594        864       4512       1682        768        369        109       3271        222        508         86         81        145       7654        369        964        460        202   Rescheduling interrupts
 CAL:        325        389        365        373        385        385        741        491       1434        921        652        488        384        357        387        385        383        384        395       3966        679        586       1914        427   Function call interrupts
 TLB:         19          5         18        157          3          6         11          7         12         78          2          3         12        781        637         30         25         12          7        807        686       7816       4244      50309   TLB shootdowns
 TRM:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0   Thermal event interrupts
 THR:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0   Threshold APIC interrupts
 MCE:          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0          0   Machine check exceptions
 MCP:        217        217        217        217        217        217        217        217        217        217        217        217        217        217        217        217        217        217        217        217        217        217        217        217   Machine check polls
 ERR:          0
 MIS:          0
[[email protected] ~]# 

interrupts

二: 设置CPU隔离

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

三: 修改收发包队列数

[[email protected] tong]# ethtool -g eth0
Ring parameters for eth0:
Pre-set maximums:
RX:             4096
RX Mini:        0
RX Jumbo:       0
TX:             4096
Current hardware settings:
RX:             64
RX Mini:        0
RX Jumbo:       0
TX:             512

[[email protected] tong]# ethtool -G eth0 rx 1  tx 1
[[email protected] tong]# ethtool -g eth0
Ring parameters for eth0:
Pre-set maximums:
RX:             4096
RX Mini:        0
RX Jumbo:       0
TX:             4096
Current hardware settings:
RX:             64
RX Mini:        0
RX Jumbo:       0
TX:             64

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=16000,16000                                

。。。 。。。

Multiqueue
----------
Valid Range:
0, 1
0 = Disables Multiple Queue support
1 = Enabled Multiple Queue support (a prerequisite for RSS)
                                      

README

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

[[email protected] tong]# modprobe -r ixgbe
[[email protected] tong]# modprobe ixgbe MQ=1,0
[[email protected] tong]# ls /sys/class/net/eth0/queues/
rx-0  rx-10  rx-12  rx-14  rx-16  rx-18  rx-2   rx-21  rx-23  rx-4  rx-6  rx-8  tx-0  tx-10  tx-12  tx-14  tx-16  tx-18  tx-2   tx-21  tx-23  tx-4  tx-6  tx-8
rx-1  rx-11  rx-13  rx-15  rx-17  rx-19  rx-20  rx-22  rx-3   rx-5  rx-7  rx-9  tx-1  tx-11  tx-13  tx-15  tx-17  tx-19  tx-20  tx-22  tx-3   tx-5  tx-7  tx-9
[[email protected] tong]# ls /sys/class/net/eth1/queues/
rx-0  tx-0
[[email protected] tong]#

四:中断绑定:

cpu结构:

[[email protected] tong]# ./cpu_layout.py
============================================================
Core and Socket Information (as reported by ‘/proc/cpuinfo‘)
============================================================

cores =  [0, 1, 2, 3, 4, 5]
sockets =  [0, 1]

       Socket 0        Socket 1
       --------        --------
Core 0 [0, 12]         [6, 18]
Core 1 [1, 13]         [7, 19]
Core 2 [2, 14]         [8, 20]
Core 3 [3, 15]         [9, 21]
Core 4 [4, 16]         [10, 22]
Core 5 [5, 17]         [11, 23]
[[email protected] tong]# 

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

中断绑定:

#! /bin/bash

function bind() # $lcpus, $irq_list, $set
{
        for i in $2
        do
                echo -n $i ": "
                if [ $3 -eq 1 ]
                then
                        echo $1 > /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 1 ]
then
        usage
        exit
fi

if [ \( "$1" != "1" \) -a \( "$1" != "0" \) ]
then
        usage
        exit
fi

irq_list=`cat /proc/interrupts |grep eth0 |awk -F: ‘{print $1}‘`
bind "1,13" "$irq_list" $1

irq_list=`cat /proc/interrupts |grep eth1 |awk -F: ‘{print $1}‘`
bind "2,14" "$irq_list" $1

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

五: 发包:

tcpreplay -i eth0 -l0 -L10000000 -p400000 -K syy/50000.pcap 
时间: 2024-08-01 16:22:10

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

代码学习-Linux内核网卡收包过程(NAPI)

本文通过学习RealTek8169/8168/8101网卡的驱动代码(drivers/net/r8169.c),梳理一下Linux下网卡的收包过程. 在下水平相当有限,有不当之处,还请大家斧正^_^ 驱动的初始化 如下的rtl8169_init_module函数是此驱动的初始化代码,此函数只干了一件事,就是向内核注册一个pci驱动rtl8169_pci_driver. static int __init rtl8169_init_module(void) { returnpci_register

[ovs][dpdk] ovs-dpdk 线程数,收包队列,core绑定

http://docs.openvswitch.org/en/latest/intro/install/dpdk/?highlight=dpdk 绑定2,4,6, 8核 [[email protected] ~]# ovs-vsctl set Open_vSwitch . other_config:pmd-cpu-mask=0x0154 设置4个收包队列 [[email protected] ~]# ovs-vsctl set Interface dpdk-p0 options:n_rxq=4

netback的tasklet调度问题及网卡丢包的简单分析

最近在万兆网卡上测试,出现了之前千兆网卡没有出现的一个现象,tasklet版本的netback下,vm进行发包测试,发现vif的interrupt默认绑定在cpu0上,但是vm发包运行时发现host上面cpu1, cpu2的ksoftirqd很高. 从之前的理解上来说,包从netfront出来通过eventchannel notify触发vif的irq处理函数,然后tasklet_schedule调用tx_action,通过一系列处理流程把包发给网卡.所以vif的interrupt绑在哪个cpu

浅谈UDP(数据包长度,收包能力,丢包及进程结构选择)

UDP数据包长度 UDP数据包的理论长度 udp数据包的理论长度是多少,合适的udp数据包应该是多少呢?从TCP-IP详解卷一第11章的udp数据包的包头可以看出,udp的最大包长度是2^16-1的个字节.由于udp包头占8个字节,而在ip层进行封装后的ip包头占去20字节,所以这个是udp数据包的最大理论长度是2^16-1-8-20=65507. 然而这个只是udp数据包的最大理论长度.首先,我们知道,TCP/IP通常被认为是一个四层协议系统,包括链路层.网络层.运输层.应用层.UDP属于运输

一次刨根问底的socket收包过程(Linux)

Linux会对一个网络包(packet)的收和发做大量的处理.packet在被发送之前会被存在队列中,而在被接受之后也会存在队列中,共有三个队列:reception(接收),transmission(发送)和Backlog.它们都受到spinlock的保护,是为了保证在并发访问时的一致性.言归正传,接下来看看当一个packet到达NIC(网卡)时,linux都会做些什么工作. 先来看一个图(来自论文 Analysis of Linux UDP Sockets Concurrent Perform

服务器网卡丢包

有时会发生网络丢包现象,此处的丢包有两种,真正意义上的丢包和逻辑丢包(此处以tcp协议栈丢包为例).之前falcon-agent也上报了相应的指标,在此处对一些疑问给出尽量详细的解释. 二.linux系统pakcet接收的过程 过程简单概括为 网卡收到包以后通过DMA传至ring buffer 网卡触发硬件中断,中断处理函数调用包接受软中断(softirq) Softirq检测各cpu的网卡poll list,并轮询相应网卡的ring buffer 包从相应packet desciptor 中移

记录一个UDP收包丢包的问题

这几天写GB28181平台接入层代码,对收到的PS包进行解包时,总是出现误码,最终导致rtsp点播服务中画面花屏. 分析了码流抓包数据之后,发现网络上没有丢包,遂认为PS流解包代码有bug,于是埋头分析了2个小时的解包函数后,没有发现问题.将抓包RTP负载中的PS包数据导出之后,专门利用PS解包代码写了一个小程序,对导出的数据进行处理,又没有问题——后来事实证明解包代码的确没有问题,而且这部分的代码是在其他项目中用过的.自己有些迷糊了,一时想不明白问题出在哪里. 起身转了几圈冷静后分析一下,认为

IOS多网卡抓包

linux下libpcap支持从多网卡抓包,设置为any即可 在IOS或者mac上就无法通过次方法抓取所有网卡报文 1.通过设置libevent事件回调,每个网卡注册读事件, fd通过 pd = pcap_open_live(device, snaplen, dopromisc, timeout, ebuf); 获得. #ifdef IOS static int add_event(pcap_t *p) { if(!p) return -1; //event_init(); if(!base)

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

参考: [development][dpdk][hugepage] 为不同的结点分配不同大小的大页内存 完成了以上内容之后, 下一步需要做的是挂载, 大页内存只有被挂载了之后,才能被应用程序使用. 挂载方法如下: 参考dpdk文档:  http://dpdk.org/doc/guides/linux_gsg/sys_reqs.html mkdir /mnt/huge mount -t hugetlbfs nodev /mnt/huge 如果是有1G的大页, 需要给定默认参数 pagesize=1