[PATCH] qla2xxx: Fix-up merge ATIO IOCB related fallout

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

 



From: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>

This patch addresses two issues with commit cca76818ad71:

    qla2xxx/tcm_qla2xxx: Merge ATIO IOCB structs in qla_target.h.

The first is add entry_type and entry_count into atio_from_isp_t.u.raw
in order to bring atio_from_isp_t back it's proper 64-byte size as per
the original code.  This includes updating the handful of locations of
it's use in qla_target.c

The second is to re-introduce atio_t for qla_hw_data->atio_ring and
->atio_ring_ptr because qla_tgt_24xx_process_atio_queue() runs into problems
when not walking the ring list at ha->atio_ring_ptr directly.  The use
of atio_t is required as it's currently not possible to put atio_from_isp_t
directly into qla_def.h:struct qla_hw_data due to target structure
dependencies that would require including qla_target.h every location
that qla_def.h is currently included.

Allowing atio_from_isp_t to be included into qla_hw_data would be a worthwhile
cleanup, but this patch currently just re-instates existing atio_t in order
to address the ring walking issue within qla_tgt_24xx_process_atio_queue()

Cc: Madhuranath Iyengar <mni@xxxxxxxxxxxxxxx>
Signed-off-by: Nicholas Bellinger <nab@xxxxxxxxxxxxxxx>
---
 drivers/scsi/qla2xxx/qla_def.h    |   15 +++++++++++++--
 drivers/scsi/qla2xxx/qla_target.c |   27 +++++++++++++--------------
 drivers/scsi/qla2xxx/qla_target.h |    6 ++++--
 3 files changed, 30 insertions(+), 18 deletions(-)

diff --git a/drivers/scsi/qla2xxx/qla_def.h b/drivers/scsi/qla2xxx/qla_def.h
index f1ed22b..4b09b5c 100644
--- a/drivers/scsi/qla2xxx/qla_def.h
+++ b/drivers/scsi/qla2xxx/qla_def.h
@@ -1231,6 +1231,17 @@ typedef struct {
 #define RESPONSE_PROCESSED	0xDEADDEAD	/* Signature */
 } response_t;
 
