linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] qedf: Misc fixes for the driver.
@ 2020-09-07 12:14 Javed Hasan
  2020-09-07 12:14 ` [PATCH 1/8] qedf: Changed the debug parameter permission to read & write Javed Hasan
                   ` (9 more replies)
  0 siblings, 10 replies; 12+ messages in thread
From: Javed Hasan @ 2020-09-07 12:14 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, GR-QLogic-Storage-Upstream, jhasan

This series has misc bug fixes and code enhancements.

Kindly apply this series to scsi-queue at your earliest convenience.

Thanks,
~Javed

Javed Hasan (3):
  qedf: Changed the debug parameter permission from read to read &
    write.
  qedf: Fix for the session’s E_D_TOV value.
  qedf: FDMI Enhancement.

Saurav Kashyap (5):
  qedf: Correct the comment in qedf_initiate_els.
  qedf: Return SUCCESS if stale rport in encounteredon eh_abort.
  qedf: Add schedule_hw_err_handler callback for fan failure.
  qedf: Retry qed->probe during recovery.
  qedf: Changes the %p to %px to print pointers.

 drivers/scsi/qedf/qedf.h      |   9 +++
 drivers/scsi/qedf/qedf_els.c  |  24 +++---
 drivers/scsi/qedf/qedf_fip.c  |   2 +-
 drivers/scsi/qedf/qedf_io.c   |  56 ++++++-------
 drivers/scsi/qedf/qedf_main.c | 184 ++++++++++++++++++++++++++++++------------
 5 files changed, 184 insertions(+), 91 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/8] qedf: Changed the debug parameter permission to read & write
  2020-09-07 12:14 [PATCH 0/8] qedf: Misc fixes for the driver Javed Hasan
@ 2020-09-07 12:14 ` Javed Hasan
  2020-09-07 12:14 ` [PATCH 2/8] qedf: Correct the comment in qedf_initiate_els Javed Hasan
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Javed Hasan @ 2020-09-07 12:14 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, GR-QLogic-Storage-Upstream, jhasan

 Changed the debug parameter permission to read & write.
 Gives flexibility to change the debug verbosity dynamically.

Signed-off-by: Javed Hasan <jhasan@marvell.com>
---
 drivers/scsi/qedf/qedf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 86b9479..5770692 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -40,7 +40,7 @@
 	"remote ports (default 60)");
 
 uint qedf_debug = QEDF_LOG_INFO;
