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

Go to the source code of this file.

Detailed Description

Details SLI port (sport) functions.

Definition in file ocs_sport.c.

Data Structures

struct  ocs_fdmi_get_cmd_results_t
 

Macros

#define std_sport_state_decl()
 Common SLI port state machine declarations and initialization. More...
 
#define sport_sm_trace(sport)
 Common SLI port state machine trace logging. More...
 

Functions

static void ocs_vport_update_spec (ocs_sport_t *sport)
 Save the virtual port's parameters. More...
 
static void ocs_vport_link_down (ocs_sport_t *sport)
 Clear the sport reference in the vport specification. More...
 
static void _ocs_sport_free (void *arg)
 Free a SLI port object. More...
 
void ocs_mgmt_sport_list (ocs_textbuf_t *textbuf, void *sport)
 
void ocs_mgmt_sport_get_all (ocs_textbuf_t *textbuf, void *sport)
 
int ocs_mgmt_sport_get (ocs_textbuf_t *textbuf, char *parent, char *name, void *sport)
 
int ocs_mgmt_sport_set (char *parent, char *name, char *value, void *sport)
 
int ocs_mgmt_sport_exec (char *parent, char *action, void *arg_in, uint32_t arg_in_length, void *arg_out, uint32_t arg_out_length, void *object)
 
static int32_t ocs_sport_fdmi_get_cmd (ocs_sport_t *sport, ocs_sport_exec_arg_t *sport_exec_args, uint32_t fdmi_cmd_code)
 send FDMI get command. More...
 
static void ocs_fdmi_get_cmd_cb (ocs_node_t *node, ocs_node_cb_t *node_data, void *cb_data)
 
int32_t ocs_port_cb (void *arg, ocs_hal_port_event_e event, void *data)
 SLI port HAL callback. More...
 
ocs_sport_t * ocs_sport_alloc (ocs_domain_t *domain, uint64_t wwpn, uint64_t wwnn, uint32_t fc_id, uint8_t enable_ini, uint8_t enable_tgt)
 Allocate a SLI port object. More...
 
void ocs_sport_free (ocs_sport_t *sport)
 
void ocs_sport_force_free (ocs_sport_t *sport)
 Free memory resources of a SLI port object. More...
 
ocs_sport_t * ocs_sport_get_instance (ocs_domain_t *domain, uint32_t index)
 Return a SLI port object, given an instance index. More...
 
ocs_sport_t * ocs_sport_find (ocs_domain_t *domain, uint32_t d_id)
 Find a SLI port object, given an FC_ID. More...
 
ocs_sport_t * ocs_sport_find_wwn (ocs_domain_t *domain, uint64_t wwnn, uint64_t wwpn)
 Find a SLI port, given the WWNN and WWPN. More...
 
int32_t ocs_sport_attach (ocs_sport_t *sport, uint32_t fc_id)
 Request a SLI port attach. More...
 
