Skip to contentSkip to conversation

qla2xxx: updates for 2.6.24 [8.02.00-k7].

PATCH In review Andrew Vasquez 2 participants 18 messages Jan 17, 2008

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

cover qla2xxx: updates for 2.6.24 [8.02.00-k7].

This patchset updates the qla2xxx driver to 8.02.00-k7.

 drivers/scsi/qla2xxx/Makefile      |    2 +-
 drivers/scsi/qla2xxx/qla_attr.c    |   52 +++--
 drivers/scsi/qla2xxx/qla_dbg.c     |   37 ++--
 drivers/scsi/qla2xxx/qla_dbg.h     |   19 ++
 drivers/scsi/qla2xxx/qla_def.h     |   42 +++--
 drivers/scsi/qla2xxx/qla_dfs.c     |  175 +++++++++++++++
 drivers/scsi/qla2xxx/qla_fw.h      |   14 ++
 drivers/scsi/qla2xxx/qla_gbl.h     |   51 ++---
 drivers/scsi/qla2xxx/qla_init.c    |   80 ++++++--
 drivers/scsi/qla2xxx/qla_isr.c     |  105 ++++-----
 drivers/scsi/qla2xxx/qla_mbx.c     |  426 ++++++++++++------------------------
 drivers/scsi/qla2xxx/qla_mid.c     |   13 +-
 drivers/scsi/qla2xxx/qla_os.c      |   80 +++-----
 drivers/scsi/qla2xxx/qla_sup.c     |   18 +-
 drivers/scsi/qla2xxx/qla_version.h |    2 +-
 15 files changed, 616 insertions(+), 500 deletions(-)

here's the commits:

- Consolidate duplicate sense-data handling codes.
- Retrieve additional HBA port statistics from recent ISPs.
- Fix for 32-bit platforms with 64-bit resources.
- Wait for FLASH write-protection to complete after a write.
- Restrict MSI/MSI-X enablement on select ISP2432-type HBAs.
- Don't schedule the DPC routine to perform an issue-lip request.
- Use completion routines.
- Add a filter to compare port_name against the physical on vport creation.
- Code cleanups.
- Trace-Control naming cleanups.
- Add Fibre Channel Event (FCE) tracing support.
- Correct late-memset() of EFT buffer.
- Issue correct MBC_INITIALIZE_FIRMWARE command.
- Update version number to 8.02.00-k7.

Regards,
Andrew Vasquez
QLogic Corporation

#1 lore raw

PATCH 1/1 qla2xxx: Consolidate duplicate sense-data handling codes.

---
 drivers/scsi/qla2xxx/qla_isr.c |   85 ++++++++++++++-------------------------
 1 files changed, 31 insertions(+), 54 deletions(-)
drivers/scsi/qla2xxx/qla_isr.c +31 -54
index 53cbaff..5d2dc92 100644
@@ -822,6 +822,35 @@ qla2x00_process_response_queue(struct scsi_qla_host *ha)
 	WRT_REG_WORD(ISP_RSP_Q_OUT(ha, reg), ha->rsp_ring_index);
 }
 
