Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
lpfc_els.c File Reference
#include <linux/blkdev.h>
#include <linux/pci.h>
#include <linux/slab.h>
#include <linux/interrupt.h>
#include <scsi/scsi.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_transport_fc.h>
#include "lpfc_hw4.h"
#include "lpfc_hw.h"
#include "lpfc_sli.h"
#include "lpfc_sli4.h"
#include "lpfc_nl.h"
#include "lpfc_disc.h"
#include "lpfc_scsi.h"
#include "lpfc.h"
#include "lpfc_logmsg.h"
#include "lpfc_crtn.h"
#include "lpfc_vport.h"
#include "lpfc_debugfs.h"

Go to the source code of this file.

Functions

int lpfc_els_chk_latt (struct lpfc_vport *vport)
 
struct lpfc_iocbqlpfc_prep_els_iocb (struct lpfc_vport *vport, uint8_t expectRsp, uint16_t cmdSize, uint8_t retry, struct lpfc_nodelist *ndlp, uint32_t did, uint32_t elscmd)
 
int lpfc_issue_fabric_reglogin (struct lpfc_vport *vport)
 
int lpfc_issue_reg_vfi (struct lpfc_vport *vport)
 
int lpfc_issue_unreg_vfi (struct lpfc_vport *vport)
 
int lpfc_els_abort_flogi (struct lpfc_hba *phba)
 
int lpfc_initial_flogi (struct lpfc_vport *vport)
 
int lpfc_initial_fdisc (struct lpfc_vport *vport)
 
void lpfc_more_plogi (struct lpfc_vport *vport)
 
void lpfc_end_rscn (struct lpfc_vport *vport)
 
int lpfc_issue_els_plogi (struct lpfc_vport *vport, uint32_t did, uint8_t retry)
 
int lpfc_issue_els_prli (struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, uint8_t retry)
 
void lpfc_more_adisc (struct lpfc_vport *vport)
 
int lpfc_issue_els_adisc (struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, uint8_t retry)
 
int lpfc_issue_els_logo (struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, uint8_t retry)
 
int lpfc_issue_els_scr (struct lpfc_vport *vport, uint32_t nportid, uint8_t retry)
 
void lpfc_cancel_retry_delay_tmo (struct lpfc_vport *vport, struct lpfc_nodelist *nlp)
 
void lpfc_els_retry_delay (unsigned long ptr)
 
void lpfc_els_retry_delay_handler (struct lpfc_nodelist *ndlp)
 
int lpfc_els_free_iocb (struct lpfc_hba *phba, struct lpfc_iocbq *elsiocb)
 
