Skip to contentSkip to conversation

bnx2fc: General updates.

PATCH Applied Saurav Kashyap 2 participants 6 messages Mar 27, 2020 – Mar 30, 2020

Subsystems (2)
lore
Share & tools
lore

Saurav Kashyap

author maintainer
#0 lore raw

cover bnx2fc: General updates.

Hi Martin,

Kindly apply this series to scsi tree at your earliest convenience.

Thanks,
~Saurav

Javed Hasan (1):
bnx2fc: Process the RQE with CQE in interrupt context.

Saurav Kashyap (2):
bnx2fc: Fix scsi command completion after cleanup is posted.
bnx2fc: Update the driver version to 2.12.13.

 drivers/scsi/bnx2fc/bnx2fc.h      |  13 +++--
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   8 ++-
 drivers/scsi/bnx2fc/bnx2fc_hwi.c  | 103 +++++++++++++++++++++++++++-----------
 drivers/scsi/bnx2fc/bnx2fc_io.c   |  34 +++++--------
 4 files changed, 103 insertions(+), 55 deletions(-)
Signature · 1 line
1.8.3.1
author maintainer
#1 lore raw

PATCH 1/3 bnx2fc: Process the RQE with CQE in interrupt context.

From: Javed Hasan <[email protected]>

Filesystem goes to read-only after continuous error injection because RQE was handled in deferred context, leading to mismatch between CQE and RQE.

Specifically, this patch:

-Process the RQE with CQE in interrupt context, before putting it into the work queue while in the interrupt context.

-Producer and consumer indices are also updated in the interrupt context.
to gaurantee the the order of processing.

---
 drivers/scsi/bnx2fc/bnx2fc.h      |  11 ++--
 drivers/scsi/bnx2fc/bnx2fc_fcoe.c |   8 ++-
 drivers/scsi/bnx2fc/bnx2fc_hwi.c  | 103 +++++++++++++++++++++++++++-----------
 drivers/scsi/bnx2fc/bnx2fc_io.c   |  28 +++--------
 4 files changed, 96 insertions(+), 54 deletions(-)
drivers/scsi/bnx2fc/bnx2fc.h +8 -3
index 3b84db8..15fa8e2 100644
@@ -482,7 +482,10 @@ struct io_bdt {
 struct bnx2fc_work {
 	struct list_head list;
 	struct bnx2fc_rport *tgt;
+	struct fcoe_task_ctx_entry *task;
+	unsigned char rq_data[BNX2FC_RQ_BUF_SZ];
 	u16 wqe;
+	u8 num_rq;
 };
 struct bnx2fc_unsol_els {
 	struct fc_lport *lport;
@@ -550,7 +553,7 @@ void bnx2fc_rport_event_handler(struct fc_lport *lport,
 				enum fc_rport_event event);
 void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
 				   struct fcoe_task_ctx_entry *task,
-				   u8 num_rq);
+				   u8 num_rq, unsigned char *rq_data);
 void bnx2fc_process_cleanup_compl(struct bnx2fc_cmd *io_req,
 			       struct fcoe_task_ctx_entry *task,
 			       u8 num_rq);
@@ -559,7 +562,7 @@ void bnx2fc_process_abts_compl(struct bnx2fc_cmd *io_req,
 			       u8 num_rq);
 void bnx2fc_process_tm_compl(struct bnx2fc_cmd *io_req,
 			     struct fcoe_task_ctx_entry *task,
-			     u8 num_rq);
+			     u8 num_rq, unsigned char *rq_data);
 void bnx2fc_process_els_compl(struct bnx2fc_cmd *els_req,
 			      struct fcoe_task_ctx_entry *task,
 			      u8 num_rq);
@@ -577,7 +580,9 @@ struct fc_seq *bnx2fc_elsct_send(struct fc_lport *lport, u32 did,
 				      void *arg, u32 timeout);
 void bnx2fc_arm_cq(struct bnx2fc_rport *tgt);
 int bnx2fc_process_new_cqes(struct bnx2fc_rport *tgt);
