Commit f9e2beb9 authored by Karan Tilak Kumar's avatar Karan Tilak Kumar Committed by Martin K. Petersen

scsi: fnic: Avoid looping in TRANS ETH on unload

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.

Link: https://lore.kernel.org/r/20201121012145.18522-1-kartilak@cisco.comReviewed-by: default avatarArulprabhu Ponnusamy <arulponn@cisco.com>
Co-developed-by: default avatarSatish Kharat <satishkh@cisco.com>
Signed-off-by: default avatarSatish Kharat <satishkh@cisco.com>
Signed-off-by: default avatarKaran Tilak Kumar <kartilak@cisco.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 90b3a938
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
#define DRV_NAME "fnic" #define DRV_NAME "fnic"
#define DRV_DESCRIPTION "Cisco FCoE HBA Driver" #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 PFX DRV_NAME ": "
#define DFX DRV_NAME "%d: " #define DFX DRV_NAME "%d: "
...@@ -245,6 +245,7 @@ struct fnic { ...@@ -245,6 +245,7 @@ struct fnic {
u32 vlan_hw_insert:1; /* let hw insert the tag */ u32 vlan_hw_insert:1; /* let hw insert the tag */
u32 in_remove:1; /* fnic device in removal */ u32 in_remove:1; /* fnic device in removal */
u32 stop_rx_link_events:1; /* stop proc. rx frames, link events */ 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 */ struct completion *remove_wait; /* device remove thread blocks */
......
...@@ -56,6 +56,8 @@ void fnic_handle_link(struct work_struct *work) ...@@ -56,6 +56,8 @@ void fnic_handle_link(struct work_struct *work)
spin_lock_irqsave(&fnic->fnic_lock, flags); spin_lock_irqsave(&fnic->fnic_lock, flags);
fnic->link_events = 1; /* less work to just set everytime*/
if (fnic->stop_rx_link_events) { if (fnic->stop_rx_link_events) {
spin_unlock_irqrestore(&fnic->fnic_lock, flags); spin_unlock_irqrestore(&fnic->fnic_lock, flags);
return; return;
......
...@@ -580,6 +580,8 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent) ...@@ -580,6 +580,8 @@ static int fnic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
fnic->lport = lp; fnic->lport = lp;
fnic->ctlr.lp = lp; fnic->ctlr.lp = lp;
fnic->link_events = 0;
snprintf(fnic->name, sizeof(fnic->name) - 1, "%s%d", DRV_NAME, snprintf(fnic->name, sizeof(fnic->name) - 1, "%s%d", DRV_NAME,
host->host_no); host->host_no);
......
...@@ -2673,7 +2673,8 @@ void fnic_scsi_abort_io(struct fc_lport *lp) ...@@ -2673,7 +2673,8 @@ void fnic_scsi_abort_io(struct fc_lport *lp)
/* Issue firmware reset for fnic, wait for reset to complete */ /* Issue firmware reset for fnic, wait for reset to complete */
retry_fw_reset: retry_fw_reset:
spin_lock_irqsave(&fnic->fnic_lock, flags); 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 */ /* fw reset is in progress, poll for its completion */
spin_unlock_irqrestore(&fnic->fnic_lock, flags); spin_unlock_irqrestore(&fnic->fnic_lock, flags);
schedule_timeout(msecs_to_jiffies(100)); schedule_timeout(msecs_to_jiffies(100));
......
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