git: 7ef7b252adc0 - main - ctld: Always declare MaxRecvDataSegmentLength.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 26 Oct 2021 21:55:53 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=7ef7b252adc0152e5f726d00640124c5de0909a9

commit 7ef7b252adc0152e5f726d00640124c5de0909a9
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2021-10-26 21:52:40 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2021-10-26 21:52:40 +0000

    ctld: Always declare MaxRecvDataSegmentLength.
    
    This key is Declarative and should always be sent even if the
    initiator did not send it's own limit.  This is similar to the fix in
    fc79cf4fea72 but for the target side.  However, unlike that fix,
    failure to send the key simply results in reduced performance.
    
    PR:             259439
    Reviewed by:    mav, emaste
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D32651
---
 usr.sbin/ctld/login.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/usr.sbin/ctld/login.c b/usr.sbin/ctld/login.c
index f219a3044586..63b2cfd51d92 100644
--- a/usr.sbin/ctld/login.c
+++ b/usr.sbin/ctld/login.c
@@ -565,10 +565,6 @@ login_negotiate_key(struct pdu *request, const char *name,
 			tmp = conn->conn_max_send_data_segment_limit;
 		}
 		conn->conn_max_send_data_segment_length = tmp;
-		conn->conn_max_recv_data_segment_length =
-		    conn->conn_max_recv_data_segment_limit;
-		keys_add_int(response_keys, name,
-		    conn->conn_max_recv_data_segment_length);
 	} else if (strcmp(name, "MaxBurstLength") == 0) {
 		tmp = strtoul(value, NULL, 10);
 		if (tmp <= 0) {
@@ -796,6 +792,11 @@ login_negotiate(struct connection *conn, struct pdu *request)
 		log_errx(1, "initiator sent FirstBurstLength > MaxBurstLength");
 	}
 
+	conn->conn_max_recv_data_segment_length =
+	    conn->conn_max_recv_data_segment_limit;
+	keys_add_int(response_keys, "MaxRecvDataSegmentLength",
+		    conn->conn_max_recv_data_segment_length);
+
 	log_debugx("operational parameter negotiation done; "
 	    "transitioning to Full Feature Phase");