CX7 网卡 Port Mode 从 IB → ETH 切换

1 前提条件

确保系统已安装 Mellanox 工具 mstflint / mlxconfig

确认命令存在:

1
2
mlxconfig -h
mst status

2 启动 MST 设备

Mellanox 设备需要先启用 MST 驱动。

1
mst start

查看设备:

1
mst status

示例输出:

1
2
3
4
MST devices:
------------
/dev/mst/mt4129_pciconf0
/dev/mst/mt4129_pciconf1

记录设备路径,例如:

1
/dev/mst/mt4129_pciconf0

3 查询当前 Port Mode

查询网卡端口模式:

1
mlxconfig -d /dev/mst/mt4129_pciconf0 q | grep LINK_TYPE

示例:

1
LINK_TYPE_P1 IB(1)

含义:

模式
1 InfiniBand
2 Ethernet

4 修改 Port Mode 为 Ethernet

执行:

1
mlxconfig -d /dev/mst/mt4129_pciconf0 set LINK_TYPE_P1=2

系统会提示确认:

1
Apply new Configuration? (y/n)

输入:

1
y

成功示例:

1
2
Device configuration updated successfully.
Please reboot machine to load new configurations.

5 重启系统

Port Mode 修改需要 系统重启 才会生效:

1
reboot

6 验证模式

系统启动后再次检查:

1
2
mst start
mlxconfig -d /dev/mst/mt4129_pciconf0 q | grep LINK_TYPE

期望结果:

1
LINK_TYPE_P1 ETH(2)

7 验证网络接口

检查是否生成以太网接口:

1
ip link

1
ethtool -i <interface>

例如:

1
2
eth0
ens5f0

8 常见问题

8.1 mlxconfig 找不到设备

确认 MST 是否启动:

1
mst status

如果为空:

1
mst start

8.2 修改失败

确认设备支持 Ethernet 模式:

1
mlxconfig -d /dev/mst/mt4129_pciconf0 q | grep LINK_TYPE

8.3 多网卡服务器

使用 mst status 找到对应 PCI 设备:

1
mst status -v

示例:

1
00:00.0 ConnectX-7 -> /dev/mst/mt4129_pciconf0