-void bnx2fc_process_cq_compl(struct bnx2fc_rport *tgt, u16 wqe);
+void bnx2fc_process_cq_compl(struct bnx2fc_rport *tgt, u16 wqe,
+			     unsigned char *rq_data, u8 num_rq,
+			     struct fcoe_task_ctx_entry *task);
 struct bnx2fc_rport *bnx2fc_tgt_lookup(struct fcoe_port *port,
 					     u32 port_id);
 void bnx2fc_process_l2_frame_compl(struct bnx2fc_rport *tgt,
drivers/scsi/bnx2fc/bnx2fc_fcoe.c +6 -2
index b4bfab5..1cbb431 100644
@@ -660,7 +660,10 @@ static int bnx2fc_percpu_io_thread(void *arg)
 
 			list_for_each_entry_safe(work, tmp, &work_list, list) {
 				list_del_init(&work->list);
-				bnx2fc_process_cq_compl(work->tgt, work->wqe);
+				bnx2fc_process_cq_compl(work->tgt, work->wqe,
+							work->rq_data,
+							work->num_rq,
+							work->task);
 				kfree(work);
 			}
 
@@ -2655,7 +2658,8 @@ static int bnx2fc_cpu_offline(unsigned int cpu)
 	/* Free all work in the list */
 	list_for_each_entry_safe(work, tmp, &p->work_list, list) {
 		list_del_init(&work->list);
-		bnx2fc_process_cq_compl(work->tgt, work->wqe);
+		bnx2fc_process_cq_compl(work->tgt, work->wqe, work->rq_data,
+					work->num_rq, work->task);
 		kfree(work);
 	}
 
drivers/scsi/bnx2fc/bnx2fc_hwi.c +75 -28

169 lines not on this page · raw message

drivers/scsi/bnx2fc/bnx2fc_io.c +7 -21
index 4c8122a..9ab9152 100644
@@ -24,7 +24,7 @@ static int bnx2fc_split_bd(struct bnx2fc_cmd *io_req, u64 addr, int sg_len,
 static void bnx2fc_free_mp_resc(struct bnx2fc_cmd *io_req);
 static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req,
 				 struct fcoe_fcp_rsp_payload *fcp_rsp,
-				 u8 num_rq);
+				 u8 num_rq, unsigned char *rq_data);
 
 void bnx2fc_cmd_timer_set(struct bnx2fc_cmd *io_req,
 			  unsigned int timer_msec)