-module_param_named(debug, qedf_debug, uint, S_IRUGO);
+module_param_named(debug, qedf_debug, uint, S_IRUGO|S_IWUSR);
 MODULE_PARM_DESC(debug, " Debug mask. Pass '1' to enable default debugging"
 	" mask");
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/8] qedf: Correct the comment in qedf_initiate_els
  2020-09-07 12:14 [PATCH 0/8] qedf: Misc fixes for the driver Javed Hasan
  2020-09-07 12:14 ` [PATCH 1/8] qedf: Changed the debug parameter permission to read & write Javed Hasan
@ 2020-09-07 12:14 ` Javed Hasan
  2020-09-07 12:14 ` [PATCH 3/8] qedf: Fix for the session’s E_D_TOV value Javed Hasan
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Javed Hasan @ 2020-09-07 12:14 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, GR-QLogic-Storage-Upstream, jhasan

From: Saurav Kashyap <skashyap@marvell.com>

 Correction of the comment in qedf_initiate_els().
 Comment was misleading, hence corrected it.

Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
---
 drivers/scsi/qedf/qedf_els.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c
index 6cb8c9b..625e58c 100644
--- a/drivers/scsi/qedf/qedf_els.c
+++ b/drivers/scsi/qedf/qedf_els.c
@@ -124,7 +124,7 @@ static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op,
 	task = qedf_get_task_mem(&qedf->tasks, xid);
 	qedf_init_mp_task(els_req, task, sqe);
 
-	/* Put timer on original I/O request */
+	/* Put timer on els request */
 	if (timer_msec)
 		qedf_cmd_timer_set(qedf, els_req, timer_msec);
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/8] qedf: Fix for the session’s E_D_TOV value
  2020-09-07 12:14 [PATCH 0/8] qedf: Misc fixes for the driver Javed Hasan
  2020-09-07 12:14 ` [PATCH 1/8] qedf: Changed the debug parameter permission to read & write Javed Hasan
  2020-09-07 12:14 ` [PATCH 2/8] qedf: Correct the comment in qedf_initiate_els Javed Hasan
@ 2020-09-07 12:14 ` Javed Hasan
  2020-09-07 12:14 ` [PATCH 4/8] qedf: FDMI attributes correction Javed Hasan
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Javed Hasan @ 2020-09-07 12:14 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, GR-QLogic-Storage-Upstream, jhasan

  FW expects E_D_TOV field in connection offload
  parameters as “msec”. Earlier incorrect value(100ms),
  was leading to abort from driver in the case when data
  frames for read take more than 100ms from target side,
  resulting in FW reporting E_D_TOV expiration.

Signed-off-by: Javed Hasan <jhasan@marvell.com>
---
 drivers/scsi/qedf/qedf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 5770692..ccf6a99 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -1311,7 +1311,7 @@ static int qedf_offload_connection(struct qedf_ctx *qedf,
 	ether_addr_copy(conn_info.dst_mac, qedf->ctlr.dest_addr);
 
 	conn_info.tx_max_fc_pay_len = fcport->rdata->maxframe_size;
-	conn_info.e_d_tov_timer_val = qedf->lport->e_d_tov / 20;
+	conn_info.e_d_tov_timer_val = qedf->lport->e_d_tov;
 	conn_info.rec_tov_timer_val = 3; /* I think this is what E3 was */
 	conn_info.rx_max_fc_pay_len = fcport->rdata->maxframe_size;
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/8] qedf: FDMI attributes correction
  2020-09-07 12:14 [PATCH 0/8] qedf: Misc fixes for the driver Javed Hasan
                   ` (2 preceding siblings ...)
  2020-09-07 12:14 ` [PATCH 3/8] qedf: Fix for the session’s E_D_TOV value Javed Hasan
@ 2020-09-07 12:14 ` Javed Hasan
  2020-09-07 12:14 ` [PATCH 5/8] qedf: Return SUCCESS if stale rport in encountered Javed Hasan
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Javed Hasan @ 2020-09-07 12:14 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, GR-QLogic-Storage-Upstream, jhasan

 Correction in the FDMI attributes required for RHBA and RPA registration.

Signed-off-by: Javed Hasan <jhasan@marvell.com>
---
 drivers/scsi/qedf/qedf.h      |  5 +++
 drivers/scsi/qedf/qedf_main.c | 78 +++++++++++++++++++++++++++++--------------
 2 files changed, 58 insertions(+), 25 deletions(-)

diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h
index e163be8..15d6cbe 100644
--- a/drivers/scsi/qedf/qedf.h
+++ b/drivers/scsi/qedf/qedf.h
@@ -544,6 +544,11 @@ extern void qedf_process_seq_cleanup_compl(struct qedf_ctx *qedf,
 
 #define FCOE_WORD_TO_BYTE  4
 #define QEDF_MAX_TASK_NUM	0xFFFF
+#define QL45xxx			0x165C
+#define QL41xxx			0x8080
+#define MAX_CT_PAYLOAD		2048
+#define DISCOVERED_PORTS	4
+#define NUMBER_OF_PORTS		1
 
 struct fip_vlan {
 	struct ethhdr eth;
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index ccf6a99..bf1b755 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -1623,11 +1623,13 @@ static void qedf_fcoe_ctlr_setup(struct qedf_ctx *qedf)
 static void qedf_setup_fdmi(struct qedf_ctx *qedf)
 {
 	struct fc_lport *lport = qedf->lport;
-	struct fc_host_attrs *fc_host = shost_to_fc_host(lport->host);
-	u64 dsn;
+	u8 buf[8];
+	int pos;
+	uint32_t i;
 
 	/*
-	 * fdmi_enabled needs to be set for libfc to execute FDMI registration.
+	 * fdmi_enabled needs to be set for libfc
+	 * to execute FDMI registration
 	 */
 	lport->fdmi_enabled = 1;
 
@@ -1637,32 +1639,53 @@ static void qedf_setup_fdmi(struct qedf_ctx *qedf)
 	 */
 
 	/* Get the PCI-e Device Serial Number Capability */
-	dsn = pci_get_dsn(qedf->pdev);
-	if (dsn)
-		snprintf(fc_host->serial_number,
-		    sizeof(fc_host->serial_number), "%016llX", dsn);
-	else
-		snprintf(fc_host->serial_number,
-		    sizeof(fc_host->serial_number), "Unknown");
+	pos = pci_find_ext_capability(qedf->pdev, PCI_EXT_CAP_ID_DSN);
+	if (pos) {
+		pos += 4;
+		for (i = 0; i < 8; i++)
+			pci_read_config_byte(qedf->pdev, pos + i, &buf[i]);
+
+		snprintf(fc_host_serial_number(lport->host),
+		    FC_SERIAL_NUMBER_SIZE,
+		    "%02X%02X%02X%02X%02X%02X%02X%02X",
+		    buf[7], buf[6], buf[5], buf[4],
+		    buf[3], buf[2], buf[1], buf[0]);
+	} else
+		snprintf(fc_host_serial_number(lport->host),
+		    FC_SERIAL_NUMBER_SIZE, "Unknown");
+
+	snprintf(fc_host_manufacturer(lport->host),
+	    FC_SERIAL_NUMBER_SIZE, "%s", "Marvell Semiconductor Inc.");
+
+	if (qedf->pdev->device == QL45xxx) {
+		snprintf(fc_host_model(lport->host),
+			FC_SYMBOLIC_NAME_SIZE, "%s", "QL45xxx");
 
-	snprintf(fc_host->manufacturer,
-	    sizeof(fc_host->manufacturer), "%s", "Cavium Inc.");
+		snprintf(fc_host_model_description(lport->host),
+			FC_SYMBOLIC_NAME_SIZE, "%s",
+			"Marvell FastLinQ QL45xxx FCoE Adapter");
+	}
+
+	if (qedf->pdev->device == QL41xxx) {
+		snprintf(fc_host_model(lport->host),
+			FC_SYMBOLIC_NAME_SIZE, "%s", "QL41xxx");
 
-	snprintf(fc_host->model, sizeof(fc_host->model), "%s", "QL41000");
+		snprintf(fc_host_model_description(lport->host),
+			FC_SYMBOLIC_NAME_SIZE, "%s",
+			"Marvell FastLinQ QL41xxx FCoE Adapter");
+	}
 
-	snprintf(fc_host->model_description, sizeof(fc_host->model_description),
-	    "%s", "QLogic FastLinQ QL41000 Series 10/25/40/50GGbE Controller"
-	    "(FCoE)");
+	snprintf(fc_host_hardware_version(lport->host),
+	    FC_VERSION_STRING_SIZE, "Rev %d", qedf->pdev->revision);
 
-	snprintf(fc_host->hardware_version, sizeof(fc_host->hardware_version),
-	    "Rev %d", qedf->pdev->revision);
+	snprintf(fc_host_driver_version(lport->host),
+	    FC_VERSION_STRING_SIZE, "%s", QEDF_VERSION);
 
-	snprintf(fc_host->driver_version, sizeof(fc_host->driver_version),
-	    "%s", QEDF_VERSION);
+	snprintf(fc_host_firmware_version(lport->host),
+	    FC_VERSION_STRING_SIZE, "%d.%d.%d.%d",
+	    FW_MAJOR_VERSION, FW_MINOR_VERSION, FW_REVISION_VERSION,
+	    FW_ENGINEERING_VERSION);
 
-	snprintf(fc_host->firmware_version, sizeof(fc_host->firmware_version),
-	    "%d.%d.%d.%d", FW_MAJOR_VERSION, FW_MINOR_VERSION,
-	    FW_REVISION_VERSION, FW_ENGINEERING_VERSION);
 }
 
 static int qedf_lport_setup(struct qedf_ctx *qedf)
@@ -1709,8 +1732,13 @@ static int qedf_lport_setup(struct qedf_ctx *qedf)
 	fc_host_dev_loss_tmo(lport->host) = qedf_dev_loss_tmo;
 
 	/* Set symbolic node name */
-	snprintf(fc_host_symbolic_name(lport->host), 256,
-	    "QLogic %s v%s", QEDF_MODULE_NAME, QEDF_VERSION);
+	if (qedf->pdev->device == QL45xxx)
+		snprintf(fc_host_symbolic_name(lport->host), 256,
+			"Marvell FastLinQ 45xxx FCoE v%s", QEDF_VERSION);
+
+	if (qedf->pdev->device == QL41xxx)
+		snprintf(fc_host_symbolic_name(lport->host), 256,
+			"Marvell FastLinQ 41xxx FCoE v%s", QEDF_VERSION);
 
 	qedf_setup_fdmi(qedf);
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/8] qedf: Return SUCCESS if stale rport in encountered
  2020-09-07 12:14 [PATCH 0/8] qedf: Misc fixes for the driver Javed Hasan
                   ` (3 preceding siblings ...)
  2020-09-07 12:14 ` [PATCH 4/8] qedf: FDMI attributes correction Javed Hasan
@ 2020-09-07 12:14 ` Javed Hasan
  2020-09-07 12:14 ` [PATCH 6/8] qedf: Add schedule_hw_err_handler callback for fan failure Javed Hasan
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Javed Hasan @ 2020-09-07 12:14 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, GR-QLogic-Storage-Upstream, jhasan

From: Saurav Kashyap <skashyap@marvell.com>

 If SUCCESS is not return, it can get escalated. Hence, return
  SUCCESS similar to other conditions.

Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Javed Hasan <jhasan@marvell.com>
---
 drivers/scsi/qedf/qedf_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index bf1b755..50af70a 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -704,7 +704,7 @@ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd)
 	rdata = fcport->rdata;
 	if (!rdata || !kref_get_unless_zero(&rdata->kref)) {
 		QEDF_ERR(&qedf->dbg_ctx, "stale rport, sc_cmd=%p\n", sc_cmd);
-		rc = 1;
+		rc = SUCCESS;
 		goto out;
 	}
 
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 6/8] qedf: Add schedule_hw_err_handler callback for fan failure
  2020-09-07 12:14 [PATCH 0/8] qedf: Misc fixes for the driver Javed Hasan
                   ` (4 preceding siblings ...)
  2020-09-07 12:14 ` [PATCH 5/8] qedf: Return SUCCESS if stale rport in encountered Javed Hasan
@ 2020-09-07 12:14 ` Javed Hasan
  2020-09-07 12:14 ` [PATCH 7/8] qedf: Retry qed->probe during recovery Javed Hasan
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Javed Hasan @ 2020-09-07 12:14 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, GR-QLogic-Storage-Upstream, jhasan

From: Saurav Kashyap <skashyap@marvell.com>

 On fan failure, disable the PCI function and initiate recovery for ramrod
 failure.


Signed-off-by: Javed Hasan <jhasan@marvell.com>
---
 drivers/scsi/qedf/qedf.h      |  4 ++++
 drivers/scsi/qedf/qedf_main.c | 45 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h
index 15d6cbe..0e2cbb1 100644
--- a/drivers/scsi/qedf/qedf.h
+++ b/drivers/scsi/qedf/qedf.h
@@ -389,6 +389,7 @@ struct qedf_ctx {
 	mempool_t *io_mempool;
 	struct workqueue_struct *dpc_wq;
 	struct delayed_work recovery_work;
+	struct delayed_work board_disable_work;
 	struct delayed_work grcdump_work;
 	struct delayed_work stag_work;
 
@@ -541,6 +542,9 @@ extern void qedf_process_seq_cleanup_compl(struct qedf_ctx *qedf,
 extern void qedf_wq_grcdump(struct work_struct *work);
 void qedf_stag_change_work(struct work_struct *work);
 void qedf_ctx_soft_reset(struct fc_lport *lport);
+extern void qedf_board_disable_work(struct work_struct *work);
+extern void qedf_schedule_hw_err_handler(void *dev,
+		enum qed_hw_err_type err_type);
 
 #define FCOE_WORD_TO_BYTE  4
 #define QEDF_MAX_TASK_NUM	0xFFFF
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 50af70a..3a45ca7 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -104,6 +104,12 @@
 MODULE_PARM_DESC(dp_level, " printk verbosity control passed to qed module  "
 	"during probe (0-3: 0 more verbose).");
 
+static bool qedf_enable_recovery = true;
+module_param_named(enable_recovery, qedf_enable_recovery,
+		bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(enable_recovery, "Enable/disable recovery on driver/firmware "
+		"interface level errors 0 = Disabled, 1 = Enabled (Default: 1).");
+
 struct workqueue_struct *qedf_io_wq;
 
 static struct fcoe_percpu_s qedf_global;
@@ -668,6 +674,7 @@ static u32 qedf_get_login_failures(void *cookie)
 		.dcbx_aen = qedf_dcbx_handler,
 		.get_generic_tlv_data = qedf_get_generic_tlv_data,
 		.get_protocol_tlv_data = qedf_get_protocol_tlv_data,
+		.schedule_hw_err_handler = qedf_schedule_hw_err_handler,
 	}
 };
 
@@ -3777,6 +3784,44 @@ void qedf_wq_grcdump(struct work_struct *work)
 	qedf_capture_grc_dump(qedf);
 }
 
+void qedf_schedule_hw_err_handler(void *dev, enum qed_hw_err_type err_type)
+{
+	struct qedf_ctx *qedf = dev;
+
+	QEDF_ERR(&(qedf->dbg_ctx),
+			"Hardware error handler scheduled, event=%d.\n",
+			err_type);
+
+	if (test_bit(QEDF_IN_RECOVERY, &qedf->flags)) {
+		QEDF_ERR(&(qedf->dbg_ctx),
+				"Already in recovery, not scheduling board disable work.\n");
+		return;
+	}
+
+	switch (err_type) {
+	case QED_HW_ERR_FAN_FAIL:
+		schedule_delayed_work(&qedf->board_disable_work, 0);
+		break;
+	case QED_HW_ERR_MFW_RESP_FAIL:
+	case QED_HW_ERR_HW_ATTN:
+	case QED_HW_ERR_DMAE_FAIL:
+	case QED_HW_ERR_FW_ASSERT:
+		/* Prevent HW attentions from being reasserted */
+		qed_ops->common->attn_clr_enable(qedf->cdev, true);
+		break;
+	case QED_HW_ERR_RAMROD_FAIL:
+		/* Prevent HW attentions from being reasserted */
+		qed_ops->common->attn_clr_enable(qedf->cdev, true);
+
+		if (qedf_enable_recovery)
+			qed_ops->common->recovery_process(qedf->cdev);
+
+		break;
+	default:
+		break;
+	}
+}
+
 /*
  * Protocol TLV handler
  */
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 7/8] qedf: Retry qed->probe during recovery
  2020-09-07 12:14 [PATCH 0/8] qedf: Misc fixes for the driver Javed Hasan
                   ` (5 preceding siblings ...)
  2020-09-07 12:14 ` [PATCH 6/8] qedf: Add schedule_hw_err_handler callback for fan failure Javed Hasan
@ 2020-09-07 12:14 ` Javed Hasan
  2020-09-07 12:14 ` [PATCH 8/8] qedf: Changes the %p to %px to print pointers Javed Hasan
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 12+ messages in thread
From: Javed Hasan @ 2020-09-07 12:14 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, GR-QLogic-Storage-Upstream, jhasan

From: Saurav Kashyap <skashyap@marvell.com>

 During recovery due to fcoe fn ramrod failure, we
 wait for 2 sec and then call qed->probe, if probe
 fails then re-try max 10 times.

Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
Signed-off-by: Javed Hasan <jhasan@marvell.com>
---
 drivers/scsi/qedf/qedf_main.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 3a45ca7..091cf86 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -3245,11 +3245,16 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
 	void *task_start, *task_end;
 	struct qed_slowpath_params slowpath_params;
 	struct qed_probe_params qed_params;
+	u16 retry_cnt = 10;
 
 	/*
 	 * When doing error recovery we didn't reap the lport so don't try
 	 * to reallocate it.
 	 */
+retry_probe:
+	if (mode == QEDF_MODE_RECOVERY)
+		msleep(2000);
+
 	if (mode != QEDF_MODE_RECOVERY) {
 		lport = libfc_host_alloc(&qedf_host_template,
 		    sizeof(struct qedf_ctx));
@@ -3336,6 +3341,12 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
 	qed_params.is_vf = is_vf;
 	qedf->cdev = qed_ops->common->probe(pdev, &qed_params);
 	if (!qedf->cdev) {
+		if ((mode == QEDF_MODE_RECOVERY) && retry_cnt) {
+			QEDF_ERR(&qedf->dbg_ctx,
+				"Retry %d initialize hardware\n", retry_cnt);
+			retry_cnt--;
+			goto retry_probe;
+		}
 		QEDF_ERR(&qedf->dbg_ctx, "common probe failed.\n");
 		rc = -ENODEV;
 		goto err1;
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 8/8] qedf: Changes the %p to %px to print pointers
  2020-09-07 12:14 [PATCH 0/8] qedf: Misc fixes for the driver Javed Hasan
                   ` (6 preceding siblings ...)
  2020-09-07 12:14 ` [PATCH 7/8] qedf: Retry qed->probe during recovery Javed Hasan
@ 2020-09-07 12:14 ` Javed Hasan
  2020-09-09  3:19 ` [PATCH 0/8] qedf: Misc fixes for the driver Martin K. Petersen
  2020-09-15 20:16 ` Martin K. Petersen
  9 siblings, 0 replies; 12+ messages in thread
