目录

 

 

基于 DPDK QoS 套件实现的 Hqos

FD.io/VPP — QoS — DPDK Hqos_DPDK QoS

Hqos 的处理流程如上图所示:

  1. Worker 线程从 NIC 中读取报文进行处理;
  2. 调用 DPDK 设备的发送函数时,如果配置了 Hqos,那么设置 Hqos 的相关参数,将其送入 Swq 队列(swq 队列与 Worker 线程是 1:1 的关系);
  3. Worker 线程处理结束后,Hqos 线程(根据配置决定个数)轮询从 Swq 中读取报文进行 QoS 处理。
1、CONF 配置 Hqos
  • startup.conf
# DPDK 配置
dpdk {
...
  dev 0000:02:00.0 {
    num-rx-queues 2
    hqos  # 使能网卡的 Hqos。
  }
...
}

# CPU 配置
cpu {
  main-core 0
  corelist-workers  1, 2, 3, 4
  corelist-hqos-threads  5, 6  # 启动两个 Hqos 线程,分别使用 CPU 5、6。
}
2、CLI 配置 Hqos
  • 配置 subport 参数
set dpdk interface hqos subport <if-name> subport <n>
	[rate <n>]
	[bktsize <n>]
	[tc0 <n>] 
	[tc1 <n>]
	[tc2 <n>]
	[tc3 <n>] 
	[period <n>]
  • 配置 pipe 参数
set dpdk interface hqos pipe <if-name> subport <n> pipe <n> profile <n>
  • 指定 interface 的 hqos 处理线程
set dpdk interface hqos placement <if-name> thread <n>
  • 设置报文的具体字段(pktfield)用于分类,其中 id 为 hqos_field 编号
set dpdk interface hqos pktfield <if-name> id <n> offset <n> mask <n>
  • 设置 tc 和 tcq 映射表,根据 DSCP 映射到具体的 tc 和 tcq
set dpdk interface hqos tctbl <if-name> entry <n> tc <n> queue <n>
  • 查看 hqos 配置的命令
show dpdk interface hqos TenGigabitEthernet2/0/0
  • 查看设备所属的 hqos 线程
show dpdk interface hqos placement