mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Karan Tilak Kumar <kartilak@cisco.com>
To: sebaddel@cisco.com
Cc: arulponn@cisco.com, djhawar@cisco.com, gcboffa@cisco.com,
	mkai2@cisco.com, satishkh@cisco.com, jejb@linux.ibm.com,
	martin.petersen@oracle.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Karan Tilak Kumar <kartilak@cisco.com>
Subject: [PATCH v2 09/13] scsi: fnic: Remove usage of host_lock
Date: Fri, 27 Oct 2023 11:02:58 -0700	[thread overview]
Message-ID: <20231027180302.418676-10-kartilak@cisco.com> (raw)
In-Reply-To: <20231027180302.418676-1-kartilak@cisco.com>

Remove usage of host_lock.
Replace with fnic_lock, where necessary.

Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com>
Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com>
Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com>
---
 drivers/scsi/fnic/fnic_scsi.c | 27 ++++++---------------------
 1 file changed, 6 insertions(+), 21 deletions(-)

diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index f32781f8fdd0..9a1beb3e7269 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -170,17 +170,14 @@ __fnic_set_state_flags(struct fnic *fnic, unsigned long st_flags,
 			unsigned long clearbits)
 {
 	unsigned long flags = 0;
-	unsigned long host_lock_flags = 0;
 
 	spin_lock_irqsave(&fnic->fnic_lock, flags);
-	spin_lock_irqsave(fnic->lport->host->host_lock, host_lock_flags);
 
 	if (clearbits)
 		fnic->state_flags &= ~st_flags;
 	else
 		fnic->state_flags |= st_flags;
 
-	spin_unlock_irqrestore(fnic->lport->host->host_lock, host_lock_flags);
 	spin_unlock_irqrestore(&fnic->fnic_lock, flags);
 
 	return;
@@ -479,12 +476,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)
 
 	atomic_inc(&fnic->in_flight);
 
-	/*
-	 * Release host lock, use driver resource specific locks from here.
-	 * Don't re-enable interrupts in case they were disabled prior to the
-	 * caller disabling them.
-	 */
-	spin_unlock(lp->host->host_lock);
 	fnic_priv(sc)->state = FNIC_IOREQ_NOT_INITED;
 	fnic_priv(sc)->flags = FNIC_NO_FLAGS;
 
@@ -569,8 +560,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)
 			mempool_free(io_req, fnic->io_req_pool);
 		}
 		atomic_dec(&fnic->in_flight);
-		/* acquire host lock before returning to SCSI */
-		spin_lock(lp->host->host_lock);
 		return ret;
 	} else {
 		atomic64_inc(&fnic_stats->io_stats.active_ios);
@@ -598,8 +587,6 @@ static int fnic_queuecommand_lck(struct scsi_cmnd *sc)
 		spin_unlock_irqrestore(io_lock, flags);
 
 	atomic_dec(&fnic->in_flight);
-	/* acquire host lock before returning to SCSI */
-	spin_lock(lp->host->host_lock);
 	return ret;
 }
 