From: Javed Hasan @ 2020-09-07 12:14 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, GR-QLogic-Storage-Upstream, jhasan

From: Saurav Kashyap <skashyap@marvell.com>

 Changed all the pointer address printing method from 
  %p to %px to print unmodified addresses.
 

Signed-off-by: Javed Hasan <jhasan@marvell.com>
Signed-off-by: Saurav Kashyap <skashyap@marvell.com>
---
 drivers/scsi/qedf/qedf_els.c  | 22 ++++++++---------
 drivers/scsi/qedf/qedf_fip.c  |  2 +-
 drivers/scsi/qedf/qedf_io.c   | 56 +++++++++++++++++++++----------------------
 drivers/scsi/qedf/qedf_main.c | 44 +++++++++++++++++-----------------
 4 files changed, 62 insertions(+), 62 deletions(-)

diff --git a/drivers/scsi/qedf/qedf_els.c b/drivers/scsi/qedf/qedf_els.c
index 625e58c..04f37d0 100644
--- a/drivers/scsi/qedf/qedf_els.c
+++ b/drivers/scsi/qedf/qedf_els.c
@@ -63,7 +63,7 @@ static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op,
 	}
 
 	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "initiate_els els_req = "
-		   "0x%p cb_arg = %p xid = %x\n", els_req, cb_arg,
+		   "0x%px cb_arg = %px xid = %x\n", els_req, cb_arg,
 		   els_req->xid);
 	els_req->sc_cmd = NULL;
 	els_req->cmd_type = QEDF_ELS;
