[PATCH 3/3] nvme-tcp: send quota for nvme_tcp_send_all()

Hannes Reinecke hare at suse.de
Wed May 18 23:26:17 PDT 2022


From: Daniel Wagner <dwagner at suse.de>

Add a send quota in nvme_tcp_send_all() to avoid stalls when sending
large amounts of requests.

Signed-off-by: Daniel Wagner <dwagner at suse.de>
Signed-off-by: Hannes Reinecke <hare at suse.de>
---
 drivers/nvme/host/tcp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 606565a4c708..87d760dfa3a9 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -308,11 +308,12 @@ static inline void nvme_tcp_advance_req(struct nvme_tcp_request *req,
 static inline void nvme_tcp_send_all(struct nvme_tcp_queue *queue)
 {
 	int ret;
+	unsigned long deadline = jiffies + msecs_to_jiffies(1);
 
 	/* drain the send queue as much as we can... */
 	do {
 		ret = nvme_tcp_try_send(queue);
-	} while (ret > 0);
+	} while (ret > 0 || !time_after(jiffies, deadline));
 }
 
 static inline bool nvme_tcp_queue_more(struct nvme_tcp_queue *queue)
-- 
2.29.2




More information about the Linux-nvme mailing list