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

Go to the source code of this file.

Detailed Description

Code to handle unsolicited received FC frames.

Definition in file ocs_unsol.c.

Macros

#define frame_printf(ocs, hdr, fmt,...)
 
#define OCS_MAX_FRAMES_BEFORE_YEILDING   10000
 

Functions

static int32_t ocs_unsol_process (ocs_t *ocs, ocs_hal_sequence_t *seq)
 Handle unsolicited FC frames. More...
 
static int32_t ocs_dispatch_fcp_cmd (ocs_node_t *node, ocs_hal_sequence_t *seq)
 Dispatch unsolicited FCP_CMND frame. More...
 
static int32_t ocs_dispatch_tow_fcp_cmd (ocs_node_t *node, ocs_hal_sequence_t *seq)
 Dispatch unsolicited FCP_CMND frame. More...
 
static int32_t ocs_dispatch_fcp_data (ocs_node_t *node, ocs_hal_sequence_t *seq)
 Dispatch FCP data frames for TOW. More...
 
static uint32_t ocs_fc_decode_lun (uint8_t *lu)
 Decode a LU Number according to SAM. More...
 
static int32_t ocs_domain_dispatch_frame (void *arg, ocs_hal_sequence_t *seq)
 Dispatch unsolicited FC frame. More...
 
static int32_t ocs_node_dispatch_frame (void *arg, ocs_hal_sequence_t *seq)
 Dispatch a frame. More...
 
static int32_t ocs_fc_tmf_rejected_cb (ocs_io_t *io, ocs_scsi_io_status_e scsi_status, uint32_t flags, void *arg)
 Handle the callback for the TMF FUNCTION_REJECTED response. More...
 
static uint8_t ocs_node_frames_held (void *arg)
 Check if node's pending frames are held. More...
 
static uint8_t ocs_domain_frames_held (void *arg)
 Check if domain's pending frames are held. More...
 
static int32_t ocs_purge_pending (ocs_t *ocs, ocs_list_t *pend_list, ocs_lock_t *list_lock)
 Purge given pending list. More...
 
static int32_t ocs_sframe_send_task_set_full_or_busy (ocs_node_t *node, ocs_hal_sequence_t *seq)
 Send task set full response. More...
 
ocs_hal_sequence_t * ocs_frame_next (ocs_list_t *pend_list, ocs_lock_t *list_lock)
 Return next FC frame on node->pend_frames list. More...
 
int32_t ocs_unsol_rq_thread (ocs_thread_t *mythread)
 Process the RQ circular buffer and process the incoming frames. More...
 
static int32_t ocs_unsol_abort_cb (ocs_hal_io_t *hio, ocs_remote_node_t *rnode, uint32_t len, int32_t status, uint32_t ext, void *arg)
 Callback function when aborting a port owned XRI exchanges. More...
 
static void ocs_port_owned_abort (ocs_t *ocs, ocs_hal_io_t *hio)
 Abort either a RQ Pair auto XFER RDY XRI. More...
 
int32_t ocs_unsolicited_cb (void *arg, ocs_hal_sequence_t *seq)
 Handle unsolicited FC frames. More...
 
int32_t ocs_process_node_pending (ocs_node_t *node)
 Process pending frames queued to the given node. More...
 
int32_t ocs_domain_process_pending (ocs_domain_t *domain)
 Process pending frames queued to the given domain. More...
 
int32_t ocs_node_purge_pending (ocs_node_t *node)
 Purge node's pending (queued) frames. More...
 
int32_t ocs_domain_purge_pending (ocs_domain_t *domain)
 Purge xport's pending (queued) frames. More...
 
void ocs_domain_hold_frames (ocs_domain_t *domain)
 Globally (at xport level) hold unsolicited frames. More...
 
void ocs_domain_accept_frames (ocs_domain_t *domain)
 Clear hold on unsolicited frames. More...
 
static void ocs_dispatch_unsolicited_tmf (ocs_io_t *io, uint8_t task_management_flags, ocs_node_t *node, uint32_t lun)
 Dispatch unsolicited FCP frames (RQ Pair). More...
 
static int32_t ocs_validate_fcp_cmd (ocs_t *ocs, ocs_hal_sequence_t *seq)
 
static void ocs_populate_io_fcp_cmd (ocs_io_t *io, fcp_cmnd_iu_t *cmnd, fc_header_t *fchdr, uint8_t sit)
 
static uint32_t ocs_get_flags_fcp_cmd (fcp_cmnd_iu_t *cmnd)
 
static void ocs_sframe_common_send_cb (void *arg, uint8_t *cqe, int32_t status)
 Process send fcp response frame callback. More...
 
static int32_t ocs_sframe_common_send (ocs_node_t *node, ocs_hal_sequence_t *seq, uint8_t r_ctl, uint8_t info, uint32_t f_ctl, uint8_t type, void *payload, uint32_t payload_len)
 Send a frame, common code. More...
 
static int32_t ocs_sframe_send_fcp_rsp (ocs_node_t *node, ocs_hal_sequence_t *seq, void *rsp, uint32_t rsp_len)
 Send FCP response using SEND_FRAME. More...
 