@@ -204,12 +204,12 @@ static void qedf_rrq_compl(struct qedf_els_cb_arg *cb_arg)
 
 	if (!orig_io_req) {
 		QEDF_ERR(&qedf->dbg_ctx,
-			 "Original io_req is NULL, rrq_req = %p.\n", rrq_req);
+			 "Original io_req is NULL, rrq_req = %px.\n", rrq_req);
 		goto out_free;
 	}
 
 	refcount = kref_read(&orig_io_req->refcount);
-	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "rrq_compl: orig io = %p,"
+	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "rrq_compl: orig io = %px,"
 		   " orig xid = 0x%x, rrq_xid = 0x%x, refcount=%d\n",
 		   orig_io_req, orig_io_req->xid, rrq_req->xid, refcount);
 
@@ -283,7 +283,7 @@ int qedf_send_rrq(struct qedf_ioreq *aborted_io_req)
 	refcount = kref_read(&aborted_io_req->refcount);
 	if (refcount != 1) {
 		QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_ELS,
-			  "refcount for xid=%x io_req=%p refcount=%d is not 1.\n",
+			  "refcount for xid=%x io_req=%px refcount=%d is not 1.\n",
 			  aborted_io_req->xid, aborted_io_req, refcount);
 		return -EINVAL;
 	}
@@ -293,7 +293,7 @@ int qedf_send_rrq(struct qedf_ioreq *aborted_io_req)
 	r_a_tov = lport->r_a_tov;
 
 	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Sending RRQ orig "
-		   "io = %p, orig_xid = 0x%x\n", aborted_io_req,
+		   "io = %px, orig_xid = 0x%x\n", aborted_io_req,
 		   aborted_io_req->xid);
 	memset(&rrq, 0, sizeof(rrq));
 
@@ -381,7 +381,7 @@ void qedf_restart_rport(struct qedf_rport *fcport)
 	if (test_bit(QEDF_RPORT_IN_RESET, &fcport->flags) ||
 	    !test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags) ||
 	    test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) {
-		QEDF_ERR(&(fcport->qedf->dbg_ctx), "fcport %p already in reset or not offloaded.\n",
+		QEDF_ERR(&(fcport->qedf->dbg_ctx), "fcport %px already in reset or not offloaded.\n",
 		    fcport);
 		spin_unlock_irqrestore(&fcport->rport_lock, flags);
 		return;
@@ -567,7 +567,7 @@ static void qedf_srr_compl(struct qedf_els_cb_arg *cb_arg)
 		cancel_delayed_work_sync(&orig_io_req->timeout_work);
 
 	refcount = kref_read(&orig_io_req->refcount);
-	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Entered: orig_io=%p,"
+	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Entered: orig_io=%px,"
 		   " orig_io_xid=0x%x, rec_xid=0x%x, refcount=%d\n",
 		   orig_io_req, orig_io_req->xid, srr_req->xid, refcount);
 
@@ -655,7 +655,7 @@ static int qedf_send_srr(struct qedf_ioreq *orig_io_req, u32 offset, u8 r_ctl)
 	lport = qedf->lport;
 	r_a_tov = lport->r_a_tov;
 
-	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Sending SRR orig_io=%p, "
+	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Sending SRR orig_io=%px, "
 		   "orig_xid=0x%x\n", orig_io_req, orig_io_req->xid);
 	memset(&srr, 0, sizeof(srr));
 
@@ -866,14 +866,14 @@ static void qedf_rec_compl(struct qedf_els_cb_arg *cb_arg)
 		cancel_delayed_work_sync(&orig_io_req->timeout_work);
 
 	refcount = kref_read(&orig_io_req->refcount);
-	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Entered: orig_io=%p,"
+	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Entered: orig_io=%px,"
 		   " orig_io_xid=0x%x, rec_xid=0x%x, refcount=%d\n",
 		   orig_io_req, orig_io_req->xid, rec_req->xid, refcount);
 
 	/* If a REC times out, free resources */
 	if (rec_req->event == QEDF_IOREQ_EV_ELS_TMO) {
 		QEDF_ERR(&qedf->dbg_ctx,
-			 "Got TMO event, orig_io_req %p orig_io_xid=0x%x.\n",
+			 "Got TMO event, orig_io_req %px orig_io_xid=0x%x.\n",
 			 orig_io_req, orig_io_req->xid);
 		goto out_put;
 	}
@@ -1049,7 +1049,7 @@ int qedf_send_rec(struct qedf_ioreq *orig_io_req)
 	rec.rec_rx_id =
 	    htons(orig_io_req->task->tstorm_st_context.read_write.rx_id);
 
-	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Sending REC orig_io=%p, "
+	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Sending REC orig_io=%px, "
 	   "orig_xid=0x%x rx_id=0x%x\n", orig_io_req,
 	   orig_io_req->xid, rec.rec_rx_id);
 	rc = qedf_initiate_els(fcport, ELS_REC, &rec, sizeof(rec),
diff --git a/drivers/scsi/qedf/qedf_fip.c b/drivers/scsi/qedf/qedf_fip.c
index ad6a56c..b2e44bf 100644
--- a/drivers/scsi/qedf/qedf_fip.c
+++ b/drivers/scsi/qedf/qedf_fip.c
@@ -189,7 +189,7 @@ void qedf_fip_recv(struct qedf_ctx *qedf, struct sk_buff *skb)
 	sub = fiph->fip_subcode;
 
 	QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_LL2,
-		  "FIP frame received: skb=%p fiph=%p source=%pM destn=%pM op=%x sub=%x vlan=%04x",
+		  "FIP frame received: skb=%px fiph=%px source=%pM destn=%pM op=%x sub=%x vlan=%04x",
 		  skb, fiph, eth_hdr->h_source, eth_hdr->h_dest, op,
 		  sub, vlan);
 	if (qedf_dump_frames)
diff --git a/drivers/scsi/qedf/qedf_io.c b/drivers/scsi/qedf/qedf_io.c
index 86c8afb..4fba5cc 100644
--- a/drivers/scsi/qedf/qedf_io.c
+++ b/drivers/scsi/qedf/qedf_io.c
@@ -444,7 +444,7 @@ void qedf_release_cmd(struct kref *ref)
 
 	if (io_req->cmd_type == QEDF_SCSI_CMD) {
 		QEDF_WARN(&fcport->qedf->dbg_ctx,
-			  "Cmd released called without scsi_done called, io_req %p xid=0x%x.\n",
+			  "Cmd released called without scsi_done called, io_req %px xid=0x%x.\n",
 			  io_req, io_req->xid);
 		WARN_ON(io_req->sc_cmd);
 	}
@@ -968,7 +968,7 @@ int qedf_post_io_req(struct qedf_rport *fcport, struct qedf_ioreq *io_req)
 
 	if (!qedf->pdev->msix_enabled) {
 		QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO,
-		    "Completing sc_cmd=%p DID_NO_CONNECT as MSI-X is not enabled.\n",
+		    "Completing sc_cmd=%px DID_NO_CONNECT as MSI-X is not enabled.\n",
 		    sc_cmd);
 		sc_cmd->result = DID_NO_CONNECT << 16;
 		sc_cmd->scsi_done(sc_cmd);
