Skip to contentSkip to conversation

scsi: fnic: Fix sg_reset success path

PATCH Applied Karan Tilak Kumar 2 participants 2 messages Sep 19, 2023 – Sep 27, 2023

Subsystems (2)
lore
Share & tools
lore

Karan Tilak Kumar

author maintainer
#0 lore raw

PATCH 1/1 scsi: fnic: Fix sg_reset success path

sg_reset performs a device reset/lun reset on a lun. Since it is issued by the user, it does not come into the driver with a tag or a queue id.
Fix the fnic driver to create an io_req and use a scsi command tag. Fix the ITMF path to special case the sg_reset response.

---
 drivers/scsi/fnic/fnic.h      |  4 ++-
 drivers/scsi/fnic/fnic_io.h   |  2 ++
 drivers/scsi/fnic/fnic_main.c |  2 ++
 drivers/scsi/fnic/fnic_scsi.c | 64 +++++++++++++++++++++++++----------
 4 files changed, 54 insertions(+), 18 deletions(-)
drivers/scsi/fnic/fnic.h +3 -1
index 93c68931a593..22cef283b2b9 100644
@@ -27,7 +27,7 @@
 
 #define DRV_NAME		"fnic"
 #define DRV_DESCRIPTION		"Cisco FCoE HBA Driver"
-#define DRV_VERSION		"1.6.0.56"
+#define DRV_VERSION		"1.6.0.57"
 #define PFX			DRV_NAME ": "
 #define DFX                     DRV_NAME "%d: "
 
@@ -237,6 +237,8 @@ struct fnic {
 	unsigned int cq_count;
 
 	struct mutex sgreset_mutex;
+	spinlock_t sgreset_lock; /* lock for sgreset */
+	struct scsi_cmnd *sgreset_sc;
 	struct dentry *fnic_stats_debugfs_host;
 	struct dentry *fnic_stats_debugfs_file;
 	struct dentry *fnic_reset_debugfs_file;
drivers/scsi/fnic/fnic_io.h +2 -0
index f4c8769df312..9ec41aadb04e 100644
@@ -52,6 +52,8 @@ struct fnic_io_req {
 	unsigned long start_time; /* in jiffies */
 	struct completion *abts_done; /* completion for abts */
 	struct completion *dr_done; /* completion for device reset */
+	unsigned int tag;
+	struct scsi_cmnd *sc; /* midlayer's cmd pointer*/
 };
 
 enum fnic_port_speeds {
drivers/scsi/fnic/fnic_main.c +2 -0
index 984bc5fc55e2..f27f9319e0b2 100644
@@ -754,6 +754,8 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	for (i = 0; i < FNIC_IO_LOCKS; i++)
 		spin_lock_init(&fnic->io_req_lock[i]);
 
+	spin_lock_init(&fnic->sgreset_lock);
+
 	err = -ENOMEM;
 	fnic->io_req_pool = mempool_create_slab_pool(2, fnic_io_req_cache);
 	if (!fnic->io_req_pool)
drivers/scsi/fnic/fnic_scsi.c +47 -17

133 lines not on this page · raw message

Signature · 1 line
2.31.1
#1 lore raw
Quoted 8 lines · Karan Tilak Kumar

sg_reset performs a device reset/lun reset on a lun. Since it is issued by the user, it does not come into the driver with a tag or a queue id.
Fix the fnic driver to create an io_req and use a scsi command tag. Fix the ITMF path to special case the sg_reset response.

[...]

Applied to 6.6/scsi-fixes, thanks!

[1/1] scsi: fnic: Fix sg_reset success path

      https://git.kernel.org/mkp/scsi/c/514f0c400bde
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering