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

Go to the source code of this file.

Detailed Description

Handles the domain object callback from the HAL.

Definition in file ocs_domain.c.

Macros

#define domain_sm_trace(domain)
 
#define domain_trace(domain, fmt,...)
 
#define domain_printf(domain, fmt,...)
 
#define std_domain_state_decl(...)
 

Functions

void ocs_mgmt_domain_list (ocs_textbuf_t *textbuf, void *domain)
 
void ocs_mgmt_domain_get_all (ocs_textbuf_t *textbuf, void *domain)
 
int ocs_mgmt_domain_get (ocs_textbuf_t *textbuf, char *parent, char *name, void *domain)
 
int ocs_mgmt_domain_set (char *parent, char *name, char *value, void *domain)
 
int ocs_mgmt_domain_exec (char *parent, char *action, void *arg_in, uint32_t arg_in_length, void *arg_out, uint32_t arg_out_length, void *object)
 
int32_t ocs_domain_cb (void *arg, ocs_hal_domain_event_e event, void *data)
 Accept domain callback events from the HAL. More...
 
ocs_domain_t * ocs_domain_find (ocs_t *ocs, uint64_t fcf_wwn)
 Find the domain, given its FCF_WWN. More...
 
ocs_domain_t * ocs_domain_alloc (ocs_t *ocs, uint64_t fcf_wwn)
 Allocate a domain object. More...
 
void ocs_domain_free (ocs_domain_t *domain)
 Free a domain object. More...
 
void ocs_domain_force_free (ocs_domain_t *domain)
 Free memory resources of a domain object. More...
 
void ocs_unregister_domain_list_empty_cb (ocs_t *ocs)
 Unregister a callback for the domain_list empty cb. More...
 
void ocs_register_domain_list_empty_cb (ocs_t *ocs)
 Register a callback when the domain_list goes empty. More...
 
ocs_domain_t * ocs_domain_get_instance (ocs_t *ocs, uint32_t index)
 Return a pointer to the domain, given the instance index. More...
 
static void * __ocs_domain_common (const char *funcname, ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 Domain state machine: Common event handler. More...
 
static void * __ocs_domain_common_shutdown (const char *funcname, ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 Domain state machine: Common shutdown. More...
 
void * __ocs_domain_init (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 Domain state machine: Initial state. More...
 
void * __ocs_domain_wait_alloc (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 Domain state machine: Wait for the domain allocation to complete. More...
 
void * __ocs_domain_allocated (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 Domain state machine: Wait for the domain attach request. More...
 
void * __ocs_domain_wait_attach (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 Domain state machine: Wait for the HAL domain attach to complete. More...
 
void * __ocs_domain_ready (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 Domain state machine: Ready state. More...
 
void * __ocs_domain_wait_sports_free (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 Domain state machine: Wait for nodes to free prior to the domain shutdown. More...
 
void * __ocs_domain_wait_shutdown (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 Domain state machine: Complete the domain shutdown. More...
 
void * __ocs_domain_wait_domain_lost (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 Domain state machine: Wait for the domain alloc/attach completion after receiving a domain lost. More...
 
void ocs_domain_save_sparms (ocs_domain_t *domain, void *payload)
 Save the port's service parameters. More...
 
void __ocs_domain_attach_internal (ocs_domain_t *domain, uint32_t s_id)
 Initiator domain attach. (internal call only) More...
 
void ocs_domain_attach (ocs_domain_t *domain, uint32_t s_id)
 Initiator domain attach. More...
 
int ocs_domain_post_event (ocs_domain_t *domain, ocs_sm_event_t event, void *arg)
 
uint64_t ocs_get_wwn (ocs_hal_t *hal, ocs_hal_property_e prop)
 Return the WWN as a uint64_t. More...
 
int ocs_ddump_domain (ocs_textbuf_t *textbuf, ocs_domain_t *domain)
 Generate a domain ddump. More...
 
void ocs_mgmt_domain_exec_cb (ocs_domain_t *domain, void *arg_in)
 

Variables

static ocs_mgmt_functions_t domain_mgmt_functions
 

Macro Details

#define domain_printf (   domain,
  fmt,
  ... 
)
Value:
do { \
ocs_log_info(domain ? domain->ocs : NULL, fmt, ##__VA_ARGS__); \
} while (0)
const char const char * fmt
Definition: ocs_ddump.h:54

Definition at line 60 of file ocs_domain.c.

#define domain_sm_trace (   domain)
Value:
do { \
if (OCS_LOG_ENABLE_DOMAIN_SM_TRACE(domain->ocs)) \
ocs_log_info(domain->ocs, "[domain] %-20s %-20s\n", __func__, ocs_sm_event_name(evt)); \
} while (0)
#define OCS_LOG_ENABLE_DOMAIN_SM_TRACE(ocs)
Definition: ocs_debug.h:74
const char * ocs_sm_event_name(ocs_sm_event_t evt)
Definition: ocs_sm.c:92

Definition at line 48 of file ocs_domain.c.

#define domain_trace (   domain,
  fmt,
  ... 
)
Value:
do { \
if (OCS_LOG_ENABLE_DOMAIN_SM_TRACE(domain ? domain->ocs : NULL)) \
ocs_log_info(domain ? domain->ocs : NULL, fmt, ##__VA_ARGS__); \
} while (0)
#define OCS_LOG_ENABLE_DOMAIN_SM_TRACE(ocs)
Definition: ocs_debug.h:74
const char const char * fmt
Definition: ocs_ddump.h:54

Definition at line 54 of file ocs_domain.c.

#define std_domain_state_decl (   ...)
Value:
ocs_domain_t *domain = NULL; \
ocs_t *ocs = NULL; \
ocs_assert(ctx, NULL); \
ocs_assert(ctx->app, NULL); \
domain = ctx->app; \
ocs_assert(domain->ocs, NULL); \
ocs = domain->ocs; \
ocs_assert(ocs->xport, NULL);
#define ocs_assert(cond,...)
Definition: ocs_debug.h:176

Definition at line 511 of file ocs_domain.c.

Function Details

void __ocs_domain_attach_internal ( ocs_domain_t *  domain,
uint32_t  s_id 
)

Initiator domain attach. (internal call only)

Assumes that the domain SM lock is already locked

Description

The HAL domain attach function is started.

Parameters
domainPointer to the domain object.
s_idFC_ID of which to register this domain.
Returns
None.

Definition at line 1280 of file ocs_domain.c.

int ocs_ddump_domain ( ocs_textbuf_t *  textbuf,
ocs_domain_t *  domain 
)

Generate a domain ddump.

Description

Generates a domain ddump.

Parameters
textbufPointer to the text buffer.
domainPointer to the domain context.
Returns
Returns 0 on success, or a negative value on failure.

Definition at line 1376 of file ocs_domain.c.

ocs_domain_t* ocs_domain_alloc ( ocs_t *  ocs,
uint64_t  fcf_wwn 
)

Allocate a domain object.

Description

A domain object is allocated and initialized. It is associated with the ocs argument.

Parameters
ocsPointer to the OCS device.
fcf_wwnFCF WWN of the domain.
Returns
Returns a pointer to the ocs_domain_t object; or NULL.

Definition at line 218 of file ocs_domain.c.

void ocs_domain_attach ( ocs_domain_t *  domain,
uint32_t  s_id 
)

Initiator domain attach.

Description

The HAL domain attach function is started.

Parameters
domainPointer to the domain object.
s_idFC_ID of which to register this domain.
Returns
None.

Definition at line 1299 of file ocs_domain.c.

int32_t ocs_domain_cb ( void *  arg,
ocs_hal_domain_event_e  event,
void *  data 
)

Accept domain callback events from the HAL.

Description

HAL calls this function with various domain-related events.

Parameters
argApplication-specified argument.
eventDomain event.
dataEvent specific data.
Returns
Returns 0 on success; or a negative error value on failure.

Definition at line 94 of file ocs_domain.c.

ocs_domain_t* ocs_domain_find ( ocs_t *  ocs,
uint64_t  fcf_wwn 
)

Find the domain, given its FCF_WWN.

Description

Search the domain_list to find a matching domain object.

Parameters
ocsPointer to the OCS device.
fcf_wwnFCF WWN to find.
Returns
Returns the pointer to the domain if found; or NULL otherwise.

Definition at line 189 of file ocs_domain.c.

void ocs_domain_force_free ( ocs_domain_t *  domain)

Free memory resources of a domain object.

Description

After the domain object is freed, its child objects are also freed.

Parameters
domainPointer to a domain object.
Returns
None.

Definition at line 341 of file ocs_domain.c.

void ocs_domain_free ( ocs_domain_t *  domain)

Free a domain object.

Description

The domain object is freed.

Parameters
domainDomain object to free.
Returns
None.

Definition at line 279 of file ocs_domain.c.

ocs_domain_t* ocs_domain_get_instance ( ocs_t *  ocs,
uint32_t  index 
)

Return a pointer to the domain, given the instance index.

Description

A pointer to the domain context, given by the index, is returned.

Parameters
ocsPointer to the driver instance context.
indexInstance index.
Returns
Returns a pointer to the domain; or NULL.

Definition at line 414 of file ocs_domain.c.

int ocs_domain_post_event ( ocs_domain_t *  domain,
ocs_sm_event_t  event,
void *  arg 
)

Definition at line 1307 of file ocs_domain.c.

void ocs_domain_save_sparms ( ocs_domain_t *  domain,
void *  payload 
)

Save the port's service parameters.

Description

Service parameters from the fabric FLOGI are saved in the domain's flogi_service_params array.

Parameters
domainPointer to the domain.
payloadService parameters to save.
Returns
None.

Definition at line 1261 of file ocs_domain.c.

uint64_t ocs_get_wwn ( ocs_hal_t *  hal,
ocs_hal_property_e  prop 
)

Return the WWN as a uint64_t.

Description

Calls the HAL property function for the WWNN or WWPN, and returns the value as a uint64_t.

Parameters
halPointer to the HAL object.
propHAL property.
Returns
Returns uint64_t request value.

Definition at line 1349 of file ocs_domain.c.

int ocs_mgmt_domain_exec ( char *  parent,
char *  action,
void *  arg_in,
uint32_t  arg_in_length,
void *  arg_out,
uint32_t  arg_out_length,
void *  object 
)

Definition at line 1617 of file ocs_domain.c.

void ocs_mgmt_domain_exec_cb ( ocs_domain_t *  domain,
void *  arg_in 
)

Definition at line 1603 of file ocs_domain.c.

int ocs_mgmt_domain_get ( ocs_textbuf_t *  textbuf,
char *  parent,
char *  name,
void *  domain 
)

Definition at line 1457 of file ocs_domain.c.

void ocs_mgmt_domain_get_all ( ocs_textbuf_t *  textbuf,
void *  domain 
)

Definition at line 1531 of file ocs_domain.c.

void ocs_mgmt_domain_list ( ocs_textbuf_t *  textbuf,
void *  domain 
)

Definition at line 1421 of file ocs_domain.c.

int ocs_mgmt_domain_set ( char *  parent,
char *  name,
char *  value,
void *  domain 
)

Definition at line 1565 of file ocs_domain.c.

void ocs_register_domain_list_empty_cb ( ocs_t *  ocs)

Register a callback when the domain_list goes empty.

Description

A function callback may be registered when the domain_list goes empty.

Parameters
ocsPointer to a device object.
Returns
None.

Definition at line 389 of file ocs_domain.c.

void ocs_unregister_domain_list_empty_cb ( ocs_t *  ocs)

Unregister a callback for the domain_list empty cb.

Description

A function callback may be unregistered when the domain_list goes empty.

Parameters
ocsPointer to a device object.
Returns
None.

Definition at line 370 of file ocs_domain.c.

Variable Details

ocs_mgmt_functions_t domain_mgmt_functions
static
Initial value:
= {
.get_list_handler = ocs_mgmt_domain_list,
.get_handler = ocs_mgmt_domain_get,
.get_all_handler = ocs_mgmt_domain_get_all,
.set_handler = ocs_mgmt_domain_set,
.exec_handler = ocs_mgmt_domain_exec,
}
void ocs_mgmt_domain_get_all(ocs_textbuf_t *textbuf, void *domain)
Definition: ocs_domain.c:1531
int ocs_mgmt_domain_get(ocs_textbuf_t *textbuf, char *parent, char *name, void *domain)
Definition: ocs_domain.c:1457
void ocs_mgmt_domain_list(ocs_textbuf_t *textbuf, void *domain)
Definition: ocs_domain.c:1421
int ocs_mgmt_domain_exec(char *parent, char *action, void *arg_in, uint32_t arg_in_length, void *arg_out, uint32_t arg_out_length, void *object)
Definition: ocs_domain.c:1617
int ocs_mgmt_domain_set(char *parent, char *name, char *value, void *domain)
Definition: ocs_domain.c:1565

Definition at line 72 of file ocs_domain.c.