This is an RDMA example for two-sided operation SEND/RECEIVE and on-sided operation WRITE by Soft-RoCE.
Server: A simple database for client to query value
by key
and set value
by key.
- Setup RDMA resources
- Wait for a client to connect
- Allocate and pin buffers
- Accept the incoming client connection
- Send information about database buffer to client.
- Wait for new messages and do the operation.
- Disconnect
Client: Use SEND/RECEIVE to set/query value by key, and use RDMA WRITE to set value directly.
- Setup RDMA resources
- Connect to server
- Receive database buffer information via send/recv exchange
- Set/Query value by send/recv, or set value by RDMA WRITE
- Disconnect
Via two-sided operation can we see the operation in both server and client side. When perform a RDMA WRITE there is nothing to be printed since one-sided operation does not need CPU involvement of another side
Note that it is not recommended to write codes like that in rdma_write
. First step is to make this toy be able to sing. I will upgrade it that can dance later.
- Set up 2 VMs as client and server and a NAT Network.
- Build RDMA Core Userspace Libraries and Daemons (rdma-core)
- Clone this repository.
-
Open
CMakeLists.txt
and change theinclude_directories
andlink_directories
to the right path.include_directories(/your/rdma-core/location/build/include) link_directories(/your/rdma-core/location/build/lib)
-
Open
setup.sh
and changeenp0s3
to your device name. You can useifconfig
to check that. -
Run
bash setup.sh
. You should see
ink rxe_eth/1 state ACTIVE physical_state LINK_UP netdev enp0s3
It indicates that Soft-RoCE has started.
-
Run
bash build.sh cd build
Server: Run
./toy_server
. Support-p port_number
Client: Run
./toy_client
. Support-p port_number
and-s server_address
- rdma-core. https://github.com/linux-rdma/rdma-core/tree/master
- rdma-exmaple.
ibv_rc_pingpong
does not work.https://transactional.blog/rdma/soft-roce-requires-ipv6-link-local