+/*
+ * ISP queue - ATIO queue entry definition.
+ */
+typedef struct {
+	uint8_t		entry_type;		/* Entry type. */
+	uint8_t		entry_count;		/* Entry count. */
+	uint8_t		data[58];
+	uint32_t	signature;
+#define ATIO_PROCESSED 0xDEADDEAD		/* Signature */
+} atio_t;
+
 typedef union {
 	uint16_t extended;
 	struct {
@@ -2840,8 +2851,8 @@ struct qla_hw_data {
 	uint32_t node_name_set:1;
 
 	dma_addr_t atio_dma;	/* Physical address. */
-	void *atio_ring;	/* Base virtual address */
-	void *atio_ring_ptr;	/* Current address. */
+	atio_t *atio_ring;	/* Base virtual address */
+	atio_t *atio_ring_ptr;	/* Current address. */
 	uint16_t atio_ring_index; /* Current index. */
 	uint16_t atio_q_length;
 
diff --git a/drivers/scsi/qla2xxx/qla_target.c b/drivers/scsi/qla2xxx/qla_target.c
index f309667..ec9de8d 100644
--- a/drivers/scsi/qla2xxx/qla_target.c
+++ b/drivers/scsi/qla2xxx/qla_target.c
@@ -223,7 +223,7 @@ void qla_tgt_24xx_atio_pkt_all_vps(struct scsi_qla_host *vha, atio_from_isp_t *a
 {
 	struct qla_hw_data *ha = vha->hw;
 
-	switch (atio->entry_type) {
+	switch (atio->u.raw.entry_type) {
 	case ATIO_TYPE7:
 	{
 		struct scsi_qla_host *host = qla_tgt_find_host_by_d_id(vha,
@@ -265,7 +265,7 @@ void qla_tgt_24xx_atio_pkt_all_vps(struct scsi_qla_host *vha, atio_from_isp_t *a
 
 	default:
 		printk(KERN_ERR "qla_target(%d): Received unknown ATIO atio "
-		     "type %x\n", vha->vp_idx, atio->entry_type);
+		     "type %x\n", vha->vp_idx, atio->u.raw.entry_type);
 		break;
 	}
 
@@ -3175,7 +3175,7 @@ out_free_cmd:
 	return res;
 
 out_sched:
-	if (atio->entry_count > 1) {
+	if (atio->u.raw.entry_count > 1) {
 		ql_dbg(ql_dbg_tgt_mgt, vha, 0xe127, "Dropping multy entry cmd %p\n", cmd);
 		res = -EBUSY;
 		goto out_free_cmd;
@@ -4073,10 +4073,9 @@ static void qla_tgt_24xx_atio_pkt(struct scsi_qla_host *vha, atio_from_isp_t *at
 		ql_dbg(ql_dbg_tgt_mgt, vha, 0xe140, "ATIO pkt, but no tgt (ha %p)", ha);
 		return;
 	}
-
 	ql_dbg(ql_dbg_tgt_pkt, vha, 0xe209, "qla_target(%d): ATIO pkt %p:"
-		" type %02x count %02x", vha->vp_idx, atio, atio->entry_type,
-		atio->entry_count);
+		" type %02x count %02x", vha->vp_idx, atio, atio->u.raw.entry_type,
+		atio->u.raw.entry_count);
 	/*
 	 * In tgt_stop mode we also should allow all requests to pass.
 	 * Otherwise, some commands can stuck.
@@ -4084,7 +4083,7 @@ static void qla_tgt_24xx_atio_pkt(struct scsi_qla_host *vha, atio_from_isp_t *at
 
 	tgt->irq_cmd_count++;
 
-	switch (atio->entry_type) {
+	switch (atio->u.raw.entry_type) {
 	case ATIO_TYPE7:
 		ql_dbg(ql_dbg_tgt, vha, 0xe026, "ATIO_TYPE7 instance %d, lun"
 			" %Lx, read/write %d/%d, add_cdb_len %d, data_length "
@@ -4135,7 +4134,7 @@ static void qla_tgt_24xx_atio_pkt(struct scsi_qla_host *vha, atio_from_isp_t *at
 		if (unlikely(atio->u.isp2x.entry_status != 0)) {
 			printk(KERN_ERR "qla_target(%d): Received ATIO packet %x "
 				"with error status %x\n", vha->vp_idx,
-				atio->entry_type, atio->u.isp2x.entry_status);
+				atio->u.raw.entry_type, atio->u.isp2x.entry_status);
 			break;
 		}
 		ql_dbg(ql_dbg_tgt, vha, 0xe027, "%s", "IMMED_NOTIFY ATIO");
@@ -4145,7 +4144,7 @@ static void qla_tgt_24xx_atio_pkt(struct scsi_qla_host *vha, atio_from_isp_t *at
 
 	default:
 		printk(KERN_ERR "qla_target(%d): Received unknown ATIO atio "
-		     "type %x\n", vha->vp_idx, atio->entry_type);
+		     "type %x\n", vha->vp_idx, atio->u.raw.entry_type);
 		break;
 	}
 
@@ -5015,7 +5014,7 @@ qla_tgt_init_atio_q_entries(struct scsi_qla_host *vha)
 {
 	struct qla_hw_data *ha = vha->hw;
 	uint16_t cnt;
-	atio_from_isp_t *pkt = ha->atio_ring;
+	atio_from_isp_t *pkt = (atio_from_isp_t *)ha->atio_ring;
 
 	for (cnt = 0; cnt < ha->atio_q_length; cnt++) {
 		pkt->u.raw.signature = ATIO_PROCESSED;
@@ -5039,9 +5038,9 @@ qla_tgt_24xx_process_atio_queue(struct scsi_qla_host *vha)
 	if (!vha->flags.online)
 		return;
 
-	pkt = ha->atio_ring_ptr;
-	while (pkt->u.raw.signature != ATIO_PROCESSED) {
-		cnt = pkt->entry_count;
+	while (ha->atio_ring_ptr->signature != ATIO_PROCESSED) {
+		pkt = (atio_from_isp_t *)ha->atio_ring_ptr;
+		cnt = pkt->u.raw.entry_count;
 
 		qla_tgt_24xx_atio_pkt_all_vps(vha, (atio_from_isp_t *)pkt);
 
@@ -5054,7 +5053,7 @@ qla_tgt_24xx_process_atio_queue(struct scsi_qla_host *vha)
 				ha->atio_ring_ptr++;
 
 			pkt->u.raw.signature = ATIO_PROCESSED;
-			pkt = ha->atio_ring_ptr;
+			pkt = (atio_from_isp_t *)ha->atio_ring_ptr;
 		}
 		wmb();
 	}
diff --git a/drivers/scsi/qla2xxx/qla_target.h b/drivers/scsi/qla2xxx/qla_target.h
index 1ef0219..1e0682f 100644
--- a/drivers/scsi/qla2xxx/qla_target.h
+++ b/drivers/scsi/qla2xxx/qla_target.h
@@ -459,10 +459,9 @@ typedef struct {
  *		This is sent from the ISP to the target driver.
  */
 typedef struct {
-	uint8_t	 entry_type;		    /* Entry type. */
-	uint8_t	 entry_count;		    /* Entry count. */
 	union {
 		struct {
+			uint16_t entry_hdr;
 			uint8_t  sys_define;   /* System defined. */
 			uint8_t  entry_status; /* Entry Status.   */
 			uint32_t sys_define_2; /* System defined. */
@@ -482,6 +481,7 @@ typedef struct {
 			uint16_t ox_id;
 		} isp2x;
 		struct {
+			uint16_t entry_hdr;
 			uint8_t  fcp_cmnd_len_low;
 			uint8_t  fcp_cmnd_len_high:4;
 			uint8_t  attr:4;
@@ -491,6 +491,8 @@ typedef struct {
 			atio7_fcp_cmnd_t fcp_cmnd;
 		} isp24;
 		struct {
+			uint8_t  entry_type;	/* Entry type. */
+			uint8_t  entry_count;	/* Entry count. */
 			uint8_t  data[58];
 			uint32_t signature;
 #define ATIO_PROCESSED 0xDEADDEAD		/* Signature */
-- 
1.7.2.5

--
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