Emulex Logo
OneCoreā„¢ Storage SDK Release 11.2
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ocs_login.h File Reference

Go to the source code of this file.

Detailed Description

Defines the iSCSI Login interface functions.

This module will queue requests when insufficent resources exist to send the request immediately.

Definition in file ocs_login.h.

Data Structures

struct  ocs_login_key_def_t
 Defines the fields required to track the login keys during negotiation. More...
 

Macros

#define KEY_FLAG_SEND_INI   (1 << 0) /* specifies the sender of the key */
 
#define KEY_FLAG_SEND_TGT   (1 << 1)
 
#define KEY_FLAG_SEND_BOTH   (KEY_FLAG_SEND_INI | KEY_FLAG_SEND_TGT)
 
#define KEY_FLAG_PHASE_SEC   (1 << 2) /* specifies the valid phases for the key */
 
#define KEY_FLAG_PHASE_OPER   (1 << 3)
 
#define KEY_FLAG_PHASE_FFP   (1 << 4)
 
#define KEY_FLAG_PHASE_SEC_OPER   (KEY_FLAG_PHASE_SEC | KEY_FLAG_PHASE_OPER)
 
#define KEY_FLAG_PHASE_ALL   (KEY_FLAG_PHASE_SEC | KEY_FLAG_PHASE_OPER | KEY_FLAG_PHASE_FFP)
 
#define KEY_FLAG_USE_LEADING   (1 << 5) /* Valid on leading login only */
 
#define KEY_FLAG_USE_LOGIN   (1 << 6) /* Valid on any login */
 
#define KEY_FLAG_VALID_DISC   (1 << 7) /* Valid on discovery sessions */
 
#define KEY_FLAG_NEGOTIATE   (1 << 8) /* This code should automatically negotiate the key */
 
#define KEY_FLAG_DEFAULT   (1 << 9) /* Value is default, negotiation not required */
 
#define KEY_FLAG_ALLOW_MULTI   (1 << 10) /* do not error if key is sent multiple times */
 
#define KEY_FLAG_ALLOW_LARGE   (1 << 11) /* do not error if key value is > 255 characters */
 
#define OCS_LOGIN_ERROR_WRONG_STATE   -10
 
#define OCS_LOGIN_ERROR_VIRT_ARRAY_TOO_SMALL   -11
 
#define OCS_LOGIN_REQUEST_QUEUED   -12
 
#define OCS_LOGIN_NO_QUEUING_RESOURCES   -13
 

Enumerations

enum  ocs_login_key_t {
  KEY_SESSION_TYPE, KEY_INITIATOR_NAME, KEY_TARGET_NAME, KEY_TARGET_ADDRESS,
  KEY_INITIATOR_ALIAS, KEY_TARGET_ALIAS, KEY_TARGET_PORTAL_GROUP_TAG, KEY_AUTH_METHOD,
  KEY_HEADER_DIGEST, KEY_DATA_DIGEST, KEY_MAX_CONNECTIONS, KEY_SEND_TARGETS,
  KEY_INITIAL_R2T, KEY_IMMEDIATE_DATA, KEY_MAX_RECV_DATA_SEGMENT_LEN, KEY_MAX_BURST_LENGTH,
  KEY_FIRST_BURST_LENGTH, KEY_DEFAULT_TIME_2_WAIT, KEY_DEFAULT_TIME_2_RETAIN, KEY_MAX_OUTSTANDING_R2T,
  KEY_DATA_PDU_IN_ORDER, KEY_DATA_SEQUENCE_IN_ORDER, KEY_ERROR_RECOVERY_LEVEL, KEY_TASK_REPORTING,
  KEY_OF_MARKER, KEY_IF_MARKER, KEY_OF_MARK_INT, KEY_IF_MARK_INT,
  KEY_CHAP_ALGORITHM, KEY_CHAP_IDENTIFIER, KEY_CHAP_CHALLENGE, KEY_CHAP_NAME,
  KEY_CHAP_RESPONSE, KEY_MAX
}
 enum identifying valid login keys. More...
 