static void * __ocs_sport_common (const char *funcname, ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 SLI port state machine: Common event handler. More...
 
void * __ocs_sport_allocated (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 SLI port state machine: Physical sport allocated. More...
 
void * __ocs_sport_vport_init (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 SLI port state machine: Handle initial virtual port events. More...
 
void * __ocs_sport_vport_wait_alloc (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 SLI port state machine: Wait for the HAL SLI port allocation to complete. More...
 
void * __ocs_sport_vport_allocated (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 SLI port state machine: virtual sport allocated. More...
 
void * __ocs_sport_attached (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 SLI port state machine: Attached. More...
 
void * __ocs_sport_wait_shutdown (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 SLI port state machine: Wait for the node shutdowns to complete. More...
 
void * __ocs_sport_wait_port_free (ocs_sm_ctx_t *ctx, ocs_sm_event_t evt, void *arg)
 SLI port state machine: Wait for the HAL's port free to complete. More...
 
int32_t ocs_vport_start (ocs_domain_t *domain)
 Start the vports on a domain. More...
 
int32_t ocs_sport_vport_new (ocs_domain_t *domain, uint64_t wwpn, uint64_t wwnn, uint32_t fc_id, uint8_t ini, uint8_t tgt, void *tgt_data, void *ini_data, uint8_t restore_vport)
 Allocate a new virtual SLI port. More...
 
int32_t ocs_sport_vport_del (ocs_t *ocs, ocs_domain_t *domain, uint64_t wwpn, uint64_t wwnn)
 Remove a previously-allocated virtual port. More...
 
void ocs_vport_del_all (ocs_t *ocs)
 Force free all saved vports. More...
 
int ocs_ddump_sport (ocs_textbuf_t *textbuf, ocs_sli_port_t *sport)
 Generate a SLI port ddump. More...
 
void ocs_mgmt_sport_exec_cb (ocs_sport_t *sport, void *arg_in)
 
int8_t ocs_vport_create_spec (ocs_t *ocs, uint64_t wwnn, uint64_t wwpn, uint32_t fc_id, uint32_t enable_ini, uint32_t enable_tgt, void *tgt_data, void *ini_data)
 Create a saved vport entry. More...
 
static void and8 (uint8_t *a, uint8_t *b, uint8_t *c, uint32_t n)
 Perform the AND operation on source vectors. More...
 
int ocs_sparm_cmp (uint8_t *sp1, uint8_t *sp2)
 Compare service parameters. More...
 
ocs_node_group_dir_t * ocs_node_group_dir_alloc (ocs_sport_t *sport, uint8_t *sparms)
 Allocate a node group directory entry. More...
 
void ocs_node_group_dir_free (ocs_node_group_dir_t *node_group_dir)
 Free a node group directory entry. More...
 
ocs_node_group_dir_t * ocs_node_group_dir_find (ocs_sport_t *sport, uint8_t *sparms)
 Find a matching node group directory entry. More...
 
ocs_remote_node_group_t * ocs_remote_node_group_alloc (ocs_node_group_dir_t *node_group_dir)
 Allocate a remote node group object. More...
 
void ocs_remote_node_group_free (ocs_remote_node_group_t *node_group)
 Free a remote node group object. More...
 
int ocs_node_group_init (ocs_node_t *node)
 Initialize a node for high login mode. More...
 
void ocs_sport_nodes_shutdown (ocs_t *ocs, ocs_sport_t *sport)
 Shutdown all remote nodes of sport. More...
 

Variables

static ocs_mgmt_functions_t sport_mgmt_functions
 
static fc_sparms_t sparms_cmp_mask
 Service parameters mask data. More...
 

Macro Details

#define sport_sm_trace (   sport)
Value:
do { \
ocs_log_debug(ocs, "[%s] %-20s\n", sport->display_name, 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

Common SLI port state machine trace logging.

Definition at line 473 of file ocs_sport.c.

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

Common SLI port state machine declarations and initialization.

Definition at line 456 of file ocs_sport.c.

Function Details

static void* __ocs_sport_common ( const char *  funcname,
ocs_sm_ctx_t *  ctx,
ocs_sm_event_t  evt,
void *  arg 
)
static

SLI port state machine: Common event handler.

Description
Handle common sport events.
Parameters
funcnameFunction name to display.
ctxSport state machine context.
evtEvent to process.
argPer event optional argument.
Returns
Returns NULL.

Definition at line 495 of file ocs_sport.c.

static void and8 ( uint8_t *  a,
uint8_t *  b,
uint8_t *  c,
uint32_t  n 
)
static

Perform the AND operation on source vectors.

Description
Performs an AND operation on the 8-bit values in source vectors b and c. The resulting value is stored in a.
Parameters
aDestination-byte vector.
bSource-byte vector.
cSource-byte vector.
nByte count.
Returns
None.

Definition at line 1770 of file ocs_sport.c.

static void ocs_fdmi_get_cmd_cb ( ocs_node_t *  node,
ocs_node_cb_t *  node_data,
void *  cb_data 
)
static

Definition at line 1459 of file ocs_sport.c.

int ocs_mgmt_sport_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 1620 of file ocs_sport.c.

void ocs_mgmt_sport_exec_cb ( ocs_sport_t *  sport,
void *  arg_in 
)

Definition at line 1608 of file ocs_sport.c.

int ocs_mgmt_sport_get ( ocs_textbuf_t *  textbuf,
char *  parent,
char *  name,
void *  sport 
)

Definition at line 1314 of file ocs_sport.c.

void ocs_mgmt_sport_get_all ( ocs_textbuf_t *  textbuf,
void *  sport 
)

Definition at line 1388 of file ocs_sport.c.

void ocs_mgmt_sport_list ( ocs_textbuf_t *  textbuf,
void *  sport 
)

Definition at line 1276 of file ocs_sport.c.

int ocs_mgmt_sport_set ( char *  parent,
char *  name,
char *  value,
void *  sport 
)

Definition at line 1420 of file ocs_sport.c.

ocs_node_group_dir_t* ocs_node_group_dir_alloc ( ocs_sport_t *  sport,
uint8_t *  sparms 
)

Allocate a node group directory entry.

Description
A node group directory entry is allocated, initialized, and added to the sport's node group directory list.
Parameters
sportPointer to the sport object.
sparmsPointer to the service parameters.
Returns
Returns a pointer to the allocated ocs_node_group_dir_t; or NULL.

Definition at line 1843 of file ocs_sport.c.

ocs_node_group_dir_t* ocs_node_group_dir_find ( ocs_sport_t *  sport,
uint8_t *  sparms 
)

Find a matching node group directory entry.

Description
The sport's node group directory list is searched for a matching set of service parameters. The first matching entry is returned; otherwise NULL is returned.
Parameters
sportPointer to the sport object.
sparmsPointer to the sparams to match.
Returns
Returns a pointer to the first matching entry found; or NULL.

Definition at line 1912 of file ocs_sport.c.

void ocs_node_group_dir_free ( ocs_node_group_dir_t *  node_group_dir)

Free a node group directory entry.

Description
The node group directory entry node_group_dir is removed from the sport's node group directory list and freed.
Parameters
node_group_dirPointer to the node group directory entry.
Returns
None.

Definition at line 1880 of file ocs_sport.c.

int ocs_node_group_init ( ocs_node_t *  node)

Initialize a node for high login mode.

Description
The node is initialized for high login mode. The following steps are performed:
  1. The sports node group directory is searched for a matching set of service parameters.
  2. If a matching set is not found, a node group directory entry is allocated.
  3. If less than the hlm_group_size number of remote node group objects is present in the node group directory, a new remote node group object is allocated and added to the list.
  4. A remote node group object is selected, and the node is attached to the node group.
Parameters
nodePointer to the node.
Returns
Returns 0 on success, or a negative error value on failure.

Definition at line 2042 of file ocs_sport.c.

ocs_remote_node_group_t* ocs_remote_node_group_alloc ( ocs_node_group_dir_t *  node_group_dir)

Allocate a remote node group object.

Description
A remote node group object is allocated, initialized, and placed on the node group list of node_group_dir. The HAL remote node group alloc function is called.
Parameters
node_group_dirPointer to the node group directory.
Returns
Returns a pointer to the allocated remote node group object; or NULL.

Definition at line 1940 of file ocs_sport.c.

void ocs_remote_node_group_free ( ocs_remote_node_group_t *  node_group)

Free a remote node group object.

Description
The remote node group object node_group is removed from its node group directory entry and freed.
Parameters
node_groupPointer to the remote node group object.
Returns
None.

Definition at line 1995 of file ocs_sport.c.

int ocs_sparm_cmp ( uint8_t *  sp1,
uint8_t *  sp2 
)

Compare service parameters.

Description
Returns 0 if the two service parameters are the same, excluding the port/node name elements.
Parameters
sp1Pointer to service parameters 1.
sp2Pointer to service parameters 2.
Returns
Returns 0 if parameters match; otherwise, returns a positive or negative value, depending on the arithmetic magnitude of the first mismatching byte.

Definition at line 1814 of file ocs_sport.c.

static int32_t ocs_sport_fdmi_get_cmd ( ocs_sport_t *  sport,
ocs_sport_exec_arg_t *  sport_exec_args,
uint32_t  fdmi_cmd_code 
)
static

send FDMI get command.

Parameters
sport: Pointer to sport
in_buf,:input buffer
in_buf_len,:input buffer length
buf,:User provided buffer to copy HBA lists info
buf_len,:user buffer length
fdmi_cmd_code,:FDMI command code
Returns
Returns 0 on success, or a negative value on failure.

Definition at line 1520 of file ocs_sport.c.

void ocs_sport_free ( ocs_sport_t *  sport)

Definition at line 280 of file ocs_sport.c.

void ocs_sport_nodes_shutdown ( ocs_t *  ocs,
ocs_sport_t *  sport 
)

Shutdown all remote nodes of sport.

Definition at line 2124 of file ocs_sport.c.

int8_t ocs_vport_create_spec ( ocs_t *  ocs,
uint64_t  wwnn,
uint64_t  wwpn,
uint32_t  fc_id,
uint32_t  enable_ini,
uint32_t  enable_tgt,
void *  tgt_data,
void *  ini_data 
)

Create a saved vport entry.

A saved vport entry is added to the vport list, which is restored following a link up. This function is used to allow vports to be created the first time the link comes up without having to go through the ioctl() API.

Parameters
ocsPointer to device context.
wwnnWorld wide node name (may be zero for auto-select).
wwpnWorld wide port name (may be zero for auto-select).
fc_idRequested port ID (used in fabric emulation mode).
enable_iniTRUE if vport is to be an initiator port.
enable_tgtTRUE if vport is to be a target port.
tgt_dataPointer to target specific data.
ini_dataPointer to initiator specific data.
Returns
None.

Definition at line 1716 of file ocs_sport.c.

void ocs_vport_del_all ( ocs_t *  ocs)

Force free all saved vports.

Description
Delete all device vports.
Parameters
ocsPointer to the device object.
Returns
None.

Definition at line 1175 of file ocs_sport.c.

static void ocs_vport_update_spec ( ocs_sport_t *  sport)
static

Save the virtual port's parameters.

Description
The information required to restore a virtual port is saved.
Parameters
sportPointer to the sport context.
Returns
None.

Definition at line 1677 of file ocs_sport.c.

Variable Details

fc_sparms_t sparms_cmp_mask
static
Initial value:
= {
0,
0,
{~0, ~0, ~0, ~0},
0,
0,
0,
0,
{~0, ~0, ~0, ~0},
{~0, ~0, ~0, ~0},
{~0, ~0, ~0, ~0},
{~0, ~0, ~0, ~0},
{~0, ~0, ~0, ~0}}

Service parameters mask data.

Definition at line 1785 of file ocs_sport.c.

ocs_mgmt_functions_t sport_mgmt_functions
static
Initial value:
= {
.get_list_handler = ocs_mgmt_sport_list,
.get_handler = ocs_mgmt_sport_get,
.get_all_handler = ocs_mgmt_sport_get_all,
.set_handler = ocs_mgmt_sport_set,
.exec_handler = ocs_mgmt_sport_exec,
}
int ocs_mgmt_sport_set(char *parent, char *name, char *value, void *sport)
Definition: ocs_sport.c:1420
void ocs_mgmt_sport_get_all(ocs_textbuf_t *textbuf, void *sport)
Definition: ocs_sport.c:1388
int ocs_mgmt_sport_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_sport.c:1620
int ocs_mgmt_sport_get(ocs_textbuf_t *textbuf, char *parent, char *name, void *sport)
Definition: ocs_sport.c:1314
void ocs_mgmt_sport_list(ocs_textbuf_t *textbuf, void *sport)
Definition: ocs_sport.c:1276

Definition at line 60 of file ocs_sport.c.