int32_t ocs_sframe_send_bls_acc (ocs_node_t *node, ocs_hal_sequence_t *seq)
 Send BA_ACC using sent frame. More...
 

Macro Details

#define frame_printf (   ocs,
  hdr,
  fmt,
  ... 
)
Value:
do { \
char s_id_text[16]; \
ocs_node_fcid_display(fc_be24toh((hdr)->s_id), s_id_text, sizeof(s_id_text)); \
ocs_log_debug(ocs, "[%06x.%s] %02x/%04x/%04x: " fmt, fc_be24toh((hdr)->d_id), s_id_text, \
(hdr)->r_ctl, ocs_be16toh((hdr)->ox_id), ocs_be16toh((hdr)->rx_id), ##__VA_ARGS__); \
} while(0)
void ocs_node_fcid_display(uint32_t fc_id, char *buffer, uint32_t buffer_length)
Generate text for a node's fc_id.
Definition: ocs_node.c:719
static uint32_t fc_be24toh(uint32_t x)
Definition: ocs_fcp.h:143
const char const char * fmt
Definition: ocs_ddump.h:54

Definition at line 49 of file ocs_unsol.c.

#define OCS_MAX_FRAMES_BEFORE_YEILDING   10000

Definition at line 71 of file ocs_unsol.c.

Function Details

ocs_hal_sequence_t * ocs_frame_next ( ocs_list_t *  pend_list,
ocs_lock_t *  list_lock 
)

Return next FC frame on node->pend_frames list.

The next FC frame on the node->pend_frames list is returned, or NULL if the list is empty.

Parameters
pend_listPending list to be purged.
list_lockLock that protects pending list.
Returns
Returns pointer to the next FC frame, or NULL if the pending frame list is empty.

Definition at line 1248 of file ocs_unsol.c.

static uint32_t ocs_get_flags_fcp_cmd ( fcp_cmnd_iu_t *  cmnd)
static

Definition at line 850 of file ocs_unsol.c.

static void ocs_populate_io_fcp_cmd ( ocs_io_t *  io,
fcp_cmnd_iu_t *  cmnd,
fc_header_t *  fchdr,
uint8_t  sit 
)
static

Definition at line 826 of file ocs_unsol.c.

static int32_t ocs_sframe_common_send ( ocs_node_t *  node,
ocs_hal_sequence_t *  seq,
uint8_t  r_ctl,
uint8_t  info,
uint32_t  f_ctl,
uint8_t  type,
void *  payload,
uint32_t  payload_len 
)
static

Send a frame, common code.

A frame is sent using SEND_FRAME, the R_CTL/F_CTL/TYPE may be specified, the payload is sent as a single frame.

Memory resources are allocated from RQ buffers contained in the passed in sequence data.

Parameters
nodePointer to node object.
seqPointer to sequence object.
r_ctlR_CTL value to place in FC header.
infoINFO value to place in FC header.
f_ctlF_CTL value to place in FC header.
typeTYPE value to place in FC header.
payloadPointer to payload data
payload_lenLength of payload in bytes.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 1303 of file ocs_unsol.c.

static void ocs_sframe_common_send_cb ( void *  arg,
uint8_t *  cqe,
int32_t  status 
)
static

Process send fcp response frame callback.

The function is called when the send FCP response posting has completed. Regardless of the outcome, the sequence is freed.

Parameters
argPointer to originator frame sequence.
cqePointer to completion queue entry.
statusStatus of operation.
Returns
None.

Definition at line 1271 of file ocs_unsol.c.

int32_t ocs_sframe_send_bls_acc ( ocs_node_t *  node,
ocs_hal_sequence_t *  seq 
)

Send BA_ACC using sent frame.

A BA_ACC is sent using SEND_FRAME

Parameters
nodePointer to node object.
seqPointer to originator frame sequence.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 1450 of file ocs_unsol.c.

static int32_t ocs_sframe_send_fcp_rsp ( ocs_node_t *  node,
ocs_hal_sequence_t *  seq,
void *  rsp,
uint32_t  rsp_len 
)
static

Send FCP response using SEND_FRAME.

The FCP response is send using the SEND_FRAME function.

Parameters
nodePointer to node object.
seqPointer to inbound sequence.
rspPointer to response data.
rsp_lenLength of response data, in bytes.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 1387 of file ocs_unsol.c.

static int32_t ocs_sframe_send_task_set_full_or_busy ( ocs_node_t *  node,
ocs_hal_sequence_t *  seq 
)
static

Send task set full response.

Return a task set full or busy response using send frame.

Parameters
nodePointer to node object.
seqPointer to originator frame sequence.
Returns
Returns 0 on success, or a negative error code value on failure.

Definition at line 1411 of file ocs_unsol.c.

int32_t ocs_unsol_rq_thread ( ocs_thread_t *  mythread)

Process the RQ circular buffer and process the incoming frames.

Parameters
mythreadPointer to thread object.
Returns
Returns 0 on success, or a non-zero value on failure.

Definition at line 81 of file ocs_unsol.c.

static int32_t ocs_validate_fcp_cmd ( ocs_t *  ocs,
ocs_hal_sequence_t *  seq 
)
static

Definition at line 803 of file ocs_unsol.c.