ioccsz and iorcsz check failing

Daniel Wagner dwagner at suse.de
Mon Dec 18 05:57:01 PST 2023


On Mon, Dec 18, 2023 at 11:59:32AM +0200, Sagi Grimberg wrote:
> Is anything else in the identify wrong, or is it just these
> fabrics fields?

So what I am seeing on the wire are a few fabrics commands (connect, get
property) followed by the nvme id ctrl command (opcode 0x6).

 nvmet: nvmet_req_init:962
 nvmet: nvmet_parse_admin_cmd:1011
 nvmet: nvmet_parse_discovery_cmd:359 opcode 6

This calls then nvmet_execute_disc_identify, so adding

--- a/drivers/nvme/target/discovery.c
+++ b/drivers/nvme/target/discovery.c
@@ -249,6 +249,7 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req)
 {
        struct nvmet_ctrl *ctrl = req->sq->ctrl;
        struct nvme_id_ctrl *id;
+       u32 cmd_capsule_size;
        u16 status = 0;

        if (!nvmet_check_transfer_len(req, NVME_IDENTIFY_DATA_SIZE))
@@ -289,6 +290,17 @@ static void nvmet_execute_disc_identify(struct nvmet_req *req)
                id->sgls |= cpu_to_le32(1 << 2);
        if (req->port->inline_data_size)
                id->sgls |= cpu_to_le32(1 << 20);
+       /*
+        * Max command capsule size is sqe + in-capsule data size.
+        * Disable in-capsule data for Metadata capable controllers.
+        */
+       cmd_capsule_size = sizeof(struct nvme_command);
+       if (!ctrl->pi_support)
+               cmd_capsule_size += req->port->inline_data_size;
+       id->ioccsz = cpu_to_le32(cmd_capsule_size / 16);
+
+       /* Max response capsule size is cqe */
+       id->iorcsz = cpu_to_le32(sizeof(struct nvme_completion) / 16);

        id->oaes = cpu_to_le32(NVMET_DISC_AEN_CFG_OPTIONAL);


seems to do the trick for nvme-tcp and nvme-fc. Is this the right fix?



More information about the Linux-nvme mailing list