Skip to contentSkip to conversation

qla2xxx: driver update.

PATCH In review Andrew Vasquez 7 participants 25 messages Oct 2, 2006 – Oct 12, 2006

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

cover qla2xxx: driver update.

This patchset updates the qla2xxx driver to 8.01.07-k2.

 drivers/scsi/qla2xxx/qla_attr.c    |   57 +++++++++-
 drivers/scsi/qla2xxx/qla_def.h     |   40 ++++++-
 drivers/scsi/qla2xxx/qla_gbl.h     |    9 ++
 drivers/scsi/qla2xxx/qla_gs.c      |  228 +++++++++++++++++++++++++++++++++---
 drivers/scsi/qla2xxx/qla_init.c    |   84 +++++++++++++-
 drivers/scsi/qla2xxx/qla_isr.c     |    4 +-
 drivers/scsi/qla2xxx/qla_mbx.c     |   86 ++++++++++++++
 drivers/scsi/qla2xxx/qla_os.c      |   48 +++++++-
 drivers/scsi/qla2xxx/qla_version.h |    2 +-
 9 files changed, 524 insertions(+), 34 deletions(-)

here's the commits:

- Add iIDMA support.
- Add support for symbolic nodename FC transport attribute.
- Add support for system hostname FC transport attribute.
- Add support for fabric name FC transport attribute.
- Add support for host port state FC transport attribute.
- Add MODULE_FIRMWARE tags.
- Stall mid-layer error handlers while rport is blocked.
- Update version number to 8.01.07-k2.

#1 lore raw

PATCH 1/8 qla2xxx: Add iIDMA support.

iIDMA (Intelligent Interleaved Direct Memory Access) allows for the HBA hardware to send FC frames at the rate at which they can be received by a target device. By taking advantage of the higher link rate, the HBA can maximize bandwidth utilization in a heterogeneous multi-speed SAN.

Within a fabric topology, port speed detection is done via a Name Server command (GFPN_ID) followed by a Fabric Management command (GPSC). In an FCAL/N2N topology, port speed is based on the HBA link-rate.

---
 drivers/scsi/qla2xxx/qla_attr.c |    6 +-
 drivers/scsi/qla2xxx/qla_def.h  |   39 +++++++-
 drivers/scsi/qla2xxx/qla_gbl.h  |    8 ++
 drivers/scsi/qla2xxx/qla_gs.c   |  187 ++++++++++++++++++++++++++++++++++++++-
 drivers/scsi/qla2xxx/qla_init.c |   81 +++++++++++++++++
 drivers/scsi/qla2xxx/qla_isr.c  |    4 +-
 drivers/scsi/qla2xxx/qla_mbx.c  |   86 ++++++++++++++++++
 drivers/scsi/qla2xxx/qla_os.c   |    2 +-
 8 files changed, 401 insertions(+), 12 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +3 -3
