Skip to content

Commit 7058329

Browse files
sagigrimbergChristoph Hellwig
authored andcommitted
nvmet-tcp: implement C2HData SUCCESS optimization
TP 8000 says that the use of the SUCCESS flag depends on weather the controller support disabling sq_head pointer updates. Given that we support it by default, makes sense that we go the extra mile to actually use the SUCCESS flag. When we create the C2HData PDU header, we check if sqhd_disabled is set on our queue, if so, we set the SUCCESS flag in the PDU header and skip sending a completion response capsule. Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Reviewed-by: Oliver Smith-Denny <osmithde@cisco.com> Tested-by: Oliver Smith-Denny <osmithde@cisco.com> Signed-off-by: Christoph Hellwig <hch@lst.de>
1 parent 6b80f1d commit 7058329

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

drivers/nvme/target/tcp.c

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,8 @@ static void nvmet_setup_c2h_data_pdu(struct nvmet_tcp_cmd *cmd)
371371
cmd->state = NVMET_TCP_SEND_DATA_PDU;
372372

373373
pdu->hdr.type = nvme_tcp_c2h_data;
374-
pdu->hdr.flags = NVME_TCP_F_DATA_LAST;
374+
pdu->hdr.flags = NVME_TCP_F_DATA_LAST | (queue->nvme_sq.sqhd_disabled ?
375+
NVME_TCP_F_DATA_SUCCESS : 0);
375376
pdu->hdr.hlen = sizeof(*pdu);
376377
pdu->hdr.pdo = pdu->hdr.hlen + hdgst;
377378
pdu->hdr.plen =
@@ -542,8 +543,19 @@ static int nvmet_try_send_data(struct nvmet_tcp_cmd *cmd)
542543
cmd->state = NVMET_TCP_SEND_DDGST;
543544
cmd->offset = 0;
544545
} else {
545-
nvmet_setup_response_pdu(cmd);
546+
if (queue->nvme_sq.sqhd_disabled) {
547+
cmd->queue->snd_cmd = NULL;
548+
nvmet_tcp_put_cmd(cmd);
549+
} else {
550+
nvmet_setup_response_pdu(cmd);
551+
}
546552
}
553+
554+
if (queue->nvme_sq.sqhd_disabled) {
555+
kfree(cmd->iov);
556+
sgl_free(cmd->req.sg);
557+
}
558+
547559
return 1;
548560

549561
}
@@ -619,7 +631,13 @@ static int nvmet_try_send_ddgst(struct nvmet_tcp_cmd *cmd)
619631
return ret;
620632

621633
cmd->offset += ret;
622-
nvmet_setup_response_pdu(cmd);
634+
635+
if (queue->nvme_sq.sqhd_disabled) {
636+
cmd->queue->snd_cmd = NULL;
637+
nvmet_tcp_put_cmd(cmd);
638+
} else {
639+
nvmet_setup_response_pdu(cmd);
640+
}
623641
return 1;
624642
}
625643

0 commit comments

Comments
 (0)