《NVM-Express-1_4-2019.06.10-Ratified》学习笔记(6.10-6.13)-- Reservation Acquire/Register/Release/Report命令

6.10 Reservation Acquire command 【预订获得命令】

Reservation Acquire命令用于在一个namespace上获得预订,抢占一个namespace的持有权,或终止一个namespace的预订持有权。

此命令使用Command Dword 10 和内存中的Reservation Acquire数据结构。如果为了传输数据命令使用PRPs,那么PRP Entry 1和PRP Entry 2字段被使用。如果为了传输数据命令使用SGLs,那么SGL Entry 1字段被使用,其他命令特定字段被保留。

【Reservation Acquire Command Dword 10,参考SPDK代码,定义如下】:

【Command Dword 10其中的rtype字段,表示请求的Reservation Type,对应的值请参考下表Figure 380】:

【Reservation Acquire命令跟随的16字节数据的数据结构如下】:

6.10.1 Command Completion

当命令被完成,controller应该发送一个CQE到对应的I/O CQ指明命令【处理结果】状态。

6.11 Reservation Register command【预订注册命令】

Reservation Register命令用于注册,注销,或重置reservation key【预订密钥】。

此命令使用Command Dword 10 和内存中的Reservation Register数据结构(参考Figure 383)。如果为了传输数据命令使用PRPs,那么PRP Entry 1和PRP Entry 2字段被使用。如果为了传输数据命令使用SGLs,那么SGL Entry 1字段被使用,其他命令特定字段被保留。

【Command Dword 10 对应的代码示例如下】:

【Reservation Register Data Structure对应的代码示例如下】:

6.11.1 Command Completion

当命令被完成,controller应该发送一个CQE到对应的I/O CQ指明命令【处理结果】状态。

6.12 Reservation Release command【预订释放命令】

Reservation Release命令用于释放或清除namespace上的一个预订持有权。

此命令使用Command Dword 10 和内存中的Reservation Release数据结构(参考Figure 383)。如果为了传输数据命令使用PRPs,那么PRP Entry 1和PRP Entry 2字段被使用。如果为了传输数据命令使用SGLs,那么SGL Entry 1字段被使用,其他命令特定字段被保留。

 

6.12.1 Command Completion

当命令被完成,controller应该发送一个CQE到对应的I/O CQ指明命令【处理结果】状态。

6.13 Reservation Report command【预订报告命令】

Reservation Report命令返回到内存一个描述namespace的注册和预订状态的Reservation Status数据结构。

Reservation Status数据结构的大小是函数关系计算出来的,函数参数是对应namespace的注册者主机相关联的NVM subsystem中的controller的数量(即:每个这样的controller有一个Registered Controller数据结构和/或Registered Controller扩展数据结构)。如果主机选择了64位Host Identifier,controller返回Figure 390那样的数据结构;如果主机选择了128位Host Identifier(参考第5.21.1.26章节),controller返回Figure 391那样的数据结构【NVMe over Fabrics只选这个】。

如果指定了64位Host Identifier,Command Dword 11中Extended Data Structure位设置为1,那么controller应该中止命令,返回错误码Host Identifier Inconsistent Format。如果指定了128位Host Identifier,Command Dword 11中Extended Data Structure位设置为0,那么controller应该中止命令,返回错误码Host Identifier Inconsistent Format。

此命令使用Command Dword 10和Command Dword 11。如果命令数据传输使用PRPs,那么PRP Entry 1和PRP Entry 2字段被使用。如果命令数据传输使用SGLs,那么SGL Entry 1字段被使用,所有其他命令特定字段被保留。

 【注意:对于NVMe over Fabrics,EDS必须填写1,也就是说Host Identifier使用的是128位的,Reservation Status Data Structure用的是Figure 391】

 

 

 

 

 

 

【此struct spdk_nvme_reservation_status_extended_data 结构体占用64字节】

 

【此struct spdk_nvme_reservation_status_data 结构体占用24字节】

6.13.1 Command Completion

当命令被完成,controller应该发送一个CQE到对应的I/O CQ指明命令【处理结果】状态。

原文地址:https://www.cnblogs.com/JamesLi/p/13278265.html