@@ -1477,18 +1464,17 @@ static inline int fnic_queue_abort_io_req(struct fnic *fnic, int tag,
 					  struct fnic_io_req *io_req)
 {
 	struct vnic_wq_copy *wq = &fnic->hw_copy_wq[0];
-	struct Scsi_Host *host = fnic->lport->host;
 	struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats;
 	unsigned long flags;
 
-	spin_lock_irqsave(host->host_lock, flags);
+	spin_lock_irqsave(&fnic->fnic_lock, flags);
 	if (unlikely(fnic_chk_state_flags_locked(fnic,
 						FNIC_FLAGS_IO_BLOCKED))) {
-		spin_unlock_irqrestore(host->host_lock, flags);
+		spin_unlock_irqrestore(&fnic->fnic_lock, flags);
 		return 1;
 	} else
 		atomic_inc(&fnic->in_flight);
-	spin_unlock_irqrestore(host->host_lock, flags);
+	spin_unlock_irqrestore(&fnic->fnic_lock, flags);
 
 	spin_lock_irqsave(&fnic->wq_copy_lock[0], flags);
 
@@ -1923,20 +1909,19 @@ static inline int fnic_queue_dr_io_req(struct fnic *fnic,
 				       struct fnic_io_req *io_req)
 {
 	struct vnic_wq_copy *wq = &fnic->hw_copy_wq[0];
-	struct Scsi_Host *host = fnic->lport->host;
 	struct misc_stats *misc_stats = &fnic->fnic_stats.misc_stats;
 	struct scsi_lun fc_lun;
 	int ret = 0;
 	unsigned long intr_flags;
 
-	spin_lock_irqsave(host->host_lock, intr_flags);
+	spin_lock_irqsave(&fnic->fnic_lock, intr_flags);
 	if (unlikely(fnic_chk_state_flags_locked(fnic,
 						FNIC_FLAGS_IO_BLOCKED))) {
-		spin_unlock_irqrestore(host->host_lock, intr_flags);
+		spin_unlock_irqrestore(&fnic->fnic_lock, intr_flags);
 		return FAILED;
 	} else
 		atomic_inc(&fnic->in_flight);
-	spin_unlock_irqrestore(host->host_lock, intr_flags);
+	spin_unlock_irqrestore(&fnic->fnic_lock, intr_flags);
 
 	spin_lock_irqsave(&fnic->wq_copy_lock[0], intr_flags);
 
-- 
2.31.1


  parent reply	other threads:[~2023-10-27 18:04 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-27 18:02 [PATCH v2 00/13] Introduce support for multiqueue (MQ) in fnic Karan Tilak Kumar
2023-10-27 18:02 ` [PATCH v2 01/13] scsi: fnic: Modify definitions to sync with VIC firmware Karan Tilak Kumar
2023-11-02  7:23   ` Hannes Reinecke
2023-11-06 19:47     ` Karan Tilak Kumar (kartilak)
2023-10-27 18:02 ` [PATCH v2 02/13] scsi: fnic: Add and use fnic number Karan Tilak Kumar
2023-11-02  7:25   ` Hannes Reinecke
2023-11-06 19:49     ` Karan Tilak Kumar (kartilak)
2023-10-27 18:02 ` [PATCH v2 03/13] scsi: fnic: Add and improve log messages Karan Tilak Kumar
2023-11-02  7:27   ` Hannes Reinecke
2023-11-06 19:55     ` Karan Tilak Kumar (kartilak)
2023-11-07  7:20       ` Hannes Reinecke
2023-11-07 19:54         ` Karan Tilak Kumar (kartilak)
2023-10-27 18:02 ` [PATCH v2 04/13] scsi: fnic: Rename wq_copy to hw_copy_wq Karan Tilak Kumar
2023-11-02  7:28   ` Hannes Reinecke
2023-11-06 19:57     ` Karan Tilak Kumar (kartilak)
2023-10-27 18:02 ` [PATCH v2 05/13] scsi: fnic: Get copy workqueue count and interrupt mode from config Karan Tilak Kumar
2023-11-02  7:29   ` Hannes Reinecke
2023-11-06 19:59     ` Karan Tilak Kumar (kartilak)
2023-10-27 18:02 ` [PATCH v2 06/13] scsi: fnic: Refactor and redefine fnic.h for multiqueue Karan Tilak Kumar
2023-11-02  7:36   ` Hannes Reinecke
2023-11-06 20:11     ` Karan Tilak Kumar (kartilak)
2023-10-27 18:02 ` [PATCH v2 07/13] scsi: fnic: Modify ISRs to support multiqueue(MQ) Karan Tilak Kumar
2023-11-02  7:45   ` Hannes Reinecke
2023-11-06 20:13     ` Karan Tilak Kumar (kartilak)
2023-10-27 18:02 ` [PATCH v2 08/13] scsi: fnic: Define stats to track multiqueue (MQ) IOs Karan Tilak Kumar
2023-11-02  7:46   ` Hannes Reinecke
2023-10-27 18:02 ` Karan Tilak Kumar [this message]
2023-11-02  7:52   ` [PATCH v2 09/13] scsi: fnic: Remove usage of host_lock Hannes Reinecke
2023-11-06 20:20     ` Karan Tilak Kumar (kartilak)
2023-10-27 18:02 ` [PATCH v2 10/13] scsi: fnic: Add support for multiqueue (MQ) in fnic_main.c Karan Tilak Kumar
2023-11-02  7:57   ` Hannes Reinecke
2023-10-27 18:03 ` [PATCH v2 11/13] scsi: fnic: Use fnic_lock to protect fnic structures in queuecommand Karan Tilak Kumar
2023-11-02  8:02   ` Hannes Reinecke
2023-10-27 18:03 ` [PATCH v2 12/13] scsi: fnic: Add support for multiqueue (MQ) in fnic driver Karan Tilak Kumar
2023-10-29 17:20   ` kernel test robot
2023-11-02  8:11   ` Hannes Reinecke
2023-11-06 20:25     ` Karan Tilak Kumar (kartilak)
2023-10-27 18:03 ` [PATCH v2 13/13] scsi: fnic: Improve logs and add support for multiqueue (MQ) Karan Tilak Kumar
2023-11-02  7:59   ` Hannes Reinecke
2023-11-06 20:44     ` Karan Tilak Kumar (kartilak)
2023-11-07  7:27       ` Hannes Reinecke
2023-11-07 18:41         ` Karan Tilak Kumar (kartilak)
2023-11-02  8:14   ` Hannes Reinecke
2023-11-06 20:30     ` Karan Tilak Kumar (kartilak)
2023-11-02  9:00 ` [PATCH v2 00/13] Introduce support for multiqueue (MQ) in fnic John Garry
2023-11-06 19:44   ` Karan Tilak Kumar (kartilak)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231027180302.418676-10-kartilak@cisco.com \
    --to=kartilak@cisco.com \
    --cc=arulponn@cisco.com \
    --cc=djhawar@cisco.com \
    --cc=gcboffa@cisco.com \
    --cc=jejb@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=mkai2@cisco.com \
    --cc=satishkh@cisco.com \
    --cc=sebaddel@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®