Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Typedefs | Enumerations | Functions | Variables
lpfc_sli.c File Reference
#include <linux/blkdev.h>
#include <linux/pci.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <scsi/scsi.h>
#include <scsi/scsi_cmnd.h>
#include <scsi/scsi_device.h>
#include <scsi/scsi_host.h>
#include <scsi/scsi_transport_fc.h>
#include <scsi/fc/fc_fs.h>
#include <linux/aer.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_crtn.h"
#include "lpfc_logmsg.h"
#include "lpfc_compat.h"
#include "lpfc_debugfs.h"
#include "lpfc_vport.h"

Go to the source code of this file.

Macros

#define BARRIER_TEST_PATTERN   (0xdeadbeef)
 

Typedefs

typedef enum _lpfc_iocb_type lpfc_iocb_type
 

Enumerations

enum  _lpfc_iocb_type { LPFC_UNKNOWN_IOCB, LPFC_UNSOL_IOCB, LPFC_SOL_IOCB, LPFC_ABORT_IOCB }
 

Functions

uint32_t lpfc_sli4_eq_release (struct lpfc_queue *q, bool arm)
 
uint32_t lpfc_sli4_cq_release (struct lpfc_queue *q, bool arm)
 
struct lpfc_iocbq__lpfc_sli_get_iocbq (struct lpfc_hba *phba)
 
struct lpfc_sglq__lpfc_get_active_sglq (struct lpfc_hba *phba, uint16_t xritag)
 
void lpfc_clr_rrq_active (struct lpfc_hba *phba, uint16_t xritag, struct lpfc_node_rrq *rrq)
 
void lpfc_handle_rrq_active (struct lpfc_hba *phba)
 
struct lpfc_node_rrqlpfc_get_active_rrq (struct lpfc_vport *vport, uint16_t xri, uint32_t did)
 