+static inline void
+qla2x00_handle_sense(srb_t *sp, uint8_t *sense_data, uint32_t sense_len)
+{
+	struct scsi_cmnd *cp = sp->cmd;
+
+	if (sense_len >= SCSI_SENSE_BUFFERSIZE)
+		sense_len = SCSI_SENSE_BUFFERSIZE;
+
+	CMD_ACTUAL_SNSLEN(cp) = sense_len;
+	sp->request_sense_length = sense_len;
+	sp->request_sense_ptr = cp->sense_buffer;
+	if (sp->request_sense_length > 32)
+		sense_len = 32;
+
+	memcpy(cp->sense_buffer, sense_data, sense_len);
+
+	sp->request_sense_ptr += sense_len;
+	sp->request_sense_length -= sense_len;
+	if (sp->request_sense_length != 0)
+		sp->ha->status_srb = sp;
+
+	DEBUG5(printk("%s(): Check condition Sense data, scsi(%ld:%d:%d:%d) "
+	    "cmd=%p pid=%ld\n", __func__, sp->ha->host_no, cp->device->channel,
+	    cp->device->id, cp->device->lun, cp, cp->serial_number));
+	if (sense_len)
+		DEBUG5(qla2x00_dump_buffer(cp->sense_buffer,
+		    CMD_ACTUAL_SNSLEN(cp)));
+}
+
 /**
  * qla2x00_status_entry() - Process a Status IOCB entry.
  * @ha: SCSI driver HA context
@@ -976,36 +1005,11 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
 		if (lscsi_status != SS_CHECK_CONDITION)
 			break;
 
-		/* Copy Sense Data into sense buffer. */
 		memset(cp->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
-
 		if (!(scsi_status & SS_SENSE_LEN_VALID))
 			break;
 
-		if (sense_len >= SCSI_SENSE_BUFFERSIZE)
-			sense_len = SCSI_SENSE_BUFFERSIZE;
-
-		CMD_ACTUAL_SNSLEN(cp) = sense_len;
-		sp->request_sense_length = sense_len;
-		sp->request_sense_ptr = cp->sense_buffer;
-
-		if (sp->request_sense_length > 32)
-			sense_len = 32;
-
-		memcpy(cp->sense_buffer, sense_data, sense_len);
-
-		sp->request_sense_ptr += sense_len;
-		sp->request_sense_length -= sense_len;
-		if (sp->request_sense_length != 0)
-			ha->status_srb = sp;
-
-		DEBUG5(printk("%s(): Check condition Sense data, "
-		    "scsi(%ld:%d:%d:%d) cmd=%p pid=%ld\n", __func__,
-		    ha->host_no, cp->device->channel, cp->device->id,
-		    cp->device->lun, cp, cp->serial_number));
-		if (sense_len)
-			DEBUG5(qla2x00_dump_buffer(cp->sense_buffer,
-			    CMD_ACTUAL_SNSLEN(cp)));
+		qla2x00_handle_sense(sp, sense_data, sense_len);
 		break;
 
 	case CS_DATA_UNDERRUN:
@@ -1060,34 +1064,11 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
 			if (lscsi_status != SS_CHECK_CONDITION)
 				break;
 
-			/* Copy Sense Data into sense buffer */
 			memset(cp->sense_buffer, 0, SCSI_SENSE_BUFFERSIZE);
-
 			if (!(scsi_status & SS_SENSE_LEN_VALID))
 				break;
 
-			if (sense_len >= SCSI_SENSE_BUFFERSIZE)
-				sense_len = SCSI_SENSE_BUFFERSIZE;
-
-			CMD_ACTUAL_SNSLEN(cp) = sense_len;
-			sp->request_sense_length = sense_len;
-			sp->request_sense_ptr = cp->sense_buffer;
-
-			if (sp->request_sense_length > 32)
-				sense_len = 32;
-
-			memcpy(cp->sense_buffer, sense_data, sense_len);
-
-			sp->request_sense_ptr += sense_len;
-			sp->request_sense_length -= sense_len;
-			if (sp->request_sense_length != 0)
-				ha->status_srb = sp;
-
-			DEBUG5(printk("%s(): Check condition Sense data, "
-			    "scsi(%ld:%d:%d:%d) cmd=%p pid=%ld\n",
-			    __func__, ha->host_no, cp->device->channel,
-			    cp->device->id, cp->device->lun, cp,
-			    cp->serial_number));
+			qla2x00_handle_sense(sp, sense_data, sense_len);
 
 			/*
 			 * In case of a Underrun condition, set both the lscsi
@@ -1107,10 +1088,6 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
 
 				cp->result = DID_ERROR << 16 | lscsi_status;
 			}
-
-			if (sense_len)
-				DEBUG5(qla2x00_dump_buffer(cp->sense_buffer,
-				    CMD_ACTUAL_SNSLEN(cp)));
 		} else {
 			/*
 			 * If RISC reports underrun and target does not report
Signature · 1 line
1.5.4.rc3.14.g44397
#2 lore raw

PATCH 1/1 qla2xxx: Fix for 32-bit platforms with 64-bit resources.

In reply to Andrew Vasquez

The driver stores the contents of PCI resources into unsigned long's before ioremapping. This breaks on 32-bit platforms which support 64-bit MMIO resources.

Correct code by removing the temporary variables used during MMIO PIO mapping and using resource_size_t where applicable. Also correct a small typo in a printk() where the wrong region number was displayed.

---
 drivers/scsi/qla2xxx/qla_def.h |    3 +--
 drivers/scsi/qla2xxx/qla_os.c  |   22 +++++++---------------
 2 files changed, 8 insertions(+), 17 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +1 -2
index a33d3d5..d0b78af 100644
@@ -2271,8 +2271,7 @@ typedef struct scsi_qla_host {
 
 	int		bars;
 	device_reg_t __iomem *iobase;		/* Base I/O address */
-	unsigned long	pio_address;
-	unsigned long	pio_length;
+	resource_size_t pio_address;
 #define MIN_IOBASE_LEN		0x100
 
 	/* ISP ring lock, rings, and indexes */
drivers/scsi/qla2xxx/qla_os.c +7 -15
index 8ecc047..ab7abe0 100644
@@ -1479,8 +1479,7 @@ qla2x00_set_isp_flags(scsi_qla_host_t *ha)
 static int
 qla2x00_iospace_config(scsi_qla_host_t *ha)
 {
-	unsigned long	pio, pio_len, pio_flags;
-	unsigned long	mmio, mmio_len, mmio_flags;
+	resource_size_t pio;
 
 	if (pci_request_selected_regions(ha->pdev, ha->bars,
 	    QLA2XXX_DRIVER_NAME)) {
@@ -1495,10 +1494,8 @@ qla2x00_iospace_config(scsi_qla_host_t *ha)
 
 	/* We only need PIO for Flash operations on ISP2312 v2 chips. */
 	pio = pci_resource_start(ha->pdev, 0);
-	pio_len = pci_resource_len(ha->pdev, 0);
-	pio_flags = pci_resource_flags(ha->pdev, 0);
-	if (pio_flags & IORESOURCE_IO) {
-		if (pio_len < MIN_IOBASE_LEN) {
+	if (pci_resource_flags(ha->pdev, 0) & IORESOURCE_IO) {
+		if (pci_resource_len(ha->pdev, 0) < MIN_IOBASE_LEN) {
 			qla_printk(KERN_WARNING, ha,
 			    "Invalid PCI I/O region size (%s)...\n",
 				pci_name(ha->pdev));
@@ -1511,28 +1508,23 @@ qla2x00_iospace_config(scsi_qla_host_t *ha)
 		pio = 0;
 	}
 	ha->pio_address = pio;
-	ha->pio_length = pio_len;
 
 skip_pio:
 	/* Use MMIO operations for all accesses. */
-	mmio = pci_resource_start(ha->pdev, 1);
-	mmio_len = pci_resource_len(ha->pdev, 1);
-	mmio_flags = pci_resource_flags(ha->pdev, 1);
-
-	if (!(mmio_flags & IORESOURCE_MEM)) {
+	if (!(pci_resource_flags(ha->pdev, 1) & IORESOURCE_MEM)) {
 		qla_printk(KERN_ERR, ha,
-		    "region #0 not an MMIO resource (%s), aborting\n",
+		    "region #1 not an MMIO resource (%s), aborting\n",
 		    pci_name(ha->pdev));
 		goto iospace_error_exit;
 	}
-	if (mmio_len < MIN_IOBASE_LEN) {
+	if (pci_resource_len(ha->pdev, 1) < MIN_IOBASE_LEN) {
 		qla_printk(KERN_ERR, ha,
 		    "Invalid PCI mem region size (%s), aborting\n",
 			pci_name(ha->pdev));
 		goto iospace_error_exit;
 	}
 
-	ha->iobase = ioremap(mmio, MIN_IOBASE_LEN);
+	ha->iobase = ioremap(pci_resource_start(ha->pdev, 1), MIN_IOBASE_LEN);
 	if (!ha->iobase) {
 		qla_printk(KERN_ERR, ha,
 		    "cannot remap MMIO (%s), aborting\n", pci_name(ha->pdev));
Signature · 1 line
1.5.4.rc3.14.g44397
#3 lore raw

PATCH 1/1 qla2xxx: Retrieve additional HBA port statistics from recent ISPs.

In reply to Andrew Vasquez

HBAs supporting these additional counters include ISP24xx and ISP25xx type boards.

---
 drivers/scsi/qla2xxx/qla_attr.c |   44 ++++++++++++------
 drivers/scsi/qla2xxx/qla_def.h  |   22 ++++++---
 drivers/scsi/qla2xxx/qla_gbl.h  |    7 ++-
 drivers/scsi/qla2xxx/qla_mbx.c  |   99 ++++++++++----------------------------
 4 files changed, 74 insertions(+), 98 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +30 -14
index 745283f..e3bda8f 100644
@@ -967,35 +967,51 @@ qla2x00_get_fc_host_stats(struct Scsi_Host *shost)
 {
 	scsi_qla_host_t *ha = shost_priv(shost);
 	int rval;
-	uint16_t mb_stat[1];
-	link_stat_t stat_buf;
+	struct link_statistics *stats;
+	dma_addr_t stats_dma;
 	struct fc_host_statistics *pfc_host_stat;
 
-	rval = QLA_FUNCTION_FAILED;
 	pfc_host_stat = &ha->fc_host_stat;
 	memset(pfc_host_stat, -1, sizeof(struct fc_host_statistics));
 
+	stats = dma_pool_alloc(ha->s_dma_pool, GFP_KERNEL, &stats_dma);
+	if (stats == NULL) {
+		DEBUG2_3_11(printk("%s(%ld): Failed to allocate memory.\n",
+		    __func__, ha->host_no));
+		goto done;
+	}
+	memset(stats, 0, DMA_POOL_SIZE);
+
+	rval = QLA_FUNCTION_FAILED;
 	if (IS_FWI2_CAPABLE(ha)) {
-		rval = qla24xx_get_isp_stats(ha, (uint32_t *)&stat_buf,
-		    sizeof(stat_buf) / 4, mb_stat);
+		rval = qla24xx_get_isp_stats(ha, stats, stats_dma);
 	} else if (atomic_read(&ha->loop_state) == LOOP_READY &&
 		    !test_bit(ABORT_ISP_ACTIVE, &ha->dpc_flags) &&
 		    !test_bit(ISP_ABORT_NEEDED, &ha->dpc_flags) &&
 		    !ha->dpc_active) {
 		/* Must be in a 'READY' state for statistics retrieval. */
-		rval = qla2x00_get_link_status(ha, ha->loop_id, &stat_buf,
-		    mb_stat);
+		rval = qla2x00_get_link_status(ha, ha->loop_id, stats,
+		    stats_dma);
 	}
 
 	if (rval != QLA_SUCCESS)
-		goto done;
+		goto done_free;
+
+	pfc_host_stat->link_failure_count = stats->link_fail_cnt;
+	pfc_host_stat->loss_of_sync_count = stats->loss_sync_cnt;
+	pfc_host_stat->loss_of_signal_count = stats->loss_sig_cnt;
+	pfc_host_stat->prim_seq_protocol_err_count = stats->prim_seq_err_cnt;
+	pfc_host_stat->invalid_tx_word_count = stats->inval_xmit_word_cnt;
+	pfc_host_stat->invalid_crc_count = stats->inval_crc_cnt;
+	if (IS_FWI2_CAPABLE(ha)) {
+		pfc_host_stat->tx_frames = stats->tx_frames;
+		pfc_host_stat->rx_frames = stats->rx_frames;
+		pfc_host_stat->dumped_frames = stats->dumped_frames;
+		pfc_host_stat->nos_count = stats->nos_rcvd;
+	}
 
-	pfc_host_stat->link_failure_count = stat_buf.link_fail_cnt;
-	pfc_host_stat->loss_of_sync_count = stat_buf.loss_sync_cnt;
-	pfc_host_stat->loss_of_signal_count = stat_buf.loss_sig_cnt;
-	pfc_host_stat->prim_seq_protocol_err_count = stat_buf.prim_seq_err_cnt;
-	pfc_host_stat->invalid_tx_word_count = stat_buf.inval_xmit_word_cnt;
-	pfc_host_stat->invalid_crc_count = stat_buf.inval_crc_cnt;
+done_free:
+        dma_pool_free(ha->s_dma_pool, stats, stats_dma);
 done:
 	return pfc_host_stat;
 }
drivers/scsi/qla2xxx/qla_def.h +14 -8
index fe8f782..a33d3d5 100644
@@ -862,14 +862,20 @@ typedef struct {
 #define GLSO_SEND_RPS	BIT_0
 #define GLSO_USE_DID	BIT_3
 
-typedef struct {
-	uint32_t	link_fail_cnt;
-	uint32_t	loss_sync_cnt;
-	uint32_t	loss_sig_cnt;
-	uint32_t	prim_seq_err_cnt;
-	uint32_t	inval_xmit_word_cnt;
-	uint32_t	inval_crc_cnt;
-} link_stat_t;
+struct link_statistics {
+	uint32_t link_fail_cnt;
+	uint32_t loss_sync_cnt;
+	uint32_t loss_sig_cnt;
+	uint32_t prim_seq_err_cnt;
+	uint32_t inval_xmit_word_cnt;
+	uint32_t inval_crc_cnt;
+	uint32_t unused1[0x1b];
+	uint32_t tx_frames;
+	uint32_t rx_frames;
+	uint32_t dumped_frames;
+	uint32_t unused2[2];
+	uint32_t nos_rcvd;
+};
 
 /*
  * NVRAM Command values.
drivers/scsi/qla2xxx/qla_gbl.h +4 -3
index 09cb2a9..5b381dc 100644
@@ -222,11 +222,12 @@ extern int
 qla2x00_get_fcal_position_map(scsi_qla_host_t *ha, char *pos_map);
 
 extern int
-qla2x00_get_link_status(scsi_qla_host_t *, uint16_t, link_stat_t *,
-    uint16_t *);
+qla2x00_get_link_status(scsi_qla_host_t *, uint16_t, struct link_statistics *,
+    dma_addr_t);
 
 extern int
-qla24xx_get_isp_stats(scsi_qla_host_t *, uint32_t *, uint32_t, uint16_t *);
+qla24xx_get_isp_stats(scsi_qla_host_t *, struct link_statistics *,
+    dma_addr_t);
 
 extern int qla24xx_abort_command(scsi_qla_host_t *, srb_t *);
 extern int qla24xx_abort_target(fc_port_t *);
drivers/scsi/qla2xxx/qla_mbx.c +26 -73

156 lines not on this page · raw message

Signature · 1 line
1.5.4.rc3.14.g44397
#4 lore raw

PATCH 1/1 qla2xxx: Wait for FLASH write-protection to complete after a write.

In reply to Andrew Vasquez

Some flash parts have a slow enable write-protection (WP) operation whereby subsequent FLASH accesses would fail if the WP operation had not completed. Software now polls the SPI's status-register for WP completion.

---
 drivers/scsi/qla2xxx/qla_sup.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_sup.c +8 -2
index ad2fa01..af16c55 100644
@@ -550,7 +550,7 @@ qla24xx_write_flash_data(scsi_qla_host_t *ha, uint32_t *dwptr, uint32_t faddr,
 	int ret;
 	uint32_t liter, miter;
 	uint32_t sec_mask, rest_addr, conf_addr;
-	uint32_t fdata, findex ;
+	uint32_t fdata, findex, cnt;
 	uint8_t	man_id, flash_id;
 	struct device_reg_24xx __iomem *reg = &ha->iobase->isp24;
 	dma_addr_t optrom_dma;
@@ -690,8 +690,14 @@ qla24xx_write_flash_data(scsi_qla_host_t *ha, uint32_t *dwptr, uint32_t faddr,
 			    0xff0000) | ((fdata >> 16) & 0xff));
 	}
 
-	/* Enable flash write-protection. */
+	/* Enable flash write-protection and wait for completion. */
 	qla24xx_write_flash_dword(ha, flash_conf_to_access_addr(0x101), 0x9c);
+	for (cnt = 300; cnt &&
+	    qla24xx_read_flash_dword(ha,
+		    flash_conf_to_access_addr(0x005)) & BIT_0;
+	    cnt--) {
+		udelay(10);
+	}
 
 	/* Disable flash write. */
 	WRT_REG_DWORD(&reg->ctrl_status,
Signature · 1 line
1.5.4.rc3.14.g44397
#5 lore raw

PATCH 1/1 qla2xxx: Restrict MSI/MSI-X enablement on select ISP2432-type HBAs.

In reply to Andrew Vasquez
---
 drivers/scsi/qla2xxx/qla_isr.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
drivers/scsi/qla2xxx/qla_isr.c +12 -0
index 5d2dc92..22216fe 100644
@@ -1829,6 +1829,18 @@ qla2x00_request_irqs(scsi_qla_host_t *ha)
 		goto skip_msix;
 	}
 
+	if (ha->pdev->subsystem_vendor == PCI_VENDOR_ID_HP &&
+	    (ha->pdev->subsystem_device == 0x7040 ||
+		ha->pdev->subsystem_device == 0x7041 ||
+		ha->pdev->subsystem_device == 0x1705)) {
+		DEBUG2(qla_printk(KERN_WARNING, ha,
+		    "MSI-X: Unsupported ISP2432 SSVID/SSDID (0x%X, 0x%X).\n",
+		    ha->pdev->subsystem_vendor,
+		    ha->pdev->subsystem_device));
+
+		goto skip_msi;
+	}
+
 	ret = qla24xx_enable_msix(ha);
 	if (!ret) {
 		DEBUG2(qla_printk(KERN_INFO, ha,
Signature · 1 line
1.5.4.rc3.14.g44397
#6 lore raw

PATCH 1/1 qla2xxx: Don't schedule the DPC routine to perform an issue-lip request.

In reply to Andrew Vasquez

As the driver depends on the DPC routine to handle bottom-half loop resynchronization in order to recover from the issue-lip request. The issue_lip call is sleeping context capable, so just issue the reset function there.

---
 drivers/scsi/qla2xxx/qla_attr.c |    2 +-
 drivers/scsi/qla2xxx/qla_gbl.h  |    2 ++
 drivers/scsi/qla2xxx/qla_os.c   |    3 +--
 3 files changed, 4 insertions(+), 3 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +1 -1
index e3bda8f..22b3868 100644
@@ -958,7 +958,7 @@ qla2x00_issue_lip(struct Scsi_Host *shost)
 {
 	scsi_qla_host_t *ha = shost_priv(shost);
 
-	set_bit(LOOP_RESET_NEEDED, &ha->dpc_flags);
+	qla2x00_loop_reset(ha);
 	return 0;
 }
 
drivers/scsi/qla2xxx/qla_gbl.h +2 -0
index 5b381dc..f6917b9 100644
@@ -65,6 +65,8 @@ extern int ql2xextended_error_logging;
 extern int ql2xqfullrampup;
 extern int num_hosts;
 
+extern int qla2x00_loop_reset(scsi_qla_host_t *);
+
 /*
  * Global Functions in qla_mid.c source file.
  */
drivers/scsi/qla2xxx/qla_os.c +1 -2
index ab7abe0..bb2d3d6 100644
@@ -105,7 +105,6 @@ static int qla2xxx_eh_abort(struct scsi_cmnd *);
 static int qla2xxx_eh_device_reset(struct scsi_cmnd *);
 static int qla2xxx_eh_bus_reset(struct scsi_cmnd *);
 static int qla2xxx_eh_host_reset(struct scsi_cmnd *);
-static int qla2x00_loop_reset(scsi_qla_host_t *ha);
 static int qla2x00_device_reset(scsi_qla_host_t *, fc_port_t *);
 
 static int qla2x00_change_queue_depth(struct scsi_device *, int);
@@ -1060,7 +1059,7 @@ eh_host_reset_lock:
 * Returns:
 *      0 = success
 */
-static int
+int
 qla2x00_loop_reset(scsi_qla_host_t *ha)
 {
 	int ret;
Signature · 1 line
1.5.4.rc3.14.g44397
#7 lore raw

PATCH 1/1 qla2xxx: Correct late-memset() of EFT buffer.

In reply to Andrew Vasquez

Original code would clear the buffer after the firmware had already been initialized to use the buffer, thus potentially and inadvertantly clearing data previously DMA'd by the firmware.

---
 drivers/scsi/qla2xxx/qla_init.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +1 -1
index cacfd25..7637fa7 100644
@@ -766,6 +766,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha)
 			goto cont_alloc;
 		}
 
+		memset(tc, 0, EFT_SIZE);
 		rval = qla2x00_enable_eft_trace(ha, tc_dma, EFT_NUM_BUFFERS);
 		if (rval) {
 			qla_printk(KERN_WARNING, ha, "Unable to initialize "
@@ -779,7 +780,6 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha)
 		    EFT_SIZE / 1024);
 
 		eft_size = EFT_SIZE;
-		memset(tc, 0, eft_size);
 		ha->eft_dma = tc_dma;
 		ha->eft = tc;
 
Signature · 1 line
1.5.4.rc3.14.g44397
#8 lore raw

PATCH 1/1 qla2xxx: Update version number to 8.02.00-k7.

In reply to Andrew Vasquez
---
 drivers/scsi/qla2xxx/qla_version.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/scsi/qla2xxx/qla_version.h +1 -1
index 6e3dc40..2c2f6b4 100644
@@ -7,7 +7,7 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION      "8.02.00-k6"
+#define QLA2XXX_VERSION      "8.02.00-k7"
 
 #define QLA_DRIVER_MAJOR_VER	8
 #define QLA_DRIVER_MINOR_VER	2
Signature · 1 line
1.5.4.rc3.14.g44397
#9 lore raw

PATCH 1/1 qla2xxx: Add a filter to compare port_name against the physical on vport creation.

In reply to Andrew Vasquez

From: Seokmann Ju <[email protected]>

During vport creation, there was a possibility to get create a vport with same port_name as pport. A new filter has added to compare given port_name with the port_name of the pport.

---
 drivers/scsi/qla2xxx/qla_mid.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/scsi/qla2xxx/qla_mid.c +2 -0
index 325bdab..dea3768 100644
@@ -341,6 +341,8 @@ qla24xx_vport_create_req_sanity_check(struct fc_vport *fc_vport)
 
 	/* Check up unique WWPN */
 	u64_to_wwn(fc_vport->port_name, port_name);
+	if (!memcmp(port_name, ha->port_name, WWN_SIZE))
+		return VPCERR_BAD_WWN;
 	vha = qla24xx_find_vhost_by_name(ha, port_name);
 	if (vha)
 		return VPCERR_BAD_WWN;
Signature · 1 line
1.5.4.rc3.14.g44397
#10 lore raw

PATCH 1/1 qla2xxx: Issue correct MBC_INITIALIZE_FIRMWARE command.

In reply to Andrew Vasquez

From: Seokmann Ju <[email protected]>

There is a case where 54xx HBA loads MID firmware as it use 24xx firmware. In this case, the driver should issue MBC_MID_INITIALIZE FIRMWARE even though the HBA doesn't support NPIV. This patch make changes in the driver so that could behave accordingly.

---
 drivers/scsi/qla2xxx/qla_init.c |    4 +++-
 drivers/scsi/qla2xxx/qla_mbx.c  |    2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/scsi/qla2xxx/qla_init.c +3 -1
index 7637fa7..d0633ca 100644
@@ -1193,7 +1193,9 @@ qla2x00_init_rings(scsi_qla_host_t *ha)
 
 	DEBUG(printk("scsi(%ld): Issue init firmware.\n", ha->host_no));
 
-	mid_init_cb->count = cpu_to_le16(ha->max_npiv_vports);
+	if (ha->flags.npiv_supported)
+		mid_init_cb->count = cpu_to_le16(ha->max_npiv_vports);
+
 	mid_init_cb->options = __constant_cpu_to_le16(BIT_1);
 
 	rval = qla2x00_init_firmware(ha, ha->init_cb_size);
drivers/scsi/qla2xxx/qla_mbx.c +1 -1
index 99d29ff..0c10c0b 100644
@@ -980,7 +980,7 @@ qla2x00_init_firmware(scsi_qla_host_t *ha, uint16_t size)
 	DEBUG11(printk("qla2x00_init_firmware(%ld): entered.\n",
 	    ha->host_no));
 
-	if (ha->flags.npiv_supported)
+	if (ha->fw_attributes & BIT_2)
 		mcp->mb[0] = MBC_MID_INITIALIZE_FIRMWARE;
 	else
 		mcp->mb[0] = MBC_INITIALIZE_FIRMWARE;
Signature · 1 line
1.5.4.rc3.14.g44397
#11 lore raw

PATCH 1/1 qla2xxx: Code cleanups.

In reply to Andrew Vasquez

From: Adrian Bunk <[email protected]>

- make the following needlessly global code static:
- qla_attr.c: qla24xx_vport_delete()
- qla_attr.c: qla24xx_vport_disable()
- qla_mid.c: qla24xx_allocate_vp_id()
- qla_mid.c: qla24xx_find_vhost_by_name()
- qla_mid.c: qla2x00_do_dpc_vp()
- qla_os.c: struct qla2x00_driver_template
- qla_os.c: qla2x00_stop_timer()
- qla_os.c: qla2x00_mem_alloc()
- qla_os.c: qla2x00_mem_free()
- qla_sup.c: qla2x00_lock_nvram_access()
- qla_sup.c: qla2x00_unlock_nvram_access()
- qla_sup.c: qla2x00_get_nvram_word()
- qla_sup.c: qla2x00_write_nvram_word()
- #if 0 the following unused global functions:
- qla_mbx.c: qla2x00_system_error()
- qla_os.c: remove some unneeded function prototypes
- removed unused functions:
- qla_dbg.c: qla2x00_dump_pkt()
- qla_mbx.c: qla2x00_get_serdes_params()
- qla_mbx.c: qla2x00_get_idma_speed()
- qla_mbx.c: qla24xx_get_vp_database()
- qla_mbx.c: qla24xx_get_vp_entry()

Small modifications and

---
 drivers/scsi/qla2xxx/qla_attr.c |    6 +-
 drivers/scsi/qla2xxx/qla_dbg.c  |   15 ----
 drivers/scsi/qla2xxx/qla_gbl.h  |   25 ------
 drivers/scsi/qla2xxx/qla_mbx.c  |  177 +--------------------------------------
 drivers/scsi/qla2xxx/qla_mid.c  |    6 +-
 drivers/scsi/qla2xxx/qla_os.c   |   20 ++---
 drivers/scsi/qla2xxx/qla_sup.c  |    8 +-
 7 files changed, 19 insertions(+), 238 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +3 -3
index 22b3868..adf9732 100644
@@ -9,7 +9,7 @@
 #include <linux/kthread.h>
 #include <linux/vmalloc.h>
 
-int qla24xx_vport_disable(struct fc_vport *, bool);
+static int qla24xx_vport_disable(struct fc_vport *, bool);
 
 /* SYSFS attributes --------------------------------------------------------- */
 
@@ -1129,7 +1129,7 @@ vport_create_failed_2:
 	return FC_VPORT_FAILED;
 }
 
-int
+static int
 qla24xx_vport_delete(struct fc_vport *fc_vport)
 {
 	scsi_qla_host_t *ha = shost_priv(fc_vport->shost);
@@ -1162,7 +1162,7 @@ qla24xx_vport_delete(struct fc_vport *fc_vport)
 	return 0;
 }
 
-int
+static int
 qla24xx_vport_disable(struct fc_vport *fc_vport, bool disable)
 {
 	scsi_qla_host_t *vha = fc_vport->dd_data;
drivers/scsi/qla2xxx/qla_dbg.c +0 -15
index eaa04da..796c4ce 100644
@@ -1428,21 +1428,6 @@ qla2x00_print_scsi_cmd(struct scsi_cmnd * cmd)
 	printk("  sp flags=0x%x\n", sp->flags);
 }
 
-void
-qla2x00_dump_pkt(void *pkt)
-{
-	uint32_t i;
-	uint8_t *data = (uint8_t *) pkt;
-
-	for (i = 0; i < 64; i++) {
-		if (!(i % 4))
-			printk("\n%02x: ", i);
-
-		printk("%02x ", data[i]);
-	}
-	printk("\n");
-}
-
 #if defined(QL_DEBUG_ROUTINES)
 /*
  * qla2x00_formatted_dump_buffer
drivers/scsi/qla2xxx/qla_gbl.h +0 -25
index fa4455f..fd75539 100644
@@ -70,30 +70,20 @@ extern int qla2x00_loop_reset(scsi_qla_host_t *);
 /*
  * Global Functions in qla_mid.c source file.
  */
-extern struct scsi_host_template qla2x00_driver_template;
 extern struct scsi_host_template qla24xx_driver_template;
 extern struct scsi_transport_template *qla2xxx_transport_vport_template;
-extern uint8_t qla2x00_mem_alloc(scsi_qla_host_t *);
 extern void qla2x00_timer(scsi_qla_host_t *);
 extern void qla2x00_start_timer(scsi_qla_host_t *, void *, unsigned long);
-extern void qla2x00_stop_timer(scsi_qla_host_t *);
-extern uint32_t qla24xx_allocate_vp_id(scsi_qla_host_t *);
 extern void qla24xx_deallocate_vp_id(scsi_qla_host_t *);
 extern int qla24xx_disable_vp (scsi_qla_host_t *);
 extern int qla24xx_enable_vp (scsi_qla_host_t *);
-extern void qla2x00_mem_free(scsi_qla_host_t *);
 extern int qla24xx_control_vp(scsi_qla_host_t *, int );
 extern int qla24xx_modify_vp_config(scsi_qla_host_t *);
 extern int qla2x00_send_change_request(scsi_qla_host_t *, uint16_t, uint16_t);
 extern void qla2x00_vp_stop_timer(scsi_qla_host_t *);
 extern int qla24xx_configure_vhba (scsi_qla_host_t *);
-extern int qla24xx_get_vp_entry(scsi_qla_host_t *, uint16_t, int);
-extern int qla24xx_get_vp_database(scsi_qla_host_t *, uint16_t);
-extern int qla2x00_do_dpc_vp(scsi_qla_host_t *);
 extern void qla24xx_report_id_acquisition(scsi_qla_host_t *,
     struct vp_rpt_id_entry_24xx *);
-extern scsi_qla_host_t * qla24xx_find_vhost_by_name(scsi_qla_host_t *,
-    uint8_t *);
 extern void qla2x00_do_dpc_all_vps(scsi_qla_host_t *);
 extern int qla24xx_vport_create_req_sanity_check(struct fc_vport *);
 extern scsi_qla_host_t * qla24xx_create_vhost(struct fc_vport *);
@@ -113,7 +103,6 @@ extern void qla2xxx_wake_dpc(scsi_qla_host_t *);
 extern void qla2x00_alert_all_vps(scsi_qla_host_t *, uint16_t *);
 extern void qla2x00_async_event(scsi_qla_host_t *, uint16_t *);
 extern void qla2x00_vp_abort_isp(scsi_qla_host_t *);
-extern int qla24xx_vport_delete(struct fc_vport *);
 
 /*
  * Global Function Prototypes in qla_iocb.c source file.
@@ -232,12 +221,6 @@ qla24xx_get_isp_stats(scsi_qla_host_t *, struct link_statistics *,
 extern int qla24xx_abort_command(scsi_qla_host_t *, srb_t *);
 extern int qla24xx_abort_target(fc_port_t *);
 
-extern int qla2x00_system_error(scsi_qla_host_t *);
-
-extern int
-qla2x00_get_serdes_params(scsi_qla_host_t *, uint16_t *, uint16_t *,
-    uint16_t *);
-
 extern int
 qla2x00_set_serdes_params(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t);
 
@@ -251,9 +234,6 @@ extern int
 qla2x00_read_sfp(scsi_qla_host_t *, dma_addr_t, uint16_t, uint16_t, uint16_t);
 
 extern int
-qla2x00_get_idma_speed(scsi_qla_host_t *, uint16_t, uint16_t *, uint16_t *);
-
-extern int
 qla2x00_set_idma_speed(scsi_qla_host_t *, uint16_t, uint16_t, uint16_t *);
 
 /*
@@ -271,11 +251,7 @@ extern void qla2x00_free_irqs(scsi_qla_host_t *);
 /*
  * Global Function Prototypes in qla_sup.c source file.
  */
-extern void qla2x00_lock_nvram_access(scsi_qla_host_t *);
-extern void qla2x00_unlock_nvram_access(scsi_qla_host_t *);
 extern void qla2x00_release_nvram_protection(scsi_qla_host_t *);
-extern uint16_t qla2x00_get_nvram_word(scsi_qla_host_t *, uint32_t);
-extern void qla2x00_write_nvram_word(scsi_qla_host_t *, uint32_t, uint16_t);
 extern uint32_t *qla24xx_read_flash_data(scsi_qla_host_t *, uint32_t *,
     uint32_t, uint32_t);
 extern uint8_t *qla2x00_read_nvram_data(scsi_qla_host_t *, uint8_t *, uint32_t,
@@ -322,7 +298,6 @@ extern void qla25xx_fw_dump(scsi_qla_host_t *, int);
 extern void qla2x00_dump_regs(scsi_qla_host_t *);
 extern void qla2x00_dump_buffer(uint8_t *, uint32_t);
 extern void qla2x00_print_scsi_cmd(struct scsi_cmnd *);
-extern void qla2x00_dump_pkt(void *);
 
 /*
  * Global Function Prototypes in qla_gs.c source file.
drivers/scsi/qla2xxx/qla_mbx.c +3 -174

201 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_mid.c +3 -3
index dea3768..cf784cd 100644
@@ -39,7 +39,7 @@ qla2x00_vp_stop_timer(scsi_qla_host_t *vha)
 	}
 }
 
-uint32_t
+static uint32_t
 qla24xx_allocate_vp_id(scsi_qla_host_t *vha)
 {
 	uint32_t vp_id;
@@ -77,7 +77,7 @@ qla24xx_deallocate_vp_id(scsi_qla_host_t *vha)
 	up(&ha->vport_sem);
 }
 
-scsi_qla_host_t *
+static scsi_qla_host_t *
 qla24xx_find_vhost_by_name(scsi_qla_host_t *ha, uint8_t *port_name)
 {
 	scsi_qla_host_t *vha;
@@ -265,7 +265,7 @@ qla2x00_vp_abort_isp(scsi_qla_host_t *vha)
 	qla24xx_enable_vp(vha);
 }
 
-int
+static int
 qla2x00_do_dpc_vp(scsi_qla_host_t *vha)
 {
 	if (test_and_clear_bit(VP_IDX_ACQUIRED, &vha->vp_flags)) {
drivers/scsi/qla2xxx/qla_os.c +6 -14
index 19d0f95..2dd4371 100644
@@ -110,7 +110,7 @@ static int qla2x00_device_reset(scsi_qla_host_t *, fc_port_t *);
 static int qla2x00_change_queue_depth(struct scsi_device *, int);
 static int qla2x00_change_queue_type(struct scsi_device *, int);
 
-struct scsi_host_template qla2x00_driver_template = {
+static struct scsi_host_template qla2x00_driver_template = {
 	.module			= THIS_MODULE,
 	.name			= QLA2XXX_DRIVER_NAME,
 	.queuecommand		= qla2x00_queuecommand,
@@ -178,13 +178,6 @@ struct scsi_transport_template *qla2xxx_transport_vport_template = NULL;
  * Timer routines
  */
 
-void qla2x00_timer(scsi_qla_host_t *);
-
-__inline__ void qla2x00_start_timer(scsi_qla_host_t *,
-    void *, unsigned long);
-static __inline__ void qla2x00_restart_timer(scsi_qla_host_t *, unsigned long);
-__inline__ void qla2x00_stop_timer(scsi_qla_host_t *);
-
 __inline__ void
 qla2x00_start_timer(scsi_qla_host_t *ha, void *func, unsigned long interval)
 {
@@ -202,7 +195,7 @@ qla2x00_restart_timer(scsi_qla_host_t *ha, unsigned long interval)
 	mod_timer(&ha->timer, jiffies + interval * HZ);
 }
 
-__inline__ void
+static __inline__ void
 qla2x00_stop_timer(scsi_qla_host_t *ha)
 {
 	del_timer_sync(&ha->timer);
@@ -213,12 +206,11 @@ static int qla2x00_do_dpc(void *data);
 
 static void qla2x00_rst_aen(scsi_qla_host_t *);
 
-uint8_t qla2x00_mem_alloc(scsi_qla_host_t *);
-void qla2x00_mem_free(scsi_qla_host_t *ha);
+static uint8_t qla2x00_mem_alloc(scsi_qla_host_t *);
+static void qla2x00_mem_free(scsi_qla_host_t *ha);
 static int qla2x00_allocate_sp_pool( scsi_qla_host_t *ha);
 static void qla2x00_free_sp_pool(scsi_qla_host_t *ha);
 static void qla2x00_sp_free_dma(scsi_qla_host_t *, srb_t *);
-void qla2x00_sp_compl(scsi_qla_host_t *ha, srb_t *);
 
 /* -------------------------------------------------------------------------- */
 
@@ -2008,7 +2000,7 @@ qla2x00_mark_all_devices_lost(scsi_qla_host_t *ha, int defer)
 *      0  = success.
 *      1  = failure.
 */
-uint8_t
+static uint8_t
 qla2x00_mem_alloc(scsi_qla_host_t *ha)
 {
 	char	name[16];
@@ -2205,7 +2197,7 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
 * Input:
 *      ha = adapter block pointer.
 */
-void
+static void
 qla2x00_mem_free(scsi_qla_host_t *ha)
 {
 	struct list_head	*fcpl, *fcptemp;
drivers/scsi/qla2xxx/qla_sup.c +4 -4
index af16c55..b68fb73 100644
@@ -22,7 +22,7 @@ static void qla2x00_nv_write(scsi_qla_host_t *, uint16_t);
  * qla2x00_lock_nvram_access() -
  * @ha: HA context
  */
-void
+static void
 qla2x00_lock_nvram_access(scsi_qla_host_t *ha)
 {
 	uint16_t data;
@@ -55,7 +55,7 @@ qla2x00_lock_nvram_access(scsi_qla_host_t *ha)
  * qla2x00_unlock_nvram_access() -
  * @ha: HA context
  */
-void
+static void
 qla2x00_unlock_nvram_access(scsi_qla_host_t *ha)
 {
 	struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
@@ -74,7 +74,7 @@ qla2x00_unlock_nvram_access(scsi_qla_host_t *ha)
  *
  * Returns the word read from nvram @addr.
  */
-uint16_t
+static uint16_t
 qla2x00_get_nvram_word(scsi_qla_host_t *ha, uint32_t addr)
 {
 	uint16_t	data;
@@ -93,7 +93,7 @@ qla2x00_get_nvram_word(scsi_qla_host_t *ha, uint32_t addr)
  * @addr: Address in NVRAM to write
  * @data: word to program
  */
-void
+static void
 qla2x00_write_nvram_word(scsi_qla_host_t *ha, uint32_t addr, uint16_t data)
 {
 	int count;
Signature · 1 line
1.5.4.rc3.14.g44397
#12 lore raw

PATCH 1/1 qla2xxx: Use completion routines.

In reply to Andrew Vasquez

From: Marcus Barrow <[email protected]>

Instead of abusing the semaphore interfaces for mailbox command completions.

Additional cleanups and

---
 drivers/scsi/qla2xxx/qla_def.h |    4 +-
 drivers/scsi/qla2xxx/qla_gbl.h |    2 -
 drivers/scsi/qla2xxx/qla_isr.c |    8 +++---
 drivers/scsi/qla2xxx/qla_mbx.c |   44 +++------------------------------------
 drivers/scsi/qla2xxx/qla_mid.c |    5 ++-
 drivers/scsi/qla2xxx/qla_os.c  |   22 ++-----------------
 6 files changed, 16 insertions(+), 69 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +2 -2
index d0b78af..144f6d0 100644
@@ -2413,9 +2413,9 @@ typedef struct scsi_qla_host {
 #define MBX_INTR_WAIT	2
 #define MBX_UPDATE_FLASH_ACTIVE	3
 
-	struct semaphore mbx_cmd_sem;	/* Serialialize mbx access */
 	struct semaphore vport_sem;	/* Virtual port synchronization */
-	struct semaphore mbx_intr_sem;  /* Used for completion notification */
+	struct completion mbx_cmd_comp;	/* Serialize mbx access */
+	struct completion mbx_intr_comp;  /* Used for completion notification */
 
 	uint32_t	mbx_flags;
 #define  MBX_IN_PROGRESS	BIT_0
drivers/scsi/qla2xxx/qla_gbl.h +0 -2
index f6917b9..fa4455f 100644
@@ -105,8 +105,6 @@ extern char *qla2x00_get_fw_version_str(struct scsi_qla_host *, char *);
 extern void qla2x00_mark_device_lost(scsi_qla_host_t *, fc_port_t *, int, int);
 extern void qla2x00_mark_all_devices_lost(scsi_qla_host_t *, int);
 
-extern int qla2x00_down_timeout(struct semaphore *, unsigned long);
-
 extern struct fw_blob *qla2x00_request_firmware(scsi_qla_host_t *);
 
 extern int qla2x00_wait_for_hba_online(scsi_qla_host_t *);
drivers/scsi/qla2xxx/qla_isr.c +4 -4
index 22216fe..642a0c3 100644
@@ -104,7 +104,7 @@ qla2100_intr_handler(int irq, void *dev_id)
 	if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
 	    (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
 		set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
-		up(&ha->mbx_intr_sem);
+		complete(&ha->mbx_intr_comp);
 	}
 
 	return (IRQ_HANDLED);
@@ -216,7 +216,7 @@ qla2300_intr_handler(int irq, void *dev_id)
 	if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
 	    (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
 		set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
-		up(&ha->mbx_intr_sem);
+		complete(&ha->mbx_intr_comp);
 	}
 
 	return (IRQ_HANDLED);
@@ -1597,7 +1597,7 @@ qla24xx_intr_handler(int irq, void *dev_id)
 	if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
 	    (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
 		set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
-		up(&ha->mbx_intr_sem);
+		complete(&ha->mbx_intr_comp);
 	}
 
 	return IRQ_HANDLED;
@@ -1734,7 +1734,7 @@ qla24xx_msix_default(int irq, void *dev_id)
 	if (test_bit(MBX_INTR_WAIT, &ha->mbx_cmd_flags) &&
 	    (status & MBX_INTERRUPT) && ha->flags.mbox_int) {
 		set_bit(MBX_INTERRUPT, &ha->mbx_cmd_flags);
-		up(&ha->mbx_intr_sem);
+		complete(&ha->mbx_intr_comp);
 	}
 
 	return IRQ_HANDLED;
drivers/scsi/qla2xxx/qla_mbx.c +4 -40

83 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_mid.c +3 -2
index 74096aa..325bdab 100644
@@ -403,8 +403,9 @@ qla24xx_create_vhost(struct fc_vport *fc_vport)
 	}
 	vha->mgmt_svr_loop_id = 10 + vha->vp_idx;
 
-	init_MUTEX(&vha->mbx_cmd_sem);
-	init_MUTEX_LOCKED(&vha->mbx_intr_sem);
+	init_completion(&vha->mbx_cmd_comp);
+	complete(&vha->mbx_cmd_comp);
+	init_completion(&vha->mbx_intr_comp);
 
 	INIT_LIST_HEAD(&vha->list);
 	INIT_LIST_HEAD(&vha->fcports);
drivers/scsi/qla2xxx/qla_os.c +3 -19
index bb2d3d6..19d0f95 100644
@@ -1692,9 +1692,10 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 	/* load the F/W, read paramaters, and init the H/W */
 	ha->instance = num_hosts;
 
-	init_MUTEX(&ha->mbx_cmd_sem);
 	init_MUTEX(&ha->vport_sem);
-	init_MUTEX_LOCKED(&ha->mbx_intr_sem);
+	init_completion(&ha->mbx_cmd_comp);
+	complete(&ha->mbx_cmd_comp);
+	init_completion(&ha->mbx_intr_comp);
 
 	INIT_LIST_HEAD(&ha->list);
 	INIT_LIST_HEAD(&ha->fcports);
@@ -2739,23 +2740,6 @@ qla2x00_timer(scsi_qla_host_t *ha)
 	qla2x00_restart_timer(ha, WATCH_INTERVAL);
 }
 
-/* XXX(hch): crude hack to emulate a down_timeout() */
-int
-qla2x00_down_timeout(struct semaphore *sema, unsigned long timeout)
-{
-	const unsigned int step = 100; /* msecs */
-	unsigned int iterations = jiffies_to_msecs(timeout)/100;
-
-	do {
-		if (!down_trylock(sema))
-			return 0;
-		if (msleep_interruptible(step))
-			break;
-	} while (--iterations > 0);
-
-	return -ETIMEDOUT;
-}
-
 /* Firmware interface routines. */
 
 #define FW_BLOBS	6
Signature · 1 line
1.5.4.rc3.14.g44397
#13 lore raw

PATCH 1/1 qla2xxx: Trace-Control naming cleanups.

In reply to Andrew Vasquez

In preparation for FCE (Fibre Channel Event) tracing support.

---
 drivers/scsi/qla2xxx/qla_def.h  |    3 --
 drivers/scsi/qla2xxx/qla_fw.h   |    7 +++++
 drivers/scsi/qla2xxx/qla_gbl.h  |    4 ++-
 drivers/scsi/qla2xxx/qla_init.c |    5 +--
 drivers/scsi/qla2xxx/qla_mbx.c  |   49 +++++++++++++++++++++++++++++---------
 drivers/scsi/qla2xxx/qla_os.c   |    2 +-
 6 files changed, 50 insertions(+), 20 deletions(-)
drivers/scsi/qla2xxx/qla_def.h +0 -3
index 144f6d0..3f934bd 100644
@@ -623,9 +623,6 @@ typedef struct {
 #define MBC_GET_LINK_PRIV_STATS		0x6d	/* Get link & private data. */
 #define MBC_SET_VENDOR_ID		0x76	/* Set Vendor ID. */
 
-#define TC_ENABLE			4
-#define TC_DISABLE			5
-
 /* Firmware return data sizes */
 #define FCAL_MAP_SIZE	128
 
drivers/scsi/qla2xxx/qla_fw.h +7 -0
index 69a5e31..ef14bcd 100644
@@ -952,6 +952,13 @@ struct device_reg_24xx {
 	uint32_t iobase_sdata;
 };
 
+/* Trace Control *************************************************************/
+
+#define TC_AEN_DISABLE		0
+
+#define TC_EFT_ENABLE		4
+#define TC_EFT_DISABLE		5
+
 /* MID Support ***************************************************************/
 
 #define MIN_MULTI_ID_FABRIC	64	/* Must be power-of-2. */
drivers/scsi/qla2xxx/qla_gbl.h +3 -1
index fd75539..2fd31fd 100644
@@ -228,7 +228,9 @@ extern int
 qla2x00_stop_firmware(scsi_qla_host_t *);
 
 extern int
-qla2x00_trace_control(scsi_qla_host_t *, uint16_t, dma_addr_t, uint16_t);
+qla2x00_enable_eft_trace(scsi_qla_host_t *, dma_addr_t, uint16_t);
+extern int
+qla2x00_disable_eft_trace(scsi_qla_host_t *);
 
 extern int
 qla2x00_read_sfp(scsi_qla_host_t *, dma_addr_t, uint16_t, uint16_t, uint16_t);
drivers/scsi/qla2xxx/qla_init.c +2 -3
index 03444d6..da2cce0 100644
@@ -766,8 +766,7 @@ qla2x00_alloc_fw_dump(scsi_qla_host_t *ha)
 			goto cont_alloc;
 		}
 
-		rval = qla2x00_trace_control(ha, TC_ENABLE, eft_dma,
-		    EFT_NUM_BUFFERS);
+		rval = qla2x00_enable_eft_trace(ha, eft_dma, EFT_NUM_BUFFERS);
 		if (rval) {
 			qla_printk(KERN_WARNING, ha, "Unable to initialize "
 			    "EFT (%d).\n", rval);
@@ -3240,7 +3239,7 @@ qla2x00_abort_isp(scsi_qla_host_t *ha)
 			clear_bit(ISP_ABORT_RETRY, &ha->dpc_flags);
 
 			if (ha->eft) {
-				rval = qla2x00_trace_control(ha, TC_ENABLE,
+				rval = qla2x00_enable_eft_trace(ha,
 				    ha->eft_dma, EFT_NUM_BUFFERS);
 				if (rval) {
 					qla_printk(KERN_WARNING, ha,
drivers/scsi/qla2xxx/qla_mbx.c +37 -12

66 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_os.c +1 -1
index 2dd4371..37b02c0 100644
@@ -1856,7 +1856,7 @@ qla2x00_free_device(scsi_qla_host_t *ha)
 	}
 
 	if (ha->eft)
-		qla2x00_trace_control(ha, TC_DISABLE, 0, 0);
+		qla2x00_disable_eft_trace(ha);
 
 	ha->flags.online = 0;
 
Signature · 1 line
1.5.4.rc3.14.g44397
#14 lore raw

PATCH 1/1 qla2xxx: Add Fibre Channel Event (FCE) tracing support.

In reply to Andrew Vasquez

FCE support enables the firmware to record FC extended link services and basic link services frames which have been transmitted and received by the ISP. This allows for a limited view of the FC traffic through the ISP without using a FC analyzer. This can be useful in situations where a physical connection to the FC bus is not possible.

The driver exports this information in two ways -- first, via a debugfs node exported for all supported ISPs under:

	<debugfs_mount_point>/qla2xxx/qla2xxx_<host_no>/fce

where a read of the 'fce' file will provide a snapshot of the firmware's FCE buffer; and finally, the FCE buffer will be extracted during a firmware-dump scenario.

---
 drivers/scsi/qla2xxx/Makefile   |    2 +-
 drivers/scsi/qla2xxx/qla_dbg.c  |   22 +++++
 drivers/scsi/qla2xxx/qla_dbg.h  |   19 ++++
 drivers/scsi/qla2xxx/qla_def.h  |   10 ++
 drivers/scsi/qla2xxx/qla_dfs.c  |  175 +++++++++++++++++++++++++++++++++++++++
 drivers/scsi/qla2xxx/qla_fw.h   |    7 ++
 drivers/scsi/qla2xxx/qla_gbl.h  |   13 +++
 drivers/scsi/qla2xxx/qla_init.c |   73 +++++++++++++---
 drivers/scsi/qla2xxx/qla_mbx.c  |   87 +++++++++++++++++++
 drivers/scsi/qla2xxx/qla_os.c   |   11 +++
 10 files changed, 405 insertions(+), 14 deletions(-)
 create mode 100644 drivers/scsi/qla2xxx/qla_dfs.c
drivers/scsi/qla2xxx/Makefile +1 -1
index 71ddb5d..c51fd1f 100644
@@ -1,4 +1,4 @@
 qla2xxx-y := qla_os.o qla_init.o qla_mbx.o qla_iocb.o qla_isr.o qla_gs.o \
-		qla_dbg.o qla_sup.o qla_attr.o qla_mid.o
+		qla_dbg.o qla_sup.o qla_attr.o qla_mid.o qla_dfs.o
 
 obj-$(CONFIG_SCSI_QLA_FC) += qla2xxx.o
drivers/scsi/qla2xxx/qla_dbg.c +22 -0
index 796c4ce..d88e98c 100644
@@ -1051,6 +1051,7 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
 	struct qla25xx_fw_dump *fw;
 	uint32_t	ext_mem_cnt;
 	void		*nxt;
+	struct qla2xxx_fce_chain *fcec;
 
 	risc_address = ext_mem_cnt = 0;
 	flags = 0;
@@ -1321,10 +1322,31 @@ qla25xx_fw_dump(scsi_qla_host_t *ha, int hardware_locked)
 	if (rval != QLA_SUCCESS)
 		goto qla25xx_fw_dump_failed_0;
 
+	/* Fibre Channel Trace Buffer. */
 	nxt = qla2xxx_copy_queues(ha, nxt);
 	if (ha->eft)
 		memcpy(nxt, ha->eft, ntohl(ha->fw_dump->eft_size));
 
+	/* Fibre Channel Event Buffer. */
+	if (!ha->fce)
+		goto qla25xx_fw_dump_failed_0;
+
+	ha->fw_dump->version |= __constant_htonl(DUMP_CHAIN_VARIANT);
+
+	fcec = nxt + ntohl(ha->fw_dump->eft_size);
+	fcec->type = __constant_htonl(DUMP_CHAIN_FCE | DUMP_CHAIN_LAST);
+	fcec->chain_size = htonl(sizeof(struct qla2xxx_fce_chain) +
+	    fce_calc_size(ha->fce_bufs));
+	fcec->size = htonl(fce_calc_size(ha->fce_bufs));
+	fcec->addr_l = htonl(LSD(ha->fce_dma));
+	fcec->addr_h = htonl(MSD(ha->fce_dma));
+
+	iter_reg = fcec->eregs;
+	for (cnt = 0; cnt < 8; cnt++)
+		*iter_reg++ = htonl(ha->fce_mb[cnt]);
+
+	memcpy(iter_reg, ha->fce, ntohl(fcec->size));
+
 qla25xx_fw_dump_failed_0:
 	if (rval != QLA_SUCCESS) {
 		qla_printk(KERN_WARNING, ha,
drivers/scsi/qla2xxx/qla_dbg.h +19 -0
index a50ecf0..524598a 100644
@@ -256,6 +256,25 @@ struct qla25xx_fw_dump {
 #define EFT_BYTES_PER_BUFFER	0x4000
 #define EFT_SIZE		((EFT_BYTES_PER_BUFFER) * (EFT_NUM_BUFFERS))
 
+#define FCE_NUM_BUFFERS		64
+#define FCE_BYTES_PER_BUFFER	0x400
+#define FCE_SIZE		((FCE_BYTES_PER_BUFFER) * (FCE_NUM_BUFFERS))
+#define fce_calc_size(b)	((FCE_BYTES_PER_BUFFER) * (b))
+
+struct qla2xxx_fce_chain {
+	uint32_t type;
+	uint32_t chain_size;
+
+	uint32_t size;
+	uint32_t addr_l;
+	uint32_t addr_h;
+	uint32_t eregs[8];
+};
+
+#define DUMP_CHAIN_VARIANT	0x80000000
+#define DUMP_CHAIN_FCE		0x7FFFFAF0
+#define DUMP_CHAIN_LAST		0x80000000
+
 struct qla2xxx_fw_dump {
 	uint8_t signature[4];
 	uint32_t version;
drivers/scsi/qla2xxx/qla_def.h +10 -0
index 3f934bd..6f129da 100644
@@ -2156,6 +2156,7 @@ typedef struct scsi_qla_host {
 		uint32_t	gpsc_supported		:1;
 		uint32_t        vsan_enabled            :1;
 		uint32_t	npiv_supported		:1;
+		uint32_t	fce_enabled		:1;
 	} flags;
 
 	atomic_t	loop_state;
@@ -2449,6 +2450,15 @@ typedef struct scsi_qla_host {
 	dma_addr_t	eft_dma;
 	void		*eft;
 
+	struct dentry *dfs_dir;
+	struct dentry *dfs_fce;
+	dma_addr_t	fce_dma;
+	void		*fce;
+	uint32_t	fce_bufs;
+	uint16_t	fce_mb[8];
+	uint64_t	fce_wr, fce_rd;
+	struct mutex	fce_mutex;
+
 	uint8_t		host_str[16];
 	uint32_t	pci_attr;
 	uint16_t	chip_revision;
drivers/scsi/qla2xxx/qla_dfs.c new file +175 -0

175 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_fw.h +7 -0
index ef14bcd..9337e13 100644
@@ -959,6 +959,13 @@ struct device_reg_24xx {
 #define TC_EFT_ENABLE		4
 #define TC_EFT_DISABLE		5
 
+#define TC_FCE_ENABLE		8
+#define TC_FCE_OPTIONS		0
+#define TC_FCE_DEFAULT_RX_SIZE	2112
+#define TC_FCE_DEFAULT_TX_SIZE	2112
+#define TC_FCE_DISABLE		9
+#define TC_FCE_DISABLE_TRACE	BIT_0
+
 /* MID Support ***************************************************************/
 
 #define MIN_MULTI_ID_FABRIC	64	/* Must be power-of-2. */
drivers/scsi/qla2xxx/qla_gbl.h +13 -0
index 2fd31fd..ba35fc2 100644
@@ -233,6 +233,13 @@ extern int
 qla2x00_disable_eft_trace(scsi_qla_host_t *);
 
 extern int
+qla2x00_enable_fce_trace(scsi_qla_host_t *, dma_addr_t, uint16_t , uint16_t *,
+    uint32_t *);
+
+extern int
+qla2x00_disable_fce_trace(scsi_qla_host_t *, uint64_t *, uint64_t *);
+
+extern int
 qla2x00_read_sfp(scsi_qla_host_t *, dma_addr_t, uint16_t, uint16_t, uint16_t);
 
 extern int
@@ -334,4 +341,10 @@ extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *);
 extern void qla2x00_init_host_attr(scsi_qla_host_t *);
 extern void qla2x00_alloc_sysfs_attr(scsi_qla_host_t *);
 extern void qla2x00_free_sysfs_attr(scsi_qla_host_t *);
+
+/*
+ * Global Function Prototypes in qla_dfs.c source file.
+ */
+extern int qla2x00_dfs_setup(scsi_qla_host_t *);
+extern int qla2x00_dfs_remove(scsi_qla_host_t *);
 #endif /* _QLA_GBL_H */
drivers/scsi/qla2xxx/qla_init.c +60 -13

118 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_mbx.c +87 -0

93 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_os.c +11 -0
index 37b02c0..aba1e6d 100644
@@ -1791,6 +1791,8 @@ qla2x00_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
 
 	qla2x00_init_host_attr(ha);
 
+	qla2x00_dfs_setup(ha);
+
 	qla_printk(KERN_INFO, ha, "\n"
 	    " QLogic Fibre Channel HBA Driver: %s\n"
 	    "  QLogic %s - %s\n"
@@ -1822,6 +1824,8 @@ qla2x00_remove_one(struct pci_dev *pdev)
 
 	ha = pci_get_drvdata(pdev);
 
+	qla2x00_dfs_remove(ha);
+
 	qla2x00_free_sysfs_attr(ha);
 
 	fc_remove_host(ha->host);
@@ -1855,6 +1859,9 @@ qla2x00_free_device(scsi_qla_host_t *ha)
 		kthread_stop(t);
 	}
 
+	if (ha->flags.fce_enabled)
+		qla2x00_disable_fce_trace(ha, NULL, NULL);
+
 	if (ha->eft)
 		qla2x00_disable_eft_trace(ha);
 
@@ -2212,6 +2219,10 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
 	/* free sp pool */
 	qla2x00_free_sp_pool(ha);
 
+	if (ha->fce)
+		dma_free_coherent(&ha->pdev->dev, FCE_SIZE, ha->fce,
+		    ha->fce_dma);
+
 	if (ha->fw_dump) {
 		if (ha->eft)
 			dma_free_coherent(&ha->pdev->dev,
Signature · 1 line
1.5.4.rc3.14.g44397
#15 lore raw
In reply to Andrew Vasquez
Quoted 1 line · Andrew Vasquez

This patchset updates the qla2xxx driver to 8.02.00-k7.

...

BTW: Small typo in the subject, it's obvious these patches aren't for 2.6.24, instead, meant for the next merge window of 2.6.25...

maintainer
#16 lore raw
Quoted 8 lines · Andrew Vasquez
Quoted 1 line · Andrew Vasquez

This patchset updates the qla2xxx driver to 8.02.00-k7.

...

BTW: Small typo in the subject, it's obvious these patches aren't for 2.6.24, instead, meant for the next merge window of 2.6.25...

I was just about to ask about that.

Your patches are all unnumbered, which makes applying them a pain unless they're all independent; are they?

James

#17 lore raw
Quoted 7 lines · James Bottomley
Quoted 6 lines · Andrew Vasquez
Quoted 1 line · Andrew Vasquez

This patchset updates the qla2xxx driver to 8.02.00-k7.

...

Quoted 7 lines
Quoted 2 lines

BTW: Small typo in the subject, it's obvious these patches aren't for 2.6.24, instead, meant for the next merge window of 2.6.25...

I was just about to ask about that.

Your patches are all unnumbered, which makes applying them a pain unless they're all independent; are they?

Cazzo! No, sorry about that, there's some ordering required. The order should be:

[PATCH 01/14] qla2xxx: Consolidate duplicate sense-data handling codes.
[PATCH 02/14] qla2xxx: Retrieve additional HBA port statistics from recent ISPs. [PATCH 03/14] qla2xxx: Fix for 32-bit platforms with 64-bit resources.
[PATCH 04/14] qla2xxx: Wait for FLASH write-protection to complete after a write. [PATCH 05/14] qla2xxx: Restrict MSI/MSI-X enablement on select ISP2432-type HBAs. [PATCH 06/14] qla2xxx: Don't schedule the DPC routine to perform an issue-lip request. [PATCH 07/14] qla2xxx: Use completion routines.
[PATCH 08/14] qla2xxx: Add a filter to compare port_name against the physical on vport creation. [PATCH 09/14] qla2xxx: Code cleanups.
[PATCH 10/14] qla2xxx: Trace-Control naming cleanups.
[PATCH 11/14] qla2xxx: Add Fibre Channel Event (FCE) tracing support.
[PATCH 12/14] qla2xxx: Correct late-memset() of EFT buffer.
[PATCH 13/14] qla2xxx: Issue correct MBC_INITIALIZE_FIRMWARE command.
[PATCH 14/14] qla2xxx: Update version number to 8.02.00-k7.

I believe git-send-email adjusts the 'seconds' field in the 'Date' header, so hopefully, your threaded email reader maintained the order. If not, if you like, I can resend with the X/Y prefix.