目录
验证RDMA内核模块是否已加载
在centos7中,可以用以下命令查看RDMA内核模块的状态:
[root@power27 docs]# /etc/init.d/openibd status
HCA driver loaded
Configured IPoIB devices:
ib0Currently active IPoIB devices:
ib0
Configured Mellanox EN devices:Currently active Mellanox devices:
ib0The following OFED modules are loaded:
rdma_ucm
rdma_cm
ib_ipoib
mlx4_core
mlx4_ib
mlx4_en
mlx5_core
mlx5_ib
ib_uverbs
ib_umad
ib_ucm
ib_cm
ib_core
mlxfw
mlx5_fpga_tools
HCA即支持RDMA的网卡,driver loaded表示驱动已加载。
检查主机上是否有可用的RDMA网卡
ibv_devices是一个包含在libibverbs-utils.rpm包里的工具,用于显示本机上的RDMA设备:
[root@power27 docs]# ibv_devices
device node GUID
------ ----------------
mlx4_0 e41d2d030050e830
ibv_devinfo也是libibverbs-utils.rpm包中的一个工具,它会打开一个设备查询设备的属性,通过它可以验证用户空间和内核空间的RMDA栈是否能够一起正常运作:
[root@power27 docs]# ibv_devinfo -d mlx4_0
hca_id: mlx4_0
transport: InfiniBand (0)
fw_ver: 2.42.5000
node_guid: e41d:2d03:0050:e830
sys_image_guid: e41d:2d03:0050:e833
vendor_id: 0x02c9
vendor_part_id: 4099
hw_ver: 0x1
board_id: MT_1100120019
phys_port_cnt: 1
Device ports:
port: 1
state: PORT_ACTIVE (4)
max_mtu: 4096 (5)
active_mtu: 4096 (5)
sm_lid: 1
port_lid: 12
port_lmc: 0x00
link_layer: InfiniBand
至少要有一个端口的状态是PORT_ACTIVE,才能说明RDMA相关组件已经正常运行起来。
测试RDMA通信
使用bv_xxx_pingpong可以测试RDMA设备的流量发送功能:
# 在服务端
ibv_rc_pingpong -g 0 -d mlx4_0 -i 1
local address: LID 0x000c, QPN 0x000a19, PSN 0xf31d1e, GID fe80::e41d:2d03:50:e831
remote address: LID 0x000e, QPN 0x000491, PSN 0xfefc9e, GID fe80::e41d:2d03:50:e801
8192000 bytes in 0.01 seconds = 11821.07 Mbit/sec
1000 iters in 0.01 seconds = 5.54 usec/iter#在客户端 192.168.10.27是服务端的地址
ibv_rc_pingpong -g 0 -d mlx4_0 -i 1 192.168.10.27
local address: LID 0x000e, QPN 0x000491, PSN 0xfefc9e, GID fe80::e41d:2d03:50:e801
remote address: LID 0x000c, QPN 0x000a19, PSN 0xf31d1e, GID fe80::e41d:2d03:50:e831
8192000 bytes in 0.01 seconds = 11797.66 Mbit/sec
1000 iters in 0.01 seconds = 5.55 usec/iter
Syntax
ibv_rc_pingpong [-p TCP_port][-d device][-i IB_port][-s size][-r depth] [-n iters][-l level][-e][-h][IP_address]
where:
- TCP_port is the TCP port.
- device is the InfiniBand device.
- IB_port is the InfiniBand port.
- size is the size of the ping-pong messages.
- depth is the number of depth receives to post at one time.
- iters is the number of message exchanges.
- level is the service level of the queue pair.
- IP_address is the IP address of the remote node host.