nvm_cmd - Raw Commands

nvm_cmd

struct nvm_cmd

Encapsulation of lowest-level user and admin commands.

Public Members

uint8_t opcode
uint8_t flags
uint16_t control
uint16_t nppas
uint16_t rsvd
uint64_t metadata
uint64_t addr
uint64_t ppa_list
uint32_t metadata_len
uint32_t data_len
uint64_t status
uint32_t result
uint32_t nvm_cmd::rsvd3[3]
struct nvm_cmd::@0::@2 vuser

Common fields for vector user commands.

uint8_t nvm_cmd::rsvd[2]
uint32_t nsid
uint32_t cdw2
uint32_t cdw3
uint32_t cdw13
uint32_t cdw14
uint32_t cdw15
uint32_t timeout_ms
struct nvm_cmd::@0::@3 vadmin

Common fields for vector admin commands.

uint16_t rsvd1
uint32_t cdw10
uint32_t cdw11
uint32_t cdw12
struct nvm_cmd::@0::@4 admin

Common fields for admin commands.

uint16_t nblocks
uint64_t slba
uint32_t dsmgmt
uint32_t reftag
uint16_t apptag
uint16_t appmask
struct nvm_cmd::@0::@5 user

Common fields for user commands.

uint32_t nvm_cmd::cdw[20]

Command as array of dwords.

union nvm_cmd::@0 nvm_cmd::@1

nvm_cmd_vadmin

int nvm_cmd_vadmin(struct nvm_dev * dev, struct nvm_cmd * cmd, struct nvm_ret * ret)

Execute a vector admin command on the given device.

Return
On success, 0 is returned. On error, -1 is returned, errno set to indicate the error and ret filled with lower-level result codes
Parameters
  • dev: Device handle obtained with nvm_dev_open
  • cmd: The command to execute
  • ret: Pointer to struct to fill with lower-level result-codes

nvm_cmd_vuser

int nvm_cmd_vuser(struct nvm_dev * dev, struct nvm_cmd * cmd, struct nvm_ret * ret)

Execute a vector user command on the given device.

Return
On success, 0 is returned. On error, -1 is returned, errno set to indicate the error and ret filled with lower-level result codes
Parameters
  • dev: Device handle obtained with nvm_dev_open
  • cmd: The command to execute
  • ret: Pointer to struct to fill with lower-level result-codes

nvm_cmd_admin

int nvm_cmd_admin(struct nvm_dev * dev, struct nvm_cmd * cmd, struct nvm_ret * ret)

Execute an admin command on the given device.

Return
On success, 0 is returned. On error, -1 is returned, errno set to indicate the error and ret filled with lower-level result codes
Parameters
  • dev: Device handle obtained with nvm_dev_open
  • cmd: The command to execute
  • ret: Pointer to struct to fill with lower-level result-codes

nvm_cmd_user

int nvm_cmd_user(struct nvm_dev * dev, struct nvm_cmd * cmd, struct nvm_ret * ret)

Execute an user command on the given device.

Return
On success, 0 is returned. On error, -1 is returned, errno set to indicate the error and ret filled with lower-level result codes
Parameters
  • dev: Device handle obtained with nvm_dev_open
  • cmd: The command to execute
  • ret: Pointer to struct to fill with lower-level result-codes

nvm_cmd_pr

void nvm_cmd_pr(struct nvm_cmd * cmd)

Prints a text-representation of the given command.

Parameters
  • cmd: The command to print

nvm_cmd_vuser_pr

void nvm_cmd_vuser_pr(struct nvm_cmd * cmd)

Prints a textual presentation of the vuser par of the given command.

Parameters
  • cmd: The command to print