void lpfc_cleanup_vports_rrqs (struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
 
void lpfc_cleanup_wt_rrqs (struct lpfc_hba *phba)
 
int lpfc_test_rrq_active (struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, uint16_t xritag)
 
int lpfc_set_rrq_active (struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, uint16_t xritag, uint16_t rxid, uint16_t send_rrq)
 
struct lpfc_iocbqlpfc_sli_get_iocbq (struct lpfc_hba *phba)
 
void lpfc_sli_release_iocbq (struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
 
void lpfc_sli_cancel_iocbs (struct lpfc_hba *phba, struct list_head *iocblist, uint32_t ulpstatus, uint32_t ulpWord4)
 
struct lpfc_iocbqlpfc_sli_ringtx_get (struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
 
uint16_t lpfc_sli_next_iotag (struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
 
void lpfc_sli_hbqbuf_free_all (struct lpfc_hba *phba)
 
int lpfc_sli_hbqbuf_add_hbqs (struct lpfc_hba *phba, uint32_t qno)
 
void lpfc_sli_free_hbq (struct lpfc_hba *phba, struct hbq_dmabuf *hbq_buffer)
 
void lpfc_sli_wake_mbox_wait (struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
 
void lpfc_sli_def_mbox_cmpl (struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
 
int lpfc_sli_handle_mb_event (struct lpfc_hba *phba)
 
void lpfc_poll_eratt (unsigned long ptr)
 
int lpfc_sli_handle_fast_ring_event (struct lpfc_hba *phba, struct lpfc_sli_ring *pring, uint32_t mask)
 
void lpfc_sli_handle_slow_ring_event (struct lpfc_hba *phba, struct lpfc_sli_ring *pring, uint32_t mask)
 
void lpfc_sli_abort_iocb_ring (struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
 
void lpfc_sli_flush_fcp_rings (struct lpfc_hba *phba)
 
int lpfc_sli_brdready (struct lpfc_hba *phba, uint32_t mask)
 
void lpfc_reset_barrier (struct lpfc_hba *phba)
 
int lpfc_sli_brdkill (struct lpfc_hba *phba)
 
int lpfc_sli_brdreset (struct lpfc_hba *phba)
 
int lpfc_sli4_brdreset (struct lpfc_hba *phba)
 
int lpfc_sli_brdrestart (struct lpfc_hba *phba)
 
int lpfc_sli_hbq_count (void)
 
int lpfc_sli_hbq_size (void)
 
int lpfc_sli_config_port (struct lpfc_hba *phba, int sli_mode)
 
int lpfc_sli_hba_setup (struct lpfc_hba *phba)
 
int lpfc_sli4_get_avail_extnt_rsrc (struct lpfc_hba *phba, uint16_t type, uint16_t *extnt_count, uint16_t *extnt_size)
 
int lpfc_sli4_alloc_resource_identifiers (struct lpfc_hba *phba)
 
int lpfc_sli4_dealloc_resource_identifiers (struct lpfc_hba *phba)
 
int lpfc_sli4_get_allocated_extnts (struct lpfc_hba *phba, uint16_t type, uint16_t *extnt_cnt, uint16_t *extnt_size)
 
int lpfc_sli4_hba_setup (struct lpfc_hba *phba)
 
void lpfc_mbox_timeout (unsigned long ptr)
 
void lpfc_mbox_timeout_handler (struct lpfc_hba *phba)
 
int lpfc_sli4_post_async_mbox (struct lpfc_hba *phba)
 
int lpfc_sli_issue_mbox (struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
 
int lpfc_mbox_api_table_setup (struct lpfc_hba *phba, uint8_t dev_grp)
 
void __lpfc_sli_ringtx_put (struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct lpfc_iocbq *piocb)
 
int __lpfc_sli_issue_iocb (struct lpfc_hba *phba, uint32_t ring_number, struct lpfc_iocbq *piocb, uint32_t flag)
 
int lpfc_sli_api_table_setup (struct lpfc_hba *phba, uint8_t dev_grp)
 
int lpfc_sli_issue_iocb (struct lpfc_hba *phba, uint32_t ring_number, struct lpfc_iocbq *piocb, uint32_t flag)
 
void lpfc_sli4_abts_err_handler (struct lpfc_hba *phba, struct lpfc_nodelist *ndlp, struct sli4_wcqe_xri_aborted *axri)
 
int lpfc_sli_setup (struct lpfc_hba *phba)
 
int lpfc_sli_queue_setup (struct lpfc_hba *phba)
 
int lpfc_sli_host_down (struct lpfc_vport *vport)
 
int lpfc_sli_hba_down (struct lpfc_hba *phba)
 
void lpfc_sli_pcimem_bcopy (void *srcp, void *destp, uint32_t cnt)
 
void lpfc_sli_bemem_bcopy (void *srcp, void *destp, uint32_t cnt)
 
int lpfc_sli_ringpostbuf_put (struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct lpfc_dmabuf *mp)
 
uint32_t lpfc_sli_get_buffer_tag (struct lpfc_hba *phba)
 
struct lpfc_dmabuflpfc_sli_ring_taggedbuf_get (struct lpfc_hba *phba, struct lpfc_sli_ring *pring, uint32_t tag)
 
struct lpfc_dmabuflpfc_sli_ringpostbuf_get (struct lpfc_hba *phba, struct lpfc_sli_ring *pring, dma_addr_t phys)
 
int lpfc_sli_issue_abort_iotag (struct lpfc_hba *phba, struct lpfc_sli_ring *pring, struct lpfc_iocbq *cmdiocb)
 
void lpfc_sli_hba_iocb_abort (struct lpfc_hba *phba)
 
int lpfc_sli_sum_iocb (struct lpfc_vport *vport, uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd ctx_cmd)
 
void lpfc_sli_abort_fcp_cmpl (struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb, struct lpfc_iocbq *rspiocb)
 
int lpfc_sli_abort_iocb (struct lpfc_vport *vport, struct lpfc_sli_ring *pring, uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd abort_cmd)
 
int lpfc_sli_issue_iocb_wait (struct lpfc_hba *phba, uint32_t ring_number, struct lpfc_iocbq *piocb, struct lpfc_iocbq *prspiocbq, uint32_t timeout)
 
int lpfc_sli_issue_mbox_wait (struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq, uint32_t timeout)
 
void lpfc_sli_mbox_sys_shutdown (struct lpfc_hba *phba, int mbx_action)
 
int lpfc_sli_check_eratt (struct lpfc_hba *phba)
 
irqreturn_t lpfc_sli_sp_intr_handler (int irq, void *dev_id)
 
irqreturn_t lpfc_sli_fp_intr_handler (int irq, void *dev_id)
 
irqreturn_t lpfc_sli_intr_handler (int irq, void *dev_id)
 
void lpfc_sli4_fcp_xri_abort_event_proc (struct lpfc_hba *phba)
 
void lpfc_sli4_els_xri_abort_event_proc (struct lpfc_hba *phba)
 
irqreturn_t lpfc_sli4_hba_intr_handler (int irq, void *dev_id)
 
irqreturn_t lpfc_sli4_intr_handler (int irq, void *dev_id)
 
void lpfc_sli4_queue_free (struct lpfc_queue *queue)
 
struct lpfc_queuelpfc_sli4_queue_alloc (struct lpfc_hba *phba, uint32_t entry_size, uint32_t entry_count)
 
uint32_t lpfc_modify_fcp_eq_delay (struct lpfc_hba *phba, uint16_t startq)
 
uint32_t lpfc_eq_create (struct lpfc_hba *phba, struct lpfc_queue *eq, uint32_t imax)
 
uint32_t lpfc_cq_create (struct lpfc_hba *phba, struct lpfc_queue *cq, struct lpfc_queue *eq, uint32_t type, uint32_t subtype)
 
int32_t lpfc_mq_create (struct lpfc_hba *phba, struct lpfc_queue *mq, struct lpfc_queue *cq, uint32_t subtype)
 
uint32_t lpfc_wq_create (struct lpfc_hba *phba, struct lpfc_queue *wq, struct lpfc_queue *cq, uint32_t subtype)
 
void lpfc_rq_adjust_repost (struct lpfc_hba *phba, struct lpfc_queue *rq, int qno)
 
uint32_t lpfc_rq_create (struct lpfc_hba *phba, struct lpfc_queue *hrq, struct lpfc_queue *drq, struct lpfc_queue *cq, uint32_t subtype)
 
uint32_t lpfc_eq_destroy (struct lpfc_hba *phba, struct lpfc_queue *eq)
 
uint32_t lpfc_cq_destroy (struct lpfc_hba *phba, struct lpfc_queue *cq)
 
uint32_t lpfc_mq_destroy (struct lpfc_hba *phba, struct lpfc_queue *mq)
 
uint32_t lpfc_wq_destroy (struct lpfc_hba *phba, struct lpfc_queue *wq)
 
uint32_t lpfc_rq_destroy (struct lpfc_hba *phba, struct lpfc_queue *hrq, struct lpfc_queue *drq)
 
int lpfc_sli4_post_sgl (struct lpfc_hba *phba, dma_addr_t pdma_phys_addr0, dma_addr_t pdma_phys_addr1, uint16_t xritag)
 
uint16_t lpfc_sli4_alloc_xri (struct lpfc_hba *phba)
 
void __lpfc_sli4_free_xri (struct lpfc_hba *phba, int xri)
 
void lpfc_sli4_free_xri (struct lpfc_hba *phba, int xri)
 
uint16_t lpfc_sli4_next_xritag (struct lpfc_hba *phba)
 
int lpfc_sli4_post_scsi_sgl_block (struct lpfc_hba *phba, struct list_head *sblist, int count)
 
void lpfc_update_rcv_time_stamp (struct lpfc_vport *vport)
 
void lpfc_cleanup_rcv_buffers (struct lpfc_vport *vport)
 
void lpfc_rcv_seq_check_edtov (struct lpfc_vport *vport)
 
uint16_t lpfc_sli4_xri_inrange (struct lpfc_hba *phba, uint16_t xri)
 
void lpfc_sli4_handle_unsol_abort (struct lpfc_vport *vport, struct hbq_dmabuf *dmabuf)
 
void lpfc_sli4_handle_received_buffer (struct lpfc_hba *phba, struct hbq_dmabuf *dmabuf)
 
int lpfc_sli4_post_all_rpi_hdrs (struct lpfc_hba *phba)
 
int lpfc_sli4_post_rpi_hdr (struct lpfc_hba *phba, struct lpfc_rpi_hdr *rpi_page)
 
int lpfc_sli4_alloc_rpi (struct lpfc_hba *phba)
 
void __lpfc_sli4_free_rpi (struct lpfc_hba *phba, int rpi)
 
void lpfc_sli4_free_rpi (struct lpfc_hba *phba, int rpi)
 
void lpfc_sli4_remove_rpis (struct lpfc_hba *phba)
 
int lpfc_sli4_resume_rpi (struct lpfc_nodelist *ndlp, void(*cmpl)(struct lpfc_hba *, LPFC_MBOXQ_t *), void *arg)
 
int lpfc_sli4_init_vpi (struct lpfc_vport *vport)
 
int lpfc_sli4_add_fcf_record (struct lpfc_hba *phba, struct fcf_record *fcf_record)
 
void lpfc_sli4_build_dflt_fcf_record (struct lpfc_hba *phba, struct fcf_record *fcf_record, uint16_t fcf_index)
 
int lpfc_sli4_fcf_scan_read_fcf_rec (struct lpfc_hba *phba, uint16_t fcf_index)
 
int lpfc_sli4_fcf_rr_read_fcf_rec (struct lpfc_hba *phba, uint16_t fcf_index)
 
int lpfc_sli4_read_fcf_rec (struct lpfc_hba *phba, uint16_t fcf_index)
 
int lpfc_check_next_fcf_pri_level (struct lpfc_hba *phba)
 
uint16_t lpfc_sli4_fcf_rr_next_index_get (struct lpfc_hba *phba)
 
int lpfc_sli4_fcf_rr_index_set (struct lpfc_hba *phba, uint16_t fcf_index)
 
void lpfc_sli4_fcf_rr_index_clear (struct lpfc_hba *phba, uint16_t fcf_index)
 
void lpfc_mbx_cmpl_redisc_fcf_table (struct lpfc_hba *phba, LPFC_MBOXQ_t *mbox)
 
int lpfc_sli4_redisc_fcf_table (struct lpfc_hba *phba)
 
void lpfc_sli4_fcf_dead_failthrough (struct lpfc_hba *phba)
 
void lpfc_sli_read_link_ste (struct lpfc_hba *phba)
 
int lpfc_wr_object (struct lpfc_hba *phba, struct list_head *dmabuf_list, uint32_t size, uint32_t *offset)
 
void lpfc_cleanup_pending_mbox (struct lpfc_vport *vport)
 
uint32_t lpfc_drain_txq (struct lpfc_hba *phba)
 

Variables

struct lpfc_hbq_initlpfc_hbq_defs []
 

Macro Definition Documentation

#define BARRIER_TEST_PATTERN   (0xdeadbeef)

Definition at line 3658 of file lpfc_sli.c.

Typedef Documentation

Enumeration Type Documentation

Enumerator:
LPFC_UNKNOWN_IOCB 
LPFC_UNSOL_IOCB 
LPFC_SOL_IOCB 
LPFC_ABORT_IOCB 

Definition at line 51 of file lpfc_sli.c.

Function Documentation

struct lpfc_sglq* __lpfc_get_active_sglq ( struct lpfc_hba phba,
uint16_t  xritag 
)
read

__lpfc_get_active_sglq - Get the active sglq for this XRI. : Pointer to HBA context object. : XRI value.

This function returns the sglq pointer from the array of acive sglq's. The xritag that is passed in is used to index into the array. Before the xritag can be used it needs to be adjusted by subtracting the xribase.

Returns sglq ponter = success, NULL = Failure.

Definition at line 583 of file lpfc_sli.c.

void __lpfc_sli4_free_rpi ( struct lpfc_hba phba,
int  rpi 
)

lpfc_sli4_free_rpi - Release an rpi for reuse. : pointer to lpfc hba data structure.

This routine is invoked to release an rpi to the pool of available rpis maintained by the driver.

Definition at line 14785 of file lpfc_sli.c.

void __lpfc_sli4_free_xri ( struct lpfc_hba phba,
int  xri 
)

lpfc_sli4_free_xri - Release an xri for reuse. : pointer to lpfc hba data structure.

This routine is invoked to release an xri to the pool of available rpis maintained by the driver.

Definition at line 13426 of file lpfc_sli.c.

struct lpfc_iocbq* __lpfc_sli_get_iocbq ( struct lpfc_hba phba)
read

__lpfc_sli_get_iocbq - Allocates an iocb object from iocb pool : Pointer to HBA context object.

This function is called with hbalock held. This function allocates a new driver iocb object from the iocb pool. If the allocation is successful, it returns pointer to the newly allocated iocb object else it returns NULL.

Definition at line 535 of file lpfc_sli.c.

int __lpfc_sli_issue_iocb ( struct lpfc_hba phba,
uint32_t  ring_number,
struct lpfc_iocbq piocb,
uint32_t  flag 
)

__lpfc_sli_issue_iocb - Wrapper func of lockless version for issuing iocb

This routine wraps the actual lockless version for issusing IOCB function pointer from the lpfc_hba struct.

Return codes: IOCB_ERROR - Error IOCB_SUCCESS - Success IOCB_BUSY - Busy

Definition at line 8414 of file lpfc_sli.c.

void __lpfc_sli_ringtx_put ( struct lpfc_hba phba,
struct lpfc_sli_ring pring,
struct lpfc_iocbq piocb 
)

__lpfc_sli_ringtx_put - Add an iocb to the txq : Pointer to HBA context object. : Pointer to driver SLI ring object. : Pointer to address of newly added command iocb.

This function is called with hbalock held to add a command iocb to the txq when SLI layer cannot submit the command iocb to the ring.

Definition at line 7567 of file lpfc_sli.c.

int lpfc_check_next_fcf_pri_level ( struct lpfc_hba phba)

lpfc_check_next_fcf_pri phba pointer to the lpfc_hba struct for this port. This routine is called from the lpfc_sli4_fcf_rr_next_index_get routine when the rr_bmask is empty. The FCF indecies are put into the rr_bmask based on their priority level. Starting from the highest priority to the lowest. The most likely FCF candidate will be in the highest priority group. When this routine is called it searches the fcf_pri list for next lowest priority group and repopulates the rr_bmask with only those fcf_indexes. returns: 1=success 0=failure

Definition at line 15223 of file lpfc_sli.c.

void lpfc_cleanup_pending_mbox ( struct lpfc_vport vport)

lpfc_cleanup_pending_mbox - Free up vport discovery mailbox commands. : pointer to vport data structure.

This function iterate through the mailboxq and clean up all REG_LOGIN and REG_VPI mailbox commands associated with the vport. This function is called when driver want to restart discovery of the vport due to a Clear Virtual Link event.

Definition at line 15872 of file lpfc_sli.c.

void lpfc_cleanup_rcv_buffers ( struct lpfc_vport vport)

lpfc_cleanup_rcv_buffers - Cleans up all outstanding receive sequences. : The vport that the received sequences were sent to.

This function cleans up all outstanding received sequences. This is called by the driver when a link event or user action invalidates all the received sequences.

Definition at line 13868 of file lpfc_sli.c.

void lpfc_cleanup_vports_rrqs ( struct lpfc_vport vport,
struct lpfc_nodelist ndlp 
)

lpfc_cleanup_vports_rrqs - Remove and clear the active RRQ for this vport. : Pointer to vport context object. : Pointer to the lpfc_node_list structure. If ndlp is NULL Remove all active RRQs for this vport from the phba->active_rrq_list and clear the rrq. If ndlp is not NULL then only remove rrqs for this vport & this ndlp.

Definition at line 719 of file lpfc_sli.c.

void lpfc_cleanup_wt_rrqs ( struct lpfc_hba phba)

lpfc_cleanup_wt_rrqs - Remove all rrq's from the active list. : Pointer to HBA context object.

Remove all rrqs from the phba->active_rrq_list and free them by calling __lpfc_clr_active_rrq

Definition at line 755 of file lpfc_sli.c.

void lpfc_clr_rrq_active ( struct lpfc_hba phba,
uint16_t  xritag,
struct lpfc_node_rrq rrq 
)

lpfc_clr_rrq_active - Clears RRQ active bit in xri_bitmap. : Pointer to HBA context object. : xri used in this exchange. : The RRQ to be cleared.

Definition at line 599 of file lpfc_sli.c.

uint32_t lpfc_cq_create ( struct lpfc_hba phba,
struct lpfc_queue cq,
struct lpfc_queue eq,
uint32_t  type,
uint32_t  subtype 
)

lpfc_cq_create - Create a Completion Queue on the HBA : HBA structure that indicates port to create a queue on. : The queue structure to use to create the completion queue. : The event queue to bind this completion queue to.

This function creates a completion queue, as detailed in , on a port, described by by sending a CQ_CREATE mailbox command to the HBA.

The struct is used to send mailbox command to HBA. The struct is used to get the entry count and entry size that are necessary to determine the number of pages to allocate and use for this queue. The is used to indicate which event queue to bind this completion queue to. This function will send the CQ_CREATE mailbox command to the HBA to setup the completion queue. This function is asynchronous and will wait for the mailbox command to finish before continuing.

On success this function will return a zero. If unable to allocate enough memory this function will return -ENOMEM. If the queue create mailbox command fails this function will return -ENXIO.

Definition at line 12324 of file lpfc_sli.c.

uint32_t lpfc_cq_destroy ( struct lpfc_hba phba,
struct lpfc_queue cq 
)

lpfc_cq_destroy - Destroy a Completion Queue on the HBA : The queue structure associated with the queue to destroy.

This function destroys a queue, as detailed in by sending an mailbox command, specific to the type of queue, to the HBA.

The struct is used to get the queue ID of the queue to destroy.

On success this function will return a zero. If the queue destroy mailbox command fails this function will return -ENXIO.

Definition at line 13077 of file lpfc_sli.c.

uint32_t lpfc_drain_txq ( struct lpfc_hba phba)

lpfc_drain_txq - Drain the txq : Pointer to HBA context object.

This function attempt to submit IOCBs on the txq to the adapter. For SLI4 adapters, the txq contains ELS IOCBs that have been deferred because the there are no SGLs. This congestion can occur with large vport counts during node discovery.

Definition at line 15986 of file lpfc_sli.c.

uint32_t lpfc_eq_create ( struct lpfc_hba phba,
struct lpfc_queue eq,
uint32_t  imax 
)

lpfc_eq_create - Create an Event Queue on the HBA : HBA structure that indicates port to create a queue on. : The queue structure to use to create the event queue. : The maximum interrupt per second limit.

This function creates an event queue, as detailed in , on a port, described by by sending an EQ_CREATE mailbox command to the HBA.

The struct is used to send mailbox command to HBA. The struct is used to get the entry count and entry size that are necessary to determine the number of pages to allocate and use for this queue. This function will send the EQ_CREATE mailbox command to the HBA to setup the event queue. This function is asynchronous and will wait for the mailbox command to finish before continuing.

On success this function will return a zero. If unable to allocate enough memory this function will return -ENOMEM. If the queue create mailbox command fails this function will return -ENXIO.

Definition at line 12202 of file lpfc_sli.c.

uint32_t lpfc_eq_destroy ( struct lpfc_hba phba,
struct lpfc_queue eq 
)

lpfc_eq_destroy - Destroy an event Queue on the HBA : The queue structure associated with the queue to destroy.

This function destroys a queue, as detailed in by sending an mailbox command, specific to the type of queue, to the HBA.

The struct is used to get the queue ID of the queue to destroy.

On success this function will return a zero. If the queue destroy mailbox command fails this function will return -ENXIO.

Definition at line 13021 of file lpfc_sli.c.

struct lpfc_node_rrq* lpfc_get_active_rrq ( struct lpfc_vport vport,
uint16_t  xri,
uint32_t  did 
)
read

lpfc_get_active_rrq - Get the active RRQ for this exchange. : Pointer to vport context object. : The xri used in the exchange. : The targets DID for this exchange.

returns NULL = rrq not found in the phba->active_rrq_list. rrq = rrq for this xri and target.

Definition at line 688 of file lpfc_sli.c.

void lpfc_handle_rrq_active ( struct lpfc_hba phba)

lpfc_handle_rrq_active - Checks if RRQ has waithed RATOV. : Pointer to HBA context object.

This function is called with hbalock held. This function Checks if stop_time (ratov from setting rrq active) has been reached, if it has and the send_rrq flag is set then it will call lpfc_send_rrq. If the send_rrq flag is not set then it will just call the routine to clear the rrq and free the rrq resource. The timer is set to the next rrq that is going to expire before leaving the routine.

Definition at line 642 of file lpfc_sli.c.

int lpfc_mbox_api_table_setup ( struct lpfc_hba phba,
uint8_t  dev_grp 
)

lpfc_mbox_api_table_setup - Set up mbox api function jump table : The hba struct for which this call is being executed. : The HBA PCI-Device group number.

This routine sets up the mbox interface API function jump table in struct. Returns: 0 - success, -ENODEV - failure.

Definition at line 7526 of file lpfc_sli.c.

void lpfc_mbox_timeout ( unsigned long  ptr)

lpfc_mbox_timeout - Timeout call back function for mbox timer : context object - pointer to hba structure.

This is the callback function for mailbox timer. The mailbox timer is armed when a new mailbox command is issued and the timer is deleted when the mailbox complete. The function is called by the kernel timer code when a mailbox does not complete within expected time. This function wakes up the worker thread to process the mailbox timeout and returns. All the processing is done by the worker thread function lpfc_mbox_timeout_handler.

Definition at line 6492 of file lpfc_sli.c.

void lpfc_mbox_timeout_handler ( struct lpfc_hba phba)

lpfc_mbox_timeout_handler - Worker thread function to handle mailbox timeout : Pointer to HBA context object.

This function is called from worker thread when a mailbox command times out. The caller is not required to hold any locks. This function will reset the HBA and recover all the pending commands.

Definition at line 6519 of file lpfc_sli.c.

void lpfc_mbx_cmpl_redisc_fcf_table ( struct lpfc_hba phba,
LPFC_MBOXQ_t mbox 
)

lpfc_mbx_cmpl_redisc_fcf_table - completion routine for rediscover FCF table : pointer to lpfc hba data structure.

This routine is the completion routine for the rediscover FCF table mailbox command. If the mailbox command returned failure, it will try to stop the FCF rediscover wait timer.

Definition at line 15443 of file lpfc_sli.c.

uint32_t lpfc_modify_fcp_eq_delay ( struct lpfc_hba phba,
uint16_t  startq 
)

lpfc_modify_fcp_eq_delay - Modify Delay Multiplier on FCP EQs : HBA structure that indicates port to create a queue on. : The starting FCP EQ to modify

This function sends an MODIFY_EQ_DELAY mailbox command to the HBA.

The struct is used to send mailbox command to HBA. The is used to get the starting FCP EQ to change. This function is asynchronous and will wait for the mailbox command to finish before continuing.

On success this function will return a zero. If unable to allocate enough memory this function will return -ENOMEM. If the queue create mailbox command fails this function will return -ENXIO.

Definition at line 12116 of file lpfc_sli.c.

int32_t lpfc_mq_create ( struct lpfc_hba phba,
struct lpfc_queue mq,
struct lpfc_queue cq,
uint32_t  subtype 
)

lpfc_mq_create - Create a mailbox Queue on the HBA : HBA structure that indicates port to create a queue on. : The queue structure to use to create the mailbox queue. : The completion queue to associate with this cq. : The queue's subtype.

This function creates a mailbox queue, as detailed in , on a port, described by by sending a MQ_CREATE mailbox command to the HBA.

The struct is used to send mailbox command to HBA. The struct is used to get the entry count and entry size that are necessary to determine the number of pages to allocate and use for this queue. This function will send the MQ_CREATE mailbox command to the HBA to setup the mailbox queue. This function is asynchronous and will wait for the mailbox command to finish before continuing.

On success this function will return a zero. If unable to allocate enough memory this function will return -ENOMEM. If the queue create mailbox command fails this function will return -ENXIO.

Definition at line 12510 of file lpfc_sli.c.

uint32_t lpfc_mq_destroy ( struct lpfc_hba phba,
struct lpfc_queue mq 
)

lpfc_mq_destroy - Destroy a Mailbox Queue on the HBA : The queue structure associated with the queue to destroy.

This function destroys a queue, as detailed in by sending an mailbox command, specific to the type of queue, to the HBA.

The struct is used to get the queue ID of the queue to destroy.

On success this function will return a zero. If the queue destroy mailbox command fails this function will return -ENXIO.

Definition at line 13131 of file lpfc_sli.c.

void lpfc_poll_eratt ( unsigned long  ptr)

lpfc_poll_eratt - Error attention polling timer timeout handler : Pointer to address of HBA context object.

This function is invoked by the Error Attention polling timer when the timer times out. It will check the SLI Error Attention register for possible attention events. If so, it will post an Error Attention event and wake up worker thread to process it. Otherwise, it will set up the Error Attention polling timer for the next poll.

Definition at line 2847 of file lpfc_sli.c.

void lpfc_rcv_seq_check_edtov ( struct lpfc_vport vport)

lpfc_rcv_seq_check_edtov - Cleans up timed out receive sequences. : The vport that the received sequences were sent to.

This function determines whether any received sequences have timed out by first checking the vport's rcv_buffer_time_stamp. If this time_stamp indicates that there is at least one timed out sequence this routine will go through the received sequences one at a time from most inactive to most active to determine which ones need to be cleaned up. Once it has determined that a sequence needs to be cleaned up it will simply free up the resources without sending an abort.

Definition at line 13900 of file lpfc_sli.c.

void lpfc_reset_barrier ( struct lpfc_hba phba)

lpfc_reset_barrier - Make HBA ready for HBA reset : Pointer to HBA context object.

This function is called before resetting an HBA. This function is called with hbalock held and requests HBA to quiesce DMAs before a reset.

Definition at line 3667 of file lpfc_sli.c.

void lpfc_rq_adjust_repost ( struct lpfc_hba phba,
struct lpfc_queue rq,
int  qno 
)

lpfc_rq_adjust_repost - Adjust entry_repost for an RQ : HBA structure that indicates port to create a queue on. : The queue structure to use for the receive queue. : The associated HBQ number

For SLI4 we need to adjust the RQ repost value based on the number of buffers that are initially posted to the RQ.

Definition at line 12768 of file lpfc_sli.c.

uint32_t lpfc_rq_create ( struct lpfc_hba phba,
struct lpfc_queue hrq,
struct lpfc_queue drq,
struct lpfc_queue cq,
uint32_t  subtype 
)

lpfc_rq_create - Create a Receive Queue on the HBA : HBA structure that indicates port to create a queue on. : The queue structure to use to create the header receive queue. : The queue structure to use to create the data receive queue. : The completion queue to bind this work queue to.

This function creates a receive buffer queue pair , as detailed in and , on a port, described by by sending a RQ_CREATE mailbox command to the HBA.

The struct is used to send mailbox command to HBA. The and struct is used to get the entry count that is necessary to determine the number of pages to use for this queue. The is used to indicate which completion queue to bind received buffers that are posted to these queues to. This function will send the RQ_CREATE mailbox command to the HBA to setup the receive queue pair. This function is asynchronous and will wait for the mailbox command to finish before continuing.

On success this function will return a zero. If unable to allocate enough memory this function will return -ENOMEM. If the queue create mailbox command fails this function will return -ENXIO.

Definition at line 12809 of file lpfc_sli.c.

uint32_t lpfc_rq_destroy ( struct lpfc_hba phba,
struct lpfc_queue hrq,
struct lpfc_queue drq 
)

lpfc_rq_destroy - Destroy a Receive Queue on the HBA : The queue structure associated with the queue to destroy.

This function destroys a queue, as detailed in by sending an mailbox command, specific to the type of queue, to the HBA.

The struct is used to get the queue ID of the queue to destroy.

On success this function will return a zero. If the queue destroy mailbox command fails this function will return -ENXIO.

Definition at line 13238 of file lpfc_sli.c.

int lpfc_set_rrq_active ( struct lpfc_hba phba,
struct lpfc_nodelist ndlp,
uint16_t  xritag,
uint16_t  rxid,
uint16_t  send_rrq 
)

lpfc_set_rrq_active - set RRQ active bit in xri_bitmap. : Pointer to HBA context object. : nodelist pointer for this target. : xri used in this exchange. : Remote Exchange ID. : Flag used to determine if we should send rrq els cmd.

This function takes the hbalock. The active bit is always set in the active rrq xri_bitmap even if there is no slot avaiable for the other rrq information.

returns 0 rrq actived for this xri < 0 No memory or invalid ndlp.

Definition at line 818 of file lpfc_sli.c.

void lpfc_sli4_abts_err_handler ( struct lpfc_hba phba,
struct lpfc_nodelist ndlp,
struct sli4_wcqe_xri_aborted axri 
)

Definition at line 8640 of file lpfc_sli.c.

int lpfc_sli4_add_fcf_record ( struct lpfc_hba phba,
struct fcf_record fcf_record 
)

lpfc_sli4_add_fcf_record - Manually add an FCF Record. : pointer to lpfc hba data structure. : pointer to the initialized fcf record to add.

This routine is invoked to manually add a single FCF record. The caller must pass a completely initialized FCF_Record. This routine takes care of the nonembedded mailbox operations.

Definition at line 14943 of file lpfc_sli.c.

int lpfc_sli4_alloc_resource_identifiers ( struct lpfc_hba phba)

lpfc_sli4_alloc_resource_identifiers - Allocate all SLI4 resource extents. : Pointer to HBA context object.

This function allocates all SLI4 resource identifiers.

Definition at line 5530 of file lpfc_sli.c.

int lpfc_sli4_alloc_rpi ( struct lpfc_hba phba)

lpfc_sli4_alloc_rpi - Get an available rpi in the device's range : pointer to lpfc hba data structure.

This routine is invoked to post rpi header templates to the HBA consistent with the SLI-4 interface spec. This routine posts a SLI4_PAGE_SIZE memory region to the port to hold up to SLI4_PAGE_SIZE modulo 64 rpi context headers.

Returns A nonzero rpi defined as rpi_base <= rpi < max_rpi if successful LPFC_RPI_ALLOC_ERROR if no rpis are available.

Definition at line 14710 of file lpfc_sli.c.

uint16_t lpfc_sli4_alloc_xri ( struct lpfc_hba phba)

lpfc_sli4_alloc_xri - Get an available rpi in the device's range : pointer to lpfc hba data structure.

This routine is invoked to post rpi header templates to the HBA consistent with the SLI-4 interface spec. This routine posts a SLI4_PAGE_SIZE memory region to the port to hold up to SLI4_PAGE_SIZE modulo 64 rpi context headers.

Returns A nonzero rpi defined as rpi_base <= rpi < max_rpi if successful LPFC_RPI_ALLOC_ERROR if no rpis are available.

Definition at line 13396 of file lpfc_sli.c.

int lpfc_sli4_brdreset ( struct lpfc_hba phba)

lpfc_sli4_brdreset - Reset a sli-4 HBA : Pointer to HBA context object.

This function resets a SLI4 HBA. This function disables PCI layer parity checking during resets the device. The caller is not required to hold any locks.

This function returns 0 always.

Definition at line 3936 of file lpfc_sli.c.

void lpfc_sli4_build_dflt_fcf_record ( struct lpfc_hba phba,
struct fcf_record fcf_record,
uint16_t  fcf_index 
)

lpfc_sli4_build_dflt_fcf_record - Build the driver's default FCF Record. : pointer to lpfc hba data structure. : pointer to the fcf record to write the default data. : FCF table entry index.

This routine is invoked to build the driver's default FCF record. The values used are hardcoded. This routine handles memory initialization.

Definition at line 15025 of file lpfc_sli.c.

uint32_t lpfc_sli4_cq_release ( struct lpfc_queue q,
bool  arm 
)

lpfc_sli4_cq_release - Indicates the host has finished processing a CQ : The Completion Queue that the host has completed processing for. : Indicates whether the host wants to arms this CQ.

This routine will mark all Completion queue entries on , from the last known completed entry to the last entry that was processed, as completed by clearing the valid bit for each completion queue entry. Then it will notify the HBA, by ringing the doorbell, that the CQEs have been processed. The internal host index in the will be updated by this routine to indicate that the host has finished processing the entries. The parameter indicates that the queue should be rearmed when ringing the doorbell.

This function will return the number of CQEs that were released.

Definition at line 383 of file lpfc_sli.c.

int lpfc_sli4_dealloc_resource_identifiers ( struct lpfc_hba phba)

lpfc_sli4_dealloc_resource_identifiers - Deallocate all SLI4 resource extents. : Pointer to HBA context object.

This function allocates the number of elements for the specified resource type.

Definition at line 5747 of file lpfc_sli.c.

void lpfc_sli4_els_xri_abort_event_proc ( struct lpfc_hba phba)

lpfc_sli4_els_xri_abort_event_proc - Process els xri abort event : pointer to lpfc hba data structure.

This routine is invoked by the worker thread to process all the pending SLI4 els abort xri events.

Definition at line 10913 of file lpfc_sli.c.

uint32_t lpfc_sli4_eq_release ( struct lpfc_queue q,
bool  arm 
)

lpfc_sli4_eq_release - Indicates the host has finished processing an EQ : The Event Queue that the host has completed processing for. : Indicates whether the host wants to arms this CQ.

This routine will mark all Event Queue Entries on , from the last known completed entry to the last entry that was processed, as completed by clearing the valid bit for each completion queue entry. Then it will notify the HBA, by ringing the doorbell, that the EQEs have been processed. The internal host index in the will be updated by this routine to indicate that the host has finished processing the entries. The parameter indicates that the queue should be rearmed when ringing the doorbell.

This function will return the number of EQEs that were popped.

Definition at line 297 of file lpfc_sli.c.

void lpfc_sli4_fcf_dead_failthrough ( struct lpfc_hba phba)

lpfc_sli4_fcf_dead_failthrough - Failthrough routine to fcf dead event : pointer to lpfc hba data structure.

This function is the failover routine as a last resort to the FCF DEAD event when driver failed to perform fast FCF failover.

Definition at line 15547 of file lpfc_sli.c.

void lpfc_sli4_fcf_rr_index_clear ( struct lpfc_hba phba,
uint16_t  fcf_index 
)

lpfc_sli4_fcf_rr_index_clear - Clear bmask from eligible fcf record index : pointer to lpfc hba data structure.

This routine clears the FCF record index from the eligible bmask for roundrobin failover search. It checks to make sure that the index does not go beyond the range of the driver allocated bmask dimension before clearing the bit.

Definition at line 15408 of file lpfc_sli.c.

int lpfc_sli4_fcf_rr_index_set ( struct lpfc_hba phba,
uint16_t  fcf_index 
)

lpfc_sli4_fcf_rr_index_set - Set bmask with eligible fcf record index : pointer to lpfc hba data structure.

This routine sets the FCF record index in to the eligible bmask for roundrobin failover search. It checks to make sure that the index does not go beyond the range of the driver allocated bmask dimension before setting the bit.

Returns 0 if the index bit successfully set, otherwise, it returns -EINVAL.

Definition at line 15379 of file lpfc_sli.c.

uint16_t lpfc_sli4_fcf_rr_next_index_get ( struct lpfc_hba phba)

lpfc_sli4_fcf_rr_next_index_get - Get next eligible fcf record index : pointer to lpfc hba data structure.

This routine is to get the next eligible FCF record index in a round robin fashion. If the next eligible FCF record index equals to the initial roundrobin FCF record index, LPFC_FCOE_FCF_NEXT_NONE (0xFFFF) shall be returned, otherwise, the next eligible FCF record's index shall be returned.

Definition at line 15306 of file lpfc_sli.c.

int lpfc_sli4_fcf_rr_read_fcf_rec ( struct lpfc_hba phba,
uint16_t  fcf_index 
)

lpfc_sli4_fcf_rr_read_fcf_rec - Read hba fcf record for roundrobin fcf. : pointer to lpfc hba data structure. : FCF table entry offset.

This routine is invoked to read an FCF record indicated by and to use it for FLOGI roundrobin FCF failover.

Return 0 if the mailbox command is submitted successfully, none 0 otherwise.

Definition at line 15129 of file lpfc_sli.c.

int lpfc_sli4_fcf_scan_read_fcf_rec ( struct lpfc_hba phba,
uint16_t  fcf_index 
)

lpfc_sli4_fcf_scan_read_fcf_rec - Read hba fcf record for fcf scan. : pointer to lpfc hba data structure. : FCF table entry offset.

This routine is invoked to scan the entire FCF table by reading FCF record and processing it one at a time starting from the for initial FCF discovery or fast FCF failover rediscovery.

Return 0 if the mailbox command is submitted successfully, none 0 otherwise.

Definition at line 15067 of file lpfc_sli.c.

void lpfc_sli4_fcp_xri_abort_event_proc ( struct lpfc_hba phba)

lpfc_sli4_fcp_xri_abort_event_proc - Process fcp xri abort event : pointer to lpfc hba data structure.

This routine is invoked by the worker thread to process all the pending SLI4 FCP abort XRI events.

Definition at line 10884 of file lpfc_sli.c.

void lpfc_sli4_free_rpi ( struct lpfc_hba phba,
int  rpi 
)

lpfc_sli4_free_rpi - Release an rpi for reuse. : pointer to lpfc hba data structure.

This routine is invoked to release an rpi to the pool of available rpis maintained by the driver.

Definition at line 14801 of file lpfc_sli.c.

void lpfc_sli4_free_xri ( struct lpfc_hba phba,
int  xri 
)

lpfc_sli4_free_xri - Release an xri for reuse. : pointer to lpfc hba data structure.

This routine is invoked to release an xri to the pool of available rpis maintained by the driver.

Definition at line 13441 of file lpfc_sli.c.

int lpfc_sli4_get_allocated_extnts ( struct lpfc_hba phba,
uint16_t  type,
uint16_t extnt_cnt,
uint16_t extnt_size 
)

lpfc_sli4_get_allocated_extnts - Get the port's allocated extents. : Pointer to HBA context object. : The resource extent type. : buffer to hold port extent count response : buffer to hold port extent size response.

This function calls the port to read the host allocated extents for a particular type.

Definition at line 5780 of file lpfc_sli.c.

int lpfc_sli4_get_avail_extnt_rsrc ( struct lpfc_hba phba,
uint16_t  type,
uint16_t extnt_count,
uint16_t extnt_size 
)

lpfc_sli4_get_avail_extnt_rsrc - Get available resource extent count. : Pointer to HBA context object. : The resource extent type. : buffer to hold port available extent count. : buffer to hold element count per extent.

This function calls the port and retrievs the number of available extents and their size for a particular extent type.

Returns: 0 if successful. Nonzero otherwise.

Definition at line 4974 of file lpfc_sli.c.

void lpfc_sli4_handle_received_buffer ( struct lpfc_hba phba,
struct hbq_dmabuf dmabuf 
)

lpfc_sli4_handle_received_buffer - Handle received buffers from firmware : Pointer to HBA context object.

This function is called with no lock held. This function processes all the received buffers and gives it to upper layers when a received buffer indicates that it is the final frame in the sequence. The interrupt service routine processes received buffers at interrupt contexts and adds received dma buffers to the rb_pend_list queue and signals the worker thread. Worker thread calls lpfc_sli4_handle_received_buffer, which will call the appropriate receive function when the final frame in a sequence is received.

Definition at line 14495 of file lpfc_sli.c.

void lpfc_sli4_handle_unsol_abort ( struct lpfc_vport vport,
struct hbq_dmabuf dmabuf 
)

lpfc_sli4_handle_unsol_abort - Handle sli-4 unsolicited abort event : Pointer to the vport on which this sequence was received : pointer to a dmabuf that describes the FC sequence

This function handles an SLI-4 unsolicited abort event. If the unsolicited receive sequence is only partially assembed by the driver, it shall abort the partially assembled frames for the sequence. Otherwise, if the unsolicited receive sequence has been completely assembled and passed to the Upper Layer Protocol (UPL), it then mark the per oxid status for the unsolicited sequence has been aborted. After that, it will issue a basic accept to accept the abort.

Definition at line 14246 of file lpfc_sli.c.

irqreturn_t lpfc_sli4_hba_intr_handler ( int  irq,
void dev_id 
)

lpfc_sli4_hba_intr_handler - HBA interrupt handler to SLI-4 device : Interrupt number. : The device context pointer.

This function is directly called from the PCI layer as an interrupt service routine when device with SLI-4 interface spec is enabled with MSI-X multi-message interrupt mode and there is a fast-path FCP IOCB ring event in the HBA. However, when the device is enabled with either MSI or Pin-IRQ interrupt mode, this function is called as part of the device-level interrupt handler. When the PCI slot is in error recovery or the HBA is undergoing initialization, the interrupt handler will not process the interrupt. The SCSI FCP fast-path ring event are handled in the intrrupt context. This function is called without any lock held. It gets the hbalock to access and update SLI data structures. Note that, the FCP EQ to FCP CQ are one-to-one map such that the FCP EQ index is equal to that of FCP CQ index.

The link attention and ELS ring attention events are handled by the worker thread. The interrupt handler signals the worker thread and returns for these events. This function is called without any lock held. It gets the hbalock to access and update SLI data structures.

This function returns IRQ_HANDLED when interrupt is handled else it returns IRQ_NONE.

Definition at line 11868 of file lpfc_sli.c.

int lpfc_sli4_hba_setup ( struct lpfc_hba phba)

lpfc_sli4_hba_setup - SLI4 device intialization PCI function : Pointer to HBA context object.

This function is the main SLI4 device intialization PCI function. This function is called by the HBA intialization code, HBA reset code and HBA error attention handler code. Caller is not required to hold any locks.

Definition at line 6070 of file lpfc_sli.c.

int lpfc_sli4_init_vpi ( struct lpfc_vport vport)

lpfc_sli4_init_vpi - Initialize a vpi with the port : Pointer to the vport for which the vpi is being initialized

This routine is invoked to activate a vpi with the port.

Returns: 0 success -Evalue otherwise

Definition at line 14875 of file lpfc_sli.c.

irqreturn_t lpfc_sli4_intr_handler ( int  irq,
void dev_id 
)

lpfc_sli4_intr_handler - Device-level interrupt handler for SLI-4 device : Interrupt number. : The device context pointer.

This function is the device-level interrupt handler to device with SLI-4 interface spec, called from the PCI layer when either MSI or Pin-IRQ interrupt mode is enabled and there is an event in the HBA which requires driver attention. This function invokes the slow-path interrupt attention handling function and fast-path interrupt attention handling function in turn to process the relevant HBA attention events. This function is called without any lock held. It gets the hbalock to access and update SLI data structures.

This function returns IRQ_HANDLED when interrupt is handled, else it returns IRQ_NONE.

Definition at line 11973 of file lpfc_sli.c.

uint16_t lpfc_sli4_next_xritag ( struct lpfc_hba phba)

lpfc_sli4_next_xritag - Get an xritag for the io : Pointer to HBA context object.

This function gets an xritag for the iocb. If there is no unused xritag it will return 0xffff. The function returns the allocated xritag if successful, else returns zero. Zero is not a valid xritag. The caller is not required to hold any lock.

Definition at line 13459 of file lpfc_sli.c.

int lpfc_sli4_post_all_rpi_hdrs ( struct lpfc_hba phba)

lpfc_sli4_post_all_rpi_hdrs - Post the rpi header memory region to the port : pointer to lpfc hba data structure.

This routine is invoked to post rpi header templates to the HBA consistent with the SLI-4 interface spec. This routine posts a SLI4_PAGE_SIZE memory region to the port to hold up to SLI4_PAGE_SIZE modulo 64 rpi context headers.

This routine does not require any locks. It's usage is expected to be driver load or reset recovery when the driver is sequential.

Return codes 0 - successful -EIO - The mailbox failed to complete successfully. When this error occurs, the driver is not guaranteed to have any rpi regions posted to the device and must either attempt to repost the regions or take a fatal error.

Definition at line 14587 of file lpfc_sli.c.

int lpfc_sli4_post_async_mbox ( struct lpfc_hba phba)

lpfc_sli4_post_async_mbox - Post an SLI4 mailbox command to device : Pointer to HBA context object.

This function is called by worker thread to send a mailbox command to SLI4 HBA firmware.

Definition at line 7385 of file lpfc_sli.c.

int lpfc_sli4_post_rpi_hdr ( struct lpfc_hba phba,
struct lpfc_rpi_hdr rpi_page 
)

lpfc_sli4_post_rpi_hdr - Post an rpi header memory region to the port : pointer to lpfc hba data structure. : pointer to the rpi memory region.

This routine is invoked to post a single rpi header to the HBA consistent with the SLI-4 interface spec. This memory region maps up to 64 rpi context regions.

Return codes 0 - successful -ENOMEM - No available memory -EIO - The mailbox failed to complete successfully.

Definition at line 14640 of file lpfc_sli.c.

int lpfc_sli4_post_scsi_sgl_block ( struct lpfc_hba phba,
struct list_head sblist,
int  count 
)

lpfc_sli4_post_scsi_sgl_block - post a block of scsi sgl list to firmware : pointer to lpfc hba data structure. : pointer to scsi buffer list. : number of scsi buffers on the list.

This routine is invoked to post a block of scsi sgl pages from a SCSI buffer list to the HBA using non-embedded mailbox command. No Lock is held.

Definition at line 13588 of file lpfc_sli.c.

int lpfc_sli4_post_sgl ( struct lpfc_hba phba,
dma_addr_t  pdma_phys_addr0,
dma_addr_t  pdma_phys_addr1,
uint16_t  xritag 
)

lpfc_sli4_post_sgl - Post scatter gather list for an XRI to HBA : The virtual port for which this call being executed. : Physical address of the 1st SGL page. : Physical address of the 2nd SGL page. : the xritag that ties this io to the SGL pages.

This routine will post the sgl pages for the IO that has the xritag that is in the iocbq structure. The xritag is assigned during iocbq creation and persists for as long as the driver is loaded. if the caller has fewer than 256 scatter gather segments to map then pdma_phys_addr1 should be 0. If the caller needs to map more than 256 scatter gather segment then pdma_phys_addr1 should be a valid physical address. physical address for SGLs must be 64 byte aligned. If you are going to map 2 SGL's then the first one must have 256 entries the second sgl can have between 1 and 256 entries.

Return codes: 0 - Success -ENXIO, -ENOMEM - Failure

Definition at line 13319 of file lpfc_sli.c.

struct lpfc_queue* lpfc_sli4_queue_alloc ( struct lpfc_hba phba,
uint32_t  entry_size,
uint32_t  entry_count 
)
read

lpfc_sli4_queue_alloc - Allocate and initialize a queue structure : The HBA that this queue is being created on. : The size of each queue entry for this queue. count: The number of entries that this queue will handle.

This function allocates a queue structure and the DMAable memory used for the host resident queue. This function must be called before creating the queue on the HBA.

Definition at line 12037 of file lpfc_sli.c.

void lpfc_sli4_queue_free ( struct lpfc_queue queue)

lpfc_sli4_queue_free - free a queue structure and associated memory : The queue structure to free.

This function frees a queue structure and the DMAable memory used for the host resident queue. This function must be called after destroying the queue on the HBA.

Definition at line 12008 of file lpfc_sli.c.

int lpfc_sli4_read_fcf_rec ( struct lpfc_hba phba,
uint16_t  fcf_index 
)

lpfc_sli4_read_fcf_rec - Read hba fcf record for update eligible fcf bmask. : pointer to lpfc hba data structure. : FCF table entry offset.

This routine is invoked to read an FCF record indicated by to determine whether it's eligible for FLOGI roundrobin failover list.

Return 0 if the mailbox command is submitted successfully, none 0 otherwise.

Definition at line 15175 of file lpfc_sli.c.

int lpfc_sli4_redisc_fcf_table ( struct lpfc_hba phba)

lpfc_sli4_redisc_fcf_table - Request to rediscover entire FCF table by port. : pointer to lpfc hba data structure.

This routine is invoked to request for rediscovery of the entire FCF table by the port.

Definition at line 15500 of file lpfc_sli.c.

void lpfc_sli4_remove_rpis ( struct lpfc_hba phba)

lpfc_sli4_remove_rpis - Remove the rpi bitmask region : pointer to lpfc hba data structure.

This routine is invoked to remove the memory region that provided rpi via a bitmask.

Definition at line 14816 of file lpfc_sli.c.

int lpfc_sli4_resume_rpi ( struct lpfc_nodelist ndlp,
void(*)(struct lpfc_hba *, LPFC_MBOXQ_t *)  cmpl,
void arg 
)

lpfc_sli4_resume_rpi - Remove the rpi bitmask region : pointer to lpfc hba data structure.

This routine is invoked to remove the memory region that provided rpi via a bitmask.

Definition at line 14831 of file lpfc_sli.c.

uint16_t lpfc_sli4_xri_inrange ( struct lpfc_hba phba,
uint16_t  xri 
)

lpfc_sli4_xri_inrange - check xri is in range of xris owned by driver. : Pointer to HBA context object. : xri id in transaction.

This function validates the xri maps to the known range of XRIs allocated an used by the driver.

Definition at line 14100 of file lpfc_sli.c.

void lpfc_sli_abort_fcp_cmpl ( struct lpfc_hba phba,
struct lpfc_iocbq cmdiocb,
struct lpfc_iocbq rspiocb 
)

lpfc_sli_abort_fcp_cmpl - Completion handler function for aborted FCP IOCBs : Pointer to HBA context object : Pointer to command iocb object. : Pointer to response iocb object.

This function is called when an aborted FCP iocb completes. This function is called by the ring event handler with no lock held. This function frees the iocb.

Definition at line 9719 of file lpfc_sli.c.

int lpfc_sli_abort_iocb ( struct lpfc_vport vport,
struct lpfc_sli_ring pring,
uint16_t  tgt_id,
uint64_t  lun_id,
lpfc_ctx_cmd  abort_cmd 
)

lpfc_sli_abort_iocb - issue abort for all commands on a host/target/LUN : Pointer to virtual port. : Pointer to driver SLI ring object. : SCSI ID of the target. : LUN ID of the scsi device. : LPFC_CTX_LUN/LPFC_CTX_TGT/LPFC_CTX_HOST.

This function sends an abort command for every SCSI command associated with the given virtual port pending on the ring filtered by lpfc_sli_validate_fcp_iocb function. When abort_cmd == LPFC_CTX_LUN, the function sends abort only to the FCP iocbs associated with lun specified by tgt_id and lun_id parameters When abort_cmd == LPFC_CTX_TGT, the function sends abort only to the FCP iocbs associated with SCSI target specified by tgt_id parameter. When abort_cmd == LPFC_CTX_HOST, the function sends abort to all FCP iocbs associated with virtual port. This function returns number of iocbs it failed to abort. This function is called with no locks held.

Definition at line 9756 of file lpfc_sli.c.

void lpfc_sli_abort_iocb_ring ( struct lpfc_hba phba,
struct lpfc_sli_ring pring 
)

lpfc_sli_abort_iocb_ring - Abort all iocbs in the ring : Pointer to HBA context object. : Pointer to driver SLI ring object.

This function aborts all iocbs in the given ring and frees all the iocb objects in txq. This function issues an abort iocb for all the iocb commands in txcmplq. The iocbs in the txcmplq is not guaranteed to complete before the return of this function. The caller is not required to hold any locks.

Definition at line 3470 of file lpfc_sli.c.

int lpfc_sli_api_table_setup ( struct lpfc_hba phba,
uint8_t  dev_grp 
)

lpfc_sli_api_table_setup - Set up sli api function jump table : The hba struct for which this call is being executed. : The HBA PCI-Device group number.

This routine sets up the SLI interface API function jump table in struct. Returns: 0 - success, -ENODEV - failure.

Definition at line 8430 of file lpfc_sli.c.

void lpfc_sli_bemem_bcopy ( void srcp,
void destp,
uint32_t  cnt 
)

lpfc_sli_bemem_bcopy - SLI memory copy function : Source memory pointer. : Destination memory pointer. : Number of words required to be copied.

This function is used for copying data between a data structure with big endian representation to local endianness. This function can be called with or without lock.

Definition at line 9160 of file lpfc_sli.c.

int lpfc_sli_brdkill ( struct lpfc_hba phba)

lpfc_sli_brdkill - Issue a kill_board mailbox command : Pointer to HBA context object.

This function issues a kill_board mailbox command and waits for the error attention interrupt. This function is called for stopping the firmware processing. The caller is not required to hold any locks. This function calls lpfc_hba_down_post function to free any pending commands after the kill. The function will return 1 when it fails to kill the board else will return 0.

Definition at line 3775 of file lpfc_sli.c.

int lpfc_sli_brdready ( struct lpfc_hba phba,
uint32_t  mask 
)

lpfc_sli_brdready - Wrapper func for checking the hba readyness : Pointer to HBA context object. : Bit mask to be checked.

This routine wraps the actual SLI3 or SLI4 hba readyness check routine from the API jump table function pointer from the lpfc_hba struct.

Definition at line 3653 of file lpfc_sli.c.

int lpfc_sli_brdreset ( struct lpfc_hba phba)

lpfc_sli_brdreset - Reset a sli-2 or sli-3 HBA : Pointer to HBA context object.

This function resets the HBA by writing HC_INITFF to the control register. After the HBA resets, this function resets all the iocb ring indices. This function disables PCI layer parity checking during the reset. This function returns 0 always. The caller is not required to hold any locks.

Definition at line 3872 of file lpfc_sli.c.

int lpfc_sli_brdrestart ( struct lpfc_hba phba)

lpfc_sli_brdrestart - Wrapper func for restarting hba : Pointer to HBA context object.

This routine wraps the actual SLI3 or SLI4 hba restart routine from the API jump table function pointer from the lpfc_hba struct.

Definition at line 4104 of file lpfc_sli.c.

void lpfc_sli_cancel_iocbs ( struct lpfc_hba phba,
struct list_head iocblist,
uint32_t  ulpstatus,
uint32_t  ulpWord4 
)

lpfc_sli_cancel_iocbs - Cancel all iocbs from a list. : Pointer to HBA context object. : List of IOCBs. : ULP status in IOCB command field. : ULP word-4 in IOCB command field.

This function is called with a list of IOCBs to cancel. It cancels the IOCB on the list by invoking the complete callback function associated with the IOCB with the provided and set to the IOCB commond fields.

Definition at line 1100 of file lpfc_sli.c.

int lpfc_sli_check_eratt ( struct lpfc_hba phba)

lpfc_sli_check_eratt - check error attention events : Pointer to HBA context.

This function is called from timer soft interrupt context to check HBA's error attention register bit for error attention events.

This function returns 1 when there is Error Attention in the Host Attention Register and returns 0 otherwise.

Definition at line 10285 of file lpfc_sli.c.

int lpfc_sli_config_port ( struct lpfc_hba phba,
int  sli_mode 
)

lpfc_sli_config_port - Issue config port mailbox command : Pointer to HBA context object. : sli mode - 2/3

This function is called by the sli intialization code path to issue config_port mailbox command. This function restarts the HBA firmware and issues a config_port mailbox command to configure the SLI interface in the sli mode specified by sli_mode variable. The caller is not required to hold any locks. The function returns 0 if successful, else returns negative error code.

Definition at line 4355 of file lpfc_sli.c.

void lpfc_sli_def_mbox_cmpl ( struct lpfc_hba phba,
LPFC_MBOXQ_t pmb 
)

lpfc_sli_def_mbox_cmpl - Default mailbox completion handler : Pointer to HBA context object. : Pointer to mailbox object.

This function is the default mailbox completion handler. It frees the memory resources associated with the completed mailbox command. If the completed command is a REG_LOGIN mailbox command, this function will issue a UREG_LOGIN to re-claim the RPI.

Definition at line 2142 of file lpfc_sli.c.

void lpfc_sli_flush_fcp_rings ( struct lpfc_hba phba)

lpfc_sli_flush_fcp_rings - flush all iocbs in the fcp ring : Pointer to HBA context object.

This function flushes all iocbs in the fcp ring and frees all the iocb objects in txq and txcmplq. This function will not issue abort iocbs for all the iocb commands in txcmplq, they will just be returned with IOERR_SLI_DOWN. This function is invoked with EEH when device's PCI slot has been permanently disabled.

Definition at line 3508 of file lpfc_sli.c.

irqreturn_t lpfc_sli_fp_intr_handler ( int  irq,
void dev_id 
)

lpfc_sli_fp_intr_handler - Fast-path interrupt handler to SLI-3 device. : Interrupt number. : The device context pointer.

This function is directly called from the PCI layer as an interrupt service routine when device with SLI-3 interface spec is enabled with MSI-X multi-message interrupt mode and there is a fast-path FCP IOCB ring event in the HBA. However, when the device is enabled with either MSI or Pin-IRQ interrupt mode, this function is called as part of the device-level interrupt handler. When the PCI slot is in error recovery or the HBA is undergoing initialization, the interrupt handler will not process the interrupt. The SCSI FCP fast-path ring event are handled in the intrrupt context. This function is called without any lock held. It gets the hbalock to access and update SLI data structures.

This function returns IRQ_HANDLED when interrupt is handled else it returns IRQ_NONE.

Definition at line 10689 of file lpfc_sli.c.

void lpfc_sli_free_hbq ( struct lpfc_hba phba,
struct hbq_dmabuf hbq_buffer 
)

lpfc_sli_free_hbq - Give back the hbq buffer to firmware : Pointer to HBA context object. : Pointer to HBQ buffer.

This function is called with hbalock. This function gives back the hbq buffer to firmware. If the HBQ does not have space to post the buffer, it will free the buffer.

Definition at line 2000 of file lpfc_sli.c.

uint32_t lpfc_sli_get_buffer_tag ( struct lpfc_hba phba)

lpfc_sli_get_buffer_tag - allocates a tag for a CMD_QUE_XRI64_CX buffer : Pointer to HBA context object.

When HBQ is enabled, buffers are searched based on tags. This function allocates a tag for buffer posted using CMD_QUE_XRI64_CX iocb. The tag is bit wise or-ed with QUE_BUFTAG_BIT to make sure that the tag does not conflict with tags of buffer posted for unsolicited events. The function returns the allocated tag. The function is called with no locks held.

Definition at line 9211 of file lpfc_sli.c.

struct lpfc_iocbq* lpfc_sli_get_iocbq ( struct lpfc_hba phba)
read

lpfc_sli_get_iocbq - Allocates an iocb object from iocb pool : Pointer to HBA context object.

This function is called with no lock held. This function allocates a new driver iocb object from the iocb pool. If the allocation is successful, it returns pointer to the newly allocated iocb object else it returns NULL.

Definition at line 952 of file lpfc_sli.c.

int lpfc_sli_handle_fast_ring_event ( struct lpfc_hba phba,
struct lpfc_sli_ring pring,
uint32_t  mask 
)

lpfc_sli_handle_fast_ring_event - Handle ring events on FCP ring : Pointer to HBA context object. : Pointer to driver SLI ring object. : Host attention register mask for this ring.

This function is called from the interrupt context when there is a ring event for the fcp ring. The caller does not hold any lock. The function processes each response iocb in the response ring until it finds an iocb with LE bit set and chains all the iocbs up to the iocb with LE bit set. The function will call the completion handler of the command iocb if the response iocb indicates a completion for a command iocb or it is an abort completion. The function will call lpfc_sli_process_unsol_iocb function if this is an unsolicited iocb. This routine presumes LPFC_FCP_RING handling and doesn't bother to check it explicitly.

Definition at line 2902 of file lpfc_sli.c.

int lpfc_sli_handle_mb_event ( struct lpfc_hba phba)

lpfc_sli_handle_mb_event - Handle mailbox completions from firmware : Pointer to HBA context object.

This function is called with no lock held. This function processes all the completed mailbox commands and gives it to upper layers. The interrupt service routine processes mailbox completion interrupt and adds completed mailbox commands to the mboxq_cmpl queue and signals the worker thread. Worker thread call lpfc_sli_handle_mb_event, which will return the completed mailbox commands in mboxq_cmpl queue to the upper layers. This function returns the mailbox commands to the upper layer by calling the completion handler function of each mailbox.

Definition at line 2217 of file lpfc_sli.c.

void lpfc_sli_handle_slow_ring_event ( struct lpfc_hba phba,
struct lpfc_sli_ring pring,
uint32_t  mask 
)

lpfc_sli_handle_slow_ring_event - Wrapper func for handling slow-path iocbs : Pointer to HBA context object. : Pointer to driver SLI ring object. : Host attention register mask for this ring.

This routine wraps the actual slow_ring event process routine from the API jump table function pointer from the lpfc_hba struct.

Definition at line 3264 of file lpfc_sli.c.

int lpfc_sli_hba_down ( struct lpfc_hba phba)

lpfc_sli_hba_down - Resource cleanup function for the HBA : Pointer to HBA context object.

This function cleans up all iocb, buffers, mailbox commands while shutting down the HBA. This function is called with no lock held and always returns 1. This function does the following to cleanup driver resources:

  • Free discovery resources for each virtual port
  • Cleanup any pending fabric iocbs
  • Iterate through the iocb txq and free each entry in the list.
  • Free up any buffer posted to the HBA
  • Free mailbox commands in the mailbox queue.

Definition at line 9056 of file lpfc_sli.c.

void lpfc_sli_hba_iocb_abort ( struct lpfc_hba phba)

lpfc_sli_hba_iocb_abort - Abort all iocbs to an hba. : pointer to lpfc HBA data structure.

This routine will abort all pending and outstanding iocbs to an HBA.

Definition at line 9593 of file lpfc_sli.c.

int lpfc_sli_hba_setup ( struct lpfc_hba phba)

lpfc_sli_hba_setup - SLI intialization function : Pointer to HBA context object.

This function is the main SLI intialization function. This function is called by the HBA intialization code, HBA reset code and HBA error attention handler code. Caller is not required to hold any locks. This function issues config_port mailbox command to configure the SLI, setup iocb rings and HBQ rings. In the end the function calls the config_port_post function to issue init_link mailbox command and to start the discovery. The function will return zero if successful, else it will return negative error code.

Definition at line 4499 of file lpfc_sli.c.

int lpfc_sli_hbq_count ( void  )

lpfc_sli_hbq_count - Get the number of HBQs to be configured

This function calculates and returns the number of HBQs required to be configured.

Definition at line 4216 of file lpfc_sli.c.

int lpfc_sli_hbq_size ( void  )

lpfc_sli_hbq_size - Calculate memory required for all hbq entries

This function calculates amount of memory required for all hbq entries to be configured and returns the total memory required.

Definition at line 4247 of file lpfc_sli.c.

int lpfc_sli_hbqbuf_add_hbqs ( struct lpfc_hba phba,
uint32_t  qno 
)

lpfc_sli_hbqbuf_add_hbqs - Post more HBQ buffers to firmware : Pointer to HBA context object. : HBQ number.

This function posts more buffers to the HBQ. This function is called with no lock held. The function returns the number of HBQ entries successfully allocated.

Definition at line 1906 of file lpfc_sli.c.

void lpfc_sli_hbqbuf_free_all ( struct lpfc_hba phba)

lpfc_sli_hbqbuf_free_all - Free all the hbq buffers : Pointer to HBA context object.

This function is called with no lock held to free all the hbq buffers while uninitializing the SLI interface. It also frees the HBQ buffers returned by the firmware but not yet processed by the upper layers.

Definition at line 1672 of file lpfc_sli.c.

int lpfc_sli_host_down ( struct lpfc_vport vport)

lpfc_sli_host_down - Vport cleanup function : Pointer to virtual port object.

lpfc_sli_host_down is called to clean up the resources associated with a vport before destroying virtual port data structures. This function does following operations:

  • Free discovery resources associated with this virtual port.
  • Free iocbs associated with this virtual port in the txq.
  • Send abort for all iocb commands associated with this vport in txcmplq.

This function is called with no lock held and always returns 1.

Definition at line 8987 of file lpfc_sli.c.

irqreturn_t lpfc_sli_intr_handler ( int  irq,
void dev_id 
)

lpfc_sli_intr_handler - Device-level interrupt handler to SLI-3 device : Interrupt number. : The device context pointer.

This function is the HBA device-level interrupt handler to device with SLI-3 interface spec, called from the PCI layer when either MSI or Pin-IRQ interrupt mode is enabled and there is an event in the HBA which requires driver attention. This function invokes the slow-path interrupt attention handling function and fast-path interrupt attention handling function in turn to process the relevant HBA attention events. This function is called without any lock held. It gets the hbalock to access and update SLI data structures.

This function returns IRQ_HANDLED when interrupt is handled, else it returns IRQ_NONE.

Definition at line 10778 of file lpfc_sli.c.

int lpfc_sli_issue_abort_iotag ( struct lpfc_hba phba,
struct lpfc_sli_ring pring,
struct lpfc_iocbq cmdiocb 
)

lpfc_sli_issue_abort_iotag - Abort function for a command iocb : Pointer to HBA context object. : Pointer to driver SLI ring object. : Pointer to driver command iocb object.

This function issues an abort iocb for the provided command iocb. In case of unloading, the abort iocb will not be issued to commands on the ELS ring. Instead, the callback function shall be changed to those commands so that nothing happens when them finishes. This function is called with hbalock held. The function returns 0 when the command iocb is an abort request.

Definition at line 9506 of file lpfc_sli.c.

int lpfc_sli_issue_iocb ( struct lpfc_hba phba,
uint32_t  ring_number,
struct lpfc_iocbq piocb,
uint32_t  flag 
)

lpfc_sli_issue_iocb - Wrapper function for __lpfc_sli_issue_iocb : Pointer to HBA context object. : Pointer to driver SLI ring object. : Pointer to command iocb. : Flag indicating if this command can be put into txq.

lpfc_sli_issue_iocb is a wrapper around __lpfc_sli_issue_iocb function. This function gets the hbalock and calls __lpfc_sli_issue_iocb function and will return the error returned by __lpfc_sli_issue_iocb function. This wrapper is used by functions which do not hold hbalock.

Definition at line 8467 of file lpfc_sli.c.

int lpfc_sli_issue_iocb_wait ( struct lpfc_hba phba,
uint32_t  ring_number,
struct lpfc_iocbq piocb,
struct lpfc_iocbq prspiocbq,
uint32_t  timeout 
)

lpfc_sli_issue_iocb_wait - Synchronous function to issue iocb commands : Pointer to HBA context object.. : Pointer to sli ring. : Pointer to command iocb. : Pointer to response iocb. : Timeout in number of seconds.

This function issues the iocb to firmware and waits for the iocb to complete. If the iocb command is not completed within timeout seconds, it returns IOCB_TIMEDOUT. Caller should not free the iocb resources if this function returns IOCB_TIMEDOUT. The function waits for the iocb completion using an non-interruptible wait. This function will sleep while waiting for iocb completion. So, this function should not be called from any context which does not allow sleeping. Due to the same reason, this function cannot be called with interrupt disabled. This function assumes that the iocb completions occur while this function sleep. So, this function cannot be called from the thread which process iocb completion for this ring. This function clears the iocb_flag of the iocb object before issuing the iocb and the iocb completion handler sets this flag and wakes this thread when the iocb completes. The contents of the response iocb will be copied to prspiocbq by the completion handler when the command completes. This function returns IOCB_SUCCESS when success. This function is called with no lock held.

Definition at line 9919 of file lpfc_sli.c.

int lpfc_sli_issue_mbox ( struct lpfc_hba phba,
LPFC_MBOXQ_t pmbox,
uint32_t  flag 
)

lpfc_sli_issue_mbox - Wrapper func for issuing mailbox command : Pointer to HBA context object. : Pointer to mailbox object. : Flag indicating how the mailbox need to be processed.

This routine wraps the actual SLI3 or SLI4 mailbox issuing routine from the API jump table function pointer from the lpfc_hba struct.

Return codes the caller owns the mailbox command after the return of the function.

Definition at line 7511 of file lpfc_sli.c.

int lpfc_sli_issue_mbox_wait ( struct lpfc_hba phba,
LPFC_MBOXQ_t pmboxq,
uint32_t  timeout 
)

lpfc_sli_issue_mbox_wait - Synchronous function to issue mailbox : Pointer to HBA context object. : Pointer to driver mailbox object. : Timeout in number of seconds.

This function issues the mailbox to firmware and waits for the mailbox command to complete. If the mailbox command is not completed within timeout seconds, it returns MBX_TIMEOUT. The function waits for the mailbox completion using an interruptible wait. If the thread is woken up due to a signal, MBX_TIMEOUT error is returned to the caller. Caller should not free the mailbox resources, if this function returns MBX_TIMEOUT. This function will sleep while waiting for mailbox completion. So, this function should not be called from any context which does not allow sleeping. Due to the same reason, this function cannot be called with interrupt disabled. This function assumes that the mailbox completion occurs while this function sleep. So, this function cannot be called from the worker thread which processes mailbox completion. This function is called in the context of HBA management applications. This function returns MBX_SUCCESS when successful. This function is called with no lock held.

Definition at line 10030 of file lpfc_sli.c.

void lpfc_sli_mbox_sys_shutdown ( struct lpfc_hba phba,
int  mbx_action 
)

lpfc_sli_mbox_sys_shutdown - shutdown mailbox command sub-system : Pointer to HBA context.

This function is called to shutdown the driver's mailbox sub-system. It first marks the mailbox sub-system is in a block state to prevent the asynchronous mailbox command from issued off the pending mailbox command queue. If the mailbox command sub-system shutdown is due to HBA error conditions such as EEH or ERATT, this routine shall invoke the mailbox sub-system flush routine to forcefully bring down the mailbox sub-system. Otherwise, if it is due to normal condition (such as with offline or HBA function reset), this routine will wait for the outstanding mailbox command to complete before invoking the mailbox sub-system flush routine to gracefully bring down mailbox sub-system.

Definition at line 10089 of file lpfc_sli.c.

uint16_t lpfc_sli_next_iotag ( struct lpfc_hba phba,
struct lpfc_iocbq iocbq 
)

lpfc_sli_next_iotag - Get an iotag for the iocb : Pointer to HBA context object. : Pointer to driver iocb object.

This function gets an iotag for the iocb. If there is no unused iotag and the iocbq_lookup_len < 0xffff, this function allocates a bigger iotag_lookup array and assigns a new iotag. The function returns the allocated iotag if successful, else returns zero. Zero is not a valid iotag. The caller is not required to hold any lock.

Definition at line 1403 of file lpfc_sli.c.

void lpfc_sli_pcimem_bcopy ( void srcp,
void destp,
uint32_t  cnt 
)

lpfc_sli_pcimem_bcopy - SLI memory copy function : Source memory pointer. : Destination memory pointer. : Number of words required to be copied.

This function is used for copying data between driver memory and the SLI memory. This function also changes the endianness of each word if native endianness is different from SLI endianness. This function can be called with or without lock.

Definition at line 9132 of file lpfc_sli.c.

int lpfc_sli_queue_setup ( struct lpfc_hba phba)

lpfc_sli_queue_setup - Queue initialization function : Pointer to HBA context object.

lpfc_sli_queue_setup sets up mailbox queues and iocb queues for each ring. This function also initializes ring indices of each ring. This function is called during the initialization of the SLI interface of an HBA. This function is called with no lock held and always returns 1.

Definition at line 8895 of file lpfc_sli.c.

void lpfc_sli_read_link_ste ( struct lpfc_hba phba)

lpfc_sli_read_link_ste - Read region 23 to decide if link is disabled. : pointer to lpfc hba data structure.

This function read region 23 and parse TLV for port status to decide if the user disaled the port. If the TLV indicates the port is disabled, the hba_flag is set accordingly.

Definition at line 15683 of file lpfc_sli.c.

void lpfc_sli_release_iocbq ( struct lpfc_hba phba,
struct lpfc_iocbq iocbq 
)

lpfc_sli_release_iocbq - Release iocb to the iocb pool : Pointer to HBA context object. : Pointer to driver iocb object.

This function is called with no lock held to release the iocb to iocb pool.

Definition at line 1075 of file lpfc_sli.c.

struct lpfc_dmabuf* lpfc_sli_ring_taggedbuf_get ( struct lpfc_hba phba,
struct lpfc_sli_ring pring,
uint32_t  tag 
)
read

lpfc_sli_ring_taggedbuf_get - find HBQ buffer associated with given tag : Pointer to HBA context object. : Pointer to driver SLI ring object. : Buffer tag.

Buffers posted using CMD_QUE_XRI64_CX iocb are in pring->postbufq list. After HBA DMA data to these buffers, CMD_IOCB_RET_XRI64_CX iocb is posted to the response ring with the tag of the buffer. This function searches the pring->postbufq list using the tag to find buffer associated with CMD_IOCB_RET_XRI64_CX iocb. If the buffer is found then lpfc_dmabuf object of the buffer is returned to the caller else NULL is returned. This function is called with no lock held.

Definition at line 9240 of file lpfc_sli.c.

struct lpfc_dmabuf* lpfc_sli_ringpostbuf_get ( struct lpfc_hba phba,
struct lpfc_sli_ring pring,
dma_addr_t  phys 
)
read

lpfc_sli_ringpostbuf_get - search buffers for unsolicited CT and ELS events : Pointer to HBA context object. : Pointer to driver SLI ring object. : DMA address of the buffer.

This function searches the buffer list using the dma_address of unsolicited event to find the driver's lpfc_dmabuf object corresponding to the dma_address. The function returns the lpfc_dmabuf object if a buffer is found else it returns NULL. This function is called by the ct and els unsolicited event handlers to get the buffer associated with the unsolicited event.

This function is called with no lock held.

Definition at line 9284 of file lpfc_sli.c.

int lpfc_sli_ringpostbuf_put ( struct lpfc_hba phba,
struct lpfc_sli_ring pring,
struct lpfc_dmabuf mp 
)

lpfc_sli_ringpostbuf_put - Function to add a buffer to postbufq : Pointer to HBA context object. : Pointer to driver SLI ring object. : Pointer to driver buffer object.

This function is called with no lock held. It always return zero after adding the buffer to the postbufq buffer list.

Definition at line 9187 of file lpfc_sli.c.

struct lpfc_iocbq* lpfc_sli_ringtx_get ( struct lpfc_hba phba,
struct lpfc_sli_ring pring 
)
read

lpfc_sli_ringtx_get - Get first element of the txq : Pointer to HBA context object. : Pointer to driver SLI ring object.

This function is called with hbalock held to get next iocb in txq of the given ring. If there is any iocb in the txq, the function returns first iocb in the list after removing the iocb from the list, else it returns NULL.

Definition at line 1324 of file lpfc_sli.c.

int lpfc_sli_setup ( struct lpfc_hba phba)

lpfc_sli_setup - SLI ring setup function : Pointer to HBA context object.

lpfc_sli_setup sets up rings of the SLI interface with number of iocbs per ring and iotags. This function is called while driver attach to the HBA and before the interrupts are enabled. So there is no need for locking.

This function always returns 0.

Definition at line 8760 of file lpfc_sli.c.

irqreturn_t lpfc_sli_sp_intr_handler ( int  irq,
void dev_id 
)

lpfc_sli_sp_intr_handler - Slow-path interrupt handler to SLI-3 device : Interrupt number. : The device context pointer.

This function is directly called from the PCI layer as an interrupt service routine when device with SLI-3 interface spec is enabled with MSI-X multi-message interrupt mode and there are slow-path events in the HBA. However, when the device is enabled with either MSI or Pin-IRQ interrupt mode, this function is called as part of the device-level interrupt handler. When the PCI slot is in error recovery or the HBA is undergoing initialization, the interrupt handler will not process the interrupt. The link attention and ELS ring attention events are handled by the worker thread. The interrupt handler signals the worker thread and returns for these events. This function is called without any lock held. It gets the hbalock to access and update SLI data structures.

This function returns IRQ_HANDLED when interrupt is handled else it returns IRQ_NONE.

Definition at line 10389 of file lpfc_sli.c.

int lpfc_sli_sum_iocb ( struct lpfc_vport vport,
uint16_t  tgt_id,
uint64_t  lun_id,
lpfc_ctx_cmd  ctx_cmd 
)

lpfc_sli_sum_iocb - Function to count the number of FCP iocbs pending : Pointer to virtual port. : SCSI ID of the target. : LUN ID of the scsi device. : LPFC_CTX_LUN/LPFC_CTX_TGT/LPFC_CTX_HOST.

This function returns number of FCP commands pending for the vport. When ctx_cmd == LPFC_CTX_LUN, the function returns number of FCP commands pending on the vport associated with SCSI device specified by tgt_id and lun_id parameters. When ctx_cmd == LPFC_CTX_TGT, the function returns number of FCP commands pending on the vport associated with SCSI target specified by tgt_id parameter. When ctx_cmd == LPFC_CTX_HOST, the function returns number of FCP commands pending on the vport. This function returns the number of iocbs which satisfy the filter. This function is called without any lock held.

Definition at line 9690 of file lpfc_sli.c.

void lpfc_sli_wake_mbox_wait ( struct lpfc_hba phba,
LPFC_MBOXQ_t pmboxq 
)

lpfc_sli_wake_mbox_wait - lpfc_sli_issue_mbox_wait mbox completion handler : Pointer to HBA context object. : Pointer to mailbox command.

This is completion handler function for mailbox commands issued from lpfc_sli_issue_mbox_wait function. This function is called by the mailbox event handler function with no lock held. This function will wake up thread waiting on the wait queue pointed by context1 of the mailbox.

Definition at line 2112 of file lpfc_sli.c.

int lpfc_test_rrq_active ( struct lpfc_hba phba,
struct lpfc_nodelist ndlp,
uint16_t  xritag 
)

lpfc_test_rrq_active - Test RRQ bit in xri_bitmap. : Pointer to HBA context object. : Targets nodelist pointer for this exchange. the xri in the bitmap to test.

This function is called with hbalock held. This function returns 0 = rrq not active for this xri 1 = rrq is valid for this xri.

Definition at line 791 of file lpfc_sli.c.

void lpfc_update_rcv_time_stamp ( struct lpfc_vport vport)

lpfc_update_rcv_time_stamp - Update vport's rcv seq time stamp : The vport to work on.

This function updates the receive sequence time stamp for this vport. The receive sequence time stamp indicates the time that the last frame of the the sequence that has been idle for the longest amount of time was received. the driver uses this time stamp to indicate if any received sequences have timed out.

Definition at line 13845 of file lpfc_sli.c.

uint32_t lpfc_wq_create ( struct lpfc_hba phba,
struct lpfc_queue wq,
struct lpfc_queue cq,
uint32_t  subtype 
)

lpfc_wq_create - Create a Work Queue on the HBA : HBA structure that indicates port to create a queue on. : The queue structure to use to create the work queue. : The completion queue to bind this work queue to. : The subtype of the work queue indicating its functionality.

This function creates a work queue, as detailed in , on a port, described by by sending a WQ_CREATE mailbox command to the HBA.

The struct is used to send mailbox command to HBA. The struct is used to get the entry count and entry size that are necessary to determine the number of pages to allocate and use for this queue. The is used to indicate which completion queue to bind this work queue to. This function will send the WQ_CREATE mailbox command to the HBA to setup the work queue. This function is asynchronous and will wait for the mailbox command to finish before continuing.

On success this function will return a zero. If unable to allocate enough memory this function will return -ENOMEM. If the queue create mailbox command fails this function will return -ENXIO.

Definition at line 12665 of file lpfc_sli.c.

uint32_t lpfc_wq_destroy ( struct lpfc_hba phba,
struct lpfc_queue wq 
)

lpfc_wq_destroy - Destroy a Work Queue on the HBA : The queue structure associated with the queue to destroy.

This function destroys a queue, as detailed in by sending an mailbox command, specific to the type of queue, to the HBA.

The struct is used to get the queue ID of the queue to destroy.

On success this function will return a zero. If the queue destroy mailbox command fails this function will return -ENXIO.

Definition at line 13185 of file lpfc_sli.c.

int lpfc_wr_object ( struct lpfc_hba phba,
struct list_head dmabuf_list,
uint32_t  size,
uint32_t offset 
)

lpfc_wr_object - write an object to the firmware : HBA structure that indicates port to create a queue on. : list of dmabufs to write to the port. : the total byte value of the objects to write to the port. : the current offset to be used to start the transfer.

This routine will create a wr_object mailbox command to send to the port. the mailbox command will be constructed using the dma buffers described in to create a list of BDEs. This routine will fill in as many BDEs that the imbedded mailbox can support. The variable will be used to indicate the starting offset of the transfer and will also return the offset after the write object mailbox has completed. is used to determine the end of the object and whether the eof bit should be set.

Return 0 is successful and offset will contain the the new offset to use for the next write. Return negative value for error cases.

Definition at line 15792 of file lpfc_sli.c.

Variable Documentation

struct lpfc_hbq_init* lpfc_hbq_defs[]
Initial value:
= {
&lpfc_els_hbq,
&lpfc_extra_hbq,
}

Definition at line 1831 of file lpfc_sli.c.