enum  ocs_chap_state_e {
  OCS_CHAP_STATE_NOT_SELECTED, OCS_CHAP_STATE_CHAP_SELECTED, OCS_CHAP_STATE_WAIT_FOR_ALGORITHIM, OCS_CHAP_STATE_SENT_CHALLENGE_REQ,
  OCS_CHAP_STATE_SENT_CHALLENGE_RSP, OCS_CHAP_STATE_COMPLETE
}
 Defines the state of the CHAP negotiation. More...
 

Functions

int32_t ocs_iscsi_login_initialize (ocs_iscsi_t *iscsi)
 Initialize the login and retry object used within the login module. More...
 
void ocs_iscsi_login_teardown (ocs_iscsi_t *iscsi)
 Releases the login and retry object used within the login module. More...
 
ocs_hal_rtn_e ocs_iscsi_login_cxn_cleanup (ocs_cxn_t *cxn)
 Frees any retry objects for the connection. More...
 
void ocs_iscsi_login_retry (ocs_cxn_t *cxn)
 Attempt to start a request on the retry queue. More...
 
int32_t ocs_iscsi_send_login (ocs_cxn_t *cxn, bool is_discovery, char *tgt_name)
 Function to send an initial login PDU. More...
 
ocs_pdu_process_rtn_e ocs_iscsi_recv_login (ocs_cxn_t *cxn, ocs_hal_rq_buffer_t *hdr, uint32_t hdr_len, ocs_hal_rq_buffer_t *data, uint32_t data_len)
 Function to process a login PDU on a target. More...
 
int32_t ocs_iscsi_send_login_rsp_invalid_during_login (ocs_cxn_t *cxn, uint32_t itt)
 Function to send an login Response PDU (invalid during login). More...
 
int32_t ocs_iscsi_recv_login_rsp (ocs_cxn_t *cxn, ocs_hal_rq_buffer_t *hdr, uint32_t hdr_len, ocs_hal_rq_buffer_t *data, uint32_t data_len)
 Function to process a login response PDU. More...
 
void ocs_iscsi_ffp_text_timeout (void *arg)
 This function is called to check for stalled text negotiations for a connection on a target. More...
 
ocs_pdu_process_rtn_e ocs_iscsi_recv_text (ocs_cxn_t *cxn, ocs_hal_rq_buffer_t *hdr, uint32_t hdr_len, ocs_hal_rq_buffer_t *data, uint32_t data_len, uint8_t *reject_reason)
 Function to process a text PDU. More...
 
int32_t ocs_iscsi_send_logout (ocs_cxn_t *cxn, uint8_t immediate, uint8_t reason_code)
 Function to send a logout PDU. More...
 
ocs_pdu_process_rtn_e ocs_iscsi_recv_logout (ocs_cxn_t *cxn, ocs_hal_rq_buffer_t *hdr, uint32_t hdr_len)
 Function to process a logout PDU. More...
 
int32_t ocs_iscsi_send_logout_rsp (ocs_cxn_t *cxn, uint8_t response, uint32_t itt)
 Function to send a logout response PDU. More...
 
int32_t ocs_iscsi_recv_logout_rsp (ocs_cxn_t *cxn, ocs_hal_rq_buffer_t *hdr, uint32_t hdr_len)
 Handle logout response from a target. More...
 
int32_t ocs_iscsi_send_nop_out (ocs_cxn_t *cxn, uint64_t lun, uint32_t itt, uint32_t ttt, char *data_ptr, uint32_t data_len)
 Send NOP-Out from an initiator. More...
 
int32_t ocs_iscsi_send_nop_in (ocs_cxn_t *cxn, uint64_t lun, uint32_t itt, uint32_t ttt, char *data_ptr, uint32_t data_len)
 Send NOP-In from a target. More...
 
int32_t ocs_iscsi_recv_nop_in (ocs_cxn_t *cxn, ocs_hal_rq_buffer_t *hdr, uint32_t hdr_len, ocs_hal_rq_buffer_t *data, uint32_t data_len)
 Handle NOP-IN from a target. More...
 
ocs_pdu_process_rtn_e ocs_iscsi_recv_nop_out (ocs_cxn_t *cxn, ocs_hal_rq_buffer_t *hdr, uint32_t hdr_len, ocs_hal_rq_buffer_t *data, uint32_t data_len)
 Handle NOP-OUT from an initiator. More...
 
int32_t ocs_iscsi_send_reject (ocs_cxn_t *cxn, void *hdr, uint32_t hdr_len, uint8_t reason)
 Sends a reject PDU for the supplied PDU header. More...
 
int32_t ocs_iscsi_send_async (ocs_cxn_t *cxn, void *payload, uint32_t payload_len, uint8_t reason, uint64_t lun, uint16_t param1, uint16_t param2, uint16_t param3)
 Sends a asynchronous PDU with an optional payload. More...
 
int32_t ocs_iscsi_are_login_reqs_outstanding (ocs_cxn_t *cxn)
 Checks to see if there are any retry or login IOs active on a connection. More...
 
void ocs_iscsi_cbit_cleanup (ocs_cxn_t *cxn)
 Sends the login parameters to the firmware. More...
 

Variables

const ocs_login_key_def_t ocs_login_key_defs []
 

Macro Details

#define KEY_FLAG_ALLOW_LARGE   (1 << 11) /* do not error if key value is > 255 characters */

Definition at line 59 of file ocs_login.h.

#define KEY_FLAG_ALLOW_MULTI   (1 << 10) /* do not error if key is sent multiple times */

Definition at line 58 of file ocs_login.h.

#define KEY_FLAG_DEFAULT   (1 << 9) /* Value is default, negotiation not required */

Definition at line 57 of file ocs_login.h.

#define KEY_FLAG_NEGOTIATE   (1 << 8) /* This code should automatically negotiate the key */

Definition at line 56 of file ocs_login.h.

#define KEY_FLAG_PHASE_ALL   (KEY_FLAG_PHASE_SEC | KEY_FLAG_PHASE_OPER | KEY_FLAG_PHASE_FFP)

Definition at line 52 of file ocs_login.h.

#define KEY_FLAG_PHASE_FFP   (1 << 4)

Definition at line 50 of file ocs_login.h.

#define KEY_FLAG_PHASE_OPER   (1 << 3)

Definition at line 49 of file ocs_login.h.

#define KEY_FLAG_PHASE_SEC   (1 << 2) /* specifies the valid phases for the key */

Definition at line 48 of file ocs_login.h.

#define KEY_FLAG_PHASE_SEC_OPER   (KEY_FLAG_PHASE_SEC | KEY_FLAG_PHASE_OPER)

Definition at line 51 of file ocs_login.h.

#define KEY_FLAG_SEND_BOTH   (KEY_FLAG_SEND_INI | KEY_FLAG_SEND_TGT)

Definition at line 47 of file ocs_login.h.

#define KEY_FLAG_SEND_INI   (1 << 0) /* specifies the sender of the key */

Definition at line 45 of file ocs_login.h.

#define KEY_FLAG_SEND_TGT   (1 << 1)

Definition at line 46 of file ocs_login.h.

#define KEY_FLAG_USE_LEADING   (1 << 5) /* Valid on leading login only */

Definition at line 53 of file ocs_login.h.

#define KEY_FLAG_USE_LOGIN   (1 << 6) /* Valid on any login */

Definition at line 54 of file ocs_login.h.

#define KEY_FLAG_VALID_DISC   (1 << 7) /* Valid on discovery sessions */

Definition at line 55 of file ocs_login.h.

#define OCS_LOGIN_ERROR_VIRT_ARRAY_TOO_SMALL   -11

Definition at line 133 of file ocs_login.h.

#define OCS_LOGIN_ERROR_WRONG_STATE   -10

Definition at line 132 of file ocs_login.h.

#define OCS_LOGIN_NO_QUEUING_RESOURCES   -13

Definition at line 135 of file ocs_login.h.

#define OCS_LOGIN_REQUEST_QUEUED   -12

Definition at line 134 of file ocs_login.h.

Enumeration Details

Defines the state of the CHAP negotiation.

Enumerator
OCS_CHAP_STATE_NOT_SELECTED 
OCS_CHAP_STATE_CHAP_SELECTED 
OCS_CHAP_STATE_WAIT_FOR_ALGORITHIM 
OCS_CHAP_STATE_SENT_CHALLENGE_REQ 
OCS_CHAP_STATE_SENT_CHALLENGE_RSP 
OCS_CHAP_STATE_COMPLETE 

