收发包各个queue
https://www.cnblogs.com/zengkefu/p/5583618.html
https://zhensheng.im/2017/08/11/2997/MIAO_LE_GE_MI
https://www.sdnlab.com/17530.html
统计数
[root@localhost ~]# ethtool -S eth0
NIC statistics:
rx_packets: 3331177214
tx_packets: 3582794017
rx_bytes: 677838920428
tx_bytes: 483670086928
rx_errors: 0
tx_errors: 0
rx_dropped: 0
tx_dropped: 0
multicast: 84810
collisions: 0
rx_over_errors: 0
rx_crc_errors: 0
rx_frame_errors: 0
rx_fifo_errors: 0
rx_missed_errors: 0 # Rx FIFO满导致的丢包数
tx_aborted_errors: 0
tx_carrier_errors: 0
tx_fifo_errors: 0
tx_heartbeat_errors: 0
rx_pkts_nic: 3437891738 # GPRC(Good Packets Received Count)寄存器
tx_pkts_nic: 3582800027 # GORC(Good Packets Transmitted Count)寄存器
rx_bytes_nic: 698522123121 # GPTC(Good Octets Received Count)寄存器
tx_bytes_nic: 499451153635 # GOTC(Good Octets Transmitted Count)寄存器
...
rx_no_buffer_count: 0 # Ring Buffer满导致的不能DMA包数
...
fdir_match: 3195817250
fdir_miss: 241665763
fdir_overflow: 13914
...
tx_queue_0_packets: 2367238244
tx_queue_0_bytes: 222503084138
...
rx_queue_0_packets: 1975877817
rx_queue_0_bytes: 438935217187
...
https://bookstack.swigg.net/books/networking/page/how-the-kitchen-sink-and-statistics-explain-and-treat-dropped-packets
RNBC(Receive No Buffer Count)对应ethtool -S eth0中的rx_no_buffer_count:
It will increment when a frame has been successfully loaded into the FIFO, but can’t get out to host memory where the buffers are because there are no free buffers to put it into
MPC(Missed Packet Count )对应ethtool -S eth0中的rx_missed_errors:
This is the count of frames that were discarded because there was no room in the MAC FIFO to store the frames before they were DMA’ed out to host memory
TC
TC(Traffic Control,流控)
tc qdisc add dev eth0 root handle 1: htb
tc class add dev eth0 parent 1: classid 1:1 htb rate 10mbit
tc class add dev eth0 parent 1: classid 1:2 htb rate 10mbit
tc class add dev eth0 parent 1: classid 1:3 htb rate 10mbit
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip src 192.168.1.0/24 flowid 1:1
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip src 192.168.2.0/24 flowid 1:2
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip src 192.168.3.0/24 flowid 1:3
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip sport 1000 0xffff flowid 1:1
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip sport 2000 0xffff flowid 1:2
tc filter add dev eth0 parent 1: protocol ip prio 1 u32 match ip sport 3000 0xffff flowid 1:3
默认
tc qdisc add dev eth0 root handle 0: mq(默认)
[root@localhost ~]# tc qdisc show dev eth0
qdisc mq 0: root
qdisc pfifo_fast 0: parent :4 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: parent :3 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: parent :2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: parent :1 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
...
[root@localhost ~]# tc class show dev eth0
class mq :1 root
class mq :2 root
class mq :3 root
class mq :4 root
...
tc qdisc add dev eth0 root handle 1: mq
[root@localhost ~]# tc qdisc show dev eth0
qdisc mq 1: root
qdisc pfifo_fast 0: parent 1:4 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: parent 1:3 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: parent 1:2 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
qdisc pfifo_fast 0: parent 1:1 bands 3 priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1
...
[root@localhost ~]# tc class show dev eth0
class mq 1:1 root
class mq 1:2 root
class mq 1:3 root
class mq 1:4 root
...
bands 3:3个Band(0、1、2)
priomap 1 2 2 2 1 2 0 0 1 1 1 1 1 1 1 1:Linux Priority到Band(0、1、2)的映射
qdisc树
1、classless qdisc不能有子节点,classful qdisc可以有子节点
2、qdisc的子节点可以是class(可以多个),也可以没有
3、class的子节点可以是qdsic(只能1个),可以是class(可以多个),也可以没有
4、qdisc内的算法(htb等)相同;qdisc间的算法可以相同,也可以不同
5、叶子节点可以是qdisc,也可以是class
6、class的默认qdisc是fifo
http://tldp.org/HOWTO/Traffic-Control-HOWTO/classless-qdiscs.html#qs-fifo
This is also the qdisc used inside all newly created classes until another qdisc or a class replaces the FIFO
7、filter不能attach到classless qdisc,可以attach到classful qdisc或class
http://tldp.org/HOWTO/Traffic-Control-HOWTO/components.html#c-qdisc
https://blog.csdn.net/dog250/article/details/40483627
http://luxik.cdi.cz/~devik/qos/htb/
https://www.cnblogs.com/zengkefu/p/5635100.html
ingress
TODO