I am new to SPDK driver and trying to understand the various API’s available to do I/O on NVMe local device and using NVMeoF protocol on a target device.

I see different interfaces for the read and write I/O operations.

It seems there are two types of interfaces available.

1. spdk_nvme_ns_cmd_read() and spdk_nvme_ns_cmd_write() and related function. This is used for PCIe devices. It seems to apply to devices attached locally.

2. spdk_bdev_read_blocks() and spdk_bdev_write_blocks() and related API’s in lib/bdev.

I have been looking at the code and trying to understand how this API and related APIs for the module has been used, the API’s in 2. are used for blobfs I/O operation spdk/lib/blob/bdev/*, when there is a blob filesystem and for I/O operation on NVMe devices using NVMeoF protocol spdk/lib/nvmf/*.

Is this a correct assumption? Is the lib/bdev layer developed to address only these cases?

Can the lib/bdev API be used on a local NVMe device? If so, is there a test program to understand how to create a bdev device and do the I/O on NVMe SSD block device?

Please let me know if there is an example to understand how to use the lib/nvmf interfaces. I want to test a device on remote target using NVMeoF protocol.

 

Thanks very much for any help in the lib/bdev API.