[PATCH 16/18] nvmet-tcp: rework sendpage for kTLS

Hannes Reinecke
2023-03-29T14:00:03Z

kTLS ->sendpage() doesn't support the MSG_EOR flag, so blank
it out if kTLS is enabled.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
drivers/nvme/target/tcp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
index ebec882120fd..5daf16138471 100644
--- a/drivers/nvme/target/tcp.c
+++ b/drivers/nvme/target/tcp.c
@@ -650,7 +650,7 @@ static int nvmet_try_send_response(struct nvmet_tcp_cmd *cmd,

if (!last_in_batch && cmd->queue->send_list_len)
flags |= MSG_MORE | MSG_SENDPAGE_NOTLAST;
- else
+ else if (!cmd->queue->tls_psk)
flags |= MSG_EOR;

ret = kernel_sendpage(cmd->queue->sock, virt_to_page(cmd->rsp_pdu),
@@ -678,7 +678,7 @@ static int nvmet_try_send_r2t(struct nvmet_tcp_cmd *cmd, bool last_in_batch)

if (!last_in_batch && cmd->queue->send_list_len)
flags |= MSG_MORE | MSG_SENDPAGE_NOTLAST;
- else
+ else if (!cmd->queue->tls_psk)
flags |= MSG_EOR;

ret = kernel_sendpage(cmd->queue->sock, virt_to_page(cmd->r2t_pdu),
@@ -708,7 +708,7 @@ static int nvmet_try_send_ddgst(struct nvmet_tcp_cmd *cmd, bool last_in_batch)

if (!last_in_batch && cmd->queue->send_list_len)
msg.msg_flags |= MSG_MORE;
- else
+ else if (!cmd->queue->tls_psk)
msg.msg_flags |= MSG_EOR;

ret = kernel_sendmsg(queue->sock, &msg, &iov, 1, iov.iov_len);
--
2.35.3