Commit 2e0fef85 authored by James Smart's avatar James Smart Committed by James Bottomley
Browse files

[SCSI] lpfc: NPIV: split ports



The driver is reorganized to separate the handling of the adapter from
the handling of the FC port. Adapter handling includes submissions of
command requests, receiving responses, and managing adapter resources.
The FC port includes the discovery engine, login handling, and the
mapping of a Scsi_Host on the "port".  Although not a large functional
change, as it touches core structures and functions, resulting in a
large text delta.

Signed-off-by: default avatarJames Smart <James.Smart@emulex.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 4c2baaaf
Loading
Loading
Loading
Loading
+149 −86
Original line number Original line Diff line number Diff line
@@ -19,6 +19,8 @@
 * included with this package.                                     *
 * included with this package.                                     *
 *******************************************************************/
 *******************************************************************/


#include <scsi/scsi_host.h>

struct lpfc_sli2_slim;
struct lpfc_sli2_slim;




@@ -165,70 +167,48 @@ struct lpfc_sysfs_mbox {
	struct lpfcMboxq *    mbox;
	struct lpfcMboxq *    mbox;
};
};


struct lpfc_hba {
struct lpfc_hba;
	struct lpfc_sli sli;

	struct lpfc_sli2_slim *slim2p;
enum discovery_state {
	dma_addr_t slim2p_mapping;
	LPFC_STATE_UNKNOWN   =  0,    /* HBA state is unknown */
	uint16_t pci_cfg_value;
	LPFC_LOCAL_CFG_LINK  =  6,    /* local NPORT Id configured */

	LPFC_FLOGI           =  7,    /* FLOGI sent to Fabric */
	int32_t hba_state;
	LPFC_FABRIC_CFG_LINK =  8,    /* Fabric assigned NPORT Id

				       * configured */
#define LPFC_STATE_UNKNOWN        0    /* HBA state is unknown */
	LPFC_NS_REG          =  9,    /* Register with NameServer */
#define LPFC_WARM_START           1    /* HBA state after selective reset */
	LPFC_NS_QRY          =  10,   /* Query NameServer for NPort ID list */
#define LPFC_INIT_START           2    /* Initial state after board reset */
	LPFC_BUILD_DISC_LIST =  11,   /* Build ADISC and PLOGI lists for
#define LPFC_INIT_MBX_CMDS        3    /* Initialize HBA with mbox commands */
#define LPFC_LINK_DOWN            4    /* HBA initialized, link is down */
#define LPFC_LINK_UP              5    /* Link is up  - issue READ_LA */
#define LPFC_LOCAL_CFG_LINK       6    /* local NPORT Id configured */
#define LPFC_FLOGI                7    /* FLOGI sent to Fabric */
#define LPFC_FABRIC_CFG_LINK      8    /* Fabric assigned NPORT Id
					   configured */
#define LPFC_NS_REG               9	/* Register with NameServer */
#define LPFC_NS_QRY               10	/* Query NameServer for NPort ID list */
#define LPFC_BUILD_DISC_LIST      11	/* Build ADISC and PLOGI lists for
				       * device authentication / discovery */
				       * device authentication / discovery */
#define LPFC_DISC_AUTH            12	/* Processing ADISC list */
	LPFC_DISC_AUTH       =  12,   /* Processing ADISC list */
#define LPFC_CLEAR_LA             13	/* authentication cmplt - issue
	LPFC_VPORT_READY     =  32,
					   CLEAR_LA */
};
#define LPFC_HBA_READY            32
#define LPFC_HBA_ERROR            -1

	int32_t stopped;   /* HBA has not been restarted since last ERATT */
	uint8_t fc_linkspeed;	/* Link speed after last READ_LA */


	uint32_t fc_eventTag;	/* event tag for link attention */
enum hba_state {
	uint32_t fc_prli_sent;	/* cntr for outstanding PRLIs */
	LPFC_LINK_UNKNOWN    =   0,   /* HBA state is unknown */
	LPFC_WARM_START      =   1,   /* HBA state after selective reset */
	LPFC_INIT_START      =   2,   /* Initial state after board reset */
	LPFC_INIT_MBX_CMDS   =   3,   /* Initialize HBA with mbox commands */
	LPFC_LINK_DOWN       =   4,   /* HBA initialized, link is down */
	LPFC_LINK_UP         =   5,   /* Link is up  - issue READ_LA */
	LPFC_CLEAR_LA        =  13,   /* authentication cmplt - issue
				       * CLEAR_LA */
	LPFC_HBA_ERROR       =  -1
};


	uint32_t num_disc_nodes;	/*in addition to hba_state */
struct lpfc_vport {
	struct list_head listentry;
	struct lpfc_hba *phba;
	uint8_t port_type;
#define LPFC_PHYSICAL_PORT 1
#define LPFC_NPIV_PORT  2
#define LPFC_FABRIC_PORT 3
	enum discovery_state port_state;


	struct timer_list fc_estabtmo;	/* link establishment timer */
	struct timer_list fc_disctmo;	/* Discovery rescue timer */
	struct timer_list fc_fdmitmo;	/* fdmi timer */
	/* These fields used to be binfo */
	struct lpfc_name fc_nodename;	/* fc nodename */
	struct lpfc_name fc_portname;	/* fc portname */
	uint32_t fc_pref_DID;	/* preferred D_ID */
	uint8_t fc_pref_ALPA;	/* preferred AL_PA */
	uint32_t fc_edtov;	/* E_D_TOV timer value */
	uint32_t fc_arbtov;	/* ARB_TOV timer value */
	uint32_t fc_ratov;	/* R_A_TOV timer value */
	uint32_t fc_rttov;	/* R_T_TOV timer value */
	uint32_t fc_altov;	/* AL_TOV timer value */
	uint32_t fc_crtov;	/* C_R_TOV timer value */
	uint32_t fc_citov;	/* C_I_TOV timer value */
	uint32_t fc_myDID;	/* fibre channel S_ID */
	uint32_t fc_prevDID;	/* previous fibre channel S_ID */


	struct serv_parm fc_sparam;	/* buffer for our service parameters */
	struct serv_parm fc_fabparam;	/* fabric service parameters buffer */
	uint8_t alpa_map[128];	/* AL_PA map from READ_LA */

	uint8_t fc_ns_retry;	/* retries for fabric nameserver */
	uint32_t fc_nlp_cnt;	/* outstanding NODELIST requests */
	uint32_t fc_rscn_id_cnt;	/* count of RSCNs payloads in list */
	struct lpfc_dmabuf *fc_rscn_id_list[FC_MAX_HOLD_RSCN];
	uint32_t lmt;
	uint32_t fc_flag;	/* FC flags */
	uint32_t fc_flag;	/* FC flags */
/* Several of these flags are HBA centric and should be moved to
 * phba->link_flag (e.g. FC_PTP, FC_PUBLIC_LOOP)
 */
#define FC_PT2PT                0x1	/* pt2pt with no fabric */
#define FC_PT2PT                0x1	/* pt2pt with no fabric */
#define FC_PT2PT_PLOGI          0x2	/* pt2pt initiate PLOGI */
#define FC_PT2PT_PLOGI          0x2	/* pt2pt initiate PLOGI */
#define FC_DISC_TMO             0x4	/* Discovery timer running */
#define FC_DISC_TMO             0x4	/* Discovery timer running */
@@ -240,21 +220,10 @@ struct lpfc_hba {
#define FC_FABRIC               0x100	/* We are fabric attached */
#define FC_FABRIC               0x100	/* We are fabric attached */
#define FC_ESTABLISH_LINK       0x200	/* Reestablish Link */
#define FC_ESTABLISH_LINK       0x200	/* Reestablish Link */
#define FC_RSCN_DISCOVERY       0x400	/* Authenticate all devices after RSCN*/
#define FC_RSCN_DISCOVERY       0x400	/* Authenticate all devices after RSCN*/
#define FC_BLOCK_MGMT_IO        0x800   /* Don't allow mgmt mbx or iocb cmds */
#define FC_LOADING		0x1000	/* HBA in process of loading drvr */
#define FC_UNLOADING		0x2000	/* HBA in process of unloading drvr */
#define FC_SCSI_SCAN_TMO        0x4000	/* scsi scan timer running */
#define FC_SCSI_SCAN_TMO        0x4000	/* scsi scan timer running */
#define FC_ABORT_DISCOVERY      0x8000	/* we want to abort discovery */
#define FC_ABORT_DISCOVERY      0x8000	/* we want to abort discovery */
#define FC_NDISC_ACTIVE         0x10000	/* NPort discovery active */
#define FC_NDISC_ACTIVE         0x10000	/* NPort discovery active */
#define FC_BYPASSED_MODE        0x20000	/* NPort is in bypassed mode */
#define FC_BYPASSED_MODE        0x20000	/* NPort is in bypassed mode */
#define FC_LOOPBACK_MODE        0x40000	/* NPort is in Loopback mode */
					/* This flag is set while issuing */
					/* INIT_LINK mailbox command */
#define FC_IGNORE_ERATT         0x80000	/* intr handler should ignore ERATT */

	uint32_t fc_topology;	/* link topology, from LINK INIT */

	struct lpfc_stats fc_stat;


	struct list_head fc_nodes;
	struct list_head fc_nodes;


@@ -267,10 +236,98 @@ struct lpfc_hba {
	uint16_t fc_map_cnt;
	uint16_t fc_map_cnt;
	uint16_t fc_npr_cnt;
	uint16_t fc_npr_cnt;
	uint16_t fc_unused_cnt;
	uint16_t fc_unused_cnt;
	struct serv_parm fc_sparam;	/* buffer for our service parameters */

	uint32_t fc_myDID;	/* fibre channel S_ID */
	uint32_t fc_prevDID;	/* previous fibre channel S_ID */

	int32_t stopped;   /* HBA has not been restarted since last ERATT */
	uint8_t fc_linkspeed;	/* Link speed after last READ_LA */

	uint32_t num_disc_nodes;	/*in addition to hba_state */

	uint32_t fc_nlp_cnt;	/* outstanding NODELIST requests */
	uint32_t fc_rscn_id_cnt;	/* count of RSCNs payloads in list */
	struct lpfc_dmabuf *fc_rscn_id_list[FC_MAX_HOLD_RSCN];
	struct lpfc_name fc_nodename;	/* fc nodename */
	struct lpfc_name fc_portname;	/* fc portname */

	struct lpfc_work_evt disc_timeout_evt;

	struct timer_list fc_disctmo;	/* Discovery rescue timer */
	uint8_t fc_ns_retry;	/* retries for fabric nameserver */
	uint32_t fc_prli_sent;	/* cntr for outstanding PRLIs */

	spinlock_t work_port_lock;
	uint32_t work_port_events; /* Timeout to be handled  */
#define WORKER_DISC_TMO                0x1	/* Discovery timeout */
#define WORKER_ELS_TMO                 0x2	/* ELS timeout */
#define WORKER_MBOX_TMO                0x4	/* MBOX timeout */
#define WORKER_FDMI_TMO                0x8	/* FDMI timeout */

	struct timer_list fc_fdmitmo;
	struct timer_list els_tmofunc;

	int unreg_vpi_cmpl;

	uint8_t load_flag;
#define FC_LOADING		0x1	/* HBA in process of loading drvr */
#define FC_UNLOADING		0x2	/* HBA in process of unloading drvr */

};

struct lpfc_hba {
	struct lpfc_sli sli;

	enum hba_state link_state;
	uint32_t link_flag;	/* link state flags */
#define LS_LOOPBACK_MODE        0x40000	/* NPort is in Loopback mode */
					/* This flag is set while issuing */
					/* INIT_LINK mailbox command */
#define LS_IGNORE_ERATT         0x80000	/* intr handler should ignore ERATT */

	uint32_t pgpOffset; /* PGP offset within host memory */

	struct lpfc_sli2_slim *slim2p;
	struct lpfc_dmabuf hbqslimp;

	dma_addr_t slim2p_mapping;


	uint16_t pci_cfg_value;


	uint8_t fc_linkspeed;	/* Link speed after last READ_LA */

	uint32_t fc_eventTag;	/* event tag for link attention */


	struct timer_list fc_estabtmo;	/* link establishment timer */
	/* These fields used to be binfo */
	uint32_t fc_pref_DID;	/* preferred D_ID */
	uint8_t fc_pref_ALPA;	/* preferred AL_PA */
	uint32_t fc_edtov;	/* E_D_TOV timer value */
	uint32_t fc_arbtov;	/* ARB_TOV timer value */
	uint32_t fc_ratov;	/* R_A_TOV timer value */
	uint32_t fc_rttov;	/* R_T_TOV timer value */
	uint32_t fc_altov;	/* AL_TOV timer value */
	uint32_t fc_crtov;	/* C_R_TOV timer value */
	uint32_t fc_citov;	/* C_I_TOV timer value */

	struct serv_parm fc_fabparam;	/* fabric service parameters buffer */
	uint8_t alpa_map[128];	/* AL_PA map from READ_LA */

	uint32_t lmt;

	uint32_t fc_topology;	/* link topology, from LINK INIT */

	struct lpfc_stats fc_stat;

	struct lpfc_nodelist fc_fcpnodev; /* nodelist entry for no device */
	struct lpfc_nodelist fc_fcpnodev; /* nodelist entry for no device */
	uint32_t nport_event_cnt;	/* timestamp for nlplist entry */
	uint32_t nport_event_cnt;	/* timestamp for nlplist entry */


	uint32_t wwnn[2];
	uint8_t  wwnn[8];
	uint8_t  wwpn[8];
	uint32_t RandomData[7];
	uint32_t RandomData[7];


	uint32_t cfg_log_verbose;
	uint32_t cfg_log_verbose;
@@ -304,18 +361,12 @@ struct lpfc_hba {


	lpfc_vpd_t vpd;		/* vital product data */
	lpfc_vpd_t vpd;		/* vital product data */


	struct Scsi_Host *host;
	struct pci_dev *pcidev;
	struct pci_dev *pcidev;
	struct list_head      work_list;
	struct list_head      work_list;
	uint32_t              work_ha;      /* Host Attention Bits for WT */
	uint32_t              work_ha;      /* Host Attention Bits for WT */
	uint32_t              work_ha_mask; /* HA Bits owned by WT        */
	uint32_t              work_ha_mask; /* HA Bits owned by WT        */
	uint32_t              work_hs;      /* HS stored in case of ERRAT */
	uint32_t              work_hs;      /* HS stored in case of ERRAT */
	uint32_t              work_status[2]; /* Extra status from SLIM */
	uint32_t              work_status[2]; /* Extra status from SLIM */
	uint32_t              work_hba_events; /* Timeout to be handled  */
#define WORKER_DISC_TMO                0x1	/* Discovery timeout */
#define WORKER_ELS_TMO                 0x2	/* ELS timeout */
#define WORKER_MBOX_TMO                0x4	/* MBOX timeout */
#define WORKER_FDMI_TMO                0x8	/* FDMI timeout */


	wait_queue_head_t    *work_wait;
	wait_queue_head_t    *work_wait;
	struct task_struct   *worker_thread;
	struct task_struct   *worker_thread;
@@ -353,7 +404,6 @@ struct lpfc_hba {
	uint8_t soft_wwn_enable;
	uint8_t soft_wwn_enable;


	struct timer_list fcp_poll_timer;
	struct timer_list fcp_poll_timer;
	struct timer_list els_tmofunc;


	/*
	/*
	 * stat  counters
	 * stat  counters
@@ -370,6 +420,7 @@ struct lpfc_hba {
	uint32_t total_scsi_bufs;
	uint32_t total_scsi_bufs;
	struct list_head lpfc_iocb_list;
	struct list_head lpfc_iocb_list;
	uint32_t total_iocbq_bufs;
	uint32_t total_iocbq_bufs;
	spinlock_t hbalock;


	/* pci_mem_pools */
	/* pci_mem_pools */
	struct pci_pool *lpfc_scsi_dma_buf_pool;
	struct pci_pool *lpfc_scsi_dma_buf_pool;
@@ -380,21 +431,33 @@ struct lpfc_hba {
	mempool_t *nlp_mem_pool;
	mempool_t *nlp_mem_pool;


	struct fc_host_statistics link_stats;
	struct fc_host_statistics link_stats;
	struct list_head port_list;
	struct lpfc_vport *pport; /* physical lpfc_vport pointer */
};
};


static inline struct Scsi_Host *
lpfc_shost_from_vport(struct lpfc_vport *vport)
{
	return container_of((void *) vport, struct Scsi_Host, hostdata[0]);
}

static inline void
static inline void
lpfc_set_loopback_flag(struct lpfc_hba *phba) {
lpfc_set_loopback_flag(struct lpfc_hba *phba)
{
	if (phba->cfg_topology == FLAGS_LOCAL_LB)
	if (phba->cfg_topology == FLAGS_LOCAL_LB)
		phba->fc_flag |= FC_LOOPBACK_MODE;
		phba->link_flag |= LS_LOOPBACK_MODE;
	else
	else
		phba->fc_flag &= ~FC_LOOPBACK_MODE;
		phba->link_flag &= ~LS_LOOPBACK_MODE;
}

static inline int
lpfc_is_link_up(struct lpfc_hba *phba)
{
	return  phba->link_state == LPFC_LINK_UP ||
		phba->link_state == LPFC_CLEAR_LA;
}
}


struct rnidrsp {

	void *buf;
	uint32_t uniqueid;
	struct list_head list;
	uint32_t data;
};


#define FC_REG_DUMP_EVENT	0x10	/* Register for Dump events */
#define FC_REG_DUMP_EVENT	0x10	/* Register for Dump events */
+239 −204

File changed.

Preview size limit exceeded, changes collapsed.

+55 −50
Original line number Original line Diff line number Diff line
@@ -26,6 +26,7 @@ void lpfc_read_nv(struct lpfc_hba *, LPFC_MBOXQ_t *);
int lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb,
int lpfc_read_la(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb,
		 struct lpfc_dmabuf *mp);
		 struct lpfc_dmabuf *mp);
void lpfc_clear_la(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_clear_la(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_issue_clear_la(struct lpfc_hba *phba, struct lpfc_vport *vport);
void lpfc_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_config_link(struct lpfc_hba *, LPFC_MBOXQ_t *);
int lpfc_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *);
int lpfc_read_sparam(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_read_config(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_read_config(struct lpfc_hba *, LPFC_MBOXQ_t *);
@@ -36,7 +37,6 @@ void lpfc_unreg_login(struct lpfc_hba *, uint32_t, LPFC_MBOXQ_t *);
void lpfc_unreg_did(struct lpfc_hba *, uint32_t, LPFC_MBOXQ_t *);
void lpfc_unreg_did(struct lpfc_hba *, uint32_t, LPFC_MBOXQ_t *);
void lpfc_init_link(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t);
void lpfc_init_link(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t);



int lpfc_linkdown(struct lpfc_hba *);
int lpfc_linkdown(struct lpfc_hba *);
void lpfc_mbx_cmpl_read_la(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_mbx_cmpl_read_la(struct lpfc_hba *, LPFC_MBOXQ_t *);


@@ -45,70 +45,70 @@ void lpfc_mbx_cmpl_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *, LPFC_MBOXQ_t *);
void lpfc_dequeue_node(struct lpfc_hba *, struct lpfc_nodelist *);
void lpfc_dequeue_node(struct lpfc_vport *, struct lpfc_nodelist *);
void lpfc_nlp_set_state(struct lpfc_hba *, struct lpfc_nodelist *, int);
void lpfc_nlp_set_state(struct lpfc_vport *, struct lpfc_nodelist *, int);
void lpfc_drop_node(struct lpfc_hba *, struct lpfc_nodelist *);
void lpfc_drop_node(struct lpfc_vport *, struct lpfc_nodelist *);
void lpfc_set_disctmo(struct lpfc_hba *);
void lpfc_set_disctmo(struct lpfc_vport *);
int lpfc_can_disctmo(struct lpfc_hba *);
int  lpfc_can_disctmo(struct lpfc_vport *);
int lpfc_unreg_rpi(struct lpfc_hba *, struct lpfc_nodelist *);
int  lpfc_unreg_rpi(struct lpfc_vport *, struct lpfc_nodelist *);
int lpfc_check_sli_ndlp(struct lpfc_hba *, struct lpfc_sli_ring *,
int lpfc_check_sli_ndlp(struct lpfc_hba *, struct lpfc_sli_ring *,
			struct lpfc_iocbq *, struct lpfc_nodelist *);
			struct lpfc_iocbq *, struct lpfc_nodelist *);
void lpfc_nlp_init(struct lpfc_hba *, struct lpfc_nodelist *, uint32_t);
void lpfc_nlp_init(struct lpfc_vport *, struct lpfc_nodelist *, uint32_t);
struct lpfc_nodelist *lpfc_nlp_get(struct lpfc_nodelist *);
struct lpfc_nodelist *lpfc_nlp_get(struct lpfc_nodelist *);
int  lpfc_nlp_put(struct lpfc_nodelist *);
int  lpfc_nlp_put(struct lpfc_nodelist *);
struct lpfc_nodelist *lpfc_setup_disc_node(struct lpfc_hba *, uint32_t);
struct lpfc_nodelist *lpfc_setup_disc_node(struct lpfc_vport *, uint32_t);
void lpfc_disc_list_loopmap(struct lpfc_hba *);
void lpfc_disc_list_loopmap(struct lpfc_vport *);
void lpfc_disc_start(struct lpfc_hba *);
void lpfc_disc_start(struct lpfc_vport *);
void lpfc_disc_flush_list(struct lpfc_hba *);
void lpfc_disc_flush_list(struct lpfc_vport *);
void lpfc_disc_timeout(unsigned long);
void lpfc_disc_timeout(unsigned long);


struct lpfc_nodelist *__lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi);
struct lpfc_nodelist *__lpfc_findnode_rpi(struct lpfc_vport *, uint16_t);
struct lpfc_nodelist *lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi);
struct lpfc_nodelist *lpfc_findnode_rpi(struct lpfc_vport *, uint16_t);


int lpfc_workq_post_event(struct lpfc_hba *, void *, void *, uint32_t);
int lpfc_workq_post_event(struct lpfc_hba *, void *, void *, uint32_t);
int lpfc_do_work(void *);
int lpfc_do_work(void *);
int lpfc_disc_state_machine(struct lpfc_hba *, struct lpfc_nodelist *, void *,
int lpfc_disc_state_machine(struct lpfc_vport *, struct lpfc_nodelist *, void *,
			    uint32_t);
			    uint32_t);


int lpfc_check_sparm(struct lpfc_hba *, struct lpfc_nodelist *,
int lpfc_check_sparm(struct lpfc_vport *, struct lpfc_nodelist *,
		     struct serv_parm *, uint32_t);
		     struct serv_parm *, uint32_t);
int lpfc_els_abort(struct lpfc_hba *, struct lpfc_nodelist * ndlp);
int lpfc_els_abort(struct lpfc_hba *, struct lpfc_nodelist * ndlp);
int lpfc_els_abort_flogi(struct lpfc_hba *);
int lpfc_els_abort_flogi(struct lpfc_hba *);
int lpfc_initial_flogi(struct lpfc_hba *);
int lpfc_initial_flogi(struct lpfc_vport *);
int lpfc_issue_els_plogi(struct lpfc_hba *, uint32_t, uint8_t);
int lpfc_issue_els_plogi(struct lpfc_vport *, uint32_t, uint8_t);
int lpfc_issue_els_prli(struct lpfc_hba *, struct lpfc_nodelist *, uint8_t);
int lpfc_issue_els_prli(struct lpfc_vport *, struct lpfc_nodelist *, uint8_t);
int lpfc_issue_els_adisc(struct lpfc_hba *, struct lpfc_nodelist *, uint8_t);
int lpfc_issue_els_adisc(struct lpfc_vport *, struct lpfc_nodelist *, uint8_t);
int lpfc_issue_els_logo(struct lpfc_hba *, struct lpfc_nodelist *, uint8_t);
int lpfc_issue_els_logo(struct lpfc_vport *, struct lpfc_nodelist *, uint8_t);
int lpfc_issue_els_scr(struct lpfc_hba *, uint32_t, uint8_t);
int lpfc_issue_els_scr(struct lpfc_vport *, uint32_t, uint8_t);
int lpfc_els_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *);
int lpfc_els_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *);
int lpfc_els_rsp_acc(struct lpfc_hba *, uint32_t, struct lpfc_iocbq *,
int lpfc_els_rsp_acc(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *,
		     struct lpfc_nodelist *, LPFC_MBOXQ_t *, uint8_t);
		     struct lpfc_nodelist *, LPFC_MBOXQ_t *, uint8_t);
int lpfc_els_rsp_reject(struct lpfc_hba *, uint32_t, struct lpfc_iocbq *,
int lpfc_els_rsp_reject(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *,
			struct lpfc_nodelist *);
			struct lpfc_nodelist *);
int lpfc_els_rsp_adisc_acc(struct lpfc_hba *, struct lpfc_iocbq *,
int lpfc_els_rsp_adisc_acc(struct lpfc_vport *, struct lpfc_iocbq *,
			   struct lpfc_nodelist *);
			   struct lpfc_nodelist *);
int lpfc_els_rsp_prli_acc(struct lpfc_hba *, struct lpfc_iocbq *,
int lpfc_els_rsp_prli_acc(struct lpfc_vport *, struct lpfc_iocbq *,
			  struct lpfc_nodelist *);
			  struct lpfc_nodelist *);
void lpfc_cancel_retry_delay_tmo(struct lpfc_hba *, struct lpfc_nodelist *);
void lpfc_cancel_retry_delay_tmo(struct lpfc_vport *, struct lpfc_nodelist *);
void lpfc_els_retry_delay(unsigned long);
void lpfc_els_retry_delay(unsigned long);
void lpfc_els_retry_delay_handler(struct lpfc_nodelist *);
void lpfc_els_retry_delay_handler(struct lpfc_nodelist *);
void lpfc_els_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
void lpfc_els_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
			  struct lpfc_iocbq *);
			  struct lpfc_iocbq *);
int lpfc_els_handle_rscn(struct lpfc_hba *);
int lpfc_els_handle_rscn(struct lpfc_vport *);
int lpfc_els_flush_rscn(struct lpfc_hba *);
int lpfc_els_flush_rscn(struct lpfc_vport *);
int lpfc_rscn_payload_check(struct lpfc_hba *, uint32_t);
int lpfc_rscn_payload_check(struct lpfc_vport *, uint32_t);
void lpfc_els_flush_cmd(struct lpfc_hba *);
void lpfc_els_flush_cmd(struct lpfc_vport *);
int lpfc_els_disc_adisc(struct lpfc_hba *);
int lpfc_els_disc_adisc(struct lpfc_vport *);
int lpfc_els_disc_plogi(struct lpfc_hba *);
int lpfc_els_disc_plogi(struct lpfc_vport *);
void lpfc_els_timeout(unsigned long);
void lpfc_els_timeout(unsigned long);
void lpfc_els_timeout_handler(struct lpfc_hba *);
void lpfc_els_timeout_handler(struct lpfc_vport *);


void lpfc_ct_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
void lpfc_ct_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
			 struct lpfc_iocbq *);
			 struct lpfc_iocbq *);
