mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
scsi: fnic: Rename fnic_scsi_fcpio_reset()
The function has no dependency on SCSI/FCP, so rename it to fnic_fcpio_reset() and move it to fnic_fcs.c Tested-by: Karan Tilak Kumar <kartilak@cisco.com> Reviewed-by: Sesidhar Baddela <sebaddel@cisco.com> Reviewed-by: Arulprabhu Ponnusamy <arulponn@cisco.com> Reviewed-by: Gian Carlo Boffa <gcboffa@cisco.com> Reviewed-by: Arun Easi <aeasi@cisco.com> Reviewed-by: Hannes Reinecke <hare@kernel.org> Reviewed-by: Lee Duncan <lduncan@suse.com> Signed-off-by: Karan Tilak Kumar <kartilak@cisco.com> Co-developed-by: Hannes Reinecke <hare@kernel.org> Link: https://patch.msgid.link/20260217223943.7938-3-kartilak@cisco.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
a59d1caf1d
commit
31eda39bfd
|
|
@ -4613,7 +4613,7 @@ void fnic_fdls_disc_start(struct fnic_iport_s *iport)
|
|||
if (!iport->usefip) {
|
||||
if (iport->flags & FNIC_FIRST_LINK_UP) {
|
||||
spin_unlock_irqrestore(&fnic->fnic_lock, fnic->lock_flags);
|
||||
fnic_scsi_fcpio_reset(iport->fnic);
|
||||
fnic_fcpio_reset(iport->fnic);
|
||||
spin_lock_irqsave(&fnic->fnic_lock, fnic->lock_flags);
|
||||
|
||||
iport->flags &= ~FNIC_FIRST_LINK_UP;
|
||||
|
|
@ -5072,7 +5072,7 @@ void fnic_fdls_link_down(struct fnic_iport_s *iport)
|
|||
iport->fabric.flags = 0;
|
||||
|
||||
spin_unlock_irqrestore(&fnic->fnic_lock, fnic->lock_flags);
|
||||
fnic_scsi_fcpio_reset(iport->fnic);
|
||||
fnic_fcpio_reset(iport->fnic);
|
||||
spin_lock_irqsave(&fnic->fnic_lock, fnic->lock_flags);
|
||||
list_for_each_entry_safe(tport, next, &iport->tport_list, links) {
|
||||
FNIC_FCS_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
|
||||
|
|
|
|||
|
|
@ -737,7 +737,7 @@ void fnic_work_on_fip_timer(struct work_struct *work)
|
|||
if (memcmp(iport->selected_fcf.fcf_mac, zmac, ETH_ALEN) != 0) {
|
||||
|
||||
if (iport->flags & FNIC_FIRST_LINK_UP) {
|
||||
fnic_scsi_fcpio_reset(iport->fnic);
|
||||
fnic_fcpio_reset(iport->fnic);
|
||||
iport->flags &= ~FNIC_FIRST_LINK_UP;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -513,7 +513,6 @@ int fnic_host_reset(struct Scsi_Host *shost);
|
|||
void fnic_reset(struct Scsi_Host *shost);
|
||||
int fnic_issue_fc_host_lip(struct Scsi_Host *shost);
|
||||
void fnic_get_host_port_state(struct Scsi_Host *shost);
|
||||
void fnic_scsi_fcpio_reset(struct fnic *fnic);
|
||||
int fnic_wq_copy_cmpl_handler(struct fnic *fnic, int copy_work_to_do, unsigned int cq_index);
|
||||
int fnic_wq_cmpl_handler(struct fnic *fnic, int);
|
||||
int fnic_flogi_reg_handler(struct fnic *fnic, u32);
|
||||
|
|
|
|||
|
|
@ -1128,3 +1128,53 @@ void fnic_reset_work_handler(struct work_struct *work)
|
|||
spin_unlock_irqrestore(&reset_fnic_list_lock,
|
||||
reset_fnic_list_lock_flags);
|
||||
}
|
||||
|
||||
void fnic_fcpio_reset(struct fnic *fnic)
|
||||
{
|
||||
unsigned long flags;
|
||||
enum fnic_state old_state;
|
||||
struct fnic_iport_s *iport = &fnic->iport;
|
||||
DECLARE_COMPLETION_ONSTACK(fw_reset_done);
|
||||
int time_remain;
|
||||
|
||||
/* issue fw reset */
|
||||
spin_lock_irqsave(&fnic->fnic_lock, flags);
|
||||
if (unlikely(fnic->state == FNIC_IN_FC_TRANS_ETH_MODE)) {
|
||||
/* fw reset is in progress, poll for its completion */
|
||||
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
|
||||
FNIC_FCS_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
|
||||
"fnic is in unexpected state: %d for fw_reset\n",
|
||||
fnic->state);
|
||||
return;
|
||||
}
|
||||
|
||||
old_state = fnic->state;
|
||||
fnic->state = FNIC_IN_FC_TRANS_ETH_MODE;
|
||||
|
||||
fnic_update_mac_locked(fnic, iport->hwmac);
|
||||
fnic->fw_reset_done = &fw_reset_done;
|
||||
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
|
||||
|
||||
FNIC_FCS_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
|
||||
"Issuing fw reset\n");
|
||||
if (fnic_fw_reset_handler(fnic)) {
|
||||
spin_lock_irqsave(&fnic->fnic_lock, flags);
|
||||
if (fnic->state == FNIC_IN_FC_TRANS_ETH_MODE)
|
||||
fnic->state = old_state;
|
||||
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
|
||||
} else {
|
||||
FNIC_FCS_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
|
||||
"Waiting for fw completion\n");
|
||||
time_remain = wait_for_completion_timeout(&fw_reset_done,
|
||||
msecs_to_jiffies(FNIC_FW_RESET_TIMEOUT));
|
||||
FNIC_FCS_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
|
||||
"Woken up after fw completion timeout\n");
|
||||
if (time_remain == 0) {
|
||||
FNIC_FCS_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
|
||||
"FW reset completion timed out after %d ms\n",
|
||||
FNIC_FW_RESET_TIMEOUT);
|
||||
}
|
||||
atomic64_inc(&fnic->fnic_stats.reset_stats.fw_reset_timeouts);
|
||||
}
|
||||
fnic->fw_reset_done = NULL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -410,6 +410,7 @@ void fnic_fdls_add_tport(struct fnic_iport_s *iport,
|
|||
void fnic_fdls_remove_tport(struct fnic_iport_s *iport,
|
||||
struct fnic_tport_s *tport,
|
||||
unsigned long flags);
|
||||
void fnic_fcpio_reset(struct fnic *fnic);
|
||||
|
||||
/* fip.c */
|
||||
void fnic_fcoe_send_vlan_req(struct fnic *fnic);
|
||||
|
|
@ -422,7 +423,6 @@ void fnic_handle_fip_timer(struct timer_list *t);
|
|||
extern void fdls_fabric_timer_callback(struct timer_list *t);
|
||||
|
||||
/* fnic_scsi.c */
|
||||
void fnic_scsi_fcpio_reset(struct fnic *fnic);
|
||||
extern void fdls_fabric_timer_callback(struct timer_list *t);
|
||||
void fnic_rport_exch_reset(struct fnic *fnic, u32 fcid);
|
||||
int fnic_fdls_register_portid(struct fnic_iport_s *iport, u32 port_id,
|
||||
|
|
|
|||
|
|
@ -1975,8 +1975,7 @@ void fnic_scsi_unload(struct fnic *fnic)
|
|||
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
|
||||
|
||||
if (fdls_get_state(&fnic->iport.fabric) != FDLS_STATE_INIT)
|
||||
fnic_scsi_fcpio_reset(fnic);
|
||||
|
||||
fnic_fcpio_reset(fnic);
|
||||
spin_lock_irqsave(&fnic->fnic_lock, flags);
|
||||
fnic->in_remove = 1;
|
||||
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
|
||||
|
|
@ -3040,54 +3039,3 @@ int fnic_eh_host_reset_handler(struct scsi_cmnd *sc)
|
|||
ret = fnic_host_reset(shost);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
void fnic_scsi_fcpio_reset(struct fnic *fnic)
|
||||
{
|
||||
unsigned long flags;
|
||||
enum fnic_state old_state;
|
||||
struct fnic_iport_s *iport = &fnic->iport;
|
||||
DECLARE_COMPLETION_ONSTACK(fw_reset_done);
|
||||
int time_remain;
|
||||
|
||||
/* issue fw reset */
|
||||
spin_lock_irqsave(&fnic->fnic_lock, flags);
|
||||
if (unlikely(fnic->state == FNIC_IN_FC_TRANS_ETH_MODE)) {
|
||||
/* fw reset is in progress, poll for its completion */
|
||||
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
|
||||
FNIC_SCSI_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
|
||||
"fnic is in unexpected state: %d for fw_reset\n",
|
||||
fnic->state);
|
||||
return;
|
||||
}
|
||||
|
||||
old_state = fnic->state;
|
||||
fnic->state = FNIC_IN_FC_TRANS_ETH_MODE;
|
||||
|
||||
fnic_update_mac_locked(fnic, iport->hwmac);
|
||||
fnic->fw_reset_done = &fw_reset_done;
|
||||
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
|
||||
|
||||
FNIC_SCSI_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
|
||||
"Issuing fw reset\n");
|
||||
if (fnic_fw_reset_handler(fnic)) {
|
||||
spin_lock_irqsave(&fnic->fnic_lock, flags);
|
||||
if (fnic->state == FNIC_IN_FC_TRANS_ETH_MODE)
|
||||
fnic->state = old_state;
|
||||
spin_unlock_irqrestore(&fnic->fnic_lock, flags);
|
||||
} else {
|
||||
FNIC_SCSI_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
|
||||
"Waiting for fw completion\n");
|
||||
time_remain = wait_for_completion_timeout(&fw_reset_done,
|
||||
msecs_to_jiffies(FNIC_FW_RESET_TIMEOUT));
|
||||
FNIC_SCSI_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
|
||||
"Woken up after fw completion timeout\n");
|
||||
if (time_remain == 0) {
|
||||
FNIC_SCSI_DBG(KERN_INFO, fnic->host, fnic->fnic_num,
|
||||
"FW reset completion timed out after %d ms)\n",
|
||||
FNIC_FW_RESET_TIMEOUT);
|
||||
}
|
||||
atomic64_inc(&fnic->fnic_stats.reset_stats.fw_reset_timeouts);
|
||||
}
|
||||
fnic->fw_reset_done = NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user