[PATCHv4 01/13] nvmet: implement id ns for nvm command set

Matias Bjørling m at bjorling.me
Fri Nov 8 04:01:56 PST 2024


On 07-11-2024 20:38, Keith Busch wrote:
> From: Keith Busch <kbusch at kernel.org>
> 
> We don't report anything here, but it's a mandatory identification for
> nvme 2.1.
> 
> Reviewed-by: Chaitanya Kulkarni <kch at nvidia.com>
> Signed-off-by: Keith Busch <kbusch at kernel.org>
> ---
>   drivers/nvme/target/admin-cmd.c | 18 ++++++++++++++++--
>   1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/nvme/target/admin-cmd.c b/drivers/nvme/target/admin-cmd.c
> index 081f0473cd9ea..8d06dba42bcb3 100644
> --- a/drivers/nvme/target/admin-cmd.c
> +++ b/drivers/nvme/target/admin-cmd.c
> @@ -685,6 +685,20 @@ static void nvmet_execute_identify_ctrl_nvm(struct nvmet_req *req)
>   		   nvmet_zero_sgl(req, 0, sizeof(struct nvme_id_ctrl_nvm)));
>   }
>   
> +static void nvme_execute_identify_ns_nvm(struct nvmet_req *req)
> +{
> +	u16 status;
> +
> +	status = nvmet_req_find_ns(req);
> +	if (status)
> +		goto out;
> +
> +	status = nvmet_copy_to_sgl(req, 0, ZERO_PAGE(0),
> +				   NVME_IDENTIFY_DATA_SIZE);
> +out:
> +	nvmet_req_complete(req, status);
> +}
> +
>   static void nvmet_execute_identify(struct nvmet_req *req)
>   {
>   	if (!nvmet_check_transfer_len(req, NVME_IDENTIFY_DATA_SIZE))
> @@ -706,8 +720,8 @@ static void nvmet_execute_identify(struct nvmet_req *req)
>   	case NVME_ID_CNS_CS_NS:
>   		switch (req->cmd->identify.csi) {
>   		case NVME_CSI_NVM:
> -			/* Not supported */
> -			break;
> +			nvme_execute_identify_ns_nvm(req);
> +			return;
>   		case NVME_CSI_ZNS:
>   			if (IS_ENABLED(CONFIG_BLK_DEV_ZONED)) {
>   				nvmet_execute_identify_ns_zns(req);

Looks good.

Reviewed-by: Matias Bjørling <matias.bjorling at wdc.com>



More information about the Linux-nvme mailing list