Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

[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
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -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;
+24 −40
Original line number Diff line number Diff line
@@ -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);

	fc_starget_port_id(starget) = did;
	return NULL;
}

static void
lpfc_get_starget_node_name(struct scsi_target *starget)
lpfc_get_starget_port_id(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;
	fc_starget_port_id(starget) = ndlp ? ndlp->nlp_DID : -1;
}
	}
	spin_unlock_irq(shost->host_lock);

	fc_starget_node_name(starget) = node_name;
static void
lpfc_get_starget_node_name(struct scsi_target *starget)
{
	struct lpfc_nodelist *ndlp = lpfc_get_node_by_target(starget);

	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
+4 −3
Original line number Diff line number Diff line
@@ -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);
+4 −6
Original line number Diff line number Diff line
@@ -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);
+0 −20
Original line number Diff line number Diff line
@@ -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)
Loading