@@ -1163,19 +1163,19 @@ void qedf_scsi_completion(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
 
 	if (!sc_cmd->device) {
 		QEDF_ERR(&qedf->dbg_ctx,
-			 "Device for sc_cmd %p is NULL.\n", sc_cmd);
+			 "Device for sc_cmd %px is NULL.\n", sc_cmd);
 		return;
 	}
 
 	if (!sc_cmd->request) {
 		QEDF_WARN(&(qedf->dbg_ctx), "sc_cmd->request is NULL, "
-		    "sc_cmd=%p.\n", sc_cmd);
+		    "sc_cmd=%px.\n", sc_cmd);
 		return;
 	}
 
 	if (!sc_cmd->request->q) {
 		QEDF_WARN(&(qedf->dbg_ctx), "request->q is NULL so request "
-		   "is not valid, sc_cmd=%p.\n", sc_cmd);
+		   "is not valid, sc_cmd=%px.\n", sc_cmd);
 		return;
 	}
 
@@ -1342,7 +1342,7 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
 
 	if (test_and_set_bit(QEDF_CMD_ERR_SCSI_DONE, &io_req->flags)) {
 		QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
-			  "io_req:%p scsi_done handling already done\n",
+			  "io_req:%px scsi_done handling already done\n",
 			  io_req);
 		return;
 	}
@@ -1361,7 +1361,7 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
 	}
 
 	if (!virt_addr_valid(sc_cmd)) {
-		QEDF_ERR(&qedf->dbg_ctx, "sc_cmd=%p is not valid.", sc_cmd);
+		QEDF_ERR(&qedf->dbg_ctx, "sc_cmd=%px is not valid.", sc_cmd);
 		goto bad_scsi_ptr;
 	}
 
@@ -1372,34 +1372,34 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
 	}
 
 	if (!sc_cmd->device) {
-		QEDF_ERR(&qedf->dbg_ctx, "Device for sc_cmd %p is NULL.\n",
+		QEDF_ERR(&qedf->dbg_ctx, "Device for sc_cmd %px is NULL.\n",
 			 sc_cmd);
 		goto bad_scsi_ptr;
 	}
 
 	if (!virt_addr_valid(sc_cmd->device)) {
 		QEDF_ERR(&qedf->dbg_ctx,
-			 "Device pointer for sc_cmd %p is bad.\n", sc_cmd);
+			 "Device pointer for sc_cmd %px is bad.\n", sc_cmd);
 		goto bad_scsi_ptr;
 	}
 
 	if (!sc_cmd->sense_buffer) {
 		QEDF_ERR(&qedf->dbg_ctx,
-			 "sc_cmd->sense_buffer for sc_cmd %p is NULL.\n",
+			 "sc_cmd->sense_buffer for sc_cmd %px is NULL.\n",
 			 sc_cmd);
 		goto bad_scsi_ptr;
 	}
 
 	if (!virt_addr_valid(sc_cmd->sense_buffer)) {
 		QEDF_ERR(&qedf->dbg_ctx,
-			 "sc_cmd->sense_buffer for sc_cmd %p is bad.\n",
+			 "sc_cmd->sense_buffer for sc_cmd %px is bad.\n",
 			 sc_cmd);
 		goto bad_scsi_ptr;
 	}
 
 	if (!sc_cmd->scsi_done) {
 		QEDF_ERR(&qedf->dbg_ctx,
-			 "sc_cmd->scsi_done for sc_cmd %p is NULL.\n",
+			 "sc_cmd->scsi_done for sc_cmd %px is NULL.\n",
 			 sc_cmd);
 		goto bad_scsi_ptr;
 	}
@@ -1409,7 +1409,7 @@ void qedf_scsi_done(struct qedf_ctx *qedf, struct qedf_ioreq *io_req,
 	sc_cmd->result = result << 16;
 	refcount = kref_read(&io_req->refcount);
 	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_IO, "%d:0:%d:%lld: Completing "
-	    "sc_cmd=%p result=0x%08x op=0x%02x lba=0x%02x%02x%02x%02x, "
+	    "sc_cmd=%px result=0x%08x op=0x%02x lba=0x%02x%02x%02x%02x, "
 	    "allowed=%d retries=%d refcount=%d.\n",
 	    qedf->lport->host->host_no, sc_cmd->device->id,
 	    sc_cmd->device->lun, sc_cmd, sc_cmd->result, sc_cmd->cmnd[0],
@@ -1455,7 +1455,7 @@ void qedf_process_warning_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
 
 	if (!cqe) {
 		QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
-			  "cqe is NULL for io_req %p xid=0x%x\n",
+			  "cqe is NULL for io_req %px xid=0x%x\n",
 			  io_req, io_req->xid);
 		return;
 	}
@@ -1522,7 +1522,7 @@ void qedf_process_error_detect(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
 
 	if (!cqe) {
 		QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
-			  "cqe is NULL for io_req %p\n", io_req);
+			  "cqe is NULL for io_req %px\n", io_req);
 		return;
 	}
 
@@ -1629,7 +1629,7 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun)
 	cmd_mgr = qedf->cmd_mgr;
 
 	QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
-		  "Flush active i/o's num=0x%x fcport=0x%p port_id=0x%06x scsi_id=%d.\n",
+		  "Flush active i/o's num=0x%x fcport=0x%px port_id=0x%06x scsi_id=%d.\n",
 		  atomic_read(&fcport->num_active_ios), fcport,
 		  fcport->rdata->ids.port_id, fcport->rport->scsi_target_id);
 	QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO, "Locking flush mutex.\n");
@@ -1702,7 +1702,7 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun)
 			rc = kref_get_unless_zero(&io_req->refcount);
 			if (!rc) {
 				QEDF_ERR(&(qedf->dbg_ctx),
-				    "Could not get kref for ELS io_req=0x%p xid=0x%x.\n",
+				    "Could not get kref for ELS io_req=0x%px xid=0x%x.\n",
 				    io_req, io_req->xid);
 				continue;
 			}
@@ -1722,7 +1722,7 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun)
 			rc = kref_get_unless_zero(&io_req->refcount);
 			if (!rc) {
 				QEDF_ERR(&(qedf->dbg_ctx),
-				    "Could not get kref for abort io_req=0x%p xid=0x%x.\n",
+				    "Could not get kref for abort io_req=0x%px xid=0x%x.\n",
 				    io_req, io_req->xid);
 				continue;
 			}
@@ -1760,7 +1760,7 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun)
 			continue;
 		if (!io_req->sc_cmd->device) {
 			QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
-				  "Device backpointer NULL for sc_cmd=%p.\n",
+				  "Device backpointer NULL for sc_cmd=%px.\n",
 				  io_req->sc_cmd);
 			/* Put reference for non-existent scsi_cmnd */
 			io_req->sc_cmd = NULL;
@@ -1780,7 +1780,7 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun)
 		rc = kref_get_unless_zero(&io_req->refcount);
 		if (!rc) {
 			QEDF_ERR(&(qedf->dbg_ctx), "Could not get kref for "
-			    "io_req=0x%p xid=0x%x\n", io_req, io_req->xid);
+			    "io_req=0x%px xid=0x%x\n", io_req, io_req->xid);
 			continue;
 		}
 
@@ -1822,7 +1822,7 @@ void qedf_flush_active_ios(struct qedf_rport *fcport, int lun)
 						set_bit(QEDF_CMD_DIRTY,
 							&io_req->flags);
 						QEDF_ERR(&qedf->dbg_ctx,
-							 "Outstanding io_req =%p xid=0x%x flags=0x%lx, sc_cmd=%p refcount=%d cmd_type=%d.\n",
+							 "Outstanding io_req =%px xid=0x%x flags=0x%lx, sc_cmd=%px refcount=%d cmd_type=%d.\n",
 							 io_req, io_req->xid,
 							 io_req->flags,
 							 io_req->sc_cmd,
@@ -1908,7 +1908,7 @@ int qedf_initiate_abts(struct qedf_ioreq *io_req, bool return_scsi_cmd_on_abts)
 	    test_bit(QEDF_CMD_IN_CLEANUP, &io_req->flags) ||
 	    test_bit(QEDF_CMD_IN_ABORT, &io_req->flags)) {
 		QEDF_ERR(&qedf->dbg_ctx,
-			 "io_req xid=0x%x sc_cmd=%p already in cleanup or abort processing or already completed.\n",
+			 "io_req xid=0x%x sc_cmd=%px already in cleanup or abort processing or already completed.\n",
 			 io_req->xid, io_req->sc_cmd);
 		rc = 1;
 		goto drop_rdata_kref;
@@ -2206,7 +2206,7 @@ int qedf_initiate_cleanup(struct qedf_ioreq *io_req,
 	refcount = kref_read(&io_req->refcount);
 
 	QEDF_INFO(&qedf->dbg_ctx, QEDF_LOG_IO,
-		  "Entered xid=0x%x sc_cmd=%p cmd_type=%d flags=0x%lx refcount=%d fcport=%p port_id=0x%06x\n",
+		  "Entered xid=0x%x sc_cmd=%px cmd_type=%d flags=0x%lx refcount=%d fcport=%px port_id=0x%06x\n",
 		  io_req->xid, io_req->sc_cmd, io_req->cmd_type, io_req->flags,
 		  refcount, fcport, fcport->rdata->ids.port_id);
 
@@ -2418,7 +2418,7 @@ int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags)
 	struct fc_rport_priv *rdata = fcport->rdata;
 
 	QEDF_ERR(NULL,
-		 "tm_flags 0x%x sc_cmd %p op = 0x%02x target_id = 0x%x lun=%d\n",
+		 "tm_flags 0x%x sc_cmd %px op = 0x%02x target_id = 0x%x lun=%d\n",
 		 tm_flags, sc_cmd, sc_cmd->cmd_len ? sc_cmd->cmnd[0] : 0xff,
 		 rport->scsi_target_id, (int)sc_cmd->device->lun);
 
@@ -2435,7 +2435,7 @@ int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags)
 		io_req = (struct qedf_ioreq *)sc_cmd->SCp.ptr;
 		ref_cnt = kref_read(&io_req->refcount);
 		QEDF_ERR(NULL,
-			 "orig io_req = %p xid = 0x%x ref_cnt = %d.\n",
+			 "orig io_req = %px xid = 0x%x ref_cnt = %d.\n",
 			 io_req, io_req->xid, ref_cnt);
 	}
 
@@ -2484,11 +2484,11 @@ int qedf_initiate_tmf(struct scsi_cmnd *sc_cmd, u8 tm_flags)
 
 	if (test_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags)) {
 		if (!fcport->rdata)
-			QEDF_ERR(&qedf->dbg_ctx, "fcport %p is uploading.\n",
+			QEDF_ERR(&qedf->dbg_ctx, "fcport %px is uploading.\n",
 				 fcport);
 		else
 			QEDF_ERR(&qedf->dbg_ctx,
-				 "fcport %p port_id=%06x is uploading.\n",
+				 "fcport %px port_id=%06x is uploading.\n",
 				 fcport, fcport->rdata->ids.port_id);
 		rc = FAILED;
 		goto tmf_err;
@@ -2553,7 +2553,7 @@ void qedf_process_unsol_compl(struct qedf_ctx *qedf, uint16_t que_idx,
 
 	if (qedf_dump_frames) {
 		QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_UNSOL,
-		    "BDQ frame is at addr=%p.\n", bdq_addr);
+		    "BDQ frame is at addr=%px.\n", bdq_addr);
 		print_hex_dump(KERN_WARNING, "bdq ", DUMP_PREFIX_OFFSET, 16, 1,
 		    (void *)bdq_addr, pktlen, false);
 	}
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 091cf86..b3f691b 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -710,7 +710,7 @@ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd)
 	fcport = (struct qedf_rport *)&rp[1];
 	rdata = fcport->rdata;
 	if (!rdata || !kref_get_unless_zero(&rdata->kref)) {
-		QEDF_ERR(&qedf->dbg_ctx, "stale rport, sc_cmd=%p\n", sc_cmd);
+		QEDF_ERR(&qedf->dbg_ctx, "stale rport, sc_cmd=%px\n", sc_cmd);
 		rc = SUCCESS;
 		goto out;
 	}
@@ -719,7 +719,7 @@ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd)
 	io_req = (struct qedf_ioreq *)sc_cmd->SCp.ptr;
 	if (!io_req) {
 		QEDF_ERR(&qedf->dbg_ctx,
-			 "sc_cmd not queued with lld, sc_cmd=%p op=0x%02x, port_id=%06x\n",
+			 "sc_cmd not queued with lld, sc_cmd=%px op=0x%02x, port_id=%06x\n",
 			 sc_cmd, sc_cmd->cmnd[0],
 			 rdata->ids.port_id);
 		rc = SUCCESS;
@@ -733,7 +733,7 @@ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd)
 	/* If we got a valid io_req, confirm it belongs to this sc_cmd. */
 	if (!rval || io_req->sc_cmd != sc_cmd) {
 		QEDF_ERR(&qedf->dbg_ctx,
-			 "Freed/Incorrect io_req, io_req->sc_cmd=%p, sc_cmd=%p, port_id=%06x, bailing out.\n",
+			 "Freed/Incorrect io_req, io_req->sc_cmd=%px, sc_cmd=%px, port_id=%06x, bailing out.\n",
 			 io_req->sc_cmd, sc_cmd, rdata->ids.port_id);
 
 		goto drop_rdata_kref;
@@ -742,7 +742,7 @@ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd)
 	if (fc_remote_port_chkready(rport)) {
 		refcount = kref_read(&io_req->refcount);
 		QEDF_ERR(&qedf->dbg_ctx,
-			 "rport not ready, io_req=%p, xid=0x%x sc_cmd=%p op=0x%02x, refcount=%d, port_id=%06x\n",
+			 "rport not ready, io_req=%px, xid=0x%x sc_cmd=%px op=0x%02x, refcount=%d, port_id=%06x\n",
 			 io_req, io_req->xid, sc_cmd, sc_cmd->cmnd[0],
 			 refcount, rdata->ids.port_id);
 
@@ -777,7 +777,7 @@ static int qedf_eh_abort(struct scsi_cmnd *sc_cmd)
 	}
 
 	QEDF_ERR(&qedf->dbg_ctx,
-		 "Aborting io_req=%p sc_cmd=%p xid=0x%x fp_idx=%d, port_id=%06x.\n",
+		 "Aborting io_req=%px sc_cmd=%px xid=0x%x fp_idx=%d, port_id=%06x.\n",
 		 io_req, sc_cmd, io_req->xid, io_req->fp_idx,
 		 rdata->ids.port_id);
 
@@ -868,11 +868,11 @@ bool qedf_wait_for_upload(struct qedf_ctx *qedf)
 				       &fcport->flags)) {
 			if (fcport->rdata)
 				QEDF_ERR(&qedf->dbg_ctx,
-					 "Waiting for fcport %p portid=%06x.\n",
+					 "Waiting for fcport %px portid=%06x.\n",
 					 fcport, fcport->rdata->ids.port_id);
 			} else {
 				QEDF_ERR(&qedf->dbg_ctx,
-					 "Waiting for fcport %p.\n", fcport);
+					 "Waiting for fcport %px.\n", fcport);
 			}
 	}
 	rcu_read_unlock();
@@ -1894,7 +1894,7 @@ static int qedf_vport_create(struct fc_vport *vport, bool disabled)
 		fc_vport_setlink(vn_port);
 	}
 