int lpfc_ns_cmd(struct lpfc_hba *, struct lpfc_nodelist *, int);
int lpfc_ns_cmd(struct lpfc_vport *, struct lpfc_nodelist *, int);
int lpfc_fdmi_cmd(struct lpfc_hba *, struct lpfc_nodelist *, int);
int lpfc_fdmi_cmd(struct lpfc_vport *, struct lpfc_nodelist *, int);
void lpfc_fdmi_tmo(unsigned long);
void lpfc_fdmi_tmo(unsigned long);
void lpfc_fdmi_tmo_handler(struct lpfc_hba *);
void lpfc_fdmi_timeout_handler(struct lpfc_vport *vport);


int lpfc_config_port_prep(struct lpfc_hba *);
int lpfc_config_port_prep(struct lpfc_hba *);
int lpfc_config_port_post(struct lpfc_hba *);
int lpfc_config_port_post(struct lpfc_hba *);
@@ -146,6 +146,7 @@ void lpfc_poll_start_timer(struct lpfc_hba * phba);
void lpfc_sli_poll_fcp_ring(struct lpfc_hba * hba);
void lpfc_sli_poll_fcp_ring(struct lpfc_hba * hba);
struct lpfc_iocbq * lpfc_sli_get_iocbq(struct lpfc_hba *);
struct lpfc_iocbq * lpfc_sli_get_iocbq(struct lpfc_hba *);
void lpfc_sli_release_iocbq(struct lpfc_hba * phba, struct lpfc_iocbq * iocb);
void lpfc_sli_release_iocbq(struct lpfc_hba * phba, struct lpfc_iocbq * iocb);
void __lpfc_sli_release_iocbq(struct lpfc_hba * phba, struct lpfc_iocbq * iocb);
uint16_t lpfc_sli_next_iotag(struct lpfc_hba * phba, struct lpfc_iocbq * iocb);
uint16_t lpfc_sli_next_iotag(struct lpfc_hba * phba, struct lpfc_iocbq * iocb);


