18c2ecf20Sopenharmony_ci******************************** 28c2ecf20Sopenharmony_ciRDMA Network Block Device (RNBD) 38c2ecf20Sopenharmony_ci******************************** 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ciIntroduction 68c2ecf20Sopenharmony_ci------------ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ciRNBD (RDMA Network Block Device) is a pair of kernel modules 98c2ecf20Sopenharmony_ci(client and server) that allow for remote access of a block device on 108c2ecf20Sopenharmony_cithe server over RTRS protocol using the RDMA (InfiniBand, RoCE, iWARP) 118c2ecf20Sopenharmony_citransport. After being mapped, the remote block devices can be accessed 128c2ecf20Sopenharmony_cion the client side as local block devices. 138c2ecf20Sopenharmony_ci 148c2ecf20Sopenharmony_ciI/O is transferred between client and server by the RTRS transport 158c2ecf20Sopenharmony_cimodules. The administration of RNBD and RTRS modules is done via 168c2ecf20Sopenharmony_cisysfs entries. 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ciRequirements 198c2ecf20Sopenharmony_ci------------ 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci RTRS kernel modules 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ciQuick Start 248c2ecf20Sopenharmony_ci----------- 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ciServer side: 278c2ecf20Sopenharmony_ci # modprobe rnbd_server 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ciClient side: 308c2ecf20Sopenharmony_ci # modprobe rnbd_client 318c2ecf20Sopenharmony_ci # echo "sessname=blya path=ip:10.50.100.66 device_path=/dev/ram0" > \ 328c2ecf20Sopenharmony_ci /sys/devices/virtual/rnbd-client/ctl/map_device 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci Where "sessname=" is a session name, a string to identify the session 358c2ecf20Sopenharmony_ci on client and on server sides; "path=" is a destination IP address or 368c2ecf20Sopenharmony_ci a pair of a source and a destination IPs, separated by comma. Multiple 378c2ecf20Sopenharmony_ci "path=" options can be specified in order to use multipath (see RTRS 388c2ecf20Sopenharmony_ci description for details); "device_path=" is the block device to be 398c2ecf20Sopenharmony_ci mapped from the server side. After the session to the server machine is 408c2ecf20Sopenharmony_ci established, the mapped device will appear on the client side under 418c2ecf20Sopenharmony_ci /dev/rnbd<N>. 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciRNBD-Server Module Parameters 458c2ecf20Sopenharmony_ci============================= 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_cidev_search_path 488c2ecf20Sopenharmony_ci--------------- 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ciWhen a device is mapped from the client, the server generates the path 518c2ecf20Sopenharmony_cito the block device on the server side by concatenating dev_search_path 528c2ecf20Sopenharmony_ciand the "device_path" that was specified in the map_device operation. 538c2ecf20Sopenharmony_ci 548c2ecf20Sopenharmony_ciThe default dev_search_path is: "/". 558c2ecf20Sopenharmony_ci 568c2ecf20Sopenharmony_cidev_search_path option can also contain %SESSNAME% in order to provide 578c2ecf20Sopenharmony_cidifferent device namespaces for different sessions. See "device_path" 588c2ecf20Sopenharmony_cioption for details. 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ci============================ 618c2ecf20Sopenharmony_ciProtocol (rnbd/rnbd-proto.h) 628c2ecf20Sopenharmony_ci============================ 638c2ecf20Sopenharmony_ci 648c2ecf20Sopenharmony_ci1. Before mapping first device from a given server, client sends an 658c2ecf20Sopenharmony_ciRNBD_MSG_SESS_INFO to the server. Server responds with 668c2ecf20Sopenharmony_ciRNBD_MSG_SESS_INFO_RSP. Currently the messages only contain the protocol 678c2ecf20Sopenharmony_civersion for backward compatibility. 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_ci2. Client requests to open a device by sending RNBD_MSG_OPEN message. This 708c2ecf20Sopenharmony_cicontains the path to the device and access mode (read-only or writable). 718c2ecf20Sopenharmony_ciServer responds to the message with RNBD_MSG_OPEN_RSP. This contains 728c2ecf20Sopenharmony_cia 32 bit device id to be used for IOs and device "geometry" related 738c2ecf20Sopenharmony_ciinformation: side, max_hw_sectors, etc. 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci3. Client attaches RNBD_MSG_IO to each IO message send to a device. This 768c2ecf20Sopenharmony_cimessage contains device id, provided by server in his rnbd_msg_open_rsp, 778c2ecf20Sopenharmony_cisector to be accessed, read-write flags and bi_size. 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ci4. Client closes a device by sending RNBD_MSG_CLOSE which contains only the 808c2ecf20Sopenharmony_cidevice id provided by the server. 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci========================================= 838c2ecf20Sopenharmony_ciContributors List(in alphabetical order) 848c2ecf20Sopenharmony_ci========================================= 858c2ecf20Sopenharmony_ciDanil Kipnis <danil.kipnis@profitbricks.com> 868c2ecf20Sopenharmony_ciFabian Holler <mail@fholler.de> 878c2ecf20Sopenharmony_ciGuoqing Jiang <guoqing.jiang@cloud.ionos.com> 888c2ecf20Sopenharmony_ciJack Wang <jinpu.wang@profitbricks.com> 898c2ecf20Sopenharmony_ciKleber Souza <kleber.souza@profitbricks.com> 908c2ecf20Sopenharmony_ciLutz Pogrell <lutz.pogrell@cloud.ionos.com> 918c2ecf20Sopenharmony_ciMilind Dumbare <Milind.dumbare@gmail.com> 928c2ecf20Sopenharmony_ciRoman Penyaev <roman.penyaev@profitbricks.com> 93