Skip to content

Commit 50abcc1

Browse files
Hannes Reineckekeithbusch
authored andcommitted
nvme-tcp: strict pdu pacing to avoid send stalls on TLS
TLS requires a strict pdu pacing via MSG_EOR to signal the end of a record and subsequent encryption. If we do not set MSG_EOR at the end of a sequence the record won't be closed, encryption doesn't start, and we end up with a send stall as the message will never be passed on to the TCP layer. So do not check for the queue status when TLS is enabled but rather make the MSG_MORE setting dependent on the current request only. Signed-off-by: Hannes Reinecke <hare@kernel.org> Reviewed-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Keith Busch <kbusch@kernel.org>
1 parent 5053639 commit 50abcc1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

drivers/nvme/host/tcp.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,12 +360,18 @@ static inline void nvme_tcp_send_all(struct nvme_tcp_queue *queue)
360360
} while (ret > 0);
361361
}
362362

363-
static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue)
363+
static inline bool nvme_tcp_queue_has_pending(struct nvme_tcp_queue *queue)
364364
{
365365
return !list_empty(&queue->send_list) ||
366366
!llist_empty(&queue->req_list);
367367
}
368368

369+
static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue)
370+
{
371+
return !nvme_tcp_tls(&queue->ctrl->ctrl) &&
372+
nvme_tcp_queue_has_pending(queue);
373+
}
374+
369375
static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req,
370376
bool sync, bool last)
371377
{
@@ -386,7 +392,7 @@ static inline void nvme_tcp_queue_request(struct nvme_tcp_request *req,
386392
mutex_unlock(&queue->send_mutex);
387393
}
388394

389-
if (last && nvme_tcp_queue_more(queue))
395+
if (last && nvme_tcp_queue_has_pending(queue))
390396
queue_work_on(queue->io_cpu, nvme_tcp_wq, &queue->io_work);
391397
}
392398

0 commit comments

Comments
 (0)