162306a36Sopenharmony_ci********************************
262306a36Sopenharmony_ciRDMA Network Block Device (RNBD)
362306a36Sopenharmony_ci********************************
462306a36Sopenharmony_ci
562306a36Sopenharmony_ciIntroduction
662306a36Sopenharmony_ci------------
762306a36Sopenharmony_ci
862306a36Sopenharmony_ciRNBD (RDMA Network Block Device) is a pair of kernel modules
962306a36Sopenharmony_ci(client and server) that allow for remote access of a block device on
1062306a36Sopenharmony_cithe server over RTRS protocol using the RDMA (InfiniBand, RoCE, iWARP)
1162306a36Sopenharmony_citransport. After being mapped, the remote block devices can be accessed
1262306a36Sopenharmony_cion the client side as local block devices.
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ciI/O is transferred between client and server by the RTRS transport
1562306a36Sopenharmony_cimodules. The administration of RNBD and RTRS modules is done via
1662306a36Sopenharmony_cisysfs entries.
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ciRequirements
1962306a36Sopenharmony_ci------------
2062306a36Sopenharmony_ci
2162306a36Sopenharmony_ci  RTRS kernel modules
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_ciQuick Start
2462306a36Sopenharmony_ci-----------
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ciServer side:
2762306a36Sopenharmony_ci  # modprobe rnbd_server
2862306a36Sopenharmony_ci
2962306a36Sopenharmony_ciClient side:
3062306a36Sopenharmony_ci  # modprobe rnbd_client
3162306a36Sopenharmony_ci  # echo "sessname=blya path=ip:10.50.100.66 device_path=/dev/ram0" > \
3262306a36Sopenharmony_ci            /sys/devices/virtual/rnbd-client/ctl/map_device
3362306a36Sopenharmony_ci
3462306a36Sopenharmony_ci  Where "sessname=" is a session name, a string to identify the session
3562306a36Sopenharmony_ci  on client and on server sides; "path=" is a destination IP address or
3662306a36Sopenharmony_ci  a pair of a source and a destination IPs, separated by comma.  Multiple
3762306a36Sopenharmony_ci  "path=" options can be specified in order to use multipath  (see RTRS
3862306a36Sopenharmony_ci  description for details); "device_path=" is the block device to be
3962306a36Sopenharmony_ci  mapped from the server side. After the session to the server machine is
4062306a36Sopenharmony_ci  established, the mapped device will appear on the client side under
4162306a36Sopenharmony_ci  /dev/rnbd<N>.
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_ciRNBD-Server Module Parameters
4562306a36Sopenharmony_ci=============================
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_cidev_search_path
4862306a36Sopenharmony_ci---------------
4962306a36Sopenharmony_ci
5062306a36Sopenharmony_ciWhen a device is mapped from the client, the server generates the path
5162306a36Sopenharmony_cito the block device on the server side by concatenating dev_search_path
5262306a36Sopenharmony_ciand the "device_path" that was specified in the map_device operation.
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ciThe default dev_search_path is: "/".
5562306a36Sopenharmony_ci
5662306a36Sopenharmony_cidev_search_path option can also contain %SESSNAME% in order to provide
5762306a36Sopenharmony_cidifferent device namespaces for different sessions.  See "device_path"
5862306a36Sopenharmony_cioption for details.
5962306a36Sopenharmony_ci
6062306a36Sopenharmony_ci============================
6162306a36Sopenharmony_ciProtocol (rnbd/rnbd-proto.h)
6262306a36Sopenharmony_ci============================
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci1. Before mapping first device from a given server, client sends an
6562306a36Sopenharmony_ciRNBD_MSG_SESS_INFO to the server. Server responds with
6662306a36Sopenharmony_ciRNBD_MSG_SESS_INFO_RSP. Currently the messages only contain the protocol
6762306a36Sopenharmony_civersion for backward compatibility.
6862306a36Sopenharmony_ci
6962306a36Sopenharmony_ci2. Client requests to open a device by sending RNBD_MSG_OPEN message. This
7062306a36Sopenharmony_cicontains the path to the device and access mode (read-only or writable).
7162306a36Sopenharmony_ciServer responds to the message with RNBD_MSG_OPEN_RSP. This contains
7262306a36Sopenharmony_cia 32 bit device id to be used for  IOs and device "geometry" related
7362306a36Sopenharmony_ciinformation: side, max_hw_sectors, etc.
7462306a36Sopenharmony_ci
7562306a36Sopenharmony_ci3. Client attaches RNBD_MSG_IO to each IO message send to a device. This
7662306a36Sopenharmony_cimessage contains device id, provided by server in his rnbd_msg_open_rsp,
7762306a36Sopenharmony_cisector to be accessed, read-write flags and bi_size.
7862306a36Sopenharmony_ci
7962306a36Sopenharmony_ci4. Client closes a device by sending RNBD_MSG_CLOSE which contains only the
8062306a36Sopenharmony_cidevice id provided by the server.
8162306a36Sopenharmony_ci
8262306a36Sopenharmony_ci=========================================
8362306a36Sopenharmony_ciContributors List(in alphabetical order)
8462306a36Sopenharmony_ci=========================================
8562306a36Sopenharmony_ciDanil Kipnis <danil.kipnis@profitbricks.com>
8662306a36Sopenharmony_ciFabian Holler <mail@fholler.de>
8762306a36Sopenharmony_ciGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
8862306a36Sopenharmony_ciJack Wang <jinpu.wang@profitbricks.com>
8962306a36Sopenharmony_ciKleber Souza <kleber.souza@profitbricks.com>
9062306a36Sopenharmony_ciLutz Pogrell <lutz.pogrell@cloud.ionos.com>
9162306a36Sopenharmony_ciMilind Dumbare <Milind.dumbare@gmail.com>
9262306a36Sopenharmony_ciRoman Penyaev <roman.penyaev@profitbricks.com>
9362306a36Sopenharmony_ciSwapnil Ingle <ingleswapnil@gmail.com>
94