diff mbox series

[10/18] nvme-tcp: improve icreq/icresp logging

Message ID 20230816120608.37135-11-hare@suse.de (mailing list archive)
State Superseded
Headers show
Series nvme: In-kernel TLS support for TCP | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch, async

Commit Message

Hannes Reinecke Aug. 16, 2023, 12:06 p.m. UTC
When icreq/icresp fails we should be printing out a warning to
inform the user that the connection could not be established;
without it there won't be anything in the kernel message log,
just an error code returned to nvme-cli.

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

Comments

Sagi Grimberg Aug. 17, 2023, 10:44 a.m. UTC | #1
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Nitesh Shetty Aug. 18, 2023, 11:50 a.m. UTC | #2
On 23/08/16 02:06PM, Hannes Reinecke wrote:
>When icreq/icresp fails we should be printing out a warning to
>inform the user that the connection could not be established;
>without it there won't be anything in the kernel message log,
>just an error code returned to nvme-cli.
>
>Signed-off-by: Hannes Reinecke <hare@suse.de>
>---
> drivers/nvme/host/tcp.c | 10 ++++++++--
> 1 file changed, 8 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
>index e8e408dbb6ad..ef9cf8c7a113 100644
>--- a/drivers/nvme/host/tcp.c
>+++ b/drivers/nvme/host/tcp.c
>@@ -1403,8 +1403,11 @@ static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue)
> 	iov.iov_base = icreq;
> 	iov.iov_len = sizeof(*icreq);
> 	ret = kernel_sendmsg(queue->sock, &msg, &iov, 1, iov.iov_len);
>-	if (ret < 0)
>+	if (ret < 0) {
>+		pr_warn("queue %d: failed to send icreq, error %d\n",
>+			nvme_tcp_queue_id(queue), ret);
> 		goto free_icresp;
>+	}
>
> 	memset(&msg, 0, sizeof(msg));
> 	iov.iov_base = icresp;
>@@ -1415,8 +1418,11 @@ static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue)
> 	}
> 	ret = kernel_recvmsg(queue->sock, &msg, &iov, 1,
> 			iov.iov_len, msg.msg_flags);
>-	if (ret < 0)
>+	if (ret < 0) {
>+		pr_warn("queue %d: failed to receive icresp, error %d\n",
>+			nvme_tcp_queue_id(queue), ret);
> 		goto free_icresp;
>+	}
> 	if (queue->ctrl->ctrl.opts->tls) {
> 		ctype = tls_get_record_type(queue->sock->sk,
> 					    (struct cmsghdr *)cbuf);
>-- 
>2.35.3
>

Reviewed-by: Nitesh Shetty <nj.shetty@samsung.com>
diff mbox series

Patch

diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index e8e408dbb6ad..ef9cf8c7a113 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1403,8 +1403,11 @@  static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue)
 	iov.iov_base = icreq;
 	iov.iov_len = sizeof(*icreq);
 	ret = kernel_sendmsg(queue->sock, &msg, &iov, 1, iov.iov_len);
-	if (ret < 0)
+	if (ret < 0) {
+		pr_warn("queue %d: failed to send icreq, error %d\n",
+			nvme_tcp_queue_id(queue), ret);
 		goto free_icresp;
+	}
 
 	memset(&msg, 0, sizeof(msg));
 	iov.iov_base = icresp;
@@ -1415,8 +1418,11 @@  static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue)
 	}
 	ret = kernel_recvmsg(queue->sock, &msg, &iov, 1,
 			iov.iov_len, msg.msg_flags);
-	if (ret < 0)
+	if (ret < 0) {
+		pr_warn("queue %d: failed to receive icresp, error %d\n",
+			nvme_tcp_queue_id(queue), ret);
 		goto free_icresp;
+	}
 	if (queue->ctrl->ctrl.opts->tls) {
 		ctype = tls_get_record_type(queue->sock->sk,
 					    (struct cmsghdr *)cbuf);