An example to send nvme_cmd rpc request: scripts/rpc.py send_nvme_cmd -n Nvme0 -t admin -r c2h \ -c <base64_urlsafe encoded cmdbuf> -D 4096 nvme-rpc will be processed internally by bdev_nvme. Change-Id: I6e731b76be0f503d48154a8b34a1e81b4b454396 Signed-off-by: Liu Xiaodong <xiaodong.liu@intel.com> Reviewed-on: https://review.gerrithub.io/417962 Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
40 lines
1.5 KiB
Python
40 lines
1.5 KiB
Python
|
|
|
|
def send_nvme_cmd(client, name, cmd_type, data_direction, cmdbuf,
|
|
data=None, metadata=None,
|
|
data_len=None, metadata_len=None,
|
|
timeout_ms=None):
|
|
"""Send one NVMe command
|
|
|
|
Args:
|
|
name: Name of the operating NVMe controller
|
|
cmd_type: Type of nvme cmd. Valid values are: admin, io
|
|
data_direction: Direction of data transfer. Valid values are: c2h, h2c
|
|
cmdbuf: NVMe command encoded by base64 urlsafe
|
|
data: Data transferring to controller from host, encoded by base64 urlsafe
|
|
metadata: metadata transferring to controller from host, encoded by base64 urlsafe
|
|
data_length: Data length required to transfer from controller to host
|
|
metadata_length: Metadata length required to transfer from controller to host
|
|
timeout-ms: Command execution timeout value, in milliseconds, if 0, don't track timeout
|
|
|
|
Returns:
|
|
NVMe completion queue entry, requested data and metadata, all are encoded by base64 urlsafe.
|
|
"""
|
|
params = {'name': name,
|
|
'cmd_type': cmd_type,
|
|
'data_direction': data_direction,
|
|
'cmdbuf': cmdbuf}
|
|
|
|
if data:
|
|
params['data'] = data
|
|
if metadata:
|
|
params['metadata'] = metadata
|
|
if data_len:
|
|
params['data_len'] = data_len
|
|
if metadata_len:
|
|
params['metadata_len'] = metadata_len
|
|
if timeout_ms:
|
|
params['timeout_ms'] = timeout_ms
|
|
|
|
return client.call('send_nvme_cmd', params)
|