Definition at line 112 of file ocs_login.h.

enum identifying valid login keys.

Enumerator
KEY_SESSION_TYPE 
KEY_INITIATOR_NAME 
KEY_TARGET_NAME 
KEY_TARGET_ADDRESS 
KEY_INITIATOR_ALIAS 
KEY_TARGET_ALIAS 
KEY_TARGET_PORTAL_GROUP_TAG 
KEY_AUTH_METHOD 
KEY_HEADER_DIGEST 
KEY_DATA_DIGEST 
KEY_MAX_CONNECTIONS 
KEY_SEND_TARGETS 
KEY_INITIAL_R2T 
KEY_IMMEDIATE_DATA 
KEY_MAX_RECV_DATA_SEGMENT_LEN 
KEY_MAX_BURST_LENGTH 
KEY_FIRST_BURST_LENGTH 
KEY_DEFAULT_TIME_2_WAIT 
KEY_DEFAULT_TIME_2_RETAIN 
KEY_MAX_OUTSTANDING_R2T 
KEY_DATA_PDU_IN_ORDER 
KEY_DATA_SEQUENCE_IN_ORDER 
KEY_ERROR_RECOVERY_LEVEL 
KEY_TASK_REPORTING 
KEY_OF_MARKER 
KEY_IF_MARKER 
KEY_OF_MARK_INT 
KEY_IF_MARK_INT 
KEY_CHAP_ALGORITHM 
KEY_CHAP_IDENTIFIER 
KEY_CHAP_CHALLENGE 
KEY_CHAP_NAME 
KEY_CHAP_RESPONSE 
KEY_MAX 

Definition at line 64 of file ocs_login.h.

Function Details

void ocs_iscsi_ffp_text_timeout ( void *  arg)

This function is called to check for stalled text negotiations for a connection on a target.

Parameters
argPointer to the connection object.

Definition at line 3496 of file ocs_login.c.

int32_t ocs_iscsi_send_async ( ocs_cxn_t *  cxn,
void *  payload,
uint32_t  payload_len,
uint8_t  reason,
uint64_t  lun,
uint16_t  param1,
uint16_t  param2,
uint16_t  param3 
)

Sends a asynchronous PDU with an optional payload.

Parameters
cxnPointer to the connection object.
payloadVirtual memory containing the payload to send.
payload_lenLength of the payload to send.
reasonThe iSCSI asynchronous reason.
lunSCSI LUN.
param1Parameter 1 in the asynchronous PDU.
param2Parameter 2 in the asynchronous PDU.
param3Parameter 3 in the asynchronous PDU.
Returns
Returns 0 on success.

Definition at line 4792 of file ocs_login.c.

int32_t ocs_iscsi_send_login ( ocs_cxn_t *  cxn,
bool  is_discovery,
char *  tgt_name 
)

Function to send an initial login PDU.

Parameters
cxnPointer to the connection object.
is_discoveryTRUE for a discovery session.
tgt_nameTarget name for a normal session.
Returns
Returns 0 on success.

Definition at line 3182 of file ocs_login.c.

int32_t ocs_iscsi_send_login_rsp_invalid_during_login ( ocs_cxn_t *  cxn,
uint32_t  itt 
)

Function to send an login Response PDU (invalid during login).

Parameters
cxnPointer to the connection object.
ittInitiator task tag of the received PDU.
Returns
Returns 0 on success.

Definition at line 2815 of file ocs_login.c.

int32_t ocs_iscsi_send_reject ( ocs_cxn_t *  cxn,
void *  hdr,
uint32_t  hdr_len,
uint8_t  reason 
)

Sends a reject PDU for the supplied PDU header.

Parameters
cxnPointer to the connection object.
hdrVirtual memory information for the rejected header.
hdr_lenLength of the header received.
reasonThe iSCSI reject reason.
Returns
Returns 0 on success.

Definition at line 4652 of file ocs_login.c.

Variable Details

const ocs_login_key_def_t ocs_login_key_defs[]

Definition at line 58 of file ocs_login.c.