void lpfc_reset_barrier(struct lpfc_hba * phba);
void lpfc_reset_barrier(struct lpfc_hba * phba);
@@ -154,6 +155,7 @@ int lpfc_sli_brdkill(struct lpfc_hba *);
int lpfc_sli_brdreset(struct lpfc_hba *);
int lpfc_sli_brdreset(struct lpfc_hba *);
int lpfc_sli_brdrestart(struct lpfc_hba *);
int lpfc_sli_brdrestart(struct lpfc_hba *);
int lpfc_sli_hba_setup(struct lpfc_hba *);
int lpfc_sli_hba_setup(struct lpfc_hba *);
int lpfc_sli_host_down(struct lpfc_vport *);
int lpfc_sli_hba_down(struct lpfc_hba *);
int lpfc_sli_hba_down(struct lpfc_hba *);
int lpfc_sli_issue_mbox(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t);
int lpfc_sli_issue_mbox(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t);
int lpfc_sli_handle_mb_event(struct lpfc_hba *);
int lpfc_sli_handle_mb_event(struct lpfc_hba *);
@@ -164,7 +166,7 @@ void lpfc_sli_def_mbox_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *);
int lpfc_sli_issue_iocb(struct lpfc_hba *, struct lpfc_sli_ring *,
int lpfc_sli_issue_iocb(struct lpfc_hba *, struct lpfc_sli_ring *,
			struct lpfc_iocbq *, uint32_t);
			struct lpfc_iocbq *, uint32_t);
