《Running RoCE over L2 Network Enabled with PFC》https://www.mellanox.com/related-docs/prod_software/RoCE_with_Priority_Flow_Control_Application_Guide.pdf
环境:
两台host(各配有一块双端口40Gbps ConnectX-3 网卡,驱动版本为4.1-1.0.2.0,OS为Ubuntu 16.04)
一台32端口Mellanox Spectrum交换机SN2700,onyx版本为3.6.8102.
PFC背景知识:
PFC:https://blog.csdn.net/bandaoyu/article/details/115346857
引用Juniper对PFC的介绍,“基于优先级的流控制(PFC,Priority-based flow control),IEEE标准802.1Qbb,是一种链路级流控制机制。该流控制机制与IEEE 802.3x的暂停机制类似,但是暂停的是链路上某个优先级的消息(每个级别是一个虚拟通道,暂停某个虚拟通道),而不是整个链路暂停。PFC允许您根据其类别有选择地暂停流量。”
可见,相比于IEEE 802.3x(整个链路),PFC的粒度更小(暂停某个虚拟通道)。因此配置的过程可以理解为将应用流量映射到某一个优先级的过程。根据对流量标记位置的不同,可以分为Trust L2和Trust L3。由于ConnectX-3仅支持RoCE v1,因此本文只关注Trust L2。
在端主机侧,映射关系为:
ToS -> skb_priority -> Vlan-qos (也记为User Priority,即UP,其值为Vlan tag中PCP的值) -> tc。
在交换机侧,映射关系为:
PCP + DEI -> switch-priority -> ingress Port Group (PG)。其中PG包含对PFC阈值的配置。
本文使用tc 4以及switch-priority 4为例。
配置过程:
首先配置交换机:
0. 进入配置模式:
switch-6bd534 [standalone: master] > enable
switch-6bd534 [standalone: master] # configure terminal
1. 创建VLAN,并设置交换机端口为hybrid模式:
switch-6bd534 [standalone: master] (config) # vlan 10
switch-6bd534 [standalone: master] (config vlan 10) # exit
switch-6bd534 [standalone: master] (config) # interface ethernet 1/1-1/32 switchport mode hybrid
switch-6bd534 [standalone: master] (config) # interface ethernet 1/1-1/32 switchport hybrid allowed-vlan add 10
2. 关闭所有端口的flow control:
switch-6bd534 [standalone: master] (config) # interface ethernet 1/1-1/32 flowcontrol send off force
switch-6bd534 [standalone: master] (config) # interface ethernet 1/1-1/32 flowcontrol receive off force
3.使能priority 4,并在所有端口启用