Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_recovery.c File Reference
#include "ocs.h"
#include "ocs_recovery.h"

Go to the source code of this file.

Functions

static void ocs_adapter_event_processing (ocs_t *ocs, bool port_reset, bool start)
 Handle the EQ processing for all the ocs instances of the adapter. More...
 
static void ocs_adapter_hal_inactive (ocs_t *ocs, bool port_reset)
 Set OCS HAL state to inactive for all the ocs instances of the adapter. More...
 
static void ocs_adapter_sport_shutdown (ocs_t *ocs, bool port_reset)
 Shutdown sport(s) for all the ocs instances of the adapter. More...
 
static void ocs_adapter_xport_shutdown (ocs_t *ocs, bool port_reset)
 Shutdown xport(s) for all the ocs instances of the adapter. More...
 
static int32_t ocs_adapter_xport_online (ocs_t *ocs, bool port_reset)
 Bring the links online. More...
 
void ocs_fw_err_recovery_stop (void)
 Stop FW error recovery thread. More...
 
static void ocs_recovery_state_set (uint32_t state)
 Set recovery state. More...
 
static int32_t ocs_recovery_state_check (uint32_t state)
 Check recovery state. More...
 
void ocs_fw_dump_state_set (ocs_t *ocs, uint32_t state)
 Set fW dump state. More...
 
static int32_t ocs_fw_dump_save (ocs_t *ocs, uint8_t dump_level)
 Save dump data to OCS buffer; saved_buff will be copied to the user space buffer when an application requests for it. More...
 
static int32_t ocs_fw_dump_req (ocs_t *ocs, uint8_t dump_level)
 Request FW dump. More...
 
int32_t ocs_recovery_reset (ocs_t *ocs, uint32_t reset_mode, uint8_t dump_level, bool trigger_dump)
 Initiate FW dump and do reset. More...
 
static int32_t ocs_initiate_gendump (ocs_t *ocs, uint8_t dump_level)
 
int32_t ocs_gendump (ocs_t *ocs, uint8_t dump_level)
 
static int32_t ocs_fw_dump_ready_wait (ocs_t *ocs, uint8_t dump_state)
 Waits for FW_DUMP_PRESENT flag to be set in fw_dump.flags context, and if recovery is started, waits for recovery completion. More...
 
static int32_t ocs_fw_dump_copy_to_user (ocs_t *ocs, uint8_t *user_buff, uint32_t user_buflen, uint8_t dump_state)
 Copy dump buffers to user space buffer. More...
 
int32_t ocs_dump_to_host (ocs_t *ocs, void *buf, uint32_t buflen, uint8_t dump_level)
 Create a Lancer dump into a memory buffer. More...
 
static int32_t ocs_adapter_recover (ocs_t *ocs, uint32_t mode)
 Recover adapter from chip error. More...
 
static int32_t ocs_recovery_thread (ocs_thread_t *th)
 OCS FW error recovery thread. More...
 
int32_t ocs_fw_err_recovery_setup (void)
 Create a FW error recovery thread. More...
 
void ocs_fw_dump_init (ocs_t *ocs, int32_t fw_dump_type)
 Initialize fw dump context. More...
 

Variables

ocs_fw_error_recovery_t ocs_recovery
 

Function Details

static void ocs_adapter_event_processing ( ocs_t *  ocs,
bool  port_reset,
bool  start 
)
static

Handle the EQ processing for all the ocs instances of the adapter.

Definition at line 42 of file ocs_recovery.c.

static void ocs_adapter_hal_inactive ( ocs_t *  ocs,
bool  port_reset 
)
static

Set OCS HAL state to inactive for all the ocs instances of the adapter.

Definition at line 74 of file ocs_recovery.c.

static int32_t ocs_adapter_recover ( ocs_t *  ocs,
uint32_t  mode 
)
static

Recover adapter from chip error.

Definition at line 650 of file ocs_recovery.c.

static void ocs_adapter_sport_shutdown ( ocs_t *  ocs,
bool  port_reset 
)
static

Shutdown sport(s) for all the ocs instances of the adapter.

Definition at line 99 of file ocs_recovery.c.

static int32_t ocs_adapter_xport_online ( ocs_t *  ocs,
bool  port_reset 
)
static

Bring the links online.

Definition at line 159 of file ocs_recovery.c.

static void ocs_adapter_xport_shutdown ( ocs_t *  ocs,
bool  port_reset 
)
static

Shutdown xport(s) for all the ocs instances of the adapter.