void lpfc_sli_pcimem_bcopy(void *, void *, uint32_t);
void lpfc_sli_pcimem_bcopy(void *, void *, uint32_t);
int lpfc_sli_abort_iocb_ring(struct lpfc_hba *, struct lpfc_sli_ring *);
void lpfc_sli_abort_iocb_ring(struct lpfc_hba *, struct lpfc_sli_ring *);
int lpfc_sli_ringpostbuf_put(struct lpfc_hba *, struct lpfc_sli_ring *,
int lpfc_sli_ringpostbuf_put(struct lpfc_hba *, struct lpfc_sli_ring *,
			     struct lpfc_dmabuf *);
			     struct lpfc_dmabuf *);
struct lpfc_dmabuf *lpfc_sli_ringpostbuf_get(struct lpfc_hba *,
struct lpfc_dmabuf *lpfc_sli_ringpostbuf_get(struct lpfc_hba *,
@@ -180,8 +182,9 @@ int lpfc_sli_abort_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t,
void lpfc_mbox_timeout(unsigned long);
void lpfc_mbox_timeout(unsigned long);
void lpfc_mbox_timeout_handler(struct lpfc_hba *);
void lpfc_mbox_timeout_handler(struct lpfc_hba *);


struct lpfc_nodelist *lpfc_findnode_did(struct lpfc_hba *, uint32_t);
struct lpfc_nodelist *lpfc_findnode_did(struct lpfc_vport *, uint32_t);
struct lpfc_nodelist *lpfc_findnode_wwpn(struct lpfc_hba *, struct lpfc_name *);
struct lpfc_nodelist *lpfc_findnode_wwpn(struct lpfc_vport *,
					 struct lpfc_name *);


int lpfc_sli_issue_mbox_wait(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq,
int lpfc_sli_issue_mbox_wait(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq,
			 uint32_t timeout);
			 uint32_t timeout);
@@ -196,6 +199,7 @@ void lpfc_sli_abort_fcp_cmpl(struct lpfc_hba * phba,
			     struct lpfc_iocbq * rspiocb);
			     struct lpfc_iocbq * rspiocb);


void *lpfc_mbuf_alloc(struct lpfc_hba *, int, dma_addr_t *);
void *lpfc_mbuf_alloc(struct lpfc_hba *, int, dma_addr_t *);
void __lpfc_mbuf_free(struct lpfc_hba *, void *, dma_addr_t);
void lpfc_mbuf_free(struct lpfc_hba *, void *, dma_addr_t);
void lpfc_mbuf_free(struct lpfc_hba *, void *, dma_addr_t);


/* Function prototypes. */
/* Function prototypes. */
@@ -204,9 +208,9 @@ void lpfc_scan_start(struct Scsi_Host *);
int lpfc_scan_finished(struct Scsi_Host *, unsigned long);
int lpfc_scan_finished(struct Scsi_Host *, unsigned long);


void lpfc_get_cfgparam(struct lpfc_hba *);
void lpfc_get_cfgparam(struct lpfc_hba *);
int lpfc_alloc_sysfs_attr(struct lpfc_hba *);
int lpfc_alloc_sysfs_attr(struct lpfc_vport *);
void lpfc_free_sysfs_attr(struct lpfc_hba *);
void lpfc_free_sysfs_attr(struct lpfc_vport *);
extern struct class_device_attribute *lpfc_host_attrs[];
extern struct class_device_attribute *lpfc_hba_attrs[];
extern struct scsi_host_template lpfc_template;
extern struct scsi_host_template lpfc_template;
extern struct fc_function_template lpfc_transport_functions;
extern struct fc_function_template lpfc_transport_functions;


@@ -214,7 +218,8 @@ void lpfc_get_hba_sym_node_name(struct lpfc_hba * phba, uint8_t * symbp);
void lpfc_terminate_rport_io(struct fc_rport *);
void lpfc_terminate_rport_io(struct fc_rport *);
void lpfc_dev_loss_tmo_callbk(struct fc_rport *rport);
void lpfc_dev_loss_tmo_callbk(struct fc_rport *rport);


struct lpfc_vport *lpfc_create_port(struct lpfc_hba *, int);
void lpfc_post_hba_setup_vport_init(struct lpfc_vport *);
void destroy_port(struct lpfc_vport *);

#define ScsiResult(host_code, scsi_code) (((host_code) << 16) | scsi_code)
#define ScsiResult(host_code, scsi_code) (((host_code) << 16) | scsi_code)
#define HBA_EVENT_RSCN                   5
#define HBA_EVENT_LINK_UP                2
#define HBA_EVENT_LINK_DOWN              3
+105 −120

File changed.

Preview size limit exceeded, changes collapsed.

+3 −3
Original line number Original line Diff line number Diff line
@@ -49,8 +49,8 @@ struct lpfc_work_evt {


struct lpfc_nodelist {
struct lpfc_nodelist {
	struct list_head nlp_listp;
	struct list_head nlp_listp;
	struct lpfc_name nlp_portname;		/* port name */
	struct lpfc_name nlp_portname;
	struct lpfc_name nlp_nodename;		/* node name */
	struct lpfc_name nlp_nodename;
	uint32_t         nlp_flag;		/* entry  flags */
	uint32_t         nlp_flag;		/* entry  flags */
	uint32_t         nlp_DID;		/* FC D_ID of entry */
	uint32_t         nlp_DID;		/* FC D_ID of entry */
	uint32_t         nlp_last_elscmd;	/* Last ELS cmd sent */
	uint32_t         nlp_last_elscmd;	/* Last ELS cmd sent */
@@ -75,7 +75,7 @@ struct lpfc_nodelist {
	struct timer_list   nlp_delayfunc;	/* Used for delayed ELS cmds */
	struct timer_list   nlp_delayfunc;	/* Used for delayed ELS cmds */
	struct fc_rport *rport;			/* Corresponding FC transport
	struct fc_rport *rport;			/* Corresponding FC transport
						   port structure */
						   port structure */
	struct lpfc_hba      *nlp_phba;
	struct lpfc_vport *vport;
	struct lpfc_work_evt els_retry_evt;
	struct lpfc_work_evt els_retry_evt;
	unsigned long last_ramp_up_time;        /* jiffy of last ramp up */
	unsigned long last_ramp_up_time;        /* jiffy of last ramp up */
	unsigned long last_q_full_time;		/* jiffy of last queue full */
	unsigned long last_q_full_time;		/* jiffy of last queue full */
Loading