目录

一、硬件与固件层优化

1. PCIe 5.0 配置验证

2. 固件与驱动升级

二、中断与队列优化

1. 多队列与RSS分流

2. 中断亲和性绑定

三、内核协议栈调优

1. 内核参数优化

2. Mellanox驱动级优化

四、高级卸载与加速

1. 硬件卸载配置

2. XDP/DPDK加速(可选)

五、性能验证与监控

1. 实时诊断命令

2. 性能压测工具

六、关键注意事项


一、硬件与固件层优化

1. PCIe 5.0 配置验证
# 检查PCIe链路速率和宽度(EPYC 9004支持PCIe 5.0 x16) lspci -vv -s 0000:03:00.0 | grep -i "LnkSta" 
# 强制锁定PCIe 5.0(如果自动降级) setpci -s 0000:03:00.0 CAP_EXP+0x30.W=0x3c00 
# 启用PCIe Relaxed Ordering(降低延迟) mlxconfig -d /dev/mst/mt4125_pciconf0 set PCI_WR_ORDERING=1 ​
2. 固件与驱动升级
# 更新ConnectX-7固件(需Mellanox官方工具) flint -d /dev/mst/mt4125_pciconf0 -i fw-ConnectX7-rel-xx_xxx_xxx.bin burn 
# 加载最新mlx5_core驱动 modprobe mlx5_core log_num_mgm_entry_size=-1 # 增大资源池 ​

二、中断与队列优化

1. 多队列与RSS分流
# 启用最大硬件队列(ConnectX-7支持1024队列) 
ethtool -L ethX combined 64 
# 根据CPU核心数调整 
ethtool -X ethX hkey 6d:5a:6d:5a:6d:5a:6d:5a:6d:5a:6d:5a:6d:5a:6d:5a  # Toeplitz密钥 
ethtool -x ethX  # 验证RSS配置 
# 启用RPS软中断分流 
echo ffff > /sys/class/net/ethX/queues/rx-0/rps_cpus
# 绑定所有CPU ​
2. 中断亲和性绑定
# 绑定中断到特定NUMA节点(EPYC CCD结构敏感) IRQ_LIST=$(grep ethX-TxRx /proc/interrupts | awk '{print $1}' | cut -d: -f1) for irq in $IRQ_LIST; do echo 8-15 > /proc/irq/$irq/smp_affinity_list 
# 绑定到NUMA0的CCD1物理核 done ​

三、内核协议栈调优

1. 内核参数优化
# 增大协议栈缓存 sysctl -w net.core.rmem_max=268435456 sysctl -w net.core.wmem_max=268435456 sysctl -w net.ipv4.tcp_rmem="4096 87380 268435456" sysctl -w net.ipv4.tcp_wmem="4096 16384 268435456" 
# 减少锁竞争 sysctl -w net.core.netdev_budget=6000 sysctl -w net.core.netdev_budget_usecs=16000 ​
2. Mellanox驱动级优化
# 调整mlx5_core参数(/etc/modprobe.d/mlx5.conf) options mlx5_core log_debug=1 options mlx5_core poll_hw=1 
# 启用忙轮询(busy-poll) options mlx5_core mlx5_eqe_size=128
# 增大事件队列元素 
# 动态调整中断合并 ethtool -C ethX adaptive-rx on adaptive-tx on ​

四、高级卸载与加速

1. 硬件卸载配置
# 启用所有卸载功能(ConnectX-7支持TLS/GPUs等) ethtool -K ethX tx-checksum-ip-generic on ethtool -K ethX hw-tc-offload on 
# 流量分类卸载 ethtool --set-priv-flags ethX roce_v1_5_enable 1  # 启用RoCEv2 
# 配置流控制(PFC/ECN) mlnx_qos -i ethX --trust=dscp 
# 基于DSCP优先级 mlnx_qos -i ethX --pfc=0,0,0,1,0,0,0,0 
# 对优先级3开启PFC ​
2. XDP/DPDK加速(可选)
# 1. XDP原生模式(需内核5.10+) ip link set dev ethX xdp obj xdp_drop.o 
# 2. DPDK绑定(需绑定VFIO驱动) usertools/dpdk-devbind.py --bind=vfio-pci 0000:03:00.0 ​

五、性能验证与监控

1. 实时诊断命令
# Mellanox专用统计 ethtool -S ethX | grep -E "err|drop" 
# 检查丢包/错误 cat /sys/class/infiniband/mlx5_0/ports/1/hw_counters/* # RoCE统计 
# 中断负载分布 mpstat -P ALL 1 # 检查CPU利用率分布 ​
2. 性能压测工具
# 1. 线速测试(200GbE场景) mlxlink -d mt4125 -p -c 
# 检查链路状态 mlxperf -d mt4125 -i -t 0 -b 200 # 200Gbps带宽测试 
# 2. 延迟测试(RoCE/RDMA) ib_send_lat -d mlx5_0 -F -a -n 1000000 ​

六、关键注意事项

  1. NUMA拓扑敏感:EPYC CCD结构需确保网卡队列绑定到同一CCX内的核心,避免跨die通信。
  2. PCIe Relaxed Ordering:必须在BIOS中启用 PCIe ATS/ATS Enable。
  3. MTU与Jumbo Frame:建议设置MTU=9000(需全链路支持),提升大包吞吐量。
  4. 温度监控:ConnectX-7高负载时温度敏感,需确保散热符合要求:
    mget_temp -d mt4125 # 实时查看网卡温度 ​

更多推荐