Definition at line 133 of file ocs_recovery.c.

int32_t ocs_dump_to_host ( ocs_t *  ocs,
void *  buf,
uint32_t  buflen,
uint8_t  dump_level 
)

Create a Lancer dump into a memory buffer.

Description
This function creates a DMA buffer to hold a Lancer dump, sets the dump location to point to that buffer, then calls ocs_gen_dump to cause a dump to be transfered to the buffer. After the dump is complete it copies the dump to the provided user space buffer.
Parameters
ocsPointer to ocs structure
bufUser space buffer in which to store the dump
buflenLength of the user buffer in bytes
dump_levelGendump request level can be either chip-level or fdb
Returns
Returns 0 on success, non-zero on error.

Definition at line 581 of file ocs_recovery.c.

static int32_t ocs_fw_dump_copy_to_user ( ocs_t *  ocs,
uint8_t *  user_buff,
uint32_t  user_buflen,
uint8_t  dump_state 
)
inlinestatic

Copy dump buffers to user space buffer.

Definition at line 544 of file ocs_recovery.c.

void ocs_fw_dump_init ( ocs_t *  ocs,
int32_t  fw_dump_type 
)

Initialize fw dump context.

Definition at line 762 of file ocs_recovery.c.

static int32_t ocs_fw_dump_ready_wait ( ocs_t *  ocs,
uint8_t  dump_state 
)
static

Waits for FW_DUMP_PRESENT flag to be set in fw_dump.flags context, and if recovery is started, waits for recovery completion.

Returns
returns 0 for success, a negative error code value for failure

Definition at line 503 of file ocs_recovery.c.

static int32_t ocs_fw_dump_req ( ocs_t *  ocs,
uint8_t  dump_level 
)
static

Request FW dump.

Parameters
ocsPointer to ocs instance
dump_levelGendump request level can be either chip-level or fdb
Returns
OCS_FW_DUMP_STATUS_SUCCESS on success, OCS_FW_DUMP_STATUS_IN_PROGRESS if dump is already in progress, or OCS_FW_DUMP_STATUS_FAILED on failure.

Definition at line 324 of file ocs_recovery.c.

static int32_t ocs_fw_dump_save ( ocs_t *  ocs,
uint8_t  dump_level 
)
static

Save dump data to OCS buffer; saved_buff will be copied to the user space buffer when an application requests for it.

Definition at line 263 of file ocs_recovery.c.

void ocs_fw_dump_state_set ( ocs_t *  ocs,
uint32_t  state 
)

Set fW dump state.

Returns
void

Definition at line 231 of file ocs_recovery.c.

int32_t ocs_fw_err_recovery_setup ( void  )

Create a FW error recovery thread.

Returns
returns 0 for success, a negative error code value for failure.

Definition at line 742 of file ocs_recovery.c.

void ocs_fw_err_recovery_stop ( void  )

Stop FW error recovery thread.

Returns
void

Definition at line 191 of file ocs_recovery.c.

int32_t ocs_gendump ( ocs_t *  ocs,
uint8_t  dump_level 
)

Definition at line 480 of file ocs_recovery.c.

static int32_t ocs_initiate_gendump ( ocs_t *  ocs,
uint8_t  dump_level 
)
static

If FW dump exists already due to recovery processs, return it. Else, do gendump and reset the adapter.

Definition at line 450 of file ocs_recovery.c.

int32_t ocs_recovery_reset ( ocs_t *  ocs,
uint32_t  reset_mode,
uint8_t  dump_level,
bool  trigger_dump 
)

Initiate FW dump and do reset.

Parameters
ocsPointer to ocs instance
reset_modeGendump request mode can be auto-recovery / manual / port-migration
dump_levelGendump request level can be either chip-level or fdb
trigger_dumpTrigger FW dump
Returns
OCS_RECOVERY_STATUS_SUCCESS on success, OCS_RECOVERY_STATUS_IN_PROGRESS if recovery is already in progress, or OCS_RECOVERY_STATUS_FAILED on failure.

Definition at line 361 of file ocs_recovery.c.

static int32_t ocs_recovery_state_check ( uint32_t  state)
static

Check recovery state.

Returns
TRUE if the state matches, FALSE otherwise

Definition at line 213 of file ocs_recovery.c.

static void ocs_recovery_state_set ( uint32_t  state)
static

Set recovery state.

Definition at line 201 of file ocs_recovery.c.

Variable Details

Definition at line 37 of file ocs_recovery.c.