Chapter 10. Configuring NVMe over fabrics using NVMe/RDMA
			Configure NVMe over RDMA setup including NVMe controller and initiator configuration. You can set up RDMA controllers by using configfs and nvmetcli, and configure RDMA hosts for high-speed storage access.
		
10.1. Setting up an NVMe/RDMA controller using configfs
				You can configure a Non-volatile Memory Express™ (NVMe™) over RDMA (NVMe™/RDMA) controller by using configfs. For more information, see the nvme(1) man page on your system.
			
Prerequisites
- 
						Verify that you have a block device to assign to the nvmetsubsystem.
Procedure
- Create the - nvmet-rdmasubsystem:- modprobe nvmet-rdma mkdir /sys/kernel/config/nvmet/subsystems/testnqn cd /sys/kernel/config/nvmet/subsystems/testnqn - # modprobe nvmet-rdma # mkdir /sys/kernel/config/nvmet/subsystems/testnqn # cd /sys/kernel/config/nvmet/subsystems/testnqn- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Replace testnqn with the subsystem name. 
- Allow any host to connect to this controller: - echo 1 > attr_allow_any_host - # echo 1 > attr_allow_any_host- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Configure a namespace: - mkdir namespaces/10 cd namespaces/10 - # mkdir namespaces/10 # cd namespaces/10- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Replace 10 with the namespace number 
- Set a path to the NVMe device: - echo -n /dev/nvme0n1 > device_path - # echo -n /dev/nvme0n1 > device_path- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Enable the namespace: - echo 1 > enable - # echo 1 > enable- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Create a directory with an NVMe port: - mkdir /sys/kernel/config/nvmet/ports/1 cd /sys/kernel/config/nvmet/ports/1 - # mkdir /sys/kernel/config/nvmet/ports/1 # cd /sys/kernel/config/nvmet/ports/1- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Display the IP address of mlx5_ib0: - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Set the transport address for the controller: - echo -n 172.31.0.202 > addr_traddr - # echo -n 172.31.0.202 > addr_traddr- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Set RDMA as the transport type: - echo rdma > addr_trtype echo 4420 > addr_trsvcid - # echo rdma > addr_trtype # echo 4420 > addr_trsvcid- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Set the address family for the port: - echo ipv4 > addr_adrfam - # echo ipv4 > addr_adrfam- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Create a soft link: - ln -s /sys/kernel/config/nvmet/subsystems/testnqn /sys/kernel/config/nvmet/ports/1/subsystems/testnqn - # ln -s /sys/kernel/config/nvmet/subsystems/testnqn /sys/kernel/config/nvmet/ports/1/subsystems/testnqn- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
Verification
- Verify that the NVMe controller is listening on the given port and ready for connection requests: - dmesg | grep "enabling port" - # dmesg | grep "enabling port" [ 1091.413648] nvmet_rdma: enabling port 1 (172.31.0.202:4420)- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
10.2. Setting up the NVMe™/RDMA controller using nvmetcli
				You can configure the Non-volatile Memory Express™ (NVMe™) over RDMA (NVMe™/RDMA) controller by using the nvmetcli utility. The nvmetcli utility provides a command line and an interactive shell option. For more information, see the nvmetcli and nvme(1) man pages on your system.
			
Prerequisites
- 
						Verify that you have a block device to assign to the nvmetsubsystem.
- 
						Run the following nvmetclioperations as a root user.
Procedure
- Install the - nvmetclipackage:- dnf install nvmetcli - # dnf install nvmetcli- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Download the - rdma.jsonfile:- wget http://git.infradead.org/users/hch/nvmetcli.git/blob_plain/0a6b088db2dc2e5de11e6f23f1e890e4b54fee64:/rdma.json - # wget http://git.infradead.org/users/hch/nvmetcli.git/blob_plain/0a6b088db2dc2e5de11e6f23f1e890e4b54fee64:/rdma.json- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- 
						Edit the rdma.jsonfile and change thetraddrvalue to172.31.0.202.
- Setup the controller by loading the NVMe controller configuration file: - nvmetcli restore rdma.json - # nvmetcli restore rdma.json- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow Note- If the NVMe controller configuration file name is not specified, the - nvmetcliuses the- /etc/nvmet/config.jsonfile.
Verification
- Verify that the NVMe controller is listening on the given port and ready for connection requests: - dmesg | tail -1 - # dmesg | tail -1 [ 4797.132647] nvmet_rdma: enabling port 2 (172.31.0.202:4420)- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Optional: Clear the current NVMe controller: - nvmetcli clear - # nvmetcli clear- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
10.3. Configuring an NVMe/RDMA host
				You can configure a Non-volatile Memory Express™ (NVMe™) over RDMA (NVMe™/RDMA) host by using the NVMe management command-line interface (nvme-cli) tool. For more information, see the nvme(1) man page on your system.
			
Procedure
- Install the - nvme-clitool:- dnf install nvme-cli - # dnf install nvme-cli- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Load the - nvme-rdmamodule if it is not loaded:- modprobe nvme-rdma - # modprobe nvme-rdma- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Discover available subsystems on the NVMe controller: - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Connect to the discovered subsystems: - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow - Replace testnqn with the NVMe subsystem name. - Replace 172.31.0.202 with the controller IP address. - Replace 4420 with the port number. 
Verification
- List the NVMe devices that are currently connected: - nvme list - # nvme list- Copy to Clipboard Copied! - Toggle word wrap Toggle overflow 
- Optional: Disconnect from the controller: - Copy to Clipboard Copied! - Toggle word wrap Toggle overflow