Skip to contentSkip to conversation

tcm_fc: Convert to use pre-allocated struct se_cmd descriptors

PATCH New Nicholas A. Bellinger 1 participant 1 message Sep 10, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 4/4 tcm_fc: Convert to use pre-allocated struct se_cmd descriptors

From: Nicholas Bellinger <[email protected]>

This patch converts the Open-FCoE.org / TCM_FC fabric module to use pre-allocated struct se_cmd descriptors and sense data buffer located at struct ft_cmd->se_cmd and struct ft_cmd->ft_sense_buffer respectively.

This includes updating ft_send_cmd() to use transport_init_se_cmd() for the main FCoE CDB RX side entry point. It also includes the conversion of a number of functions to use container_of() instead of struct se_cmd->se_fabric_cmd_ptr to locate the struct ft_cmd, and the addition of the assignment operator when accessing struct ft_cmd->se_cmd within per I/O context operation.

---
 drivers/target/tcm_fc/tcm_fc.h  |    3 +-
 drivers/target/tcm_fc/tfc_cmd.c |   59 ++++++++++++++++++--------------------
 drivers/target/tcm_fc/tfc_io.c  |    4 +-
 3 files changed, 32 insertions(+), 34 deletions(-)
drivers/target/tcm_fc/tcm_fc.h +2 -1
index 8d59800..210c33e 100644
@@ -147,11 +147,12 @@ struct ft_cmd {
 	u16 lun;			/* LUN from request */
 	struct ft_sess *sess;		/* session held for cmd */
 	struct fc_seq *seq;		/* sequence in exchange mgr */
-	struct se_cmd *se_cmd;
+	struct se_cmd se_cmd;		/* Local TCM I/O descriptor */
 	struct fc_frame *req_frame;
 	unsigned char *cdb;		/* pointer to CDB inside frame */
 	u32 write_data_len;		/* data received on writes */
 	struct se_queue_req se_req;
+	unsigned char ft_sense_buffer[TRANSPORT_SENSE_BUFFER]; /* Local sense buffer */
 };
 
 extern struct list_head ft_lport_list;
drivers/target/tcm_fc/tfc_cmd.c +28 -31

155 lines not on this page · raw message

drivers/target/tcm_fc/tfc_io.c +2 -2
index f473782..2080891 100644
@@ -64,7 +64,7 @@
  */
 int ft_queue_data_in(struct se_cmd *se_cmd)
 {
-	struct ft_cmd *cmd = se_cmd->se_fabric_cmd_ptr;
+	struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd);
 	struct se_transport_task *task;
 	struct fc_frame *fp = NULL;
 	struct fc_exch *ep;
@@ -187,7 +187,7 @@ int ft_queue_data_in(struct se_cmd *se_cmd)
  */
 void ft_recv_write_data(struct ft_cmd *cmd, struct fc_frame *fp)
 {
-	struct se_cmd *se_cmd = cmd->se_cmd;
+	struct se_cmd *se_cmd = &cmd->se_cmd;
 	struct se_transport_task *task;
 	struct fc_frame_header *fh;
 	struct se_mem *mem;
Signature · 1 line
1.5.6.5