@@ -1518,7 +1518,8 @@ static void bnx2fc_tgt_reset_cmpl(struct bnx2fc_cmd *io_req)
 }
 
 void bnx2fc_process_tm_compl(struct bnx2fc_cmd *io_req,
-			     struct fcoe_task_ctx_entry *task, u8 num_rq)
+			     struct fcoe_task_ctx_entry *task, u8 num_rq,
+				  unsigned char *rq_data)
 {
 	struct bnx2fc_mp_req *tm_req;
 	struct fc_frame_header *fc_hdr;
@@ -1557,7 +1558,7 @@ void bnx2fc_process_tm_compl(struct bnx2fc_cmd *io_req,
 	if (fc_hdr->fh_r_ctl == FC_RCTL_DD_CMD_STATUS) {
 		bnx2fc_parse_fcp_rsp(io_req,
 				     (struct fcoe_fcp_rsp_payload *)
-				     rsp_buf, num_rq);
+				     rsp_buf, num_rq, rq_data);
 		if (io_req->fcp_rsp_code == 0) {
 			/* TM successful */
 			if (tm_req->tm_flags & FCP_TMF_LUN_RESET)
@@ -1755,15 +1756,11 @@ void bnx2fc_build_fcp_cmnd(struct bnx2fc_cmd *io_req,
 
 static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req,
 				 struct fcoe_fcp_rsp_payload *fcp_rsp,
-				 u8 num_rq)
+				 u8 num_rq, unsigned char *rq_data)
 {
 	struct scsi_cmnd *sc_cmd = io_req->sc_cmd;
-	struct bnx2fc_rport *tgt = io_req->tgt;
 	u8 rsp_flags = fcp_rsp->fcp_flags.flags;
 	u32 rq_buff_len = 0;
-	int i;
-	unsigned char *rq_data;
-	unsigned char *dummy;
 	int fcp_sns_len = 0;
 	int fcp_rsp_len = 0;
 
@@ -1809,14 +1806,6 @@ static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req,
 			rq_buff_len =  num_rq * BNX2FC_RQ_BUF_SZ;
 		}
 
-		rq_data = bnx2fc_get_next_rqe(tgt, 1);
-
-		if (num_rq > 1) {
-			/* We do not need extra sense data */
-			for (i = 1; i < num_rq; i++)
-				dummy = bnx2fc_get_next_rqe(tgt, 1);
-		}
-
 		/* fetch fcp_rsp_code */
 		if ((fcp_rsp_len == 4) || (fcp_rsp_len == 8)) {
 			/* Only for task management function */
@@ -1837,9 +1826,6 @@ static void bnx2fc_parse_fcp_rsp(struct bnx2fc_cmd *io_req,
 		if (fcp_sns_len)
 			memcpy(sc_cmd->sense_buffer, rq_data, fcp_sns_len);
 
-		/* return RQ entries */
-		for (i = 0; i < num_rq; i++)
-			bnx2fc_return_rqe(tgt, 1);
 	}
 }
 
@@ -1918,7 +1904,7 @@ int bnx2fc_queuecommand(struct Scsi_Host *host,
 
 void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
 				   struct fcoe_task_ctx_entry *task,
-				   u8 num_rq)
+				   u8 num_rq, unsigned char *rq_data)
 {
 	struct fcoe_fcp_rsp_payload *fcp_rsp;
 	struct bnx2fc_rport *tgt = io_req->tgt;
@@ -1950,7 +1936,7 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
 		   &(task->rxwr_only.union_ctx.comp_info.fcp_rsp.payload);
 
 	/* parse fcp_rsp and obtain sense data from RQ if available */
-	bnx2fc_parse_fcp_rsp(io_req, fcp_rsp, num_rq);
+	bnx2fc_parse_fcp_rsp(io_req, fcp_rsp, num_rq, rq_data);
 
 	if (!sc_cmd->SCp.ptr) {
 		printk(KERN_ERR PFX "SCp.ptr is NULL\n");
Signature · 1 line
1.8.3.1
author maintainer
#2 lore raw

PATCH 2/3 bnx2fc: Fix scsi command completion after cleanup is posted.

In reply to Saurav Kashyap

Driver received a scsi completion after it posted the cleanup request. This leads to a problem that one of the ref count wasn't released leading to flush_active_ios to struck. The callback from libfc never returned and other ports were not processed leading to APD.

- The patch will decrease the refcnt as well try to complete if something is waiting for completion.

---
 drivers/scsi/bnx2fc/bnx2fc_io.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/scsi/bnx2fc/bnx2fc_io.c +6 -0
index 9ab9152..2b070f0 100644
@@ -1917,6 +1917,12 @@ void bnx2fc_process_scsi_cmd_compl(struct bnx2fc_cmd *io_req,
 		/* we will not receive ABTS response for this IO */
 		BNX2FC_IO_DBG(io_req, "Timer context finished processing "
 			   "this scsi cmd\n");
+		if (test_and_clear_bit(BNX2FC_FLAG_IO_CLEANUP,
+				       &io_req->req_flags)) {
+			BNX2FC_IO_DBG(io_req,
+				      "Actual completion after cleanup request cleaning up\n");
+			bnx2fc_process_cleanup_compl(io_req, task, num_rq);
+		}
 		return;
 	}
 
Signature · 1 line
1.8.3.1
author maintainer
#3 lore raw

PATCH 3/3 bnx2fc: Update the driver version to 2.12.13.

In reply to Saurav Kashyap

- Update version to 2.12.13.

---
 drivers/scsi/bnx2fc/bnx2fc.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/bnx2fc/bnx2fc.h +1 -1
index 15fa8e2..b6e8ed7 100644
@@ -66,7 +66,7 @@
 #include "bnx2fc_constants.h"
 
 #define BNX2FC_NAME		"bnx2fc"
-#define BNX2FC_VERSION		"2.12.10"
+#define BNX2FC_VERSION		"2.12.13"
 
 #define PFX			"bnx2fc: "
 
Signature · 1 line
1.8.3.1
#4 lore raw
In reply to Saurav Kashyap

Saurav,

Quoted 1 line

Kindly apply this series to scsi tree at your earliest convenience.

Applied to 5.7/scsi-queue, thanks.

Patch #1 had several indentation issues which I fixed up.

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
author maintainer
#5 lore raw

Thanks a lot, will take care from next time.

Thanks,
~Saurav

Quoted 22 lines

-----Original Message-----
From: Martin K. Petersen <[email protected]>
Sent: Friday, March 27, 2020 11:48 PM
To: Saurav Kashyap <[email protected]>
Cc: [email protected]; GR-QLogic-Storage-Upstream <GR-QLogic- [email protected]>; [email protected]
Subject: [EXT] Re: [PATCH 0/3] bnx2fc: General updates.

External Email

----------------------------------------------------------------------

Saurav,

Quoted 1 line

Kindly apply this series to scsi tree at your earliest convenience.

Applied to 5.7/scsi-queue, thanks.

Patch #1 had several indentation issues which I fixed up.

--
Martin K. Petersen Oracle Linux Engineering