-	QEDF_INFO(&(base_qedf->dbg_ctx), QEDF_LOG_NPIV, "vn_port=%p.\n",
+	QEDF_INFO(&(base_qedf->dbg_ctx), QEDF_LOG_NPIV, "vn_port=%px.\n",
 		   vn_port);
 
 	/* Set up debug context for vport */
@@ -2314,7 +2314,7 @@ static void qedf_simd_int_handler(void *cookie)
 	/* Cookie is qedf_ctx struct */
 	struct qedf_ctx *qedf = (struct qedf_ctx *)cookie;
 
-	QEDF_WARN(&(qedf->dbg_ctx), "qedf=%p.\n", qedf);
+	QEDF_WARN(&(qedf->dbg_ctx), "qedf=%px.\n", qedf);
 }
 
 #define QEDF_SIMD_HANDLER_NUM		0
@@ -2543,13 +2543,13 @@ static void qedf_recv_frame(struct qedf_ctx *qedf,
 	if (fcport && test_bit(QEDF_RPORT_UPLOADING_CONNECTION,
 	    &fcport->flags)) {
 		QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_LL2,
-		    "Connection uploading, dropping fp=%p.\n", fp);
+		    "Connection uploading, dropping fp=%px.\n", fp);
 		kfree_skb(skb);
 		return;
 	}
 
 	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_LL2, "FCoE frame receive: "
-	    "skb=%p fp=%p src=%06x dest=%06x r_ctl=%x fh_type=%x.\n", skb, fp,
+	    "skb=%px fp=%px src=%06x dest=%06x r_ctl=%x fh_type=%x.\n", skb, fp,
 	    ntoh24(fh->fh_s_id), ntoh24(fh->fh_d_id), fh->fh_r_ctl,
 	    fh->fh_type);
 	if (qedf_dump_frames)
@@ -2776,7 +2776,7 @@ void qedf_process_cqe(struct qedf_ctx *qedf, struct fcoe_cqe *cqe)
 
 	if (fcport == NULL) {
 		QEDF_ERR(&qedf->dbg_ctx,
-			 "fcport is NULL for xid=0x%x io_req=%p.\n",
+			 "fcport is NULL for xid=0x%x io_req=%px.\n",
 			 xid, io_req);
 		return;
 	}
@@ -2787,7 +2787,7 @@ void qedf_process_cqe(struct qedf_ctx *qedf, struct fcoe_cqe *cqe)
 	 */
 	if (!test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) {
 		QEDF_ERR(&qedf->dbg_ctx,
-			 "Session not offloaded yet, fcport = %p.\n", fcport);
+			 "Session not offloaded yet, fcport = %px.\n", fcport);
 		return;
 	}
 
@@ -2930,7 +2930,7 @@ static int qedf_alloc_bdq(struct qedf_ctx *qedf)
 	}
 
 	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
-		  "BDQ PBL addr=0x%p dma=%pad\n",
+		  "BDQ PBL addr=0x%px dma=%pad\n",
 		  qedf->bdq_pbl, &qedf->bdq_pbl_dma);
 
 	/*
@@ -3011,7 +3011,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)
 		return -ENOMEM;
 	}
 	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
-		   "qedf->global_queues=%p.\n", qedf->global_queues);
+		   "qedf->global_queues=%px.\n", qedf->global_queues);
 
 	/* Allocate DMA coherent buffers for BDQ */
 	rc = qedf_alloc_bdq(qedf);
@@ -3184,7 +3184,7 @@ static int qedf_set_fcoe_pf_param(struct qedf_ctx *qedf)
 	qedf->pf_params.fcoe_pf_params.rq_buffer_size = QEDF_BDQ_BUF_SIZE;
 
 	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
-	    "bdq_list=%p bdq_pbl_list_dma=%llx bdq_pbl_list_entries=%d.\n",
+	    "bdq_list=%px bdq_pbl_list_dma=%llx bdq_pbl_list_entries=%d.\n",
 	    qedf->bdq_pbl_list,
 	    qedf->pf_params.fcoe_pf_params.bdq_pbl_base_addr[0],
 	    qedf->pf_params.fcoe_pf_params.bdq_pbl_num_entries[0]);
@@ -3309,7 +3309,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
 		QEDF_ERR(&(qedf->dbg_ctx), "qedf->io_mempool is NULL.\n");
 		goto err1;
 	}
-	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_INFO, "qedf->io_mempool=%p.\n",
+	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_INFO, "qedf->io_mempool=%px.\n",
 	    qedf->io_mempool);
 
 	sprintf(host_buf, "qedf_%u_link",
@@ -3390,7 +3390,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
 	qedf->bdq_primary_prod = qedf->dev_info.primary_dbq_rq_addr;
 	qedf->bdq_secondary_prod = qedf->dev_info.secondary_bdq_rq_addr;
 	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
-	    "BDQ primary_prod=%p secondary_prod=%p.\n", qedf->bdq_primary_prod,
+	    "BDQ primary_prod=%px secondary_prod=%px.\n", qedf->bdq_primary_prod,
 	    qedf->bdq_secondary_prod);
 
 	qed_ops->register_ops(qedf->cdev, &qedf_cb_ops, qedf);
@@ -3435,8 +3435,8 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
 	}
 	task_start = qedf_get_task_mem(&qedf->tasks, 0);
 	task_end = qedf_get_task_mem(&qedf->tasks, MAX_TID_BLOCKS_FCOE - 1);