index 87f90c4..144b0f8 100644
@@ -691,13 +691,13 @@ qla2x00_get_host_speed(struct Scsi_Host 
 	uint32_t speed = 0;
 
 	switch (ha->link_data_rate) {
-	case LDR_1GB:
+	case PORT_SPEED_1GB:
 		speed = 1;
 		break;
-	case LDR_2GB:
+	case PORT_SPEED_2GB:
 		speed = 2;
 		break;
-	case LDR_4GB:
+	case PORT_SPEED_4GB:
 		speed = 4;
 		break;
 	}
drivers/scsi/qla2xxx/qla_def.h +34 -5
index 0930260..6d677b0 100644
@@ -608,6 +608,7 @@ #define MBC_LUN_RESET			0x7E	/* Send LUN
  */
 #define MBC_SERDES_PARAMS		0x10	/* Serdes Tx Parameters. */
 #define MBC_GET_IOCB_STATUS		0x12	/* Get IOCB status command. */
+#define MBC_PORT_PARAMS			0x1A	/* Port iDMA Parameters. */
 #define MBC_GET_TIMEOUT_PARAMS		0x22	/* Get FW timeouts. */
 #define MBC_TRACE_CONTROL		0x27	/* Trace control command. */
 #define MBC_GEN_SYSTEM_ERROR		0x2a	/* Generate System Error. */
@@ -1497,6 +1498,9 @@ typedef struct {
 	port_id_t d_id;
 	uint8_t node_name[WWN_SIZE];
 	uint8_t port_name[WWN_SIZE];
+	uint8_t fabric_port_name[WWN_SIZE];
+	uint16_t fp_speeds;
+	uint16_t fp_speed;
 } sw_info_t;
 
 /*
@@ -1524,6 +1528,9 @@ typedef struct fc_port {
 	uint16_t loop_id;
 	uint16_t old_loop_id;
 
+	uint8_t fabric_port_name[WWN_SIZE];
+	uint16_t fp_speed;
+
 	fc_port_type_t port_type;
 
 	atomic_t state;
@@ -1635,6 +1642,15 @@ #define	RSNN_NN_CMD	 0x239
 #define	RSNN_NN_REQ_SIZE (16 + 8 + 1 + 255)
 #define	RSNN_NN_RSP_SIZE 16
 
+#define	GFPN_ID_CMD	0x11C
+#define	GFPN_ID_REQ_SIZE (16 + 4)
+#define	GFPN_ID_RSP_SIZE (16 + 8)
+
+#define	GPSC_CMD	0x127
+#define	GPSC_REQ_SIZE	(16 + 8)
+#define	GPSC_RSP_SIZE	(16 + 2 + 2)
+
+
 /*
  * HBA attribute types.
  */
@@ -1748,7 +1764,7 @@ struct ct_sns_req {
 	uint8_t reserved[3];
 
 	union {
-		/* GA_NXT, GPN_ID, GNN_ID, GFT_ID */
+		/* GA_NXT, GPN_ID, GNN_ID, GFT_ID, GFPN_ID */
 		struct {
 			uint8_t reserved;
 			uint8_t port_id[3];
@@ -1823,6 +1839,10 @@ struct ct_sns_req {
 		struct {
 			uint8_t port_name[8];
 		} dpa;
+
+		struct {
+			uint8_t port_name[8];
+		} gpsc;
 	} req;
 };
 
@@ -1886,6 +1906,15 @@ struct ct_sns_rsp {
 			uint8_t port_name[8];
 			struct ct_fdmi_hba_attributes attrs;
 		} ghat;
+
+		struct {
+			uint8_t port_name[8];
+		} gfpn_id;
+
+		struct {
+			uint16_t speeds;
+			uint16_t speed;
+		} gpsc;
 	} rsp;
 };
 
@@ -2182,11 +2211,11 @@ #define MIN_IOBASE_LEN		0x100
 	uint16_t	max_public_loop_ids;
 	uint16_t	min_external_loopid;	/* First external loop Id */
 
+#define PORT_SPEED_UNKNOWN 0xFFFF
+#define PORT_SPEED_1GB	0x00
+#define PORT_SPEED_2GB	0x01
+#define PORT_SPEED_4GB	0x03
 	uint16_t	link_data_rate;		/* F/W operating speed */
-#define LDR_1GB		0
-#define LDR_2GB		1
-#define LDR_4GB		3
-#define LDR_UNKNOWN	0xFFFF
 
 	uint8_t		current_topology;
 	uint8_t		prev_topology;
drivers/scsi/qla2xxx/qla_gbl.h +8 -0
index 8311ac2..c48e1d8 100644
@@ -208,6 +208,12 @@ qla2x00_trace_control(scsi_qla_host_t *,
 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 *);
+
 /*
  * Global Function Prototypes in qla_isr.c source file.
  */
@@ -279,6 +285,8 @@ extern int qla2x00_rsnn_nn(scsi_qla_host
 extern void *qla2x00_prep_ms_fdmi_iocb(scsi_qla_host_t *, uint32_t, uint32_t);
 extern void *qla24xx_prep_ms_fdmi_iocb(scsi_qla_host_t *, uint32_t, uint32_t);
 extern int qla2x00_fdmi_register(scsi_qla_host_t *);
+extern int qla2x00_gfpn_id(scsi_qla_host_t *, sw_info_t *);
+extern int qla2x00_gpsc(scsi_qla_host_t *, sw_info_t *);
 
 /*
  * Global Function Prototypes in qla_attr.c source file.
drivers/scsi/qla2xxx/qla_gs.c +186 -1

196 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_init.c +81 -0

117 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_isr.c +2 -2
index de06131..5fa933c 100644
@@ -400,7 +400,7 @@ #define LS_UNKNOWN	2
 	case MBA_LOOP_UP:		/* Loop Up Event */
 		if (IS_QLA2100(ha) || IS_QLA2200(ha)) {
 			link_speed = link_speeds[0];
-			ha->link_data_rate = LDR_1GB;
+			ha->link_data_rate = PORT_SPEED_1GB;
 		} else {
 			link_speed = link_speeds[LS_UNKNOWN];
 			if (mb[1] < 5)
@@ -429,7 +429,7 @@ #define LS_UNKNOWN	2
 		}
 
 		ha->flags.management_server_logged_in = 0;
-		ha->link_data_rate = LDR_UNKNOWN;
+		ha->link_data_rate = PORT_SPEED_UNKNOWN;
 		if (ql2xfdmienable)
 			set_bit(REGISTER_FDMI_NEEDED, &ha->dpc_flags);
 		break;
drivers/scsi/qla2xxx/qla_mbx.c +86 -0

89 lines not on this page · raw message

drivers/scsi/qla2xxx/qla_os.c +1 -1
index 65cbe2f..9e665e1 100644
@@ -1385,7 +1385,7 @@ qla2x00_probe_one(struct pci_dev *pdev, 
 	ha->prev_topology = 0;
 	ha->init_cb_size = sizeof(init_cb_t);
 	ha->mgmt_svr_loop_id = MANAGEMENT_SERVER;
-	ha->link_data_rate = LDR_UNKNOWN;
+	ha->link_data_rate = PORT_SPEED_UNKNOWN;
 	ha->optrom_size = OPTROM_SIZE_2300;
 
 	/* Assign ISP specific operations. */
Signature · 1 line
1.4.2.3.gf59615
#2 lore raw

Re: [PATCH 1/8] qla2xxx: Add iIDMA support.

Quoted 10 lines · Andrew Vasquez

iIDMA (Intelligent Interleaved Direct Memory Access) allows for the HBA hardware to send FC frames at the rate at which they can be received by a target device. By taking advantage of the higher link rate, the HBA can maximize bandwidth utilization in a heterogeneous multi-speed SAN.

Within a fabric topology, port speed detection is done via a Name Server command (GFPN_ID) followed by a Fabric Management command (GPSC). In an FCAL/N2N topology, port speed is based on the HBA link-rate.

Looks good to me.

#3 lore raw

PATCH 2/8 qla2xxx: Add support for symbolic nodename FC transport attribute.

In reply to Andrew Vasquez

Refactored original code from qla_gs.c:qla2x00_rsnn_nn().

---
 drivers/scsi/qla2xxx/qla_attr.c |   10 ++++++++++
 drivers/scsi/qla2xxx/qla_gbl.h  |    1 +
 drivers/scsi/qla2xxx/qla_gs.c   |   26 +++++++++++---------------
 3 files changed, 22 insertions(+), 15 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +10 -0
index 144b0f8..4638469 100644
@@ -849,6 +849,14 @@ qla2x00_get_fc_host_stats(struct Scsi_Ho
 	return pfc_host_stat;
 }
 
+static void
+qla2x00_get_host_symbolic_name(struct Scsi_Host *shost)
+{
+	scsi_qla_host_t *ha = to_qla_host(shost);
+
+	qla2x00_get_sym_node_name(ha, fc_host_symbolic_name(shost));
+}
+
 struct fc_function_template qla2xxx_transport_functions = {
 
 	.show_host_node_name = 1,
@@ -861,6 +869,8 @@ struct fc_function_template qla2xxx_tran
 	.show_host_speed = 1,
 	.get_host_port_type = qla2x00_get_host_port_type,
 	.show_host_port_type = 1,
+	.get_host_symbolic_name = qla2x00_get_host_symbolic_name,
+	.show_host_symbolic_name = 1,
 
 	.dd_fcrport_size = sizeof(struct fc_port *),
 	.show_rport_supported_classes = 1,
drivers/scsi/qla2xxx/qla_gbl.h +1 -0
index c48e1d8..bef7011 100644
@@ -287,6 +287,7 @@ extern void *qla24xx_prep_ms_fdmi_iocb(s
 extern int qla2x00_fdmi_register(scsi_qla_host_t *);
 extern int qla2x00_gfpn_id(scsi_qla_host_t *, sw_info_t *);
 extern int qla2x00_gpsc(scsi_qla_host_t *, sw_info_t *);
+extern void qla2x00_get_sym_node_name(scsi_qla_host_t *, uint8_t *);
 
 /*
  * Global Function Prototypes in qla_attr.c source file.
drivers/scsi/qla2xxx/qla_gs.c +11 -15
index 029953c..225cf72 100644
@@ -612,6 +612,14 @@ qla2x00_rnn_id(scsi_qla_host_t *ha)
 	return (rval);
 }
 
+void
+qla2x00_get_sym_node_name(scsi_qla_host_t *ha, uint8_t *snn)
+{
+	sprintf(snn, "%s FW:v%d.%02d.%02d DVR:v%s",ha->model_number,
+	    ha->fw_major_version, ha->fw_minor_version,
+	    ha->fw_subminor_version, qla2x00_version_str);
+}
+
 /**
  * qla2x00_rsnn_nn() - SNS Register Symbolic Node Name (RSNN_NN) of the HBA.
  * @ha: HA context
@@ -622,9 +630,6 @@ int
 qla2x00_rsnn_nn(scsi_qla_host_t *ha)
 {
 	int		rval;
-	uint8_t		*snn;
-	uint8_t		version[20];
-
 	ms_iocb_entry_t	*ms_pkt;
 	struct ct_sns_req	*ct_req;
 	struct ct_sns_rsp	*ct_rsp;
@@ -649,20 +654,11 @@ qla2x00_rsnn_nn(scsi_qla_host_t *ha)
 	memcpy(ct_req->req.rsnn_nn.node_name, ha->node_name, WWN_SIZE);
 
 	/* Prepare the Symbolic Node Name */
-	/* Board type */
-	snn = ct_req->req.rsnn_nn.sym_node_name;
-	strcpy(snn, ha->model_number);
-	/* Firmware version */
-	strcat(snn, " FW:v");
-	sprintf(version, "%d.%02d.%02d", ha->fw_major_version,
-	    ha->fw_minor_version, ha->fw_subminor_version);
-	strcat(snn, version);
-	/* Driver version */
-	strcat(snn, " DVR:v");
-	strcat(snn, qla2x00_version_str);
+	qla2x00_get_sym_node_name(ha, ct_req->req.rsnn_nn.sym_node_name);
 
 	/* Calculate SNN length */
-	ct_req->req.rsnn_nn.name_len = (uint8_t)strlen(snn);
+	ct_req->req.rsnn_nn.name_len =
+	    (uint8_t)strlen(ct_req->req.rsnn_nn.sym_node_name);
 
 	/* Update MS IOCB request */
 	ms_pkt->req_bytecount =
Signature · 1 line
1.4.2.3.gf59615
#4 lore raw

Re: [PATCH 2/8] qla2xxx: Add support for symbolic nodename FC transport attribute.

Quoted 1 line · Andrew Vasquez

Refactored original code from qla_gs.c:qla2x00_rsnn_nn().

Ok. Should we also allow to change the name from userspace?

#5 lore raw

Re: [PATCH 2/8] qla2xxx: Add support for symbolic nodename FC transport attribute.

Quoted 4 lines · Christoph Hellwig
Quoted 1 line · Andrew Vasquez

Refactored original code from qla_gs.c:qla2x00_rsnn_nn().

Ok. Should we also allow to change the name from userspace?

Maybe... FC-GS provides for no restrictions on format or content. Most initiator/target implementations I've seen have common items such as Manufacturer, Part ID, and driver/firmware version in the field. It might be useful (at least from a initiator perspective) within a virtualized environment to allow for information to be added to the SNN field, e.g. container id, DOM #, or some Virtual OS metadata.

Mike, James, Eric, any thoughts?

#6 lore raw

PATCH 3/8 qla2xxx: Add support for system hostname FC transport attribute.

In reply to Andrew Vasquez

The system hostname will be used during a subsequent FDMI registration with the fabric.

---
 drivers/scsi/qla2xxx/qla_attr.c |   10 ++++++++++
 drivers/scsi/qla2xxx/qla_gs.c   |   15 +++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +10 -0
index 4638469..4e1e175 100644
@@ -857,6 +857,14 @@ qla2x00_get_host_symbolic_name(struct Sc
 	qla2x00_get_sym_node_name(ha, fc_host_symbolic_name(shost));
 }
 
+static void
+qla2x00_set_host_system_hostname(struct Scsi_Host *shost)
+{
+	scsi_qla_host_t *ha = to_qla_host(shost);
+
+	set_bit(REGISTER_FDMI_NEEDED, &ha->dpc_flags);
+}
+
 struct fc_function_template qla2xxx_transport_functions = {
 
 	.show_host_node_name = 1,
@@ -871,6 +879,8 @@ struct fc_function_template qla2xxx_tran
 	.show_host_port_type = 1,
 	.get_host_symbolic_name = qla2x00_get_host_symbolic_name,
 	.show_host_symbolic_name = 1,
+	.set_host_system_hostname = qla2x00_set_host_system_hostname,
+	.show_host_system_hostname = 1,
 
 	.dd_fcrport_size = sizeof(struct fc_port *),
 	.show_rport_supported_classes = 1,
drivers/scsi/qla2xxx/qla_gs.c +15 -0
index 225cf72..97fbc62 100644
@@ -1580,6 +1580,21 @@ qla2x00_fdmi_rpa(scsi_qla_host_t *ha)
 	DEBUG13(printk("%s(%ld): OS_DEVICE_NAME=%s.\n", __func__, ha->host_no,
 	    eiter->a.os_dev_name));
 
+	/* Hostname. */
+	if (strlen(fc_host_system_hostname(ha->host))) {
+		eiter = (struct ct_fdmi_port_attr *) (entries + size);
+		eiter->type = __constant_cpu_to_be16(FDMI_PORT_HOST_NAME);
+		snprintf(eiter->a.host_name, sizeof(eiter->a.host_name),
+		    "%s", fc_host_system_hostname(ha->host));
+		alen = strlen(eiter->a.host_name);
+		alen += (alen & 3) ? (4 - (alen & 3)) : 4;
+		eiter->len = cpu_to_be16(4 + alen);
+		size += 4 + alen;
+
+		DEBUG13(printk("%s(%ld): HOSTNAME=%s.\n", __func__,
+		    ha->host_no, eiter->a.host_name));
+	}
+
 	/* Update MS request size. */
 	qla2x00_update_ms_fdmi_iocb(ha, size + 16);
 
Signature · 1 line
1.4.2.3.gf59615
#7 lore raw

Re: [PATCH 3/8] qla2xxx: Add support for system hostname FC transport attribute.

Quoted 14 lines · Andrew Vasquez

The system hostname will be used during a subsequent FDMI registration with the fabric.

---
 drivers/scsi/qla2xxx/qla_attr.c |   10 ++++++++++
 drivers/scsi/qla2xxx/qla_gs.c   |   15 +++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +0 -0
index 4638469..4e1e175 100644

drivers/scsi/qla2xxx/qla_attr.c qla2x00_get_host_symbolic_name(struct Sc · line 866

Quoted 10 lines
drivers/scsi/qla2xxx/qla_attr.c +7 -0
@@ -857,6 +857,14 @@ qla2x00_get_host_symbolic_name(struct Sc
 	qla2x00_get_sym_node_name(ha, fc_host_symbolic_name(shost));
 }
 
+static void
+qla2x00_set_host_system_hostname(struct Scsi_Host *shost)
+{
+	scsi_qla_host_t *ha = to_qla_host(shost);
+
+	set_bit(REGISTER_FDMI_NEEDED, &ha->dpc_flags);
+}

I think you should allow to set and clear that flag by echoing 1 respectively 0 to the file. Also it might make sense to have this attribute completely implemented at the transport-level.

#8 lore raw

PATCH 4/8 qla2xxx: Add support for fabric name FC transport attribute.

In reply to Andrew Vasquez
---
 drivers/scsi/qla2xxx/qla_attr.c |   16 ++++++++++++++++
 drivers/scsi/qla2xxx/qla_def.h  |    1 +
 drivers/scsi/qla2xxx/qla_init.c |    3 ++-
 3 files changed, 19 insertions(+), 1 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +16 -0
index 4e1e175..d4cf51a 100644
@@ -865,6 +865,20 @@ qla2x00_set_host_system_hostname(struct 
 	set_bit(REGISTER_FDMI_NEEDED, &ha->dpc_flags);
 }
 
+static void
+qla2x00_get_host_fabric_name(struct Scsi_Host *shost)
+{
+	scsi_qla_host_t *ha = to_qla_host(shost);
+	u64 node_name;
+
+	if (ha->device_flags & SWITCH_FOUND)
+		node_name = wwn_to_u64(ha->fabric_node_name);
+	else
+		node_name = wwn_to_u64(ha->node_name);
+
+	fc_host_fabric_name(shost) = node_name;
+}
+
 struct fc_function_template qla2xxx_transport_functions = {
 
 	.show_host_node_name = 1,
@@ -881,6 +895,8 @@ struct fc_function_template qla2xxx_tran
 	.show_host_symbolic_name = 1,
 	.set_host_system_hostname = qla2x00_set_host_system_hostname,
 	.show_host_system_hostname = 1,
+	.get_host_fabric_name = qla2x00_get_host_fabric_name,
+	.show_host_fabric_name = 1,
 
 	.dd_fcrport_size = sizeof(struct fc_port *),
 	.show_rport_supported_classes = 1,
drivers/scsi/qla2xxx/qla_def.h +1 -0
index 6d677b0..c37a30a 100644
@@ -2362,6 +2362,7 @@ #define BINZERO		"\0\0\0\0\0\0\0\0\0\0\0
 
 	uint8_t		*node_name;
 	uint8_t		*port_name;
+	uint8_t		fabric_node_name[WWN_SIZE];
 	uint32_t    isp_abort_cnt;
 
 	/* Option ROM information. */
drivers/scsi/qla2xxx/qla_init.c +2 -1
index 2700964..d5d2627 100644
@@ -2280,7 +2280,7 @@ qla2x00_configure_fabric(scsi_qla_host_t
 		loop_id = NPH_F_PORT;
 	else
 		loop_id = SNS_FL_PORT;
-	rval = qla2x00_get_port_name(ha, loop_id, NULL, 0);
+	rval = qla2x00_get_port_name(ha, loop_id, ha->fabric_node_name, 1);
 	if (rval != QLA_SUCCESS) {
 		DEBUG2(printk("scsi(%ld): MBC_GET_PORT_NAME Failed, No FL "
 		    "Port\n", ha->host_no));
@@ -2288,6 +2288,7 @@ qla2x00_configure_fabric(scsi_qla_host_t
 		ha->device_flags &= ~SWITCH_FOUND;
 		return (QLA_SUCCESS);
 	}
+	ha->device_flags |= SWITCH_FOUND;
 
 	/* Mark devices that need re-synchronization. */
 	rval2 = qla2x00_device_resync(ha);
Signature · 1 line
1.4.2.3.gf59615
#10 lore raw

PATCH 5/8 qla2xxx: Add support for host port state FC transport attribute.

In reply to Andrew Vasquez
---
 drivers/scsi/qla2xxx/qla_attr.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +15 -0
index d4cf51a..ee75a71 100644
@@ -879,6 +879,19 @@ qla2x00_get_host_fabric_name(struct Scsi
 	fc_host_fabric_name(shost) = node_name;
 }
 
+static void
+qla2x00_get_host_port_state(struct Scsi_Host *shost)
+{
+	scsi_qla_host_t *ha = to_qla_host(shost);
+
+	if (!ha->flags.online)
+		fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE;
+	else if (atomic_read(&ha->loop_state) == LOOP_TIMEOUT)
+		fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN;
+	else
+		fc_host_port_state(shost) = FC_PORTSTATE_ONLINE;
+}
+
 struct fc_function_template qla2xxx_transport_functions = {
 
 	.show_host_node_name = 1,
@@ -897,6 +910,8 @@ struct fc_function_template qla2xxx_tran
 	.show_host_system_hostname = 1,
 	.get_host_fabric_name = qla2x00_get_host_fabric_name,
 	.show_host_fabric_name = 1,
+	.get_host_port_state = qla2x00_get_host_port_state,
+	.show_host_port_state = 1,
 
 	.dd_fcrport_size = sizeof(struct fc_port *),
 	.show_rport_supported_classes = 1,
Signature · 1 line
1.4.2.3.gf59615
#11 lore raw

Re: [PATCH 5/8] qla2xxx: Add support for host port state FC transport attribute.

Quoted 1 line · Andrew Vasquez

Ok.

Quoted 44 lines
---
 drivers/scsi/qla2xxx/qla_attr.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
drivers/scsi/qla2xxx/qla_attr.c +15 -0
index d4cf51a..ee75a71 100644
@@ -879,6 +879,19 @@ qla2x00_get_host_fabric_name(struct Scsi
 	fc_host_fabric_name(shost) = node_name;
 }
 
+static void
+qla2x00_get_host_port_state(struct Scsi_Host *shost)
+{
+	scsi_qla_host_t *ha = to_qla_host(shost);
+
+	if (!ha->flags.online)
+		fc_host_port_state(shost) = FC_PORTSTATE_OFFLINE;
+	else if (atomic_read(&ha->loop_state) == LOOP_TIMEOUT)
+		fc_host_port_state(shost) = FC_PORTSTATE_UNKNOWN;
+	else
+		fc_host_port_state(shost) = FC_PORTSTATE_ONLINE;
+}
+
 struct fc_function_template qla2xxx_transport_functions = {
 
 	.show_host_node_name = 1,
@@ -897,6 +910,8 @@ struct fc_function_template qla2xxx_tran
 	.show_host_system_hostname = 1,
 	.get_host_fabric_name = qla2x00_get_host_fabric_name,
 	.show_host_fabric_name = 1,
+	.get_host_port_state = qla2x00_get_host_port_state,
+	.show_host_port_state = 1,
 
 	.dd_fcrport_size = sizeof(struct fc_port *),
 	.show_rport_supported_classes = 1,
Signature · 6 lines
1.4.2.3.gf59615

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

---end quoted text---

#12 lore raw

PATCH 6/8 qla2xxx: Add MODULE_FIRMWARE tags.

In reply to Andrew Vasquez
---
 drivers/scsi/qla2xxx/qla_os.c |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +16 -5
index 9e665e1..cdc7fca 100644
@@ -2564,14 +2564,20 @@ #define FW_ISP2300	2
 #define FW_ISP2322	3
 #define FW_ISP24XX	4
 
+#define FW_FILE_ISP21XX	"ql2100_fw.bin"
+#define FW_FILE_ISP22XX	"ql2200_fw.bin"
+#define FW_FILE_ISP2300	"ql2300_fw.bin"
+#define FW_FILE_ISP2322	"ql2322_fw.bin"
+#define FW_FILE_ISP24XX	"ql2400_fw.bin"
+
 static DECLARE_MUTEX(qla_fw_lock);
 
 static struct fw_blob qla_fw_blobs[FW_BLOBS] = {
-	{ .name = "ql2100_fw.bin", .segs = { 0x1000, 0 }, },
-	{ .name = "ql2200_fw.bin", .segs = { 0x1000, 0 }, },
-	{ .name = "ql2300_fw.bin", .segs = { 0x800, 0 }, },
-	{ .name = "ql2322_fw.bin", .segs = { 0x800, 0x1c000, 0x1e000, 0 }, },
-	{ .name = "ql2400_fw.bin", },
+	{ .name = FW_FILE_ISP21XX, .segs = { 0x1000, 0 }, },
+	{ .name = FW_FILE_ISP22XX, .segs = { 0x1000, 0 }, },
+	{ .name = FW_FILE_ISP2300, .segs = { 0x800, 0 }, },
+	{ .name = FW_FILE_ISP2322, .segs = { 0x800, 0x1c000, 0x1e000, 0 }, },
+	{ .name = FW_FILE_ISP24XX, },
 };
 
 struct fw_blob *
@@ -2702,3 +2708,8 @@ MODULE_AUTHOR("QLogic Corporation");
 MODULE_DESCRIPTION("QLogic Fibre Channel HBA Driver");
 MODULE_LICENSE("GPL");
 MODULE_VERSION(QLA2XXX_VERSION);
+MODULE_FIRMWARE(FW_FILE_ISP21XX);
+MODULE_FIRMWARE(FW_FILE_ISP22XX);
+MODULE_FIRMWARE(FW_FILE_ISP2300);
+MODULE_FIRMWARE(FW_FILE_ISP2322);
+MODULE_FIRMWARE(FW_FILE_ISP24XX);
Signature · 1 line
1.4.2.3.gf59615
#14 lore raw

PATCH 7/8 qla2xxx: Stall mid-layer error handlers while rport is blocked.

In reply to Andrew Vasquez

Stall error handler if attempting recovery while an rport is blocked. This avoids device offline scenarios due to errors in the error handler.

Reference implementation from lpfc/mptfc.

---
 drivers/scsi/qla2xxx/qla_os.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +25 -0
index cdc7fca..3ba8c23 100644
@@ -589,6 +589,23 @@ qla2x00_wait_for_loop_ready(scsi_qla_hos
 	return (return_status);
 }
 
+static void
+qla2x00_block_error_handler(struct scsi_cmnd *cmnd)
+{
+	struct Scsi_Host *shost = cmnd->device->host;
+	struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
+	unsigned long flags;
+
+	spin_lock_irqsave(shost->host_lock, flags);
+	while (rport->port_state == FC_PORTSTATE_BLOCKED) {
+		spin_unlock_irqrestore(shost->host_lock, flags);
+		msleep(1000);
+		spin_lock_irqsave(shost->host_lock, flags);
+	}
+	spin_unlock_irqrestore(shost->host_lock, flags);
+	return;
+}
+
 /**************************************************************************
 * qla2xxx_eh_abort
 *
@@ -615,6 +632,8 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
 	unsigned long flags;
 	int wait = 0;
 
+	qla2x00_block_error_handler(cmd);
+
 	if (!CMD_SP(cmd))
 		return SUCCESS;
 
@@ -748,6 +767,8 @@ qla2xxx_eh_device_reset(struct scsi_cmnd
 	unsigned int id, lun;
 	unsigned long serial;
 
+	qla2x00_block_error_handler(cmd);
+
 	ret = FAILED;
 
 	id = cmd->device->id;
@@ -877,6 +898,8 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *c
 	unsigned int id, lun;
 	unsigned long serial;
 
+	qla2x00_block_error_handler(cmd);
+
 	ret = FAILED;
 
 	id = cmd->device->id;
@@ -936,6 +959,8 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *
 	unsigned int id, lun;
 	unsigned long serial;
 
+	qla2x00_block_error_handler(cmd);
+
 	ret = FAILED;
 
 	id = cmd->device->id;
Signature · 1 line
1.4.2.3.gf59615
#15 lore raw

Re: [PATCH 7/8] qla2xxx: Stall mid-layer error handlers while rport is blocked.

Given this is the 3rd instance of this (qla2xxxx, lpfc, mpt fusion), we should either:

- Fix the error handler. (but we all know this is a lot of work, of which none of us have the time to do, nor expect it to be complete in time for our next distro delivery).
or
- Write a transport wrapper function that our eh functions invoke. The wrapper would perform the stall and validate port state.

-- james s

Quoted 75 lines · Andrew Vasquez

Stall error handler if attempting recovery while an rport is blocked. This avoids device offline scenarios due to errors in the error handler.

Reference implementation from lpfc/mptfc.

---
 drivers/scsi/qla2xxx/qla_os.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +25 -0
index cdc7fca..3ba8c23 100644
@@ -589,6 +589,23 @@ qla2x00_wait_for_loop_ready(scsi_qla_hos
 	return (return_status);
 }
 
+static void
+qla2x00_block_error_handler(struct scsi_cmnd *cmnd)
+{
+	struct Scsi_Host *shost = cmnd->device->host;
+	struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device));
+	unsigned long flags;
+
+	spin_lock_irqsave(shost->host_lock, flags);
+	while (rport->port_state == FC_PORTSTATE_BLOCKED) {
+		spin_unlock_irqrestore(shost->host_lock, flags);
+		msleep(1000);
+		spin_lock_irqsave(shost->host_lock, flags);
+	}
+	spin_unlock_irqrestore(shost->host_lock, flags);
+	return;
+}
+
 /**************************************************************************
 * qla2xxx_eh_abort
 *
@@ -615,6 +632,8 @@ qla2xxx_eh_abort(struct scsi_cmnd *cmd)
 	unsigned long flags;
 	int wait = 0;
 
+	qla2x00_block_error_handler(cmd);
+
 	if (!CMD_SP(cmd))
 		return SUCCESS;
 
@@ -748,6 +767,8 @@ qla2xxx_eh_device_reset(struct scsi_cmnd
 	unsigned int id, lun;
 	unsigned long serial;
 
+	qla2x00_block_error_handler(cmd);
+
 	ret = FAILED;
 
 	id = cmd->device->id;
@@ -877,6 +898,8 @@ qla2xxx_eh_bus_reset(struct scsi_cmnd *c
 	unsigned int id, lun;
 	unsigned long serial;
 
+	qla2x00_block_error_handler(cmd);
+
 	ret = FAILED;
 
 	id = cmd->device->id;
@@ -936,6 +959,8 @@ qla2xxx_eh_host_reset(struct scsi_cmnd *
 	unsigned int id, lun;
 	unsigned long serial;
 
+	qla2x00_block_error_handler(cmd);
+
 	ret = FAILED;
 
 	id = cmd->device->id;
#16 lore raw

Re: [PATCH 7/8] qla2xxx: Stall mid-layer error handlers while rport is blocked.

Quoted 3 lines · James Smart

- Fix the error handler. (but we all know this is a lot of work, of which none of us have the time to do, nor expect it to be complete in time for our next distro delivery).

Can't you fix this in the driver instead? Seems to me that .eh_timed_out in the SHT would be enough to fix this case. Just keep returning EH_RESET_TIMER until the condition expires.

#17 lore raw

Re: [PATCH 7/8] qla2xxx: Stall mid-layer error handlers while rport is blocked.

Quoted 8 lines · Matthew Wilcox
Quoted 3 lines · James Smart

- Fix the error handler. (but we all know this is a lot of work, of which none of us have the time to do, nor expect it to be complete in time for our next distro delivery).

Can't you fix this in the driver instead? Seems to me that .eh_timed_out in the SHT would be enough to fix this case. Just keep returning EH_RESET_TIMER until the condition expires.

This is already done in fc_timed_out.

-andmike
--
Michael Anderson
[email protected]

#18 lore raw

Re: [PATCH 7/8] qla2xxx: Stall mid-layer error handlers while rport is blocked.

Read the following:
http://marc.theaimsgroup.com/?l=linux-scsi&m=115583213624803&w=2

It explains the error window....

-- james

Quoted 16 lines · Mike Anderson
Quoted 7 lines · Matthew Wilcox
Quoted 3 lines · James Smart

- Fix the error handler. (but we all know this is a lot of work, of which none of us have the time to do, nor expect it to be complete in time for our next distro delivery).

Can't you fix this in the driver instead? Seems to me that .eh_timed_out in the SHT would be enough to fix this case. Just keep returning EH_RESET_TIMER until the condition expires.

This is already done in fc_timed_out.

-andmike
--
Michael Anderson
[email protected]

#19 lore raw

Re: [PATCH 7/8] qla2xxx: Stall mid-layer error handlers while rport is blocked.

In reply to James Smart
Quoted 6 lines · James Smart

Given this is the 3rd instance of this (qla2xxxx, lpfc, mpt fusion), we should either:

- Fix the error handler. (but we all know this is a lot of work, of which none of us have the time to do, nor expect it to be complete in time for our next distro delivery).

I understand the bugs in the eh. I have worked around them in iscsi and tried to fix them in scsi-ml :) (still working on the queuecommand SCSI_ML_HOST/DEVICE_BUSY fix), but along with the problems in the eh where we could get the device offlined there could really be times when the device needs to be offlined and reonlined, right? For iscsi we do not really worry about either, in our userspace daemon we have code where if the device was offlined and the daemon has corrected the problem (or in qla4xxx case has been notified that the problem has been corrected), then we online the devices. Since FC, has added a netlink interface could we add something like fc_rport state changed event support to some daemom. The daemon could online the device when the rport state is back up if needed.

I was also thinking that the iscsi code has some common features and maybe iscsi and fc could share something in some sort of blktool daemon.

Or do you think the userspace daemon is more of hack in userspace. I cannot tell when I am hacking around something in the kernel or doing something nifty in userspace anymore :)

#20 lore raw

Re: [PATCH 7/8] qla2xxx: Stall mid-layer error handlers while rport is blocked.

Quoted 8 lines · Mike Christie
Quoted 6 lines · James Smart

Given this is the 3rd instance of this (qla2xxxx, lpfc, mpt fusion), we should either:

- Fix the error handler. (but we all know this is a lot of work, of which none of us have the time to do, nor expect it to be complete in time for our next distro delivery).

Quoted 5 lines

I understand the bugs in the eh. I have worked around them in iscsi and tried to fix them in scsi-ml :) (still working on the queuecommand SCSI_ML_HOST/DEVICE_BUSY fix), but along with the problems in the eh where we could get the device offlined there could really be times when the device needs to be offlined and reonlined, right?

True...

Quoted 5 lines

For iscsi we do
not really worry about either, in our userspace daemon we have code where if the device was offlined and the daemon has corrected the problem (or in qla4xxx case has been notified that the problem has been corrected), then we online the devices.

Ok - but that's not really the intent around offlining. Offlining implies that recovery steps were taken, but it didn't result in a functional device, thus retries are likely to fail as well - which implies that device media is corrupt and could use some user interaction to clean up (filesystem check and the like). So - it's not always the best ideal to simply online after resolving the link state for the device.

That said, there are scenarios in which we lose connectivity altogether to the device, but never end up taking it offline (e.g. we fail the i/o outright in queuecommand without going through the error handler). I would assume the device media is as screwed up as when offline was justified. Perhaps it's because we expect the upper layers to be preserving the data that was contained in the retry (consider block cache data) and to eventually attempt to resync this data when connectivity to the device is restored. If we have this scenario, it implies that simply onlining after the link state is ok, is all right..

Quoted 4 lines

Since FC, has added a netlink
interface could we add something like fc_rport state changed event support to some daemom. The daemon could online the device when the rport state is back up if needed.

Well - this is similar to what we talked about in the storage bof at OLS. We decided to add kobject calls for block and unblock to the block device. These are the events you could key off of. I'll complete the patch for these events.

Quoted 2 lines

I was also thinking that the iscsi code has some common features and maybe iscsi and fc could share something in some sort of blktool daemon.

Sounds useful - we just have to make sure it's keeping the system sane.

Quoted 3 lines

Or do you think the userspace daemon is more of hack in userspace. I cannot tell when I am hacking around something in the kernel or doing something nifty in userspace anymore :)

As pointed out above, unconditionally onlining a device is not really the right solution, although it is what users unconditionally do after loosing connectivity and encountering the offline state. Anyone else with some thoughts here. Users really don't understand the offline state and the manual onlining once they believe they have restored connectivity to the device.

-- james

#21 lore raw

Re: [PATCH 7/8] qla2xxx: Stall mid-layer error handlers while rport is blocked.

Quoted 25 lines · James Smart
Quoted 8 lines · Mike Christie
Quoted 6 lines · James Smart

Given this is the 3rd instance of this (qla2xxxx, lpfc, mpt fusion), we should either:

- Fix the error handler. (but we all know this is a lot of work, of which none of us have the time to do, nor expect it to be complete in time for our next distro delivery).

Quoted 5 lines

I understand the bugs in the eh. I have worked around them in iscsi and tried to fix them in scsi-ml :) (still working on the queuecommand SCSI_ML_HOST/DEVICE_BUSY fix), but along with the problems in the eh where we could get the device offlined there could really be times when the device needs to be offlined and reonlined, right?

True...

Quoted 5 lines

For iscsi we do
not really worry about either, in our userspace daemon we have code where if the device was offlined and the daemon has corrected the problem (or in qla4xxx case has been notified that the problem has been corrected), then we online the devices.

Quoted 8 lines

Ok - but that's not really the intent around offlining. Offlining implies that recovery steps were taken, but it didn't result in a functional device,
thus retries are likely to fail as well - which implies that device media is corrupt and could use some user interaction to clean up (filesystem check
and the like). So - it's not always the best ideal to simply online after resolving the link state for the device.

Yeah ok I can see your point but there are some problems with this currently. Maybe I am thinking about this wrong too.

In order to do diagnostics like TUR or fscheck you have to online the device first. If the device is offlined because the connection is down, multipathd does not want to touch the online state. It does not know why the device was offlined and does not think it can experiment there. Should it? ChristopheV does not feel it should so if iscsid knows the device was offlined because of a connection failure, we online it so multipathd can do its tests. If we are doing a FS directly on a disk then we need to online the device so a user can now do fscheck. So I am saying we are onlining devices because we have correct the problem on our side and now the user can do whatever tests they need to do.

Maybe we need to fix up the SDEV_QUIESCE so we can do diagnostic IOs with SG_IO. Userspace can at least set the device to this state and do some tests but all other IO will not get through and the upper layers do not have to do special things like set the device in READ only or set the path state as failed.

Or are you saying that even if we are able to relogin then there will be problems that cannot be handled with the current tools? Something like that one sense bug I was asking you about at OLS right? I am not sure what to do with that?

#22 lore raw

Re: [PATCH 7/8] qla2xxx: Stall mid-layer error handlers while rport is blocked.

Quoted 10 lines

In order to do diagnostics like TUR or fscheck you have to online the device first. If the device is offlined because the connection is down, multipathd does not want to touch the online state. It does not know why the device was offlined and does not think it can experiment there. Should it? ChristopheV does not feel it should so if iscsid knows the device was offlined because of a connection failure, we online it so multipathd can do its tests. If we are doing a FS directly on a disk then we need to online the device so a user can now do fscheck. So I am saying we are onlining devices because we have correct the problem on our side and now the user can do whatever tests they need to do.

Well, my last response was to say what I thought the purpose of offlining was, and that we at least have some contradictions to it. Your point above is yet another case where it doesn't serve much use. Lastly, users/admins aren't getting the point, it's different from other OS's they are used to, so they simply online it and then deal with the residual errors.

I'm not seeing a win in offlining the device.

Quoted 10 lines

Maybe we need to fix up the SDEV_QUIESCE so we can do diagnostic IOs with SG_IO. Userspace can at least set the device to this state and do some tests but all other IO will not get through and the upper layers do not have to do special things like set the device in READ only or set the path state as failed.

Or are you saying that even if we are able to relogin then there will be problems that cannot be handled with the current tools? Something like that one sense bug I was asking you about at OLS right? I am not sure what to do with that?

I'm questioning offlining, and wouldn't want to make a complicated recovery path.

-- james s

#23 lore raw

Re: [PATCH 7/8] qla2xxx: Stall mid-layer error handlers while rport is blocked.

Quoted 8 lines · James Smart

I'm not seeing a win in offlining the device.

Quoted 6 lines

Maybe we need to fix up the SDEV_QUIESCE so we can do diagnostic IOs with SG_IO. Userspace can at least set the device to this state and do some tests but all other IO will not get through and the upper layers do not have to do special things like set the device in READ only or set the path state as failed.

Quoted 7 lines
Quoted 4 lines

Or are you saying that even if we are able to relogin then there will be problems that cannot be handled with the current tools? Something like that one sense bug I was asking you about at OLS right? I am not sure what to do with that?

I'm questioning offlining, and wouldn't want to make a complicated recovery path.

I always thought the offlining was to protect *other* devices attached to the HBA, so we don't repeatedly quiesce the entire HBA, and possibly reset the target or HBA attached to the same LU that had a timed out command.

Then onlining in user space is not a problem as far as the given LU is concerned.

Otherwise, I also can't think of a reason to offline the device.

-- Patrick Mansfield

#24 lore raw

PATCH 8/8 qla2xxx: Update version number to 8.01.07-k2.

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 9712590..e57bf45 100644
@@ -7,7 +7,7 @@
 /*
  * Driver version
  */
-#define QLA2XXX_VERSION      "8.01.07-k1"
+#define QLA2XXX_VERSION      "8.01.07-k2"
 
 #define QLA_DRIVER_MAJOR_VER	8
 #define QLA_DRIVER_MINOR_VER	1
Signature · 1 line
1.4.2.3.gf59615