Commit 5d5e5565 authored by Shyam Sundar's avatar Shyam Sundar Committed by Martin K. Petersen

scsi: qedf: Modify flush routine to handle all I/Os and TMF

The purpose of flush routine is to cleanup I/Os to the firmware and
complete them to scsi middle layer. This routine is invoked before
connection is uploaded because of rport going away.

 - Don't process any I/Os, aborts, TMFs coming when flush in progress.

 - Add flags to handle cleanup and release of I/Os because flush can
   prematurely complete I/Os.

 - Original command can get completed to driver when cleanup for same is
   posted to firmware, handle this condition.

 - Modify flush to handle I/Os in all the states like abort, TMF, RRQ and
   timeouts.
Signed-off-by: default avatarShyam Sundar <ssundar@marvell.com>
Signed-off-by: default avatarChad Dupuis <cdupuis@marvell.com>
Signed-off-by: default avatarSaurav Kashyap <skashyap@marvell.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 3e2c11b3
......@@ -113,6 +113,8 @@ struct qedf_ioreq {
#define QEDF_CMD_IN_ABORT 0x1
#define QEDF_CMD_IN_CLEANUP 0x2
#define QEDF_CMD_SRR_SENT 0x3
#define QEDF_CMD_DIRTY 0x4
#define QEDF_CMD_ERR_SCSI_DONE 0x5
u8 io_req_flags;
uint8_t tm_flags;
struct qedf_rport *fcport;
......@@ -129,6 +131,7 @@ struct qedf_ioreq {
struct fcoe_task_params *task_params;
struct scsi_sgl_task_params *sgl_task_params;
int idx;
int lun;
/*
* Need to allocate enough room for both sense data and FCP response data
* which has a max length of 8 bytes according to spec.
......@@ -168,6 +171,8 @@ struct qedf_ioreq {
* during some form of error processing.
*/
bool return_scsi_cmd_on_abts;
unsigned int alloc;
};
extern struct workqueue_struct *qedf_io_wq;
......@@ -187,6 +192,7 @@ struct qedf_rport {
void __iomem *p_doorbell;
/* Send queue management */
atomic_t free_sqes;
atomic_t ios_to_queue;
atomic_t num_active_ios;
struct fcoe_wqe *sq;
dma_addr_t sq_dma;
......
......@@ -135,6 +135,8 @@ static int qedf_initiate_els(struct qedf_rport *fcport, unsigned int op,
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Ringing doorbell for ELS "
"req\n");
qedf_ring_doorbell(fcport);
set_bit(QEDF_CMD_OUTSTANDING, &els_req->flags);
spin_unlock_irqrestore(&fcport->rport_lock, flags);
els_err:
return rc;
......@@ -151,6 +153,8 @@ void qedf_process_els_compl(struct qedf_ctx *qedf, struct fcoe_cqe *cqe,
QEDF_INFO(&(qedf->dbg_ctx), QEDF_LOG_ELS, "Entered with xid = 0x%x"
" cmd_type = %d.\n", els_req->xid, els_req->cmd_type);
clear_bit(QEDF_CMD_OUTSTANDING, &els_req->flags);
/* Kill the ELS timer */
cancel_delayed_work(&els_req->timeout_work);
......
This diff is collapsed.
......@@ -1370,10 +1370,12 @@ static void qedf_rport_event_handler(struct fc_lport *lport,
fcport = (struct qedf_rport *)&rp[1];
/* Only free this fcport if it is offloaded already */
if (test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags)) {
set_bit(QEDF_RPORT_UPLOADING_CONNECTION, &fcport->flags);
if (test_bit(QEDF_RPORT_SESSION_READY, &fcport->flags) &&
!test_bit(QEDF_RPORT_UPLOADING_CONNECTION,
&fcport->flags)) {
set_bit(QEDF_RPORT_UPLOADING_CONNECTION,
&fcport->flags);
qedf_cleanup_fcport(qedf, fcport);
/*
* Remove fcport to list of qedf_ctx list of offloaded
* ports
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment