scsi: fnic: Avoid looping in TRANS ETH on unload
Subsystems (2)
Karan Tilak Kumar
maintainerPATCH 1/1 scsi: fnic: Avoid looping in TRANS ETH on unload
This change is to avoid looping in fnic_scsi_abort_io before sending fw reset when fnic is in TRANS ETH state and when we have not received any link events.
Signed-off-by Karan Tilak Kumar <[email protected]>
Signed-off-by Satish Kharat <[email protected]>
--- drivers/scsi/fnic/fnic.h | 3 ++- drivers/scsi/fnic/fnic_fcs.c | 2 ++ drivers/scsi/fnic/fnic_main.c | 2 ++ drivers/scsi/fnic/fnic_scsi.c | 3 ++- 4 files changed, 8 insertions(+), 2 deletions(-)
drivers/scsi/fnic/fnic.h +2 -1
@@ -39,7 +39,7 @@#define DRV_NAME "fnic"#define DRV_DESCRIPTION "Cisco FCoE HBA Driver" -#define DRV_VERSION "1.6.0.49" +#define DRV_VERSION "1.6.0.50"#define PFX DRV_NAME ": "#define DFX DRV_NAME "%d: "
@@ -245,6 +245,7 @@ struct fnic { u32 vlan_hw_insert:1; /* let hw insert the tag */ u32 in_remove:1; /* fnic device in removal */ u32 stop_rx_link_events:1; /* stop proc. rx frames, link events */ + u32 link_events:1; /* set when we get any link event*/struct completion *remove_wait;/* device remove thread blocks */
drivers/scsi/fnic/fnic_fcs.c +2 -0
@@ -56,6 +56,8 @@ void fnic_handle_link(struct work_struct *work)spin_lock_irqsave (&fnic->fnic_lock, flags); + fnic->link_events =1 ;/* less work to just set everytime*/ +if (fnic->stop_rx_link_events) {spin_unlock_irqrestore (&fnic->fnic_lock, flags);return ;
drivers/scsi/fnic/fnic_main.c +2 -0
@@ -580,6 +580,8 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) fnic->lport = lp; fnic->ctlr.lp = lp; + fnic->link_events =0 ; +snprintf (fnic->name,sizeof (fnic->name) -1 ,"%s%d" ,DRV_NAME , host->host_no);
drivers/scsi/fnic/fnic_scsi.c +2 -1
@@ -2673,7 +2673,8 @@ void fnic_scsi_abort_io(struct fc_lport *lp)/* Issue firmware reset for fnic, wait for reset to complete */ retry_fw_reset:spin_lock_irqsave (&fnic->fnic_lock, flags); -if (unlikely (fnic->state ==FNIC_IN_FC_TRANS_ETH_MODE )) { +if (unlikely (fnic->state ==FNIC_IN_FC_TRANS_ETH_MODE ) && + fnic->link_events) {/* fw reset is in progress, poll for its completion */ spin_unlock_irqrestore (&fnic->fnic_lock, flags);schedule_timeout (msecs_to_jiffies (100 ));
Signature · 1 line
2.29.2
Changes look good.
Reviewed-by Arulprabhu Ponnusamy <[email protected]>
On 11/20/20, 5:22 PM, "Karan Tilak Kumar" <[email protected]> wrote:
This change is to avoid looping in
fnic_scsi_abort_io before sending fw reset when
fnic is in TRANS ETH state and when we have not
received any link events.
Signed-off-by: Karan Tilak Kumar <[email protected]>
Signed-off-by: Satish Kharat <[email protected]>
---
drivers/scsi/fnic/fnic.h | 3 ++-
drivers/scsi/fnic/fnic_fcs.c | 2 ++
drivers/scsi/fnic/fnic_main.c | 2 ++
drivers/scsi/fnic/fnic_scsi.c | 3 ++-
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/fnic/fnic.h b/drivers/scsi/fnic/fnic.h
index ed00b6061e0c..6dc8c916de31 100644
--- a/drivers/scsi/fnic/fnic.h
+++ b/drivers/scsi/fnic/fnic.h
@@ -39,7 +39,7 @@
#define DRV_NAME "fnic"
#define DRV_DESCRIPTION "Cisco FCoE HBA Driver"
-#define DRV_VERSION "1.6.0.49"
+#define DRV_VERSION "1.6.0.50"
#define PFX DRV_NAME ": "
#define DFX DRV_NAME "%d: "
@@ -245,6 +245,7 @@ struct fnic {
u32 vlan_hw_insert:1; /* let hw insert the tag */
u32 in_remove:1; /* fnic device in removal */
u32 stop_rx_link_events:1; /* stop proc. rx frames, link events */
+ u32 link_events:1; /* set when we get any link event*/
struct completion *remove_wait; /* device remove thread blocks */
diff --git a/drivers/scsi/fnic/fnic_fcs.c b/drivers/scsi/fnic/fnic_fcs.c
index 3fc3a7271dc1..3337d6627baf 100644
--- a/drivers/scsi/fnic/fnic_fcs.c
+++ b/drivers/scsi/fnic/fnic_fcs.c
@@ -56,6 +56,8 @@ void fnic_handle_link(struct work_struct *work)
spin_lock_irqsave(&fnic->fnic_lock, flags);
+ fnic->link_events = 1; /* less work to just set everytime*/
+
if (fnic->stop_rx_link_events) {
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
return;
diff --git a/drivers/scsi/fnic/fnic_main.c b/drivers/scsi/fnic/fnic_main.c
index 5f8a7ef8f6a8..cad29679e90e 100644
--- a/drivers/scsi/fnic/fnic_main.c
+++ b/drivers/scsi/fnic/fnic_main.c
@@ -580,6 +580,8 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
fnic->lport = lp;
fnic->ctlr.lp = lp;
+ fnic->link_events = 0;
+
snprintf(fnic->name, sizeof(fnic->name) - 1, "%s%d", DRV_NAME,
host->host_no);
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index d1f7b84bbfe8..16e66f5b833a 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -2673,7 +2673,8 @@ void fnic_scsi_abort_io(struct fc_lport *lp)
/* Issue firmware reset for fnic, wait for reset to complete */
retry_fw_reset:
spin_lock_irqsave(&fnic->fnic_lock, flags);
- if (unlikely(fnic->state == FNIC_IN_FC_TRANS_ETH_MODE)) {
+ if (unlikely(fnic->state == FNIC_IN_FC_TRANS_ETH_MODE) &&
+ fnic->link_events) {
/* fw reset is in progress, poll for its completion */
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
schedule_timeout(msecs_to_jiffies(100));
--
2.29.2Martin K. Petersen
AppliedKaran,
Quoted 3 lines
This change is to avoid looping in
fnic_scsi_abort_iobefore sending fw reset when fnic is in TRANS ETH state and when we have not received any link events.
Applied to 5.11/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 4 lines · Karan Tilak Kumar
This change is to avoid looping in
fnic_scsi_abort_iobefore sending fw reset when fnic is in TRANS ETH state and when we have not received any link events.
Applied to 5.11/scsi-queue, thanks!
[1/1] scsi: fnic: Avoid looping in TRANS ETH on unload
https://git.kernel.org/mkp/scsi/c/f9e2beb990f0
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering