Linux Kernel
3.7.1
|
#include <linux/blkdev.h>
#include <linux/delay.h>
#include <linux/dma-mapping.h>
#include <linux/idr.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/kthread.h>
#include <linux/pci.h>
#include <linux/spinlock.h>
#include <linux/ctype.h>
#include <linux/aer.h>
#include <linux/slab.h>
#include <linux/firmware.h>
#include <linux/miscdevice.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_version.h"
Go to the source code of this file.
Macros | |
#define | S(N, V) (((V)<<(N))|((V)>>(32-(N)))) |
Variables | |
char * | _dump_buf_data |
unsigned long | _dump_buf_data_order |
char * | _dump_buf_dif |
unsigned long | _dump_buf_dif_order |
spinlock_t | _dump_buf_lock |
|
read |
__lpfc_sli4_cq_event_alloc - Allocate a completion-queue event from free pool : pointer to lpfc hba data structure.
This routine is the lock free version of the API invoked to allocate a completion-queue event from the free pool.
Return: Pointer to the newly allocated completion-queue event if successful NULL otherwise.
Definition at line 7427 of file lpfc_init.c.
void __lpfc_sli4_cq_event_release | ( | struct lpfc_hba * | phba, |
struct lpfc_cq_event * | cq_event | ||
) |
__lpfc_sli4_cq_event_release - Release a completion-queue event to free pool : pointer to lpfc hba data structure. : pointer to the completion queue event to be freed.
This routine is the lock free version of the API invoked to release a completion-queue event back into the free pool.
Definition at line 7467 of file lpfc_init.c.
void destroy_port | ( | struct lpfc_vport * | vport | ) |
lpfc_api_table_setup - Set up per hba pci-device group func api jump table : pointer to lpfc hba data structure. : The HBA PCI-Device group number.
This routine is invoked to set up the per HBA PCI-Device group function API jump table entries.
Return: 0 if success, otherwise -ENODEV
Definition at line 4395 of file lpfc_init.c.
void lpfc_cleanup | ( | struct lpfc_vport * | vport | ) |
lpfc_cleanup - Performs vport cleanups before deleting a vport : pointer to a virtual N_Port data structure.
This routine performs the necessary cleanups before deleting the . It invokes the discovery state machine to perform necessary state transitions and to release the ndlps associated with the . Note, the physical port is treated as 0.
Definition at line 2354 of file lpfc_init.c.
lpfc_config_port_post - Perform lpfc initialization after config port : pointer to lpfc hba data structure.
This routine will do LPFC initialization after the CONFIG_PORT mailbox command call. It performs all internal resource and state setups on the port: post IOCB buffers, enable appropriate host interrupt attentions, ELS ring timers, etc.
Return codes 0 - success. Any other value - error.
Definition at line 366 of file lpfc_init.c.
lpfc_config_port_prep - Perform lpfc initialization prior to config port : pointer to lpfc hba data structure.
This routine will do LPFC initialization prior to issuing the CONFIG_PORT mailbox command. It retrieves the revision information from the HBA and collects the Vital Product Data (VPD) about the HBA for preparing the configuration of the HBA.
Return codes: 0 - success. -ERESTART - requests the SLI layer to reset the HBA and try again. Any other value - indicates an error.
Definition at line 98 of file lpfc_init.c.
|
read |
lpfc_create_port - Create an FC port : pointer to lpfc hba data structure. : a unique integer ID to this FC port. : pointer to the device data structure.
This routine creates a FC port for the upper layer protocol. The FC port can be created on top of either a physical port or a virtual port provided by the HBA. This routine also allocates a SCSI host data structure (shost) and associates the FC port created before adding the shost into the SCSI layer.
Return codes - pointer to the virtual N_Port data structure. NULL - port create failed.
Definition at line 3047 of file lpfc_init.c.
lpfc_fcf_redisc_wait_start_timer - Start fcf rediscover wait timer : Pointer to hba for which this call is being executed.
This routine starts the timer waiting for the FCF rediscovery to complete.
Definition at line 3355 of file lpfc_init.c.
lpfc_free_sgl_list - Free a given sgl list. : pointer to lpfc hba data structure. : pointer to the head of sgl list.
This routine is invoked to free a give sgl list and memory.
Definition at line 5382 of file lpfc_init.c.
lpfc_get_instance - Get a unique integer ID
This routine allocates a unique integer ID from lpfc_hba_index pool. It uses the kernel idr facility to perform the task.
Return codes: instance - a unique integer ID allocated as the new instance. -1 - lpfc get instance failed.
Definition at line 3166 of file lpfc_init.c.
int lpfc_get_sli4_parameters | ( | struct lpfc_hba * | phba, |
LPFC_MBOXQ_t * | mboxq | ||
) |
lpfc_get_sli4_parameters - Get the SLI4 Config PARAMETERS. : Pointer to HBA context object. : Pointer to the mailboxq memory for the mailbox command response.
This function is called in the SLI4 code path to read the port's sli4 capabilities.
This function may be be called from any context that can block-wait for the completion. The expectation is that this routine is called typically from probe_one or from the online routine.
Definition at line 8736 of file lpfc_init.c.
lpfc_handle_eratt - Wrapper func for handling hba error attention : pointer to lpfc HBA data structure.
This routine wraps the actual SLI3 or SLI4 hba error attention handling routine from the API jump table function pointer from the lpfc_hba struct.
Return codes 0 - success. Any other value - error.
Definition at line 1604 of file lpfc_init.c.
lpfc_handle_latt - The HBA link event handler : pointer to lpfc hba data structure.
This routine is invoked from the worker thread to handle a HBA host attention link event.
Definition at line 1617 of file lpfc_init.c.
lpfc_hb_timeout_handler - The HBA-timer timeout handler : pointer to lpfc hba data structure.
This is the actual HBA-timer timeout handler to be invoked by the worker thread whenever the HBA timer fired and HBA-timeout event posted. This handler performs any periodic operations needed for the device. If such periodic event has already been attended to either in the interrupt handler or by processing slow-ring or fast-ring events within the HBA-timer timeout window (LPFC_HB_MBOX_INTERVAL), this handler just simply resets the timer for the next timeout period. If lpfc heart-beat mailbox command is configured and there is no heart-beat mailbox command outstanding, a heart-beat mailbox is issued and timer set properly. Otherwise, if there has been a heart-beat mailbox command outstanding, the HBA shall be put to offline.
Definition at line 1046 of file lpfc_init.c.
lpfc_hba_down_link - this routine downs the FC link : pointer to lpfc hba data structure. : mailbox command issue mode - either MBX_POLL or MBX_NOWAIT
This routine will issue the DOWN_LINK mailbox command call. It is available to other drivers through the lpfc_hba data structure for use to stop the link.
Return code 0 - success Any other value - error
Definition at line 733 of file lpfc_init.c.
lpfc_hba_down_post - Wrapper func for hba down post routine : pointer to lpfc HBA data structure.
This routine wraps the actual SLI3 or SLI4 routine for performing uninitialization after the HBA is reset when bring down the SLI Layer.
Return codes 0 - success. Any other value - error.
Definition at line 930 of file lpfc_init.c.
lpfc_hba_down_prep - Perform lpfc uninitialization prior to HBA reset : pointer to lpfc HBA data structure.
This routine will do LPFC uninitialization before the HBA is reset when bringing down the SLI Layer.
Return codes 0 - success. Any other value - error.
Definition at line 777 of file lpfc_init.c.
lpfc_hba_init - Perform special handling for LC HBA initialization : pointer to lpfc hba data structure. : pointer to an array of unsigned 32-bit integers.
This routine performs the special handling for LC HBA initialization.
Definition at line 2323 of file lpfc_init.c.
lpfc_hba_init_link - Initialize the FC link : pointer to lpfc hba data structure. : mailbox command issue mode - either MBX_POLL or MBX_NOWAIT
This routine will issue the INIT_LINK mailbox command call. It is available to other drivers through the lpfc_hba data structure for use as a delayed link up mechanism with the module parameter lpfc_suppress_link_up.
Return code 0 - success Any other value - error
Definition at line 632 of file lpfc_init.c.
lpfc_hba_init_link_fc_topology - Initialize FC link with desired topology : pointer to lpfc hba data structure. : desired fc topology. : mailbox command issue mode - either MBX_POLL or MBX_NOWAIT
This routine will issue the INIT_LINK mailbox command call. It is available to other drivers through the lpfc_hba data structure for use as a delayed link up mechanism with the module parameter lpfc_suppress_link_up.
Return code 0 - success Any other value - error
Definition at line 653 of file lpfc_init.c.
lpfc_host_attrib_init - Initialize SCSI host attributes on a FC port : pointer to SCSI host data structure.
This routine initializes a given SCSI host attributes on a FC port. The SCSI host can be either on top of a physical port or a virtual port.
Definition at line 3243 of file lpfc_init.c.
lpfc_init_api_table_setup - Set up init 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 device INIT interface API function jump table in struct.
Returns: 0 - success, -ENODEV - failure.
Definition at line 5184 of file lpfc_init.c.
lpfc_offline - Bring a HBA offline : pointer to lpfc hba data structure.
This routine actually brings a HBA offline. It stops all the timers associated with the HBA, brings down the SLI layer, and eventually marks the HBA as in offline state for the upper layer protocol.
Definition at line 2786 of file lpfc_init.c.
lpfc_offline_prep - Prepare a HBA to be brought offline : pointer to lpfc hba data structure.
This routine is invoked to prepare a HBA to be brought offline. It performs unregistration login to all the nodes on all vports and flushes the mailbox queue to make it ready to be brought offline.
Definition at line 2716 of file lpfc_init.c.
lpfc_online - Initialize and bring a HBA online : pointer to lpfc hba data structure.
This routine initializes the HBA and brings a HBA online. During this process, the management interface is blocked to prevent user space access to the HBA interfering with the driver initialization.
Return codes 0 - successful 1 - failed
Definition at line 2632 of file lpfc_init.c.
lpfc_parse_vpd - Parse VPD (Vital Product Data) : pointer to lpfc hba data structure. : pointer to the vital product data. : length of the vital product data in bytes.
This routine parses the Vital Product Data (VPD). The VPD is treated as an array of characters. In this routine, the ModelName, ProgramType, and ModelDesc, etc. fields of the phba data structure will be populated.
Return codes 0 - pointer to the VPD passed in is NULL 1 - success
Definition at line 1711 of file lpfc_init.c.
int lpfc_pc_sli4_params_get | ( | struct lpfc_hba * | phba, |
LPFC_MBOXQ_t * | mboxq | ||
) |
lpfc_pc_sli4_params_get - Get the SLI4_PARAMS port capabilities. : Pointer to HBA context object. : Pointer to the mailboxq memory for the mailbox command response.
This function is called in the SLI4 code path to read the port's sli4 capabilities.
This function may be be called from any context that can block-wait for the completion. The expectation is that this routine is called typically from probe_one or from the online routine.
Definition at line 8664 of file lpfc_init.c.
lpfc_pci_function_reset - Reset pci function. : pointer to lpfc hba data structure.
This routine is invoked to request a PCI function reset. It will destroys all resources assigned to the PCI function which originates this request.
Return codes 0 - successful -ENOMEM - No available memory -EIO - The mailbox failed to complete successfully.
Definition at line 7537 of file lpfc_init.c.
lpfc_post_buffer - Post IOCB(s) with DMA buffer descriptor(s) to a IOCB ring : pointer to lpfc hba data structure. : pointer to a IOCB ring. : the number of IOCBs to be posted to the IOCB ring.
This routine posts a given number of IOCBs with the associated DMA buffer descriptors specified by the cnt argument to the given IOCB ring.
Return codes The number of IOCBs NOT able to be posted to the IOCB ring.
Definition at line 2111 of file lpfc_init.c.
lpfc_reset_hba - Reset a hba : pointer to lpfc hba data structure.
This routine is invoked to reset a hba device. It brings the HBA offline, performs a board restart, and then brings the board back online. The lpfc_offline calls lpfc_sli_hba_down which will clean up on outstanding mailbox commands.
Definition at line 4545 of file lpfc_init.c.
lpfc_scan_finished - method for SCSI layer to detect whether scan is done : pointer to SCSI host data structure. : elapsed time of the scan in jiffies.
This routine is called by the SCSI layer with a SCSI host to determine whether the scan host is finished.
Note: there is no scan_start function as adapter initialization will have asynchronously kicked off the link initialization.
Return codes 0 - SCSI host scan is not over yet. 1 - SCSI host scan is over.
Definition at line 3193 of file lpfc_init.c.
|
read |
lpfc_sli4_cq_event_alloc - Allocate a completion-queue event from free pool : pointer to lpfc hba data structure.
This routine is the lock version of the API invoked to allocate a completion-queue event from the free pool.
Return: Pointer to the newly allocated completion-queue event if successful NULL otherwise.
Definition at line 7447 of file lpfc_init.c.
void lpfc_sli4_cq_event_release | ( | struct lpfc_hba * | phba, |
struct lpfc_cq_event * | cq_event | ||
) |
lpfc_sli4_cq_event_release - Release a completion-queue event to free pool : pointer to lpfc hba data structure. : pointer to the completion queue event to be freed.
This routine is the lock version of the API invoked to release a completion-queue event back into the free pool.
Definition at line 7482 of file lpfc_init.c.
|
read |
lpfc_sli4_create_rpi_hdr - Allocate an rpi header memory region : pointer to lpfc hba data structure.
This routine is invoked to allocate a single 4KB memory region to support rpis and stores them in the phba. This single region provides support for up to 64 rpis. The region is used globally by the device.
Returns: A valid rpi hdr on success. A NULL pointer on any failure.
Definition at line 5521 of file lpfc_init.c.
lpfc_sli4_fcf_redisc_event_proc - Process fcf table rediscovery event : pointer to lpfc hba data structure.
This routine is invoked by the worker thread to process FCF table rediscovery pending completion event.
Definition at line 4361 of file lpfc_init.c.
lpfc_sli4_fcf_redisc_wait_tmo - FCF table rediscover wait timeout : Map to lpfc_hba data structure pointer.
This routine is invoked when waiting for FCF table rediscover has been timed out. If new FCF record(s) has (have) been discovered during the wait period, a new FCF event shall be added to the FCOE async event list, and then worker thread shall be waked up for processing from the worker thread context.
Definition at line 3380 of file lpfc_init.c.
lpfc_sli4_get_els_iocb_cnt - Calculate the # of ELS IOCBs to reserve : pointer to lpfc hba data structure.
returns the number of ELS/CT IOCBs to reserve
Definition at line 9413 of file lpfc_init.c.
lpfc_sli4_init_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 port for those SLI4 ports that do not support extents. This routine posts a PAGE_SIZE memory region to the port to hold up to PAGE_SIZE modulo 64 rpi context headers. This is an initialization routine and should be called only when interrupts are disabled.
Return codes 0 - successful -ERROR - otherwise.
Definition at line 5485 of file lpfc_init.c.
lpfc_sli4_node_prep - Assign RPIs for active nodes. : pointer to lpfc hba data structure.
Allocate RPIs for all active remote nodes. This is needed whenever an SLI4 adapter is reset and the driver is not unloading. Its purpose is to fixup the temporary rpi assignments.
Definition at line 2592 of file lpfc_init.c.
lpfc_sli4_post_status_check - Wait for SLI4 POST done and check status : pointer to lpfc hba data structure.
This routine is invoked to wait for SLI4 device Power On Self Test (POST) done and check status.
Return 0 if successful, otherwise -ENODEV.
Definition at line 6066 of file lpfc_init.c.
lpfc_sli4_queue_create - Create all the SLI4 queues : pointer to lpfc hba data structure.
This routine is invoked to allocate all the SLI4 queues for the FCoE HBA operation. For each SLI4 queue type, the parameters such as queue entry count (queue depth) shall be taken from the module parameter. For now, we just use some constant number as place holder.
Return codes 0 - successful -ENOMEM - No availble memory -EIO - The mailbox failed to complete successfully.
Definition at line 6750 of file lpfc_init.c.
lpfc_sli4_queue_destroy - Destroy all the SLI4 queues : pointer to lpfc hba data structure.
This routine is invoked to release all the SLI4 queues with the FCoE HBA operation.
Return codes 0 - successful -ENOMEM - No available memory -EIO - The mailbox failed to complete successfully.
Definition at line 6947 of file lpfc_init.c.
lpfc_sli4_queue_setup - Set up all the SLI4 queues : pointer to lpfc hba data structure.
This routine is invoked to set up all the SLI4 queues for the FCoE HBA operation.
Return codes 0 - successful -ENOMEM - No available memory -EIO - The mailbox failed to complete successfully.
Definition at line 7046 of file lpfc_init.c.
lpfc_sli4_queue_unset - Unset all the SLI4 queues : pointer to lpfc hba data structure.
This routine is invoked to unset all the SLI4 queues with the FCoE HBA operation.
Return codes 0 - successful -ENOMEM - No available memory -EIO - The mailbox failed to complete successfully.
Definition at line 7324 of file lpfc_init.c.
lpfc_sli4_read_config - Get the config parameters. : pointer to lpfc hba data structure.
This routine is invoked to read the configuration parameters from the HBA. The configuration parameters are used to set the base and maximum values for RPI's XRI's VPI's VFI's and FCFIs. These values also affect the resource allocation for the port.
Return codes 0 - successful -ENOMEM - No available memory -EIO - The mailbox failed to complete successfully.
Definition at line 6420 of file lpfc_init.c.
lpfc_sli4_remove_rpi_hdrs - Remove all rpi header memory regions : pointer to lpfc hba data structure.
This routine is invoked to remove all memory resources allocated to support rpis for SLI4 ports not supporting extents. This routine presumes the caller has released all rpis consumed by fabric or port logins and is prepared to have the header pages removed.
Definition at line 5626 of file lpfc_init.c.
lpfc_sli4_stop_fcf_redisc_wait_timer - Stop FCF rediscovery wait timer : pointer to lpfc hba data structure.
This routine stops the SLI4 FCF rediscover wait timer if it's on. It checks whether the FCF rediscovery wait timer is pending with the host lock held before proceeding with disabling the timer and clearing the wait timer pendig flag.
Definition at line 2482 of file lpfc_init.c.
lpfc_sli4_xri_sgl_update - update xri-sgl sizing and mapping : pointer to lpfc hba data structure.
This routine first calculates the sizes of the current els and allocated scsi sgl lists, and then goes through all sgls to updates the physical XRIs assigned due to port function reset. During port initialization, the current els and allocated scsi sgl lists are 0s.
Return codes 0 - successful (for now, it always returns 0)
Definition at line 2871 of file lpfc_init.c.
lpfc_sli_port_speed_get - Get sli3 link speed code to link speed : pointer to lpfc hba data structure.
This routine is to get an SLI3 FC port's link speed in Mbps.
Return: link speed in terms of Mbps.
Definition at line 3519 of file lpfc_init.c.
lpfc_sli_probe_sriov_nr_virtfn - Enable a number of sr-iov virtual functions : pointer to lpfc hba data structure. : number of virtual functions to be enabled.
This function enables the PCI SR-IOV virtual functions to a physical function. It invokes the PCI SR-IOV api with the provided to enable the number of virtual functions to the physical function. As not all devices support SR-IOV, the return code from the pci_enable_sriov() API call does not considered as an error condition for most of the device.
Definition at line 4596 of file lpfc_init.c.
lpfc_sli_sriov_nr_virtfn_get - Get the number of sr-iov virtual functions : pointer to lpfc hba data structure.
This function enables the PCI SR-IOV virtual functions to a physical function. It invokes the PCI SR-IOV api with the provided to enable the number of virtual functions to the physical function. As not all devices support SR-IOV, the return code from the pci_enable_sriov() API call does not considered as an error condition for most of the device.
Definition at line 4570 of file lpfc_init.c.
void lpfc_stop_vport_timers | ( | struct lpfc_vport * | vport | ) |
lpfc_stop_vport_timers - Stop all the timers associated with a vport : pointer to a virtual N_Port data structure.
This routine stops all the timers associated with a . This function is invoked before disabling or deleting a . Note that the physical port is treated as 0.
Definition at line 2446 of file lpfc_init.c.
lpfc_unblock_mgmt_io - Mark a HBA's management interface to be not blocked : pointer to lpfc hba data structure.
This routine marks a HBA's management interface as not blocked. Once the HBA's management interface is marked as not blocked, all the user space access to the HBA, whether they are from sysfs interface or libdfc interface will be allowed. The HBA is set to block the management interface when the driver prepares the HBA interface for online or offline and then set to unblock the management interface afterwards.
Definition at line 2698 of file lpfc_init.c.
void lpfc_update_vport_wwn | ( | struct lpfc_vport * | vport | ) |
lpfc_update_vport_wwn - Updates the fc_nodename, fc_portname, cfg_soft_wwnn, cfg_soft_wwpn : pointer to lpfc vport data structure.
Return codes None.
Definition at line 323 of file lpfc_init.c.
MODULE_AUTHOR | ( | "Emulex Corporation - tech.support@emulex.com" | ) |
MODULE_DESCRIPTION | ( | LPFC_MODULE_DESC | ) |
MODULE_DEVICE_TABLE | ( | pci | , |
lpfc_id_table | |||
) |
module_exit | ( | lpfc_exit | ) |
module_init | ( | lpfc_init | ) |
MODULE_LICENSE | ( | "GPL" | ) |
MODULE_VERSION | ( | "0:" | LPFC_DRIVER_VERSION | ) |
char* _dump_buf_data |
Definition at line 55 of file lpfc_init.c.
unsigned long _dump_buf_data_order |
Definition at line 56 of file lpfc_init.c.
char* _dump_buf_dif |
Definition at line 57 of file lpfc_init.c.
unsigned long _dump_buf_dif_order |
Definition at line 58 of file lpfc_init.c.
spinlock_t _dump_buf_lock |
Definition at line 59 of file lpfc_init.c.