Commit 685f0bf7 authored by James Smart's avatar James Smart Committed by James Bottomley

[SCSI] lpfc 8.1.12 : Collapse discovery lists to a single node list

Collapse discovery lists to a single node list.
Signed-off-by: default avatarJames Smart <James.Smart@emulex.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 329f9bc7
......@@ -255,17 +255,7 @@ struct lpfc_hba {
struct lpfc_stats fc_stat;
/* These are the head/tail pointers for the bind, plogi, adisc, unmap,
* and map lists. Their counters are immediately following.
*/
struct list_head fc_plogi_list;
struct list_head fc_adisc_list;
struct list_head fc_reglogin_list;
struct list_head fc_prli_list;
struct list_head fc_nlpunmap_list;
struct list_head fc_nlpmap_list;
struct list_head fc_npr_list;
struct list_head fc_unused_list;
struct list_head fc_nodes;
/* Keep counters for the number of entries in each list. */
uint16_t fc_plogi_cnt;
......
......@@ -1781,67 +1781,51 @@ lpfc_reset_stats(struct Scsi_Host *shost)
* The LPFC driver treats linkdown handling as target loss events so there
* are no sysfs handlers for link_down_tmo.
*/
static void
lpfc_get_starget_port_id(struct scsi_target *starget)
static struct lpfc_nodelist *
lpfc_get_node_by_target(struct scsi_target *starget)
{
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata;
uint32_t did = -1;
struct lpfc_nodelist *ndlp = NULL;
struct lpfc_nodelist *ndlp;
spin_lock_irq(shost->host_lock);
/* Search the mapped list for this target ID */
list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) {
if (starget->id == ndlp->nlp_sid) {
did = ndlp->nlp_DID;
break;
/* Search for this, mapped, target ID */
list_for_each_entry(ndlp, &phba->fc_nodes, nlp_listp) {
if (ndlp->nlp_state == NLP_STE_MAPPED_NODE &&
starget->id == ndlp->nlp_sid) {
spin_unlock_irq(shost->host_lock);
return ndlp;
}
}
spin_unlock_irq(shost->host_lock);
return NULL;
}
fc_starget_port_id(starget) = did;
static void
lpfc_get_starget_port_id(struct scsi_target *starget)
{
struct lpfc_nodelist *ndlp = lpfc_get_node_by_target(starget);
fc_starget_port_id(starget) = ndlp ? ndlp->nlp_DID : -1;
}
static void
lpfc_get_starget_node_name(struct scsi_target *starget)
{
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata;
u64 node_name = 0;
struct lpfc_nodelist *ndlp = NULL;
struct lpfc_nodelist *ndlp = lpfc_get_node_by_target(starget);
spin_lock_irq(shost->host_lock);
/* Search the mapped list for this target ID */
list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) {
if (starget->id == ndlp->nlp_sid) {
node_name = wwn_to_u64(ndlp->nlp_nodename.u.wwn);
break;
}
}
spin_unlock_irq(shost->host_lock);
fc_starget_node_name(starget) = node_name;
fc_starget_node_name(starget) =
ndlp ? wwn_to_u64(ndlp->nlp_nodename.u.wwn) : 0;
}
static void
lpfc_get_starget_port_name(struct scsi_target *starget)
{
struct Scsi_Host *shost = dev_to_shost(starget->dev.parent);
struct lpfc_hba *phba = (struct lpfc_hba *) shost->hostdata;
u64 port_name = 0;
struct lpfc_nodelist *ndlp = NULL;
spin_lock_irq(shost->host_lock);
/* Search the mapped list for this target ID */
list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) {
if (starget->id == ndlp->nlp_sid) {
port_name = wwn_to_u64(ndlp->nlp_portname.u.wwn);
break;
}
}
spin_unlock_irq(shost->host_lock);
struct lpfc_nodelist *ndlp = lpfc_get_node_by_target(starget);
fc_starget_port_name(starget) = port_name;
fc_starget_port_name(starget) =
ndlp ? wwn_to_u64(ndlp->nlp_portname.u.wwn) : 0;
}
static void
......
......@@ -18,6 +18,8 @@
* included with this package. *
*******************************************************************/
typedef int (*node_filter)(struct lpfc_nodelist *ndlp, void *param);
struct fc_rport;
void lpfc_dump_mem(struct lpfc_hba *, LPFC_MBOXQ_t *, uint16_t);
void lpfc_read_nv(struct lpfc_hba *, LPFC_MBOXQ_t *);
......@@ -178,9 +180,8 @@ int lpfc_sli_abort_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t,
void lpfc_mbox_timeout(unsigned long);
void lpfc_mbox_timeout_handler(struct lpfc_hba *);
struct lpfc_nodelist *lpfc_findnode_did(struct lpfc_hba *, uint32_t, uint32_t);
struct lpfc_nodelist *lpfc_findnode_wwpn(struct lpfc_hba *, uint32_t,
struct lpfc_name *);
struct lpfc_nodelist *lpfc_findnode_did(struct lpfc_hba *, uint32_t);
struct lpfc_nodelist *lpfc_findnode_wwpn(struct lpfc_hba *, struct lpfc_name *);
int lpfc_sli_issue_mbox_wait(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq,
uint32_t timeout);
......
......@@ -443,10 +443,8 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
if (phba->fc_ns_retry < LPFC_MAX_NS_RETRY) {
phba->fc_ns_retry++;
/* CT command is being retried */
ndlp =
lpfc_findnode_did(phba, NLP_SEARCH_UNMAPPED,
NameServer_DID);
if (ndlp) {
ndlp = lpfc_findnode_did(phba, NameServer_DID);
if (ndlp && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) {
if (lpfc_ns_cmd(phba, ndlp, SLI_CTNS_GID_FT) ==
0) {
goto out;
......@@ -730,7 +728,7 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba * phba,
uint16_t fdmi_cmd = CTcmd->CommandResponse.bits.CmdRsp;
uint16_t fdmi_rsp = CTrsp->CommandResponse.bits.CmdRsp;
ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, FDMI_DID);
ndlp = lpfc_findnode_did(phba, FDMI_DID);
if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) {
/* FDMI rsp failed */
lpfc_printf_log(phba,
......@@ -1162,7 +1160,7 @@ lpfc_fdmi_tmo_handler(struct lpfc_hba *phba)
{
struct lpfc_nodelist *ndlp;
ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, FDMI_DID);
ndlp = lpfc_findnode_did(phba, FDMI_DID);
if (ndlp) {
if (init_utsname()->nodename[0] != '\0') {
lpfc_fdmi_cmd(phba, ndlp, SLI_MGMT_DHBA);
......
......@@ -83,15 +83,6 @@ struct lpfc_nodelist {
};
/* Defines for nlp_flag (uint32) */
#define NLP_UNUSED_LIST 0x1 /* Flg to indicate node will be freed */
#define NLP_PLOGI_LIST 0x2 /* Flg to indicate sent PLOGI */
#define NLP_ADISC_LIST 0x3 /* Flg to indicate sent ADISC */
#define NLP_REGLOGIN_LIST 0x4 /* Flg to indicate sent REG_LOGIN */
#define NLP_PRLI_LIST 0x5 /* Flg to indicate sent PRLI */
#define NLP_UNMAPPED_LIST 0x6 /* Node is now unmapped */
#define NLP_MAPPED_LIST 0x7 /* Node is now mapped */
#define NLP_NPR_LIST 0x8 /* Node is in NPort Recovery state */
#define NLP_LIST_MASK 0xf /* mask to see what list node is on */
#define NLP_PLOGI_SND 0x20 /* sent PLOGI request for this entry */
#define NLP_PRLI_SND 0x40 /* sent PRLI request for this entry */
#define NLP_ADISC_SND 0x80 /* sent ADISC request for this entry */
......@@ -109,17 +100,6 @@ struct lpfc_nodelist {
NPR list */
#define NLP_NODEV_REMOVE 0x8000000 /* Defer removal till discovery ends */
/* Defines for list searchs */
#define NLP_SEARCH_MAPPED 0x1 /* search mapped */
#define NLP_SEARCH_UNMAPPED 0x2 /* search unmapped */
#define NLP_SEARCH_PLOGI 0x4 /* search plogi */
#define NLP_SEARCH_ADISC 0x8 /* search adisc */
#define NLP_SEARCH_REGLOGIN 0x10 /* search reglogin */
#define NLP_SEARCH_PRLI 0x20 /* search prli */
#define NLP_SEARCH_NPR 0x40 /* search npr */
#define NLP_SEARCH_UNUSED 0x80 /* search mapped */
#define NLP_SEARCH_ALL 0xff /* search all lists */
/* There are 4 different double linked lists nodelist entries can reside on.
* The Port Login (PLOGI) list and Address Discovery (ADISC) list are used
* when Link Up discovery or Registered State Change Notification (RSCN)
......
......@@ -372,7 +372,7 @@ lpfc_cmpl_els_flogi_nport(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp,
}
lpfc_nlp_put(ndlp);
ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, PT2PT_RemoteID);
ndlp = lpfc_findnode_did(phba, PT2PT_RemoteID);
if (!ndlp) {
/*
* Cannot find existing Fabric ndlp, so allocate a
......@@ -592,12 +592,12 @@ lpfc_els_abort_flogi(struct lpfc_hba * phba)
}
int
lpfc_initial_flogi(struct lpfc_hba * phba)
lpfc_initial_flogi(struct lpfc_hba *phba)
{
struct lpfc_nodelist *ndlp;
/* First look for the Fabric ndlp */
ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, Fabric_DID);
ndlp = lpfc_findnode_did(phba, Fabric_DID);
if (!ndlp) {
/* Cannot find existing Fabric ndlp, so allocate a new one */
ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
......@@ -637,7 +637,7 @@ lpfc_more_plogi(struct lpfc_hba * phba)
}
static struct lpfc_nodelist *
lpfc_plogi_confirm_nport(struct lpfc_hba * phba, struct lpfc_dmabuf *prsp,
lpfc_plogi_confirm_nport(struct lpfc_hba *phba, struct lpfc_dmabuf *prsp,
struct lpfc_nodelist *ndlp)
{
struct lpfc_nodelist *new_ndlp;
......@@ -654,12 +654,12 @@ lpfc_plogi_confirm_nport(struct lpfc_hba * phba, struct lpfc_dmabuf *prsp,
lp = (uint32_t *) prsp->virt;
sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t));
memset(name, 0, sizeof (struct lpfc_name));
memset(name, 0, sizeof(struct lpfc_name));
/* Now we to find out if the NPort we are logging into, matches the WWPN
/* Now we find out if the NPort we are logging into, matches the WWPN
* we have for that ndlp. If not, we have some work to do.
*/
new_ndlp = lpfc_findnode_wwpn(phba, NLP_SEARCH_ALL, &sp->portName);
new_ndlp = lpfc_findnode_wwpn(phba, &sp->portName);
if (new_ndlp == ndlp)
return ndlp;
......@@ -705,8 +705,7 @@ lpfc_cmpl_els_plogi(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
cmdiocb->context_un.rsp_iocb = rspiocb;
irsp = &rspiocb->iocb;
ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL,
irsp->un.elsreq64.remoteID);
ndlp = lpfc_findnode_did(phba, irsp->un.elsreq64.remoteID);
if (!ndlp)
goto out;
......@@ -1408,7 +1407,7 @@ lpfc_issue_els_farpr(struct lpfc_hba * phba, uint32_t nportid, uint8_t retry)
memcpy(&fp->RportName, &phba->fc_portname, sizeof (struct lpfc_name));
memcpy(&fp->RnodeName, &phba->fc_nodename, sizeof (struct lpfc_name));
if ((ondlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, nportid))) {
if ((ondlp = lpfc_findnode_did(phba, nportid))) {
memcpy(&fp->OportName, &ondlp->nlp_portname,
sizeof (struct lpfc_name));
memcpy(&fp->OnodeName, &ondlp->nlp_nodename,
......@@ -1595,7 +1594,7 @@ lpfc_els_retry(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
else {
/* We should only hit this case for retrying PLOGI */
did = irsp->un.elsreq64.remoteID;
ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, did);
ndlp = lpfc_findnode_did(phba, did);
if (!ndlp && (cmd != ELS_CMD_PLOGI))
return 1;
}
......@@ -2291,21 +2290,22 @@ lpfc_els_rsp_rnid_acc(struct lpfc_hba *phba, uint8_t format,
}
int
lpfc_els_disc_adisc(struct lpfc_hba * phba)
lpfc_els_disc_adisc(struct lpfc_hba *phba)
{
int sentadisc;
struct lpfc_nodelist *ndlp, *next_ndlp;
sentadisc = 0;
/* go thru NPR list and issue any remaining ELS ADISCs */
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list,
nlp_listp) {
if (ndlp->nlp_flag & NLP_NPR_2B_DISC) {
if (ndlp->nlp_flag & NLP_NPR_ADISC) {
/* go thru NPR nodes and issue any remaining ELS ADISCs */
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, nlp_listp) {
if (ndlp->nlp_state == NLP_STE_NPR_NODE &&
(ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 &&
(ndlp->nlp_flag & NLP_NPR_ADISC) != 0) {
spin_lock_irq(phba->host->host_lock);
ndlp->nlp_flag &= ~NLP_NPR_ADISC;
spin_unlock_irq(phba->host->host_lock);
ndlp->nlp_prev_state = ndlp->nlp_state;
lpfc_nlp_set_state(phba, ndlp,
NLP_STE_ADISC_ISSUE);
lpfc_nlp_set_state(phba, ndlp, NLP_STE_ADISC_ISSUE);
lpfc_issue_els_adisc(phba, ndlp, 0);
sentadisc++;
phba->num_disc_nodes++;
......@@ -2318,7 +2318,6 @@ lpfc_els_disc_adisc(struct lpfc_hba * phba)
}
}
}
}
if (sentadisc == 0) {
spin_lock_irq(phba->host->host_lock);
phba->fc_flag &= ~FC_NLP_MORE;
......@@ -2335,14 +2334,13 @@ lpfc_els_disc_plogi(struct lpfc_hba * phba)
sentplogi = 0;
/* go thru NPR list and issue any remaining ELS PLOGIs */
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list,
nlp_listp) {
if ((ndlp->nlp_flag & NLP_NPR_2B_DISC) &&
(!(ndlp->nlp_flag & NLP_DELAY_TMO))) {
if (!(ndlp->nlp_flag & NLP_NPR_ADISC)) {
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, nlp_listp) {
if (ndlp->nlp_state == NLP_STE_NPR_NODE &&
(ndlp->nlp_flag & NLP_NPR_2B_DISC) != 0 &&
(ndlp->nlp_flag & NLP_DELAY_TMO) == 0 &&
(ndlp->nlp_flag & NLP_NPR_ADISC) == 0) {
ndlp->nlp_prev_state = ndlp->nlp_state;
lpfc_nlp_set_state(phba, ndlp,
NLP_STE_PLOGI_ISSUE);
lpfc_nlp_set_state(phba, ndlp, NLP_STE_PLOGI_ISSUE);
lpfc_issue_els_plogi(phba, ndlp->nlp_DID, 0);
sentplogi++;
phba->num_disc_nodes++;
......@@ -2355,7 +2353,6 @@ lpfc_els_disc_plogi(struct lpfc_hba * phba)
}
}
}
}
if (sentplogi == 0) {
spin_lock_irq(phba->host->host_lock);
phba->fc_flag &= ~FC_NLP_MORE;
......@@ -2456,40 +2453,28 @@ lpfc_rscn_payload_check(struct lpfc_hba * phba, uint32_t did)
static int
lpfc_rscn_recovery_check(struct lpfc_hba *phba)
{
struct lpfc_nodelist *ndlp = NULL, *next_ndlp;
struct list_head *listp;
struct list_head *node_list[7];
int i;
struct lpfc_nodelist *ndlp = NULL;
/* Look at all nodes effected by pending RSCNs and move
* them to NPR list.
* them to NPR state.
*/
node_list[0] = &phba->fc_npr_list; /* MUST do this list first */
node_list[1] = &phba->fc_nlpmap_list;
node_list[2] = &phba->fc_nlpunmap_list;
node_list[3] = &phba->fc_prli_list;
node_list[4] = &phba->fc_reglogin_list;
node_list[5] = &phba->fc_adisc_list;
node_list[6] = &phba->fc_plogi_list;
for (i = 0; i < 7; i++) {
listp = node_list[i];
if (list_empty(listp))
continue;
list_for_each_entry_safe(ndlp, next_ndlp, listp, nlp_listp) {
if (!(lpfc_rscn_payload_check(phba, ndlp->nlp_DID)))
list_for_each_entry(ndlp, &phba->fc_nodes, nlp_listp) {
if (ndlp->nlp_state == NLP_STE_UNUSED_NODE ||
lpfc_rscn_payload_check(phba, ndlp->nlp_DID) == 0)
continue;
lpfc_disc_state_machine(phba, ndlp, NULL,
NLP_EVT_DEVICE_RECOVERY);
/* Make sure NLP_DELAY_TMO is NOT running
* after a device recovery event.
/*
* Make sure NLP_DELAY_TMO is NOT running after a device
* recovery event.
*/
if (ndlp->nlp_flag & NLP_DELAY_TMO)
lpfc_cancel_retry_delay_tmo(phba, ndlp);
}
}
return 0;
}
......@@ -2614,8 +2599,8 @@ lpfc_els_handle_rscn(struct lpfc_hba * phba)
/* To process RSCN, first compare RSCN data with NameServer */
phba->fc_ns_retry = 0;
ndlp = lpfc_findnode_did(phba, NLP_SEARCH_UNMAPPED, NameServer_DID);
if (ndlp) {
ndlp = lpfc_findnode_did(phba, NameServer_DID);
if (ndlp && ndlp->nlp_state == NLP_STE_UNMAPPED_NODE) {
/* Good ndlp, issue CT Request to NameServer */
if (lpfc_ns_cmd(phba, ndlp, SLI_CTNS_GID_FT) == 0) {
/* Wait for NameServer query cmpl before we can
......@@ -2625,7 +2610,7 @@ lpfc_els_handle_rscn(struct lpfc_hba * phba)
} else {
/* If login to NameServer does not exist, issue one */
/* Good status, issue PLOGI to NameServer */
ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, NameServer_DID);
ndlp = lpfc_findnode_did(phba, NameServer_DID);
if (ndlp) {
/* Wait for NameServer login cmpl before we can
continue */
......@@ -2859,6 +2844,7 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
elsiocb->iocb_cmpl = lpfc_cmpl_els_acc;
phba->fc_stat.elsXmitACC++;
if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) {
lpfc_els_free_iocb(phba, elsiocb);
}
......@@ -3144,8 +3130,9 @@ lpfc_els_rcv_fan(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
*/
list_for_each_entry_safe(ndlp, next_ndlp,
&phba->fc_npr_list, nlp_listp) {
&phba->fc_nodes, nlp_listp) {
if (ndlp->nlp_state != NLP_STE_NPR_NODE)
continue;
if (ndlp->nlp_type & NLP_FABRIC) {
/*
* Clean up old Fabric, Nameserver and
......@@ -3168,8 +3155,10 @@ lpfc_els_rcv_fan(struct lpfc_hba * phba, struct lpfc_iocbq * cmdiocb,
/* Discovery not needed,
* move the nodes to their original state.
*/
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list,
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes,
nlp_listp) {
if (ndlp->nlp_state != NLP_STE_NPR_NODE)
continue;
switch (ndlp->nlp_prev_state) {
case NLP_STE_UNMAPPED_NODE:
......@@ -3409,7 +3398,7 @@ lpfc_els_unsol_event(struct lpfc_hba * phba,
}
did = icmd->un.rcvels.remoteID;
ndlp = lpfc_findnode_did(phba, NLP_SEARCH_ALL, did);
ndlp = lpfc_findnode_did(phba, did);
if (!ndlp) {
/* Cannot find existing Fabric ndlp, so allocate a new one */
ndlp = mempool_alloc(phba->nlp_mem_pool, GFP_KERNEL);
......
This diff is collapsed.
......@@ -1185,63 +1185,11 @@ lpfc_cleanup(struct lpfc_hba * phba)
/* clean up phba - lpfc specific */
lpfc_can_disctmo(phba);
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nlpunmap_list,
nlp_listp) {
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, nlp_listp)
lpfc_nlp_put(ndlp);
}
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nlpmap_list,
nlp_listp) {
lpfc_nlp_put(ndlp);
}
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_unused_list,
nlp_listp) {
lpfc_drop_node(phba, ndlp);
}
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_plogi_list,
nlp_listp) {
lpfc_nlp_put(ndlp);
}
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_adisc_list,
nlp_listp) {
lpfc_nlp_put(ndlp);
}
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_reglogin_list,
nlp_listp) {
lpfc_nlp_put(ndlp);
}
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_prli_list,
nlp_listp) {
lpfc_nlp_put(ndlp);
}
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_npr_list,
nlp_listp) {
lpfc_nlp_put(ndlp);
}
INIT_LIST_HEAD(&phba->fc_nodes);
INIT_LIST_HEAD(&phba->fc_nlpmap_list);
INIT_LIST_HEAD(&phba->fc_nlpunmap_list);
INIT_LIST_HEAD(&phba->fc_unused_list);
INIT_LIST_HEAD(&phba->fc_plogi_list);
INIT_LIST_HEAD(&phba->fc_adisc_list);
INIT_LIST_HEAD(&phba->fc_reglogin_list);
INIT_LIST_HEAD(&phba->fc_prli_list);
INIT_LIST_HEAD(&phba->fc_npr_list);
phba->fc_map_cnt = 0;
phba->fc_unmap_cnt = 0;
phba->fc_plogi_cnt = 0;
phba->fc_adisc_cnt = 0;
phba->fc_reglogin_cnt = 0;
phba->fc_prli_cnt = 0;
phba->fc_npr_cnt = 0;
phba->fc_unused_cnt= 0;
return;
}
......@@ -1336,8 +1284,6 @@ void
lpfc_offline_prep(struct lpfc_hba * phba)
{
struct lpfc_nodelist *ndlp, *next_ndlp;
struct list_head *listp, *node_list[7];
int i;
if (phba->fc_flag & FC_OFFLINE_MODE)
return;
......@@ -1347,21 +1293,9 @@ lpfc_offline_prep(struct lpfc_hba * phba)
lpfc_linkdown(phba);
/* Issue an unreg_login to all nodes */
node_list[0] = &phba->fc_npr_list; /* MUST do this list first */
node_list[1] = &phba->fc_nlpmap_list;
node_list[2] = &phba->fc_nlpunmap_list;
node_list[3] = &phba->fc_prli_list;
node_list[4] = &phba->fc_reglogin_list;
node_list[5] = &phba->fc_adisc_list;
node_list[6] = &phba->fc_plogi_list;
for (i = 0; i < 7; i++) {
listp = node_list[i];
if (list_empty(listp))
continue;
list_for_each_entry_safe(ndlp, next_ndlp, listp, nlp_listp)
list_for_each_entry_safe(ndlp, next_ndlp, &phba->fc_nodes, nlp_listp)
if (ndlp->nlp_state != NLP_STE_UNUSED_NODE)
lpfc_unreg_rpi(phba, ndlp);
}
lpfc_sli_flush_mbox_queue(phba);
}
......@@ -1500,15 +1434,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
host->max_lun = phba->cfg_max_luns;
host->this_id = -1;
/* Initialize all internally managed lists. */
INIT_LIST_HEAD(&phba->fc_nlpmap_list);
INIT_LIST_HEAD(&phba->fc_nlpunmap_list);
INIT_LIST_HEAD(&phba->fc_unused_list);
INIT_LIST_HEAD(&phba->fc_plogi_list);
INIT_LIST_HEAD(&phba->fc_adisc_list);
INIT_LIST_HEAD(&phba->fc_reglogin_list);
INIT_LIST_HEAD(&phba->fc_prli_list);
INIT_LIST_HEAD(&phba->fc_npr_list);
INIT_LIST_HEAD(&phba->fc_nodes);
pci_set_master(pdev);
retval = pci_set_mwi(pdev);
......
......@@ -1175,10 +1175,12 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
* fail, this routine returns failure to the midlayer.
*/
for (i = 0; i < LPFC_MAX_TARGET; i++) {
/* Search the mapped list for this target ID */
/* Search for mapped node by target ID */
match = 0;
list_for_each_entry(ndlp, &phba->fc_nlpmap_list, nlp_listp) {
if ((i == ndlp->nlp_sid) && ndlp->rport) {
list_for_each_entry(ndlp, &phba->fc_nodes, nlp_listp) {
if (ndlp->nlp_state == NLP_STE_MAPPED_NODE &&
i == ndlp->nlp_sid &&
ndlp->rport) {
match = 1;
break;
}
......
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