Soft-RoCE是RoCE协议的软件栈版本,可以在普通网卡上搭建RDMA环境
先确保安装以下软件:
| 1 | sudo apt-get install git | 
Install Kernel
Clone kernel
| 1 | git clone https://github.com/SoftRoCE/rxe-dev.git | 
切换到 ‘rxe_submission_v18’ 分支
| 1 | git checkout rxe_submission_v18 | 
进入到rxe-dev 目录 cd rxe-dev
| 1 | cp /boot/config-$(uname –r) .config | 
切换到root用户权限,运行make menuconfig ,出现选择界面。(在使用 make menuconfig 之前需要安装ncurse-devel
输入”/“ ,然后输入RDMA_RXE,按下 enter,会查找有关RDMA_RXE 的选择项. 输入数字 1,就会选择到RDMA_RXE 的设置,输入”M” ,选中 RDMA 的配置. 
然后 vi.config 来确认CONFIG_RDMA_RXE 为 m ,CONFIG_INFINIBAND_ADDR_TRANS和CONFIG_INFINIBAND_ADDR_TRANS_CONFIGFS 为 y
建议在Generalsetup –>Local version中填写一个名称,便于之后编译出的内核与其他内核区别开。
##编译内核
| 1 | make –j 32 | 
上述步骤如果遇到permission denied,命令前加上sudo 再执行。且上述命令均应在源码目录即 /rxe-dev 下执行
确认新的内核是否在grub引导中,可以查看 /boot/grub/grub.conf
用新内核启动后查看内核版本号和rdma_rxe模块
| 1 | kevin@ubuntu:~$ uname -r | 
Install user space library (librxe)
安装以下的包
| 1 | libswitch-perl | 
编译安装 install userspace library librxe:
| 1 | git clone https://github.com/SoftRoCE/librxe-dev.git | 
(./configure --libdir=/usr/lib64/ --prefix= 中如果路径只有/lib 就用/lib)
Configure Soft-RoCE (RXE)
| 1 | kevin@ubuntu:~$ rxe_cfg status | 
Load ib_rxe kernel module, using the rxe_cfg script included in the librxe RPM:
| 1 | kevin@ubuntu:~$ sudo rxe_cfg start | 
To verify RXE kernel module is loaded, run:
| 1 | kevin@ubuntu:~$ lsmod |grep rdma_rxe | 
Create RXE device over network interface (e.g. ens33):
| 1 | sudo rxe_cfg add ens33 | 
Check the status of rxe_cfg, make sure that rxe0 was added under RDEV (rxe device).It is also possible to check the ibv_devices command.
| 1 | kevin@ubuntu:~$ rxe_cfg | 
Test connectivity.
- On the server:
| 1 | ibv_rc_pingpong -d rxe0 -g 0 | 
- On the client:
| 1 | ibv_rc_pingpong -d rxe0 -g 0 <server_management_ip> | 
e.g Client:
| 1 | kevin@ubuntu:~$ ibv_rc_pingpong -g 0 -d rxe0 -i 1 192.168.188.129 | 
Test
rping
server

client

perftest
| 1 | sudo apt-get install perftest | 
测试时需切换到root
Sever:
| 1 | ib_send_bw –a | 
Client:
| 1 | ib_send_bw 192.168.46.132 –a | 


FAQ
- 用sudoapt-get update时出现“ E: 无法获得锁/var/lib/apt/lists/lock”错误
| 1 | sudo rm /var/lib/apt/lists/lock | 
- 如果出现缺少ssl的错误,就安装ssl
| 1 | apt-get install libssl-dev | 
- ERROR: make *No rule to make target”menuconfig”.stop.
原因是没有在内核源码目录下进行。例如,要编译或升级的内核解压后的目录为/usr/src/Linux-2.4.24,一定要进入到该目录后使用makemenuconfig命令,这样就不会提示上面的错误了。(在本文中就是在rxe-dev目录下编译)
- 克隆的虚拟机中找不到eth0。因为网卡是克隆的,所以在测试连通性的时候不能用。要手动修改网卡信息。 
- 在试验 rdma 的时候,记得关闭防火墙 - 1 
 2- - sudo iptables -F 
 chkconfig iptables off #开机不启动-