-	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "Task context start=%p, "
-		   "end=%p block_size=%u.\n", task_start, task_end,
+	QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC, "Task context start=%px, "
+		   "end=%px block_size=%u.\n", task_start, task_end,
 		   qedf->tasks.size);
 
 	/*
@@ -3590,7 +3590,7 @@ static int __qedf_probe(struct pci_dev *pdev, int mode)
 			}
 
 			QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_DISC,
-			    "grcdump: addr=%p, size=%u.\n",
+			    "grcdump: addr=%px, size=%u.\n",
 			    qedf->grcdump, qedf->grcdump_size);
 		}
 		qedf_create_sysfs_ctx_attr(qedf);
@@ -4037,7 +4037,7 @@ static int __init qedf_init(void)
 		QEDF_ERR(NULL, "qedf_io_work_cache is NULL.\n");
 		goto err1;
 	}
-	QEDF_INFO(NULL, QEDF_LOG_DISC, "qedf_io_work_cache=%p.\n",
+	QEDF_INFO(NULL, QEDF_LOG_DISC, "qedf_io_work_cache=%px.\n",
 	    qedf_io_work_cache);
 
 	qed_ops = qed_get_fcoe_ops();
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/8] qedf: Misc fixes for the driver.
  2020-09-07 12:14 [PATCH 0/8] qedf: Misc fixes for the driver Javed Hasan
                   ` (7 preceding siblings ...)
  2020-09-07 12:14 ` [PATCH 8/8] qedf: Changes the %p to %px to print pointers Javed Hasan
@ 2020-09-09  3:19 ` Martin K. Petersen
  2020-09-15 20:16 ` Martin K. Petersen
  9 siblings, 0 replies; 12+ messages in thread
From: Martin K. Petersen @ 2020-09-09  3:19 UTC (permalink / raw)
  To: Javed Hasan; +Cc: martin.petersen, linux-scsi, GR-QLogic-Storage-Upstream


Javed,

> This series has misc bug fixes and code enhancements.

Applied to the 5.10 SCSI staging tree. Thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/8] qedf: Misc fixes for the driver.
  2020-09-07 12:14 [PATCH 0/8] qedf: Misc fixes for the driver Javed Hasan
                   ` (8 preceding siblings ...)
  2020-09-09  3:19 ` [PATCH 0/8] qedf: Misc fixes for the driver Martin K. Petersen
@ 2020-09-15 20:16 ` Martin K. Petersen
  9 siblings, 0 replies; 12+ messages in thread
From: Martin K. Petersen @ 2020-09-15 20:16 UTC (permalink / raw)
  To: Javed Hasan; +Cc: Martin K . Petersen, GR-QLogic-Storage-Upstream, linux-scsi

On Mon, 7 Sep 2020 05:14:35 -0700, Javed Hasan wrote:

> This series has misc bug fixes and code enhancements.
> 
> Kindly apply this series to scsi-queue at your earliest convenience.
> 
> Thanks,
> ~Javed
> 
> [...]

Applied to 5.10/scsi-queue, thanks!

[1/8] scsi: qedf: Change the debug parameter permission to read & write
      https://git.kernel.org/mkp/scsi/c/066664645d9a
[2/8] scsi: qedf: Correct the comment in qedf_initiate_els
      https://git.kernel.org/mkp/scsi/c/31fc82d7fbd8
[3/8] scsi: qedf: Fix for the session’s E_D_TOV value
      https://git.kernel.org/mkp/scsi/c/f78f8126264b
[4/8] scsi: qedf: FDMI attributes correction
      https://git.kernel.org/mkp/scsi/c/41715c6292b6
[5/8] scsi: qedf: Return SUCCESS if stale rport is encountered
      https://git.kernel.org/mkp/scsi/c/10aff62fab26
[6/8] scsi: qedf: Add schedule_hw_err_handler callback for fan failure
      https://git.kernel.org/mkp/scsi/c/55e049910e08
[7/8] scsi: qedf: Retry qed->probe during recovery
      https://git.kernel.org/mkp/scsi/c/988100a7de0f

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 6/8] qedf: Add schedule_hw_err_handler callback for fan failure.
  2020-08-25  6:43 Javed Hasan
@ 2020-08-25  6:43 ` Javed Hasan
  0 siblings, 0 replies; 12+ messages in thread
From: Javed Hasan @ 2020-08-25  6:43 UTC (permalink / raw)
  To: martin.petersen; +Cc: linux-scsi, GR-QLogic-Storage-Upstream, jhasan

From: Saurav Kashyap <skashyap@marvell.com>

 If we receive a fan failure message from qed, disable the PCI function.
 Initiate recovery for errors like ramrod failure

Signed-off-by: Javed Hasan <jhasan@marvell.com>
---
 drivers/scsi/qedf/qedf.h      |  4 ++++
 drivers/scsi/qedf/qedf_main.c | 45 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+)

diff --git a/drivers/scsi/qedf/qedf.h b/drivers/scsi/qedf/qedf.h
index 15d6cbe..0e2cbb1 100644
--- a/drivers/scsi/qedf/qedf.h
+++ b/drivers/scsi/qedf/qedf.h
@@ -389,6 +389,7 @@ struct qedf_ctx {
 	mempool_t *io_mempool;
 	struct workqueue_struct *dpc_wq;
 	struct delayed_work recovery_work;
+	struct delayed_work board_disable_work;
 	struct delayed_work grcdump_work;
 	struct delayed_work stag_work;
 
@@ -541,6 +542,9 @@ extern void qedf_process_seq_cleanup_compl(struct qedf_ctx *qedf,
 extern void qedf_wq_grcdump(struct work_struct *work);
 void qedf_stag_change_work(struct work_struct *work);
 void qedf_ctx_soft_reset(struct fc_lport *lport);
+extern void qedf_board_disable_work(struct work_struct *work);
+extern void qedf_schedule_hw_err_handler(void *dev,
+		enum qed_hw_err_type err_type);
 
 #define FCOE_WORD_TO_BYTE  4
 #define QEDF_MAX_TASK_NUM	0xFFFF
diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index 50af70a..3a45ca7 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -104,6 +104,12 @@
 MODULE_PARM_DESC(dp_level, " printk verbosity control passed to qed module  "
 	"during probe (0-3: 0 more verbose).");
 
+static bool qedf_enable_recovery = true;
+module_param_named(enable_recovery, qedf_enable_recovery,
+		bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(enable_recovery, "Enable/disable recovery on driver/firmware "
+		"interface level errors 0 = Disabled, 1 = Enabled (Default: 1).");
+
 struct workqueue_struct *qedf_io_wq;
 
 static struct fcoe_percpu_s qedf_global;
@@ -668,6 +674,7 @@ static u32 qedf_get_login_failures(void *cookie)
 		.dcbx_aen = qedf_dcbx_handler,
 		.get_generic_tlv_data = qedf_get_generic_tlv_data,
 		.get_protocol_tlv_data = qedf_get_protocol_tlv_data,
+		.schedule_hw_err_handler = qedf_schedule_hw_err_handler,
 	}
 };
 
@@ -3777,6 +3784,44 @@ void qedf_wq_grcdump(struct work_struct *work)
 	qedf_capture_grc_dump(qedf);
 }
 
+void qedf_schedule_hw_err_handler(void *dev, enum qed_hw_err_type err_type)
+{
+	struct qedf_ctx *qedf = dev;
+
+	QEDF_ERR(&(qedf->dbg_ctx),
+			"Hardware error handler scheduled, event=%d.\n",
+			err_type);
+
+	if (test_bit(QEDF_IN_RECOVERY, &qedf->flags)) {
+		QEDF_ERR(&(qedf->dbg_ctx),
+				"Already in recovery, not scheduling board disable work.\n");
+		return;
+	}
+
+	switch (err_type) {
+	case QED_HW_ERR_FAN_FAIL:
+		schedule_delayed_work(&qedf->board_disable_work, 0);
+		break;
+	case QED_HW_ERR_MFW_RESP_FAIL:
+	case QED_HW_ERR_HW_ATTN:
+	case QED_HW_ERR_DMAE_FAIL:
+	case QED_HW_ERR_FW_ASSERT:
+		/* Prevent HW attentions from being reasserted */
+		qed_ops->common->attn_clr_enable(qedf->cdev, true);
+		break;
+	case QED_HW_ERR_RAMROD_FAIL:
+		/* Prevent HW attentions from being reasserted */
+		qed_ops->common->attn_clr_enable(qedf->cdev, true);
+
+		if (qedf_enable_recovery)
+			qed_ops->common->recovery_process(qedf->cdev);
+
+		break;
+	default:
+		break;
+	}
+}
+
 /*
  * Protocol TLV handler
  */
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-09-15 22:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-07 12:14 [PATCH 0/8] qedf: Misc fixes for the driver Javed Hasan
2020-09-07 12:14 ` [PATCH 1/8] qedf: Changed the debug parameter permission to read & write Javed Hasan
2020-09-07 12:14 ` [PATCH 2/8] qedf: Correct the comment in qedf_initiate_els Javed Hasan
2020-09-07 12:14 ` [PATCH 3/8] qedf: Fix for the session’s E_D_TOV value Javed Hasan
2020-09-07 12:14 ` [PATCH 4/8] qedf: FDMI attributes correction Javed Hasan
2020-09-07 12:14 ` [PATCH 5/8] qedf: Return SUCCESS if stale rport in encountered Javed Hasan
2020-09-07 12:14 ` [PATCH 6/8] qedf: Add schedule_hw_err_handler callback for fan failure Javed Hasan
2020-09-07 12:14 ` [PATCH 7/8] qedf: Retry qed->probe during recovery Javed Hasan
2020-09-07 12:14 ` [PATCH 8/8] qedf: Changes the %p to %px to print pointers Javed Hasan
2020-09-09  3:19 ` [PATCH 0/8] qedf: Misc fixes for the driver Martin K. Petersen
2020-09-15 20:16 ` Martin K. Petersen
  -- strict thread matches above, loose matches on Subject: below --
2020-08-25  6:43 Javed Hasan
2020-08-25  6:43 ` [PATCH 6/8] qedf: Add schedule_hw_err_handler callback for fan failure Javed Hasan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).