diff mbox

[v2,08/16] iscsi-target: add void (*iscsit_get_r2t_ttt)()

Message ID 2f71b7720d07231faa12ffba830681f1d7ac07da.1460204441.git.varun@chelsio.com (mailing list archive)
State Changes Requested, archived
Headers show

Commit Message

Varun Prakash April 9, 2016, 1:11 p.m. UTC
Add void (*iscsit_get_r2t_ttt)() to
struct iscsit_transport, iscsi-target
uses this callback to get
r2t->targ_xfer_tag.

Signed-off-by: Varun Prakash <varun@chelsio.com>
---
 drivers/target/iscsi/iscsi_target.c    | 5 ++++-
 include/target/iscsi/iscsi_transport.h | 2 ++
 2 files changed, 6 insertions(+), 1 deletion(-)

Comments

Sagi Grimberg April 10, 2016, 5:51 p.m. UTC | #1
> Add void (*iscsit_get_r2t_ttt)() to
> struct iscsit_transport, iscsi-target
> uses this callback to get
> r2t->targ_xfer_tag.

Your driver allocates ttt's? That looks like bad
layering to me. This definitely deserves an explanation...
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Varun Prakash April 11, 2016, 6:08 p.m. UTC | #2
On Sun, Apr 10, 2016 at 08:51:44PM +0300, Sagi Grimberg wrote:
> 
> >Add void (*iscsit_get_r2t_ttt)() to
> >struct iscsit_transport, iscsi-target
> >uses this callback to get
> >r2t->targ_xfer_tag.
> 
> Your driver allocates ttt's? That looks like bad
> layering to me. This definitely deserves an explanation...

cxgbit.ko allocates ttt only for r2t pdus to do Direct Data
Placement of Data Out pdus, adapter uses the ttt value in
Data Out pdus to place data directly in the host buffers.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sagi Grimberg April 13, 2016, 9:52 a.m. UTC | #3
>>> Add void (*iscsit_get_r2t_ttt)() to
>>> struct iscsit_transport, iscsi-target
>>> uses this callback to get
>>> r2t->targ_xfer_tag.
>>
>> Your driver allocates ttt's? That looks like bad
>> layering to me. This definitely deserves an explanation...
>
> cxgbit.ko allocates ttt only for r2t pdus to do Direct Data
> Placement of Data Out pdus, adapter uses the ttt value in
> Data Out pdus to place data directly in the host buffers.

How do you guarantee that the core doesn't conflict with
your internal ttt's?
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Varun Prakash April 13, 2016, 1:03 p.m. UTC | #4
On Wed, Apr 13, 2016 at 12:52:11PM +0300, Sagi Grimberg wrote:
> 
> >>>Add void (*iscsit_get_r2t_ttt)() to
> >>>struct iscsit_transport, iscsi-target
> >>>uses this callback to get
> >>>r2t->targ_xfer_tag.
> >>
> >>Your driver allocates ttt's? That looks like bad
> >>layering to me. This definitely deserves an explanation...
> >
> >cxgbit.ko allocates ttt only for r2t pdus to do Direct Data
> >Placement of Data Out pdus, adapter uses the ttt value in
> >Data Out pdus to place data directly in the host buffers.
> 
> How do you guarantee that the core doesn't conflict with
> your internal ttt's?

- iscsi-target does not make any decision based on  
  r2t->targ_xfer_tag.

- From iscsi RFC https://tools.ietf.org/html/rfc7143#section-11.8.5
  There is no protocol rule about the Target Transfer Tag
  except that the value 0xffffffff is reserved and MUST NOT
  be sent by a target in an R2T.

- T5 adapter checks ttt only for Data Out pdus, so even
  if it is same for other pdus it does not matter.
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 98d96d4..ec785c8 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -3060,7 +3060,10 @@  static int iscsit_send_r2t(
 	int_to_scsilun(cmd->se_cmd.orig_fe_lun,
 			(struct scsi_lun *)&hdr->lun);
 	hdr->itt		= cmd->init_task_tag;
-	r2t->targ_xfer_tag	= session_get_next_ttt(conn->sess);
+	if (conn->conn_transport->iscsit_get_r2t_ttt)
+		conn->conn_transport->iscsit_get_r2t_ttt(conn, cmd, r2t);
+	else
+		r2t->targ_xfer_tag = session_get_next_ttt(conn->sess);
 	hdr->ttt		= cpu_to_be32(r2t->targ_xfer_tag);
 	hdr->statsn		= cpu_to_be32(conn->stat_sn);
 	hdr->exp_cmdsn		= cpu_to_be32(conn->sess->exp_cmd_sn);
diff --git a/include/target/iscsi/iscsi_transport.h b/include/target/iscsi/iscsi_transport.h
index dbef892..f949e70 100644
--- a/include/target/iscsi/iscsi_transport.h
+++ b/include/target/iscsi/iscsi_transport.h
@@ -32,6 +32,8 @@  struct iscsit_transport {
 	void (*iscsit_release_cmd)(struct iscsi_conn *, struct iscsi_cmd *);
 	void (*iscsit_get_rx_pdu)(struct iscsi_conn *);
 	int (*iscsit_validate_params)(struct iscsi_conn *);
+	void (*iscsit_get_r2t_ttt)(struct iscsi_conn *, struct iscsi_cmd *,
+				   struct iscsi_r2t *);
 	enum target_prot_op (*iscsit_get_sup_prot_ops)(struct iscsi_conn *);
 };