git: 8903d8e37f14 - main - iscsi: Pass the request PDU to icl_conn_transfer_setup().

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Tue, 04 Jan 2022 22:38:49 UTC
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=8903d8e37f141ba12125d60a84b7c78d589e4867

commit 8903d8e37f141ba12125d60a84b7c78d589e4867
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-01-04 22:37:17 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-01-04 22:37:17 +0000

    iscsi: Pass the request PDU to icl_conn_transfer_setup().
    
    This matches icl_conn_task_setup() which passes the PDU and avoids the
    need for a layering violation in cxgbei to fetch the request PDU from
    the ctl_io.
    
    Reviewed by:    mav
    Sponsored by:   Chelsio Communications
    Differential Revision:  https://reviews.freebsd.org/D33746
---
 sys/cam/ctl/ctl_frontend_iscsi.c  | 4 ++--
 sys/dev/cxgbe/cxgbei/icl_cxgbei.c | 7 ++-----
 sys/dev/iscsi/icl_conn_if.m       | 1 +
 sys/dev/iscsi/icl_soft.c          | 4 ++--
 sys/dev/iscsi/icl_wrappers.h      | 6 +++---
 5 files changed, 10 insertions(+), 12 deletions(-)

diff --git a/sys/cam/ctl/ctl_frontend_iscsi.c b/sys/cam/ctl/ctl_frontend_iscsi.c
index 6b002566b465..6368a81fe66f 100644
--- a/sys/cam/ctl/ctl_frontend_iscsi.c
+++ b/sys/cam/ctl/ctl_frontend_iscsi.c
@@ -1083,8 +1083,8 @@ cfiscsi_data_wait_new(struct cfiscsi_session *cs, union ctl_io *io,
 		return (NULL);
 	}
 
-	error = icl_conn_transfer_setup(cs->cs_conn, io, target_transfer_tagp,
-	    &cdw->cdw_icl_prv);
+	error = icl_conn_transfer_setup(cs->cs_conn, PRIV_REQUEST(io), io,
+	    target_transfer_tagp, &cdw->cdw_icl_prv);
 	if (error != 0) {
 		CFISCSI_SESSION_WARN(cs,
 		    "icl_conn_transfer_setup() failed with error %d", error);
diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
index 9296488fd793..fbe0ce1ee5c4 100644
--- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
+++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c
@@ -1197,13 +1197,11 @@ ddp_sgl_check(struct ctl_sg_entry *sg, int entries, int xferlen)
 	return (true);
 }
 
-/* XXXNP: PDU should be passed in as parameter, like on the initiator. */
-#define io_to_request_pdu(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND].ptr)
 #define io_to_ddp_state(io) ((io)->io_hdr.ctl_private[CTL_PRIV_FRONTEND2].ptr)
 
 int
-icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io,
-    uint32_t *tttp, void **arg)
+icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, struct icl_pdu *ip,
+    union ctl_io *io, uint32_t *tttp, void **arg)
 {
 	struct icl_cxgbei_conn *icc = ic_to_icc(ic);
 	struct toepcb *toep = icc->toep;
@@ -1226,7 +1224,6 @@ icl_cxgbei_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io,
 
 	if (ctsio->ext_data_filled == 0) {
 		int first_burst;
-		struct icl_pdu *ip = io_to_request_pdu(io);
 #ifdef INVARIANTS
 		struct icl_cxgbei_pdu *icp = ip_to_icp(ip);
 
diff --git a/sys/dev/iscsi/icl_conn_if.m b/sys/dev/iscsi/icl_conn_if.m
index e46b8cdc20dc..24f805f46362 100644
--- a/sys/dev/iscsi/icl_conn_if.m
+++ b/sys/dev/iscsi/icl_conn_if.m
@@ -115,6 +115,7 @@ METHOD void task_done {
 
 METHOD int transfer_setup {
 	struct icl_conn *_ic;
+	struct icl_pdu *_ip;
 	union ctl_io *_io;
 	uint32_t *_transfer_tag;
 	void **_prvp;
diff --git a/sys/dev/iscsi/icl_soft.c b/sys/dev/iscsi/icl_soft.c
index 37f3911204c4..8547a70ea535 100644
--- a/sys/dev/iscsi/icl_soft.c
+++ b/sys/dev/iscsi/icl_soft.c
@@ -1463,8 +1463,8 @@ icl_soft_conn_task_done(struct icl_conn *ic, void *prv)
 }
 
 int
-icl_soft_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io,
-    uint32_t *transfer_tag, void **prvp)
+icl_soft_conn_transfer_setup(struct icl_conn *ic, struct icl_pdu *ip,
+    union ctl_io *io, uint32_t *transfer_tag, void **prvp)
 {
 
 	return (0);
diff --git a/sys/dev/iscsi/icl_wrappers.h b/sys/dev/iscsi/icl_wrappers.h
index cc37771c7dba..515410b40045 100644
--- a/sys/dev/iscsi/icl_wrappers.h
+++ b/sys/dev/iscsi/icl_wrappers.h
@@ -129,11 +129,11 @@ icl_conn_task_done(struct icl_conn *ic, void *prv)
 }
 
 static inline int
-icl_conn_transfer_setup(struct icl_conn *ic, union ctl_io *io,
-    uint32_t *transfer_tagp, void **prvp)
+icl_conn_transfer_setup(struct icl_conn *ic, struct icl_pdu *ip,
+    union ctl_io *io, uint32_t *transfer_tagp, void **prvp)
 {
 
-	return (ICL_CONN_TRANSFER_SETUP(ic, io, transfer_tagp, prvp));
+	return (ICL_CONN_TRANSFER_SETUP(ic, ip, io, transfer_tagp, prvp));
 }
 
 static inline void