git: 9c7a4875bce9 - main - iscsi: Use ICL_NOCOPY for SCSI command immediate data and R2T.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Thu, 10 Mar 2022 23:51:25 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=9c7a4875bce9d0f8308f92a816abf36af8551914

commit 9c7a4875bce9d0f8308f92a816abf36af8551914
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-03-10 23:48:20 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-03-10 23:48:20 +0000

    iscsi: Use ICL_NOCOPY for SCSI command immediate data and R2T.
    
    The associated csio ccb will not be completed via xpt_done() until
    after the associated PDUs are transmitted to the other side and either
    the original PDU is acked with a SCSI response, or a response is
    received for a subsequent abort CCB (which means the earlier PDU has
    also been sent since it would have been sent before the abort PDU).
    
    This does assume that once an I/O request has been aborted, no further
    PDUs with data payload are queued for that I/O request.
    
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D34405
---
 sys/dev/iscsi/iscsi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c
index c97bfaf0e6c5..7ac600efdddc 100644
--- a/sys/dev/iscsi/iscsi.c
+++ b/sys/dev/iscsi/iscsi.c
@@ -1309,7 +1309,7 @@ iscsi_pdu_handle_r2t(struct icl_pdu *response)
 		bhsdo->bhsdo_datasn = htonl(datasn);
 		bhsdo->bhsdo_buffer_offset = htonl(off);
 		error = icl_pdu_append_data(request, csio->data_ptr + off, len,
-		    M_NOWAIT);
+		    M_NOWAIT | ICL_NOCOPY);
 		if (error != 0) {
 			ISCSI_SESSION_WARN(is, "failed to allocate memory; "
 			    "reconnecting");
@@ -2427,7 +2427,8 @@ iscsi_action_scsiio(struct iscsi_session *is, union ccb *ccb)
 			len = is->is_conn->ic_max_send_data_segment_length;
 		}
 
-		error = icl_pdu_append_data(request, csio->data_ptr, len, M_NOWAIT);
+		error = icl_pdu_append_data(request, csio->data_ptr, len,
+		    M_NOWAIT | ICL_NOCOPY);
 		if (error != 0) {
 			iscsi_outstanding_remove(is, io);
 			icl_pdu_free(request);