git: 6df040ea6e4a - main - nvmf_tcp: Avoid setting some unused parameters in tcp_allocate_qpair

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 30 Jul 2024 14:29:19 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=6df040ea6e4a533d4010b810c8aa74a3c3979d9a

commit 6df040ea6e4a533d4010b810c8aa74a3c3979d9a
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-07-30 14:27:47 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-07-30 14:27:47 +0000

    nvmf_tcp: Avoid setting some unused parameters in tcp_allocate_qpair
    
    Specifically, some parameters only apply to either controller or host
    queue pairs but not both.
    
    Sponsored by:   Chelsio Communications
---
 sys/dev/nvmf/nvmf_tcp.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/dev/nvmf/nvmf_tcp.c b/sys/dev/nvmf/nvmf_tcp.c
index 6c84a40611c3..80c75e02c9b5 100644
--- a/sys/dev/nvmf/nvmf_tcp.c
+++ b/sys/dev/nvmf/nvmf_tcp.c
@@ -1450,12 +1450,13 @@ tcp_allocate_qpair(bool controller,
 	qp->header_digests = params->tcp.header_digests;
 	qp->data_digests = params->tcp.data_digests;
 	qp->maxr2t = params->tcp.maxr2t;
-	qp->maxh2cdata = params->tcp.maxh2cdata;
+	if (controller)
+		qp->maxh2cdata = params->tcp.maxh2cdata;
 	qp->max_tx_data = tcp_max_transmit_data;
 	if (!controller) {
 		qp->max_tx_data = min(qp->max_tx_data, params->tcp.maxh2cdata);
+		qp->max_icd = params->tcp.max_icd;
 	}
-	qp->max_icd = params->tcp.max_icd;
 
 	if (controller) {
 		/* Use the SUCCESS flag if SQ flow control is disabled. */