void lpfc_mbx_cmpl_dflt_rpi (struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
 
int lpfc_els_rsp_acc (struct lpfc_vport *vport, uint32_t flag, struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp, LPFC_MBOXQ_t *mbox)
 
int lpfc_els_rsp_reject (struct lpfc_vport *vport, uint32_t rejectError, struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp, LPFC_MBOXQ_t *mbox)
 
int lpfc_els_rsp_adisc_acc (struct lpfc_vport *vport, struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp)
 
int lpfc_els_rsp_prli_acc (struct lpfc_vport *vport, struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp)
 
int lpfc_els_disc_adisc (struct lpfc_vport *vport)
 
int lpfc_els_disc_plogi (struct lpfc_vport *vport)
 
void lpfc_els_flush_rscn (struct lpfc_vport *vport)
 
int lpfc_rscn_payload_check (struct lpfc_vport *vport, uint32_t did)
 
int lpfc_els_handle_rscn (struct lpfc_vport *vport)
 
int lpfc_send_rrq (struct lpfc_hba *phba, struct lpfc_node_rrq *rrq)
 
void lpfc_els_timeout (unsigned long ptr)
 
void lpfc_els_timeout_handler (struct lpfc_vport *vport)
 
void lpfc_els_flush_cmd (struct lpfc_vport *vport)
 
void lpfc_els_flush_all_cmd (struct lpfc_hba *phba)
 
void lpfc_send_els_failure_event (struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocbp, struct lpfc_iocbq *rspiocbp)
 
void lpfc_els_unsol_event (struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct lpfc_iocbq *elsiocb)
 
void lpfc_do_scr_ns_plogi (struct lpfc_hba *phba, struct lpfc_vport *vport)
 
void lpfc_register_new_vport (struct lpfc_hba *phba, struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
 
void lpfc_cancel_all_vport_retry_delay_timer (struct lpfc_hba *phba)
 
void lpfc_retry_pport_discovery (struct lpfc_hba *phba)
 
int lpfc_issue_els_npiv_logo (struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
 
void lpfc_fabric_block_timeout (unsigned long ptr)
 
void lpfc_unblock_fabric_iocbs (struct lpfc_hba *phba)
 
void lpfc_fabric_abort_nport (struct lpfc_nodelist *ndlp)
 
void lpfc_fabric_abort_hba (struct lpfc_hba *phba)
 
void lpfc_sli4_vport_delete_els_xri_aborted (struct lpfc_vport *vport)
 
void lpfc_sli4_els_xri_aborted (struct lpfc_hba *phba, struct sli4_wcqe_xri_aborted *axri)
 
void lpfc_sli_abts_recover_port (struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
 

Function Documentation

void lpfc_cancel_all_vport_retry_delay_timer ( struct lpfc_hba phba)

lpfc_cancel_all_vport_retry_delay_timer - Cancel all vport retry delay timer : pointer to lpfc hba data structure.

This routine cancels the retry delay timers to all the vports.

Definition at line 7204 of file lpfc_els.c.

void lpfc_cancel_retry_delay_tmo ( struct lpfc_vport vport,
struct lpfc_nodelist nlp 
)

lpfc_cancel_retry_delay_tmo - Cancel the timer with delayed iocb-cmd retry : pointer to a host virtual N_Port data structure. : pointer to a node-list data structure.

This routine cancels the timer with a delayed IOCB-command retry for a 's . It stops the timer for the delayed function retrial and removes the ELS retry event if it presents. In addition, if the NLP_NPR_2B_DISC bit is set in the 's nlp_flag bitmap, ADISC IOCB commands are sent for the 's nodes that require issuing discovery ADISC.

Definition at line 2845 of file lpfc_els.c.

void lpfc_do_scr_ns_plogi ( struct lpfc_hba phba,
struct lpfc_vport vport 
)

lpfc_do_scr_ns_plogi - Issue a plogi to the name server for scr : pointer to lpfc hba data structure. : pointer to a virtual N_Port data structure.

This routine issues a Port Login (PLOGI) to the Name Server with State Change Request (SCR) for a . This routine will create an ndlp for the Name Server associated to the if such node does not already exist. The PLOGI to Name Server is issued by invoking the lpfc_issue_els_plogi() routine. If Fabric-Device Management Interface (FDMI) is configured to the , a FDMI node will be created and the PLOGI to FDMI is issued by invoking lpfc_issue_els_plogi() routine.

Definition at line 6954 of file lpfc_els.c.

int lpfc_els_abort_flogi ( struct lpfc_hba phba)

lpfc_els_abort_flogi - Abort all outstanding flogi iocbs : pointer to lpfc hba data structure.

This routine aborts all the outstanding Fabric Login (FLOGI) IOCBs with a . This routine walks all the outstanding IOCBs on the txcmplq list and issues an abort IOCB commond on each outstanding IOCB that contains a active Fabric_DID ndlp. Note that this function is to issue the abort IOCB command on all the outstanding IOCBs, thus when this function returns, it does not guarantee all the IOCBs are actually aborted.

Return code 0 - Successfully issued abort iocb on all outstanding flogis (Always 0)

Definition at line 1251 of file lpfc_els.c.

int lpfc_els_chk_latt ( struct lpfc_vport vport)

lpfc_els_chk_latt - Check host link attention event for a vport : pointer to a host virtual N_Port data structure.

This routine checks whether there is an outstanding host link attention event during the discovery process with the . It is done by reading the HBA's Host Attention (HA) register. If there is any host link attention events during this 's discovery process, the shall be marked as FC_ABORT_DISCOVERY, a host link attention clear shall be issued if the link state is not already in host link cleared state, and a return code shall indicate whether the host link attention event had happened.

Note that, if either the host link is in state LPFC_LINK_DOWN or state in LPFC_VPORT_READY, the request for checking host link attention event will be ignored and a return code shall indicate no host link attention event had happened.

Return codes 0 - no host link attention event happened 1 - host link attention event happened

Definition at line 80 of file lpfc_els.c.

int lpfc_els_disc_adisc ( struct lpfc_vport vport)

lpfc_els_disc_adisc - Issue remaining adisc iocbs to npr nodes of a vport : pointer to a host virtual N_Port data structure.

This routine issues Address Discover (ADISC) ELS commands to those N_Ports which are in node port recovery state and ADISC has not been issued for the . Each time an ELS ADISC IOCB is issued by invoking the lpfc_issue_els_adisc() routine, the per number of discover count (num_disc_nodes) shall be incremented. If the num_disc_nodes reaches a pre-configured threshold (cfg_discovery_threads), the fc_flag will be marked with FC_NLP_MORE bit and the process of issuing remaining ADISC IOCBs quit for later pick up. On the other hand, after walking through all the ndlps with the and there is none ADISC IOCB issued, the fc_flag shall be cleared with FC_NLP_MORE bit indicating there is no more ADISC need to be sent.

Return code The number of N_Ports with adisc issued.

Definition at line 4416 of file lpfc_els.c.

int lpfc_els_disc_plogi ( struct lpfc_vport vport)

lpfc_els_disc_plogi - Issue plogi for all npr nodes of a vport before adisc : pointer to a host virtual N_Port data structure.

This routine issues Port Login (PLOGI) ELS commands to all the N_Ports which are in node port recovery state, with a . Each time an ELS ADISC PLOGI IOCB is issued by invoking the lpfc_issue_els_plogi() routine, the per number of discover count (num_disc_nodes) shall be incremented. If the num_disc_nodes reaches a pre-configured threshold (cfg_discovery_threads), the fc_flag will be marked with FC_NLP_MORE bit set and quit the process of issuing remaining ADISC PLOGIN IOCBs for later pick up. On the other hand, after walking through all the ndlps with the and there is none ADISC PLOGI IOCB issued, the fc_flag shall be cleared with the FC_NLP_MORE bit indicating there is no more ADISC PLOGI need to be sent.

Return code The number of N_Ports with plogi issued.

Definition at line 4474 of file lpfc_els.c.

void lpfc_els_flush_all_cmd ( struct lpfc_hba phba)

lpfc_els_flush_all_cmd - Clean up all the outstanding els commands to a HBA : pointer to lpfc hba data structure.

This routine is used to clean up all the outstanding ELS commands on a . It first aborts the by invoking the lpfc_fabric_abort_hba() routine. After that, it walks the ELS transmit queue to remove all the IOCBs to the other than the QUE_RING and ABORT/CLOSE IOCBs. For the IOCBs with the completion callback function associated, the callback function will be invoked with the status set to IOSTAT_LOCAL_REJECT and un.ulpWord[4] set to IOERR_SLI_ABORTED. For IOCBs without the completion callback function associated, the IOCB will simply be released. Finally, it walks the ELS transmit completion queue to issue an abort IOCB to any transmit completion queue IOCB that is not an IOCB from libdfc (i.e., the management plane IOCBs that are not part of the discovery state machine) out to HBA by invoking the lpfc_sli_issue_abort_iotag() routine.

Definition at line 6311 of file lpfc_els.c.

void lpfc_els_flush_cmd ( struct lpfc_vport vport)

lpfc_els_flush_cmd - Clean up the outstanding els commands to a vport : pointer to a host virtual N_Port data structure.

This routine is used to clean up all the outstanding ELS commands on a . It first aborts the by invoking lpfc_fabric_abort_vport() routine. After that, it walks the ELS transmit queue to remove all the IOCBs with the other than the QUE_RING and ABORT/CLOSE IOCBs. For the IOCBs with a non-NULL completion callback function, the callback function will be invoked with the status set to IOSTAT_LOCAL_REJECT and un.ulpWord[4] set to IOERR_SLI_ABORTED. For IOCBs with a NULL completion callback function, the IOCB will simply be released. Finally, it walks the ELS transmit completion queue to issue an abort IOCB to any transmit completion queue IOCB that is associated with the and is not an IOCB from libdfc (i.e., the management plane IOCBs that are not part of the discovery state machine) out to HBA by invoking the lpfc_sli_issue_abort_iotag() routine. Note that this function issues the abort IOCB to any transmit completion queueed IOCB, it does not guarantee the IOCBs are aborted when this function returns.

Definition at line 6242 of file lpfc_els.c.

void lpfc_els_flush_rscn ( struct lpfc_vport vport)

lpfc_els_flush_rscn - Clean up any rscn activities with a vport : pointer to a host virtual N_Port data structure.

This routine cleans up any Registration State Change Notification (RSCN) activity with a . Note that the fc_rscn_flush flag of the together with the host_lock is used to prevent multiple thread trying to access the RSCN array on a same at the same time.

Definition at line 4523 of file lpfc_els.c.

int lpfc_els_free_iocb ( struct lpfc_hba phba,
struct lpfc_iocbq elsiocb 
)

lpfc_els_free_iocb - Free a command iocb and its associated resources : pointer to lpfc hba data structure. : pointer to lpfc els command iocb data structure.

This routine frees a command IOCB and its associated resources. The command IOCB data structure contains the reference to various associated resources, these fields must be set to NULL if the associated reference not present: context1 - reference to ndlp context2 - reference to cmd context2->next - reference to rsp context3 - reference to bpl

It first properly decrements the reference count held on ndlp for the IOCB completion callback function. If LPFC_DELAY_MEM_FREE flag is not set, it invokes the lpfc_els_free_data() routine to release the Direct Memory Access (DMA) buffers associated with the IOCB. Otherwise, it adds the DMA buffer the data structure for the delayed release. If reference to the Buffer Pointer List (BPL) is present, the lpfc_els_free_bpl() routine is invoked to release the DMA memory associated with BPL. Finally, the lpfc_sli_release_iocbq() routine is invoked to release the IOCB data structure back to IOCBQ list.

Return code 0 - Success (currently, always return 0)

Definition at line 3449 of file lpfc_els.c.

int lpfc_els_handle_rscn ( struct lpfc_vport vport)

lpfc_els_handle_rscn - Handle rscn for a vport : pointer to a host virtual N_Port data structure.

This routine handles the Registration State Configuration Notification (RSCN) for a . If login to NameServer does not exist, a new ndlp shall be created and a Port Login (PLOGI) to the NameServer is issued. Otherwise, if the ndlp to NameServer exists, a Common Transport (CT) command to the NameServer shall be issued. If CT command to the NameServer fails to be issued, the lpfc_els_flush_rscn() routine shall be invoked to clean up any RSCN activities with the .

Return code 0 - Cleaned up rscn on the 1 - Wait for plogi to name server before proceed

Definition at line 4914 of file lpfc_els.c.

void lpfc_els_retry_delay ( unsigned long  ptr)

lpfc_els_retry_delay - Timer function with a ndlp delayed function timer : holder for the pointer to the timer function associated data (ndlp).

This routine is invoked by the ndlp delayed-function timer to check whether there is any pending ELS retry event(s) with the node. If not, it simply returns. Otherwise, if there is at least one ELS delayed event, it adds the delayed events to the HBA work list and invokes the lpfc_worker_wake_up() routine to wake up worker thread to process the event. Note that lpfc_nlp_get() is called before posting the event to the work list to hold reference count of ndlp so that it guarantees the reference to ndlp will still be available when the worker thread gets to the event associated with the ndlp.

Definition at line 2902 of file lpfc_els.c.

void lpfc_els_retry_delay_handler ( struct lpfc_nodelist ndlp)

lpfc_els_retry_delay_handler - Work thread handler for ndlp delayed function : pointer to a node-list data structure.

This routine is the worker-thread handler for processing the delayed event(s), posted by the lpfc_els_retry_delay() routine. It simply retrieves the last ELS command from the associated ndlp and invokes the proper ELS function according to the delayed ELS command to retry the command.

Definition at line 2939 of file lpfc_els.c.

int lpfc_els_rsp_acc ( struct lpfc_vport vport,
uint32_t  flag,
struct lpfc_iocbq oldiocb,
struct lpfc_nodelist ndlp,
LPFC_MBOXQ_t mbox 
)

lpfc_els_rsp_acc - Prepare and issue an acc response iocb command : pointer to a host virtual N_Port data structure. : the els command code to be accepted. : pointer to the original lpfc command iocb data structure. : pointer to a node-list data structure. : pointer to the driver internal queue element for mailbox command.

This routine prepares and issues an Accept (ACC) response IOCB command. It uses the to properly set up the IOCB field for the specific ACC response command to be issued and invokes the lpfc_sli_issue_iocb() routine to send out ACC response IOCB. If a pointer is passed in, it will be put into the context_un.mbox field of the IOCB for the completion callback function to issue the mailbox command to the HBA later when callback is invoked.

Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp will be incremented by 1 for holding the ndlp and the reference to ndlp will be stored into the context1 field of the IOCB for the completion callback function to the corresponding response ELS IOCB command.

Return code 0 - Successfully issued acc response 1 - Failed to issue acc response

Definition at line 3819 of file lpfc_els.c.

int lpfc_els_rsp_adisc_acc ( struct lpfc_vport vport,
struct lpfc_iocbq oldiocb,
struct lpfc_nodelist ndlp 
)

lpfc_els_rsp_adisc_acc - Prepare and issue acc response to adisc iocb cmd : pointer to a virtual N_Port data structure. : pointer to the original lpfc command iocb data structure. : pointer to a node-list data structure.

This routine prepares and issues an Accept (ACC) response to Address Discover (ADISC) ELS command. It simply prepares the payload of the IOCB and invokes the lpfc_sli_issue_iocb() routine to send out the command.

Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp will be incremented by 1 for holding the ndlp and the reference to ndlp will be stored into the context1 field of the IOCB for the completion callback function to the ADISC Accept response ELS IOCB command.

Return code 0 - Successfully issued acc adisc response 1 - Failed to issue adisc acc response

Definition at line 4033 of file lpfc_els.c.

int lpfc_els_rsp_prli_acc ( struct lpfc_vport vport,
struct lpfc_iocbq oldiocb,
struct lpfc_nodelist ndlp 
)

lpfc_els_rsp_prli_acc - Prepare and issue acc response to prli iocb cmd : pointer to a virtual N_Port data structure. : pointer to the original lpfc command iocb data structure. : pointer to a node-list data structure.

This routine prepares and issues an Accept (ACC) response to Process Login (PRLI) ELS command. It simply prepares the payload of the IOCB and invokes the lpfc_sli_issue_iocb() routine to send out the command.

Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp will be incremented by 1 for holding the ndlp and the reference to ndlp will be stored into the context1 field of the IOCB for the completion callback function to the PRLI Accept response ELS IOCB command.

Return code 0 - Successfully issued acc prli response 1 - Failed to issue acc prli response

Definition at line 4107 of file lpfc_els.c.

int lpfc_els_rsp_reject ( struct lpfc_vport vport,
uint32_t  rejectError,
struct lpfc_iocbq oldiocb,
struct lpfc_nodelist ndlp,
LPFC_MBOXQ_t mbox 
)

lpfc_els_rsp_reject - Propare and issue a rjt response iocb command : pointer to a virtual N_Port data structure. : : pointer to the original lpfc command iocb data structure. : pointer to a node-list data structure. : pointer to the driver internal queue element for mailbox command.

This routine prepares and issue an Reject (RJT) response IOCB command. If a pointer is passed in, it will be put into the context_un.mbox field of the IOCB for the completion callback function to issue to the HBA later.

Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp will be incremented by 1 for holding the ndlp and the reference to ndlp will be stored into the context1 field of the IOCB for the completion callback function to the reject response ELS IOCB command.

Return code 0 - Successfully issued reject response 1 - Failed to issue reject response

Definition at line 3957 of file lpfc_els.c.

void lpfc_els_timeout ( unsigned long  ptr)

lpfc_els_timeout - Handler funciton to the els timer : holder for the timer function associated data.

This routine is invoked by the ELS timer after timeout. It posts the ELS timer timeout event by setting the WORKER_ELS_TMO bit to the work port event bitmap and then invokes the lpfc_worker_wake_up() routine to wake up the worker thread. It is for the worker thread to invoke the routine lpfc_els_timeout_handler() to work on the posted event WORKER_ELS_TMO.

Definition at line 6112 of file lpfc_els.c.

void lpfc_els_timeout_handler ( struct lpfc_vport vport)

lpfc_els_timeout_handler - Process an els timeout event : pointer to a virtual N_Port data structure.

This routine is the actual handler function that processes an ELS timeout event. It walks the ELS ring to get and abort all the IOCBs (except the ABORT/CLOSE/FARP/FARPR/FDISC), which are associated with the by invoking the lpfc_sli_issue_abort_iotag() routine.

Definition at line 6141 of file lpfc_els.c.

void lpfc_els_unsol_event ( struct lpfc_hba phba,
struct lpfc_sli_ring pring,
struct lpfc_iocbq elsiocb 
)

lpfc_els_unsol_event - Process an unsolicited event from an els sli ring : pointer to lpfc hba data structure. : pointer to a SLI ring. : pointer to lpfc els iocb data structure.

This routine is used to process an unsolicited event received from a SLI (Service Level Interface) ring. The actual processing of the data buffer associated with the unsolicited event is done by invoking the routine lpfc_els_unsol_buffer() after properly set up the iocb buffer from the SLI ring on which the unsolicited event was received.

Definition at line 6864 of file lpfc_els.c.

void lpfc_end_rscn ( struct lpfc_vport vport)

lpfc_end_rscn - Check and handle more rscn for a vport : pointer to a host virtual N_Port data structure.

This routine checks whether more Registration State Change Notifications (RSCNs) came in while the discovery state machine was in the FC_RSCN_MODE. If so, the lpfc_els_handle_rscn() routine will be invoked to handle the additional RSCNs for the . Otherwise, the FC_RSCN_MODE bit will be cleared with the to mark as the end of handling the RSCNs.

Definition at line 1631 of file lpfc_els.c.

void lpfc_fabric_abort_hba ( struct lpfc_hba phba)

lpfc_fabric_abort_hba - Abort all iocbs on driver fabric iocb list : pointer to lpfc hba data structure.

This routine aborts all the IOCBs currently on the driver internal fabric IOCB list. The list contains fabric IOCBs to be issued to the ELS IOCB ring. This function takes the entire IOCB list off the fabric IOCB list, removes IOCBs off the list, set the status feild to IOSTAT_LOCAL_REJECT, and invokes the callback function associated with the IOCB.

Definition at line 7965 of file lpfc_els.c.

void lpfc_fabric_abort_nport ( struct lpfc_nodelist ndlp)

lpfc_fabric_abort_nport - Abort a ndlp's iocbs from driver fabric iocb list : pointer to a node-list data structure.

This routine aborts all the IOCBs associated with an from the driver internal fabric IOCB list. The list contains fabric IOCBs to be issued to the ELS IOCB ring. This abort function walks the fabric IOCB list, removes each IOCB associated with the off the list, set the status feild to IOSTAT_LOCAL_REJECT, and invokes the callback function associated with the IOCB.

Definition at line 7932 of file lpfc_els.c.

void lpfc_fabric_block_timeout ( unsigned long  ptr)

lpfc_fabric_block_timeout - Handler function to the fabric block timer : holder for the timer function associated data.

This routine is invoked by the fabric iocb block timer after timeout. It posts the fabric iocb block timeout event by setting the WORKER_FABRIC_BLOCK_TMO bit to work port event bitmap and then invokes lpfc_worker_wake_up() routine to wake up the worker thread. It is for the worker thread to invoke the lpfc_unblock_fabric_iocbs() on the posted event WORKER_FABRIC_BLOCK_TMO.

Definition at line 7646 of file lpfc_els.c.

int lpfc_initial_fdisc ( struct lpfc_vport vport)

lpfc_initial_fdisc - Issue an initial fabric discovery for a vport : pointer to a host virtual N_Port data structure.

This routine issues an initial Fabric Discover (FDISC) for the specified. It first searches the ndlp with the Fabric_DID (0xfffffe) from the 's ndlp list. If no such ndlp found, it will create an ndlp and put it into the 's ndlp list. If an inactive ndlp found on the list, it will just be enabled and made active. The lpfc_issue_els_fdisc() routine is then invoked with the and the ndlp to perform the FDISC for the .

Return code 0 - failed to issue initial fdisc for 1 - successfully issued initial fdisc for

Definition at line 1355 of file lpfc_els.c.

int lpfc_initial_flogi ( struct lpfc_vport vport)

lpfc_initial_flogi - Issue an initial fabric login for a vport : pointer to a host virtual N_Port data structure.

This routine issues an initial Fabric Login (FLOGI) for the specified. It first searches the ndlp with the Fabric_DID (0xfffffe) from the 's ndlp list. If no such ndlp found, it will create an ndlp and put it into the 's ndlp list. If an inactive ndlp found on the list, it will just be enabled and made active. The lpfc_issue_els_flogi() routine is then invoked with the and the ndlp to perform the FLOGI for the .

Return code 0 - failed to issue initial flogi for 1 - successfully issued initial flogi for

Definition at line 1301 of file lpfc_els.c.

int lpfc_issue_els_adisc ( struct lpfc_vport vport,
struct lpfc_nodelist ndlp,
uint8_t  retry 
)

lpfc_issue_els_adisc - Issue an address discover iocb to an node on a vport : pointer to a virtual N_Port data structure. : pointer to a node-list data structure. : number of retries to the command IOCB.

This routine issues an Address Discover (ADISC) for an on a . It prepares the payload of the ADISC ELS command, updates the and states of the ndlp, and invokes the lpfc_sli_issue_iocb() routine to issue the ADISC ELS command.

Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp will be incremented by 1 for holding the ndlp and the reference to ndlp will be stored into the context1 field of the IOCB for the completion callback function to the ADISC ELS command.

Return code 0 - successfully issued adisc 1 - failed to issue adisc

Definition at line 2320 of file lpfc_els.c.

int lpfc_issue_els_logo ( struct lpfc_vport vport,
struct lpfc_nodelist ndlp,
uint8_t  retry 
)

lpfc_issue_els_logo - Issue a logo to an node on a vport : pointer to a virtual N_Port data structure. : pointer to a node-list data structure. : number of retries to the command IOCB.

This routine constructs and issues an ELS Logout (LOGO) iocb command to a remote node, referred by an on a . It constructs the payload of the IOCB, properly sets up the state, and invokes the lpfc_sli_issue_iocb() routine to send out the LOGO ELS command.

Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp will be incremented by 1 for holding the ndlp and the reference to ndlp will be stored into the context1 field of the IOCB for the completion callback function to the LOGO ELS command.

Return code 0 - successfully issued logo 1 - failed to issue logo

Definition at line 2517 of file lpfc_els.c.

int lpfc_issue_els_npiv_logo ( struct lpfc_vport vport,
struct lpfc_nodelist ndlp 
)

lpfc_issue_els_npiv_logo - Issue a logo off a vport : pointer to a virtual N_Port data structure. : pointer to a node-list data structure.

This routine issues a LOGO ELS command to an off a .

Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp will be incremented by 1 for holding the ndlp and the reference to ndlp will be stored into the context1 field of the IOCB for the completion callback function to the LOGO ELS command.

Return codes 0 - Successfully issued logo off the 1 - Failed to issue logo off the

Definition at line 7590 of file lpfc_els.c.

int lpfc_issue_els_plogi ( struct lpfc_vport vport,
uint32_t  did,
uint8_t  retry 
)

lpfc_issue_els_plogi - Issue an plogi iocb command for a vport : pointer to a host virtual N_Port data structure. : destination port identifier. : number of retries to the command IOCB.

This routine issues a Port Login (PLOGI) command to a remote N_Port (with the ) for a . Before issuing a PLOGI to a remote N_Port, the ndlp with the remote N_Port DID must exist on the 's ndlp list. This routine constructs the proper feilds of the PLOGI IOCB and invokes the lpfc_sli_issue_iocb() routine to send out PLOGI ELS command.

Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp will be incremented by 1 for holding the ndlp and the reference to ndlp will be stored into the context1 field of the IOCB for the completion callback function to the PLOGI ELS command.

Return code 0 - Successfully issued a plogi for 1 - failed to issue a plogi for

Definition at line 1873 of file lpfc_els.c.

int lpfc_issue_els_prli ( struct lpfc_vport vport,
struct lpfc_nodelist ndlp,
uint8_t  retry 
)

lpfc_issue_els_prli - Issue a prli iocb command for a vport : pointer to a host virtual N_Port data structure. : pointer to a node-list data structure. : number of retries to the command IOCB.

This routine issues a Process Login (PRLI) ELS command for the . The PRLI service parameters are set up in the payload of the PRLI Request command and the pointer to lpfc_cmpl_els_prli() routine is put to the IOCB completion callback func field before invoking the routine lpfc_sli_issue_iocb() to send out PRLI command.

Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp will be incremented by 1 for holding the ndlp and the reference to ndlp will be stored into the context1 field of the IOCB for the completion callback function to the PRLI ELS command.

Return code 0 - successfully issued prli iocb command for 1 - failed to issue prli iocb command for

Definition at line 2032 of file lpfc_els.c.

int lpfc_issue_els_scr ( struct lpfc_vport vport,
uint32_t  nportid,
uint8_t  retry 
)

lpfc_issue_els_scr - Issue a scr to an node on a vport : pointer to a host virtual N_Port data structure. : N_Port identifier to the remote node. : number of retries to the command IOCB.

This routine issues a State Change Request (SCR) to a fabric node on a . The remote node is passed into the function. It first search the node list to find the matching ndlp. If no such ndlp is found, a new ndlp shall be created for this (SCR) purpose. An IOCB is allocated, payload prepared, and the lpfc_sli_issue_iocb() routine is invoked to send the SCR IOCB.

Note that, in lpfc_prep_els_iocb() routine, the reference count of ndlp will be incremented by 1 for holding the ndlp and the reference to ndlp will be stored into the context1 field of the IOCB for the completion callback function to the SCR ELS command.

Return code 0 - Successfully issued scr command 1 - Failed to issue scr command

Definition at line 2652 of file lpfc_els.c.

int lpfc_issue_fabric_reglogin ( struct lpfc_vport vport)

lpfc_issue_fabric_reglogin - Issue fabric registration login for a vport : pointer to a host virtual N_Port data structure.

This routine issues a fabric registration login for a . An active ndlp node with Fabric_DID must already exist for this . The routine invokes two mailbox commands to carry out fabric registration login through the HBA firmware: the first mailbox command requests the HBA to perform link configuration for the ; and the second mailbox command requests the HBA to perform the actual fabric registration login with the .

Return code 0 - successfully issued fabric registration login for -ENXIO – failed to issue fabric registration login for

Definition at line 356 of file lpfc_els.c.

int lpfc_issue_reg_vfi ( struct lpfc_vport vport)

lpfc_issue_reg_vfi - Register VFI for this vport's fabric login : pointer to a host virtual N_Port data structure.

This routine issues a REG_VFI mailbox for the vfi, vpi, fcfi triplet for the . This mailbox command is necessary for SLI4 port only.

Return code 0 - successfully issued REG_VFI for A failure code otherwise.

Definition at line 447 of file lpfc_els.c.

int lpfc_issue_unreg_vfi ( struct lpfc_vport vport)

lpfc_issue_unreg_vfi - Unregister VFI for this vport's fabric login : pointer to a host virtual N_Port data structure.

This routine issues a UNREG_VFI mailbox with the vfi, vpi, fcfi triplet for the . This mailbox command is necessary for SLI4 port only.

Return code 0 - successfully issued REG_VFI for A failure code otherwise.

Definition at line 522 of file lpfc_els.c.

void lpfc_mbx_cmpl_dflt_rpi ( struct lpfc_hba phba,
LPFC_MBOXQ_t pmb 
)

lpfc_mbx_cmpl_dflt_rpi - Completion callbk func for unreg dflt rpi mbox cmd : pointer to lpfc hba data structure. : pointer to the driver internal queue element for mailbox command.

This routine is the completion callback function for unregister default RPI (Remote Port Index) mailbox command to the . It simply releases the associated lpfc Direct Memory Access (DMA) buffer back to the pool and decrements the ndlp reference count held for this completion callback function. After that, it invokes the lpfc_nlp_not_used() to check whether there is only one reference left on the ndlp. If so, it will perform one more decrement and trigger the release of the ndlp.

Definition at line 3595 of file lpfc_els.c.

void lpfc_more_adisc ( struct lpfc_vport vport)

lpfc_more_adisc - Issue more adisc as needed : pointer to a host virtual N_Port data structure.

This routine determines whether there are more ndlps on a node list need to have Address Discover (ADISC) issued. If so, it will invoke the lpfc_els_disc_adisc() routine to issue ADISC on the 's remaining nodes which need to have ADISC sent.

Definition at line 2184 of file lpfc_els.c.

void lpfc_more_plogi ( struct lpfc_vport vport)

lpfc_more_plogi - Check and issue remaining plogis for a vport : pointer to a host virtual N_Port data structure.

This routine checks whether there are more remaining Port Logins (PLOGI) to be issued for the . If so, it will invoke the routine lpfc_els_disc_plogi() to go through the Node Port Recovery (NPR) nodes to issue ELS PLOGIs up to the configured discover threads with the (->cfg_discovery_threads). The function also decrement the 's num_disc_node by 1 if it is not already 0.

Definition at line 1399 of file lpfc_els.c.

struct lpfc_iocbq* lpfc_prep_els_iocb ( struct lpfc_vport vport,
uint8_t  expectRsp,
uint16_t  cmdSize,
uint8_t  retry,
struct lpfc_nodelist ndlp,
uint32_t  did,
uint32_t  elscmd 
)
read

lpfc_prep_els_iocb - Allocate and prepare a lpfc iocb data structure : pointer to a host virtual N_Port data structure. : flag indicating whether response is expected. : size of the ELS command. : number of retries to the command IOCB when it fails. : pointer to a node-list data structure. : destination identifier. : the ELS command code.

This routine is used for allocating a lpfc-IOCB data structure from the driver lpfc-IOCB free-list and prepare the IOCB with the parameters passed into the routine for discovery state machine to issue an Extended Link Service (ELS) commands. It is a generic lpfc-IOCB allocation and preparation routine that is used by all the discovery state machine routines and the ELS command-specific fields will be later set up by the individual discovery machine routines after calling this routine allocating and preparing a generic IOCB data structure. It fills in the Buffer Descriptor Entries (BDEs), allocates buffers for both command payload and response payload (if expected). The reference count on the ndlp is incremented by 1 and the reference to the ndlp is put into context1 of the IOCB data structure for this IOCB to hold the ndlp reference for the command's callback function to access later.

Return code Pointer to the newly allocated/prepared els iocb data structure NULL - when els iocb data structure allocation/preparation failed

Definition at line 149 of file lpfc_els.c.

void lpfc_register_new_vport ( struct lpfc_hba phba,
struct lpfc_vport vport,
struct lpfc_nodelist ndlp 
)

lpfc_register_new_vport - Register a new vport with a HBA : pointer to lpfc hba data structure. : pointer to a host virtual N_Port data structure. : pointer to a node-list data structure.

This routine registers the as a new virtual port with a HBA. It is done through a registering vpi mailbox command.

Definition at line 7158 of file lpfc_els.c.

void lpfc_retry_pport_discovery ( struct lpfc_hba phba)

lpfc_retry_pport_discovery - Start timer to retry FLOGI. : pointer to lpfc hba data structure.

This routine abort all pending discovery commands and start a timer to retry FLOGI for the physical port discovery.

Definition at line 7238 of file lpfc_els.c.

int lpfc_rscn_payload_check ( struct lpfc_vport vport,
uint32_t  did 
)

lpfc_rscn_payload_check - Check whether there is a pending rscn to a did : pointer to a host virtual N_Port data structure. : remote destination port identifier.

This routine checks whether there is any pending Registration State Configuration Notification (RSCN) to a on .

Return code None zero - The matched with a pending rscn 0 - not able to match with a pending rscn

Definition at line 4565 of file lpfc_els.c.

void lpfc_send_els_failure_event ( struct lpfc_hba phba,
struct lpfc_iocbq cmdiocbp,
struct lpfc_iocbq rspiocbp 
)

lpfc_send_els_failure_event - Posts an ELS command failure event : Pointer to hba context object. : Pointer to command iocb which reported error. : Pointer to response iocb which reported error.

This function sends an event when there is an ELS command failure.

Definition at line 6357 of file lpfc_els.c.

int lpfc_send_rrq ( struct lpfc_hba phba,
struct lpfc_node_rrq rrq 
)

lpfc_send_rrq - Sends ELS RRQ if needed. : pointer to lpfc hba data structure. : pointer to the active rrq.

This routine will call the lpfc_issue_els_rrq if the rrq is still active for the xri. If this function returns a failure then the caller needs to clean up the RRQ by calling lpfc_clr_active_rrq.

Returns 0 Success. 1 Failure.

Definition at line 5784 of file lpfc_els.c.

void lpfc_sli4_els_xri_aborted ( struct lpfc_hba phba,
struct sli4_wcqe_xri_aborted axri 
)

lpfc_sli4_els_xri_aborted - Slow-path process of els xri abort : pointer to lpfc hba data structure. : pointer to the els xri abort wcqe structure.

This routine is invoked by the worker thread to process a SLI4 slow-path ELS aborted xri.

Definition at line 8013 of file lpfc_els.c.

void lpfc_sli4_vport_delete_els_xri_aborted ( struct lpfc_vport vport)

lpfc_sli4_vport_delete_els_xri_aborted -Remove all ndlp references for vport : pointer to lpfc vport data structure.

This routine is invoked by the vport cleanup for deletions and the cleanup for an ndlp on removal.

Definition at line 7986 of file lpfc_els.c.

void lpfc_sli_abts_recover_port ( struct lpfc_vport vport,
struct lpfc_nodelist ndlp 
)

Definition at line 8074 of file lpfc_els.c.

void lpfc_unblock_fabric_iocbs ( struct lpfc_hba phba)

lpfc_unblock_fabric_iocbs - Unblock issuing fabric iocb command : pointer to lpfc hba data structure.

This routine unblocks the issuing fabric iocb command. The function will clear the fabric iocb block bit and then invoke the routine lpfc_resume_fabric_iocbs() to issue one of the pending fabric iocb from the driver internal fabric iocb list.

Definition at line 7731 of file lpfc_els.c.