[PATCH 4/6] qla2xxx/tcm_qla2xxx: Merge ATIO structs within qla_tgt_cmd struct union in qla_target.h.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Madhuranath Iyengar <mni@xxxxxxxxxxxxxxx>

Signed-off-by: Madhuranath Iyengar <mni@xxxxxxxxxxxxxxx>
---
 drivers/scsi/qla2xxx/qla_target.c               |   30 ++++++++++------------
 drivers/scsi/qla2xxx/qla_target.h               |    5 +---
 drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c |    4 +-
 3 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index 92f24d2..b7c334a 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -1834,6 +1834,7 @@ static void qla_tgt_2xxx_build_ctio_pkt(struct qla_tgt_prm *prm, struct scsi_qla
 {
 	uint32_t h;
 	ctio_to_2xxx_entry_t *pkt;
+	atio_from_2xxx_entry_t *atio2x = (atio_from_2xxx_entry_t *)&prm->cmd->atio;
 	struct qla_hw_data *ha = vha->hw;
 
 	pkt = (ctio_to_2xxx_entry_t *)vha->req->ring_ptr;
@@ -1855,16 +1856,16 @@ static void qla_tgt_2xxx_build_ctio_pkt(struct qla_tgt_prm *prm, struct scsi_qla
 	pkt->timeout = __constant_cpu_to_le16(QLA_TGT_TIMEOUT);
 
 	/* Set initiator ID */
-	h = GET_TARGET_ID(ha, &prm->cmd->atio.atio2x);
+	h = GET_TARGET_ID(ha, atio2x);
 	SET_TARGET_ID(ha, pkt->target, h);
 
-	pkt->rx_id = prm->cmd->atio.atio2x.rx_id;
+	pkt->rx_id = atio2x->rx_id;
 	pkt->relative_offset = cpu_to_le32(prm->cmd->offset);
 
 	ql_dbg(ql_dbg_tgt_pkt, vha, 0xe202, "qla_target(%d): handle(se_cmd) -> %08x, "
 		"timeout %d L %#x -> I %#x E %#x\n", vha->vp_idx,
 		pkt->handle, QLA_TGT_TIMEOUT,
-		le16_to_cpu(prm->cmd->atio.atio2x.lun),
+		le16_to_cpu(atio2x->lun),
 		GET_TARGET_ID(ha, pkt), pkt->rx_id);
 }
 
@@ -1874,7 +1875,7 @@ static int qla_tgt_24xx_build_ctio_pkt(struct qla_tgt_prm *prm, struct scsi_qla_
 	uint32_t h;
 	ctio7_to_24xx_entry_t *pkt;
 	struct qla_hw_data *ha = vha->hw;
-	atio7_from_24xx_entry_t *atio = &prm->cmd->atio.atio7;
+	atio7_from_24xx_entry_t *atio = (atio7_from_24xx_entry_t *)&prm->cmd->atio;
 
 	pkt = (ctio7_to_24xx_entry_t *)vha->req->ring_ptr;
 	prm->pkt = pkt;
@@ -2083,7 +2084,7 @@ static int qla_tgt_pre_xmit_response(struct qla_tgt_cmd *cmd, struct qla_tgt_prm
 
 		cmd->state = QLA_TGT_STATE_ABORTED;
 
-		qla_tgt_send_term_exchange(vha, cmd, (void *)&cmd->atio.atio7,
+		qla_tgt_send_term_exchange(vha, cmd, (void *)&cmd->atio,
 			unlocked_term);
 
 		/* !! At this point cmd could be already freed !! */
@@ -2831,10 +2832,8 @@ static int qla_tgt_term_ctio_exchange(struct scsi_qla_host *vha, void *ctio,
 				__constant_cpu_to_le16(OF_TERM_EXCH));
 		} else
 			term = 1;
-		if (term) {
-			qla_tgt_send_term_exchange(vha, cmd,
-				(void *)&cmd->atio.atio7, 1);
-		}
+		if (term)
+			qla_tgt_send_term_exchange(vha, cmd, (void *)&cmd->atio, 1);
 	} else {
 		if (status != CTIO_SUCCESS)
 			qla_tgt_2xxx_send_modify_lun(vha, 1, 0);
@@ -3091,7 +3090,7 @@ static inline int qla_tgt_get_fcp_task_attr(uint8_t task_codes)
 /* This functions sends the ISP 2xxx command to the tcm_qla2xxx target */
 static int qla_tgt_2xxx_send_cmd_to_tcm(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd)
 {
-	atio_from_2xxx_entry_t *atio = &cmd->atio.atio2x;
+	atio_from_2xxx_entry_t *atio = (atio_from_2xxx_entry_t *)&cmd->atio;
 	uint32_t data_length;
 	int fcp_task_attr, data_dir, bidi = 0, ret;
 	uint16_t lun, unpacked_lun;
@@ -3129,7 +3128,7 @@ static int qla_tgt_2xxx_send_cmd_to_tcm(struct scsi_qla_host *vha, struct qla_tg
 /* This function sends the ISP 24xx command to the tcm_qla2xxx target */
 static int qla_tgt_24xx_send_cmd_to_tcm(struct scsi_qla_host *vha, struct qla_tgt_cmd *cmd)
 {
-	atio7_from_24xx_entry_t *atio = &cmd->atio.atio7;
+	atio7_from_24xx_entry_t *atio = (atio7_from_24xx_entry_t *)&cmd->atio;
 	uint32_t unpacked_lun, data_length;
 	int fcp_task_attr, data_dir, bidi = 0, ret;
 
@@ -3200,7 +3199,7 @@ static int qla_tgt_handle_cmd_for_atio(struct scsi_qla_host *vha, atio_t *atio)
 	init_completion(&cmd->cmd_free_comp);
 	init_completion(&cmd->cmd_stop_free_comp);
 
-	memcpy(&cmd->atio.atio2x, atio, sizeof(*atio));
+	memcpy(&cmd->atio, atio, sizeof(*atio));
 	cmd->state = QLA_TGT_STATE_NEW;
 	cmd->locked_rsp = 1;
 	cmd->tgt = ha->qla_tgt;
@@ -3616,14 +3615,13 @@ static void qla_tgt_handle_srr(struct scsi_qla_host *vha, struct qla_tgt_srr_cti
 	uint32_t offset;
 	uint16_t srr_ui;
 
+	atio = (void *)&cmd->atio;
 	if (IS_FWI2_CAPABLE(ha)) {
 		ntfy = (void *)ntfy24;
-		atio = (void *)&cmd->atio.atio7;
 		offset = le32_to_cpu(ntfy24->srr_rel_offs);
 		srr_ui = ntfy24->srr_ui;
 	} else {
 		ntfy = (void *)ntfy2x;
-		atio = (void *)&cmd->atio.atio2x;
 		offset = le32_to_cpu(ntfy2x->srr_rel_offs);
 		srr_ui = ntfy2x->srr_ui;
 	}
@@ -3894,7 +3892,7 @@ static void qla_tgt_prepare_srr_imm(struct scsi_qla_host *vha, void *iocb)
 					"(id %d)\n", sctio, sctio->srr_id);
 				list_del(&sctio->srr_list_entry);
 				qla_tgt_send_term_exchange(vha, sctio->cmd,
-					(void *)&sctio->cmd->atio.atio2x, 1);
+					(void *)&sctio->cmd->atio, 1);
 				kfree(sctio);
 			}
 		}
@@ -4777,7 +4775,7 @@ out_term:
 		 * cmd has not sent to target yet, so pass NULL as the second
 		 * argument
 		 */
-		qla_tgt_send_term_exchange(vha, NULL, (void *)&cmd->atio.atio2x, 1);
+		qla_tgt_send_term_exchange(vha, NULL, (void *)&cmd->atio, 1);
 	}
 	case QLA_TGT_SESS_WORK_ABORT:
 		if (IS_FWI2_CAPABLE(ha))
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h
index 4835464..8f69903 100644
--- a/drivers/scsi/qla2xxx/qla_target.h
+++ b/drivers/scsi/qla2xxx/qla_target.h
@@ -956,10 +956,7 @@ struct qla_tgt_cmd {
 	struct scsi_qla_host *vha;
 	struct list_head cmd_list;
 
-	union {
-		atio7_from_24xx_entry_t atio7;
-		atio_from_2xxx_entry_t atio2x;
-	} __attribute__((packed)) atio;
+	atio_t atio;
 };
 
 struct qla_tgt_sess_work_param {
diff --git a/drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c b/drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c
index e05cf90..28b62dd 100644
--- a/drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c
+++ b/drivers/target/tcm_qla2xxx/tcm_qla2xxx_fabric.c
@@ -748,10 +748,10 @@ int tcm_qla2xxx_new_cmd_map(struct se_cmd *se_cmd)
 	int ret;
 
 	if (IS_FWI2_CAPABLE(ha)) {
-		atio7_from_24xx_entry_t *atio = &cmd->atio.atio7;
+		atio7_from_24xx_entry_t *atio = (atio7_from_24xx_entry_t *)&cmd->atio;
 		cdb = &atio->fcp_cmnd.cdb[0];
 	} else {
-		atio_from_2xxx_entry_t *atio = &cmd->atio.atio2x;
+		atio_from_2xxx_entry_t *atio = (atio_from_2xxx_entry_t *)&cmd->atio;
 		cdb = &atio->cdb[0];
 	}
 
-- 
1.7.7

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux