srp.h File Reference

SCSI RDMA Protocol. More...

#include <stdint.h>
#include <byteswap.h>
#include <gpxe/iobuf.h>
#include <gpxe/xfer.h>
#include <gpxe/scsi.h>

Go to the source code of this file.

Data Structures

struct  srp_tag
 An SRP information unit tag. More...
struct  srp_port_id
 An SRP port ID. More...
struct  srp_port_ids
 An SRP port ID pair. More...
struct  srp_common
 SRP information unit common fields. More...
struct  srp_login_req
 An SRP login request information unit. More...
struct  srp_login_rsp
 An SRP login response. More...
struct  srp_login_rej
 An SRP login rejection. More...
struct  srp_i_logout
 An SRP initiator logout request. More...
struct  srp_t_logout
 An SRP target logout request. More...
struct  srp_tsk_mgmt
 An SRP task management request. More...
struct  srp_cmd
 An SRP SCSI command. More...
struct  srp_memory_descriptor
 An SRP memory descriptor. More...
struct  srp_rsp
 An SRP SCSI response. More...
struct  srp_cred_req
 An SRP credit request. More...
struct  srp_cred_rsp
 An SRP credit response. More...
struct  srp_aer_req
 An SRP asynchronous event request. More...
struct  srp_aer_rsp
 An SRP asynchronous event response. More...
struct  srp_transport_type
 An SRP transport type. More...
struct  srp_device
 An SRP device. More...

Defines

#define SRP_LOGIN_REQ   0x00
 Type of an SRP login request.
#define SRP_LOGIN_REQ_FMT_IDBD   0x04
 Require indirect data buffer descriptor format.
#define SRP_LOGIN_REQ_FMT_DDBD   0x02
 Require direct data buffer descriptor format.
#define SRP_LOGIN_REQ_FLAG_AESOLNT   0x40
 Use solicited notification for asynchronous events.
#define SRP_LOGIN_REQ_FLAG_CRSOLNT   0x20
 Use solicited notification for credit request.
#define SRP_LOGIN_REQ_FLAG_LOSOLNT   0x10
 Use solicited notification for logouts.
#define SRP_LOGIN_REQ_MCA_MASK   0x03
 Multi-channel action mask.
#define SRP_LOGIN_REQ_MCA_SINGLE_CHANNEL   0x00
 Single RDMA channel operation.
#define SRP_LOGIN_REQ_MCA_MULTIPLE_CHANNELS   0x01
 Multiple independent RDMA channel operation.
#define SRP_LOGIN_RSP   0xc0
 Type of an SRP login response.
#define SRP_LOGIN_RSP_FMT_IDBD   0x04
 Indirect data buffer descriptor format supported.
#define SRP_LOGIN_RSP_FMT_DDBD   0x02
 Direct data buffer descriptor format supported.
#define SRP_LOGIN_RSP_FLAG_SOLNTSUP   0x10
 Solicited notification is supported.
#define SRP_LOGIN_RSP_MCR_MASK   0x03
 Multi-channel result mask.
#define SRP_LOGIN_RSP_MCR_NO_EXISTING_CHANNELS   0x00
 No existing RDMA channels were associated with the same I_T nexus.
#define SRP_LOGIN_RSP_MCR_EXISTING_CHANNELS_TERMINATED   0x01
 One or more existing RDMA channels were terminated.
#define SRP_LOGIN_RSP_MCR_EXISTING_CHANNELS_CONTINUE   0x02
 One or more existing RDMA channels continue to operate independently.
#define SRP_LOGIN_REJ   0xc2
 Type of an SRP login rejection.
#define SRP_LOGIN_REJ_REASON_UNKNOWN   0x00010000UL
 Unable to establish RDMA channel, no reason specified.
#define SRP_LOGIN_REJ_REASON_INSUFFICIENT_RESOURCES   0x00010001UL
 Insufficient RDMA channel resources.
#define SRP_LOGIN_REJ_REASON_BAD_MAX_I_T_IU_LEN   0x00010002UL
 Requested maximum initiator to target IU length value too large.
#define SRP_LOGIN_REJ_REASON_CANNOT_ASSOCIATE   0x00010003UL
 Unable to associate RDMA channel with specified I_T nexus.
#define SRP_LOGIN_REJ_REASON_UNSUPPORTED_BUFFER_FORMAT   0x00010004UL
 One or more requested data buffer descriptor formats are not supported.
#define SRP_LOGIN_REJ_REASON_NO_MULTIPLE_CHANNELS   0x00010005UL
 SRP target port does not support multiple RDMA channels per I_T nexus.
#define SRP_LOGIN_REJ_REASON_NO_MORE_CHANNELS   0x00010006UL
 RDMA channel limit reached for this initiator.
#define SRP_LOGIN_REJ_FMT_IDBD   0x04
 Indirect data buffer descriptor format supported.
#define SRP_LOGIN_REJ_FMT_DDBD   0x02
 Direct data buffer descriptor format supported.
#define SRP_I_LOGOUT   0x03
 Type of an SRP initiator logout request.
#define SRP_T_LOGOUT   0x80
 Type of an SRP target logout request.
#define SRP_T_LOGOUT_FLAG_SOLNT   0x01
 The initiator specified solicited notification of logouts.
#define SRP_T_LOGOUT_REASON_UNKNOWN   0x00000000UL
 No reason specified.
#define SRP_T_LOGOUT_REASON_INACTIVE   0x00000001UL
 Inactive RDMA channel (reclaiming resources).
#define SRP_T_LOGOUT_REASON_INVALID_TYPE   0x00000002UL
 Invalid information unit type code received by SRP target port.
#define SRP_T_LOGOUT_REASON_SPURIOUS_RESPONSE   0x00000003UL
 SRP initiator port sent response with no corresponding request.
#define SRP_T_LOGOUT_REASON_MCA   0x00000004UL
 RDMA channel disconnected due to multi-channel action code in new login.
#define SRP_T_LOGOUT_UNSUPPORTED_DATA_OUT_FORMAT   0x00000005UL
 Unsuppported format code value specified in data-out buffer descriptor.
#define SRP_T_LOGOUT_UNSUPPORTED_DATA_IN_FORMAT   0x00000006UL
 Unsuppported format code value specified in data-in buffer descriptor.
#define SRP_T_LOGOUT_INVALID_IU_LEN   0x00000008UL
 Invalid length for IU type.
#define SRP_TSK_MGMT   0x01
 Type of an SRP task management request.
#define SRP_TSK_MGMT_FLAG_UCSOLNT   0x04
 Use solicited notification for unsuccessful completions.
#define SRP_TSK_MGMT_FLAG_SCSOLNT   0x02
 Use solicited notification for successful completions.
#define SRP_TSK_MGMT_FUNC_ABORT_TASK   0x01
 The task manager shall perform an ABORT TASK function.
#define SRP_TSK_MGMT_FUNC_ABORT_TASK_SET   0x02
 The task manager shall perform an ABORT TASK SET function.
#define SRP_TSK_MGMT_FUNC_CLEAR_TASK_SET   0x04
 The task manager shall perform a CLEAR TASK SET function.
#define SRP_TSK_MGMT_FUNC_LOGICAL_UNIT_RESET   0x08
 The task manager shall perform a LOGICAL UNIT RESET function.
#define SRP_TSK_MGMT_FUNC_CLEAR_ACA   0x40
 The task manager shall perform a CLEAR ACA function.
#define SRP_CMD   0x02
 Type of an SRP SCSI command.
#define SRP_CMD_FLAG_UCSOLNT   0x04
 Use solicited notification for unsuccessful completions.
#define SRP_CMD_FLAG_SCSOLNT   0x02
 Use solicited notification for successful completions.
#define SRP_CMD_DO_FMT_MASK   0xf0
 Data-out buffer format mask.
#define SRP_CMD_DO_FMT_DIRECT   0x10
 Direct data-out buffer format.
#define SRP_CMD_DO_FMT_INDIRECT   0x20
 Indirect data-out buffer format.
#define SRP_CMD_DI_FMT_MASK   0x0f
 Data-in buffer format mask.
#define SRP_CMD_DI_FMT_DIRECT   0x01
 Direct data-in buffer format.
#define SRP_CMD_DI_FMT_INDIRECT   0x02
 Indirect data-in buffer format.
#define SRP_CMD_TASK_ATTR_SIMPLE   0x00
 Use the rules for a simple task attribute.
#define SRP_CMD_TASK_ATTR_QUEUE_HEAD   0x01
 Use the rules for a head of queue task attribute.
#define SRP_CMD_TASK_ATTR_ORDERED   0x02
 Use the rules for an ordered task attribute.
#define SRP_CMD_TASK_ATTR_AUTOMATIC_CONTINGENT_ALLEGIANCE   0x08
 Use the rules for an automatic contingent allegiance task attribute.
#define SRP_RSP   0xc1
 Type of an SRP SCSI response.
#define SRP_RSP_FLAG_SOLNT   0x01
 The initiator specified solicited notification of this response.
#define SRP_RSP_VALID_DIUNDER   0x20
 Data-in residual count field is valid and represents an underflow.
#define SRP_RSP_VALID_DIOVER   0x10
 Data-in residual count field is valid and represents an overflow.
#define SRP_RSP_VALID_DOUNDER   0x08
 Data-out residual count field is valid and represents an underflow.
#define SRP_RSP_VALID_DOOVER   0x04
 Data-out residual count field is valid and represents an overflow.
#define SRP_RSP_VALID_SNSVALID   0x02
 Sense data list length field is valid.
#define SRP_RSP_VALID_RSPVALID   0x01
 Response data list length field is valid.
#define SRP_CRED_REQ   0x81
 Type of an SRP credit request.
#define SRP_CRED_REQ_FLAG_SOLNT   0x01
 The initiator specified solicited notification of credit requests.
#define SRP_CRED_RSP   0x41
 Type of an SRP credit response.
#define SRP_AER_REQ   0x82
 Type of an SRP asynchronous event request.
#define SRP_AER_REQ_FLAG_SOLNT   0x01
 The initiator specified solicited notification of asynchronous events.
#define SRP_AER_RSP   0x42
 Type of an SRP asynchronous event response.
#define SRP_MAX_I_T_IU_LEN   80
 Maximum length of any initiator-to-target IU that we will send.
#define SRP_MAX_RETRIES   3
 Maximum number of SRP retry attempts.

Enumerations

enum  srp_state { SRP_STATE_SOCKET_OPEN = 0x0001, SRP_STATE_LOGGED_IN = 0x0002 }
 SRP state flags. More...

Functions

 FILE_LICENCE (BSD2)
static void * srp_rsp_response_data (struct srp_rsp *rsp)
 Get response data portion of SCSI response.
static size_t srp_rsp_response_data_len (struct srp_rsp *rsp)
 Get length of response data portion of SCSI response.
static void * srp_rsp_sense_data (struct srp_rsp *rsp)
 Get sense data portion of SCSI response.
static size_t srp_rsp_sense_data_len (struct srp_rsp *rsp)
 Get length of sense data portion of SCSI response.
static __always_inline void * srp_aer_req_sense_data (struct srp_aer_req *aer_req)
 Get sense data portion of asynchronous event request.
static __always_inline size_t srp_aer_req_sense_data_len (struct srp_aer_req *aer_req)
 Get length of sense data portion of asynchronous event request.
static __always_inline void * srp_transport_priv (struct srp_device *srp)
 Get SRP transport private data.
int srp_attach (struct scsi_device *scsi, const char *root_path)
 Attach SRP device.
void srp_detach (struct scsi_device *scsi)
 Detach SRP device.

Variables

struct srp_tag packed
 An SRP information unit tag.


Detailed Description

SCSI RDMA Protocol.

Definition in file srp.h.


Define Documentation

#define SRP_LOGIN_REQ   0x00

Type of an SRP login request.

Definition at line 95 of file srp.h.

Referenced by srp_login().

#define SRP_LOGIN_REQ_FMT_IDBD   0x04

Require indirect data buffer descriptor format.

Definition at line 98 of file srp.h.

#define SRP_LOGIN_REQ_FMT_DDBD   0x02

Require direct data buffer descriptor format.

Definition at line 101 of file srp.h.

Referenced by srp_login().

#define SRP_LOGIN_REQ_FLAG_AESOLNT   0x40

Use solicited notification for asynchronous events.

Definition at line 104 of file srp.h.

#define SRP_LOGIN_REQ_FLAG_CRSOLNT   0x20

Use solicited notification for credit request.

Definition at line 107 of file srp.h.

#define SRP_LOGIN_REQ_FLAG_LOSOLNT   0x10

Use solicited notification for logouts.

Definition at line 110 of file srp.h.

#define SRP_LOGIN_REQ_MCA_MASK   0x03

Multi-channel action mask.

Definition at line 113 of file srp.h.

#define SRP_LOGIN_REQ_MCA_SINGLE_CHANNEL   0x00

Single RDMA channel operation.

Definition at line 116 of file srp.h.

#define SRP_LOGIN_REQ_MCA_MULTIPLE_CHANNELS   0x01

Multiple independent RDMA channel operation.

Definition at line 119 of file srp.h.

#define SRP_LOGIN_RSP   0xc0

Type of an SRP login response.

Definition at line 163 of file srp.h.

Referenced by srp_xfer_deliver_iob().

#define SRP_LOGIN_RSP_FMT_IDBD   0x04

Indirect data buffer descriptor format supported.

Definition at line 166 of file srp.h.

#define SRP_LOGIN_RSP_FMT_DDBD   0x02

Direct data buffer descriptor format supported.

Definition at line 169 of file srp.h.

#define SRP_LOGIN_RSP_FLAG_SOLNTSUP   0x10

Solicited notification is supported.

Definition at line 172 of file srp.h.

#define SRP_LOGIN_RSP_MCR_MASK   0x03

Multi-channel result mask.

Definition at line 175 of file srp.h.

#define SRP_LOGIN_RSP_MCR_NO_EXISTING_CHANNELS   0x00

No existing RDMA channels were associated with the same I_T nexus.

Definition at line 178 of file srp.h.

#define SRP_LOGIN_RSP_MCR_EXISTING_CHANNELS_TERMINATED   0x01

One or more existing RDMA channels were terminated.

Definition at line 181 of file srp.h.

#define SRP_LOGIN_RSP_MCR_EXISTING_CHANNELS_CONTINUE   0x02

One or more existing RDMA channels continue to operate independently.

Definition at line 184 of file srp.h.

#define SRP_LOGIN_REJ   0xc2

Type of an SRP login rejection.

Definition at line 222 of file srp.h.

Referenced by srp_xfer_deliver_iob().

#define SRP_LOGIN_REJ_REASON_UNKNOWN   0x00010000UL

Unable to establish RDMA channel, no reason specified.

Definition at line 225 of file srp.h.

#define SRP_LOGIN_REJ_REASON_INSUFFICIENT_RESOURCES   0x00010001UL

Insufficient RDMA channel resources.

Definition at line 228 of file srp.h.

#define SRP_LOGIN_REJ_REASON_BAD_MAX_I_T_IU_LEN   0x00010002UL

Requested maximum initiator to target IU length value too large.

Definition at line 231 of file srp.h.

#define SRP_LOGIN_REJ_REASON_CANNOT_ASSOCIATE   0x00010003UL

Unable to associate RDMA channel with specified I_T nexus.

Definition at line 234 of file srp.h.

#define SRP_LOGIN_REJ_REASON_UNSUPPORTED_BUFFER_FORMAT   0x00010004UL

One or more requested data buffer descriptor formats are not supported.

Definition at line 237 of file srp.h.

#define SRP_LOGIN_REJ_REASON_NO_MULTIPLE_CHANNELS   0x00010005UL

SRP target port does not support multiple RDMA channels per I_T nexus.

Definition at line 240 of file srp.h.

#define SRP_LOGIN_REJ_REASON_NO_MORE_CHANNELS   0x00010006UL

RDMA channel limit reached for this initiator.

Definition at line 243 of file srp.h.

#define SRP_LOGIN_REJ_FMT_IDBD   0x04

Indirect data buffer descriptor format supported.

Definition at line 246 of file srp.h.

#define SRP_LOGIN_REJ_FMT_DDBD   0x02

Direct data buffer descriptor format supported.

Definition at line 249 of file srp.h.

#define SRP_I_LOGOUT   0x03

Type of an SRP initiator logout request.

Definition at line 272 of file srp.h.

#define SRP_T_LOGOUT   0x80

Type of an SRP target logout request.

Definition at line 306 of file srp.h.

#define SRP_T_LOGOUT_FLAG_SOLNT   0x01

The initiator specified solicited notification of logouts.

Definition at line 309 of file srp.h.

#define SRP_T_LOGOUT_REASON_UNKNOWN   0x00000000UL

No reason specified.

Definition at line 312 of file srp.h.

#define SRP_T_LOGOUT_REASON_INACTIVE   0x00000001UL

Inactive RDMA channel (reclaiming resources).

Definition at line 315 of file srp.h.

#define SRP_T_LOGOUT_REASON_INVALID_TYPE   0x00000002UL

Invalid information unit type code received by SRP target port.

Definition at line 318 of file srp.h.

#define SRP_T_LOGOUT_REASON_SPURIOUS_RESPONSE   0x00000003UL

SRP initiator port sent response with no corresponding request.

Definition at line 321 of file srp.h.

#define SRP_T_LOGOUT_REASON_MCA   0x00000004UL

RDMA channel disconnected due to multi-channel action code in new login.

Definition at line 324 of file srp.h.

#define SRP_T_LOGOUT_UNSUPPORTED_DATA_OUT_FORMAT   0x00000005UL

Unsuppported format code value specified in data-out buffer descriptor.

Definition at line 327 of file srp.h.

#define SRP_T_LOGOUT_UNSUPPORTED_DATA_IN_FORMAT   0x00000006UL

Unsuppported format code value specified in data-in buffer descriptor.

Definition at line 330 of file srp.h.

#define SRP_T_LOGOUT_INVALID_IU_LEN   0x00000008UL

Invalid length for IU type.

Definition at line 333 of file srp.h.

#define SRP_TSK_MGMT   0x01

Type of an SRP task management request.

Definition at line 379 of file srp.h.

#define SRP_TSK_MGMT_FLAG_UCSOLNT   0x04

Use solicited notification for unsuccessful completions.

Definition at line 382 of file srp.h.

#define SRP_TSK_MGMT_FLAG_SCSOLNT   0x02

Use solicited notification for successful completions.

Definition at line 385 of file srp.h.

#define SRP_TSK_MGMT_FUNC_ABORT_TASK   0x01

The task manager shall perform an ABORT TASK function.

Definition at line 388 of file srp.h.

#define SRP_TSK_MGMT_FUNC_ABORT_TASK_SET   0x02

The task manager shall perform an ABORT TASK SET function.

Definition at line 391 of file srp.h.

#define SRP_TSK_MGMT_FUNC_CLEAR_TASK_SET   0x04

The task manager shall perform a CLEAR TASK SET function.

Definition at line 394 of file srp.h.

#define SRP_TSK_MGMT_FUNC_LOGICAL_UNIT_RESET   0x08

The task manager shall perform a LOGICAL UNIT RESET function.

Definition at line 397 of file srp.h.

#define SRP_TSK_MGMT_FUNC_CLEAR_ACA   0x40

The task manager shall perform a CLEAR ACA function.

Definition at line 400 of file srp.h.

#define SRP_CMD   0x02

Type of an SRP SCSI command.

Definition at line 456 of file srp.h.

Referenced by srp_cmd().

#define SRP_CMD_FLAG_UCSOLNT   0x04

Use solicited notification for unsuccessful completions.

Definition at line 459 of file srp.h.

#define SRP_CMD_FLAG_SCSOLNT   0x02

Use solicited notification for successful completions.

Definition at line 462 of file srp.h.

#define SRP_CMD_DO_FMT_MASK   0xf0

Data-out buffer format mask.

Definition at line 465 of file srp.h.

#define SRP_CMD_DO_FMT_DIRECT   0x10

Direct data-out buffer format.

Definition at line 468 of file srp.h.

Referenced by srp_cmd().

#define SRP_CMD_DO_FMT_INDIRECT   0x20

Indirect data-out buffer format.

Definition at line 471 of file srp.h.

#define SRP_CMD_DI_FMT_MASK   0x0f

Data-in buffer format mask.

Definition at line 474 of file srp.h.

#define SRP_CMD_DI_FMT_DIRECT   0x01

Direct data-in buffer format.

Definition at line 477 of file srp.h.

Referenced by srp_cmd().

#define SRP_CMD_DI_FMT_INDIRECT   0x02

Indirect data-in buffer format.

Definition at line 480 of file srp.h.

#define SRP_CMD_TASK_ATTR_SIMPLE   0x00

Use the rules for a simple task attribute.

Definition at line 483 of file srp.h.

#define SRP_CMD_TASK_ATTR_QUEUE_HEAD   0x01

Use the rules for a head of queue task attribute.

Definition at line 486 of file srp.h.

#define SRP_CMD_TASK_ATTR_ORDERED   0x02

Use the rules for an ordered task attribute.

Definition at line 489 of file srp.h.

#define SRP_CMD_TASK_ATTR_AUTOMATIC_CONTINGENT_ALLEGIANCE   0x08

Use the rules for an automatic contingent allegiance task attribute.

Definition at line 492 of file srp.h.

#define SRP_RSP   0xc1

Type of an SRP SCSI response.

Definition at line 554 of file srp.h.

Referenced by srp_xfer_deliver_iob().

#define SRP_RSP_FLAG_SOLNT   0x01

The initiator specified solicited notification of this response.

Definition at line 557 of file srp.h.

#define SRP_RSP_VALID_DIUNDER   0x20

Data-in residual count field is valid and represents an underflow.

Definition at line 560 of file srp.h.

Referenced by srp_rsp().

#define SRP_RSP_VALID_DIOVER   0x10

Data-in residual count field is valid and represents an overflow.

Definition at line 563 of file srp.h.

Referenced by srp_rsp().

#define SRP_RSP_VALID_DOUNDER   0x08

Data-out residual count field is valid and represents an underflow.

Definition at line 566 of file srp.h.

Referenced by srp_rsp().

#define SRP_RSP_VALID_DOOVER   0x04

Data-out residual count field is valid and represents an overflow.

Definition at line 569 of file srp.h.

Referenced by srp_rsp().

#define SRP_RSP_VALID_SNSVALID   0x02

Sense data list length field is valid.

Definition at line 572 of file srp.h.

Referenced by srp_rsp_sense_data(), and srp_rsp_sense_data_len().

#define SRP_RSP_VALID_RSPVALID   0x01

Response data list length field is valid.

Definition at line 575 of file srp.h.

Referenced by srp_rsp_response_data(), and srp_rsp_response_data_len().

#define SRP_CRED_REQ   0x81

Type of an SRP credit request.

Definition at line 651 of file srp.h.

#define SRP_CRED_REQ_FLAG_SOLNT   0x01

The initiator specified solicited notification of credit requests.

Definition at line 654 of file srp.h.

#define SRP_CRED_RSP   0x41

Type of an SRP credit response.

Definition at line 677 of file srp.h.

#define SRP_AER_REQ   0x82

Type of an SRP asynchronous event request.

Definition at line 716 of file srp.h.

#define SRP_AER_REQ_FLAG_SOLNT   0x01

The initiator specified solicited notification of asynchronous events.

Definition at line 719 of file srp.h.

#define SRP_AER_RSP   0x42

Type of an SRP asynchronous event response.

Definition at line 764 of file srp.h.

#define SRP_MAX_I_T_IU_LEN   80

Maximum length of any initiator-to-target IU that we will send.

The longest IU is a SRP_CMD with no additional CDB and two direct data buffer descriptors, which comes to 80 bytes.

Definition at line 778 of file srp.h.

Referenced by srp_cmd(), and srp_login().

#define SRP_MAX_RETRIES   3

Maximum number of SRP retry attempts.

Definition at line 863 of file srp.h.

Referenced by srp_fail().


Enumeration Type Documentation

enum srp_state

SRP state flags.

Enumerator:
SRP_STATE_SOCKET_OPEN  Underlying socket is open.
SRP_STATE_LOGGED_IN  Session is logged in.

Definition at line 855 of file srp.h.

00855                {
00856         /** Underlying socket is open */
00857         SRP_STATE_SOCKET_OPEN = 0x0001,
00858         /** Session is logged in */
00859         SRP_STATE_LOGGED_IN = 0x0002,
00860 };


Function Documentation

FILE_LICENCE ( BSD2   ) 

static void* srp_rsp_response_data ( struct srp_rsp rsp  )  [inline, static]

Get response data portion of SCSI response.

Parameters:
rsp SCSI response
Return values:
response_data Response data, or NULL if not present

Definition at line 583 of file srp.h.

References NULL, SRP_RSP_VALID_RSPVALID, and srp_rsp::valid.

00583                                                                    {
00584         return ( ( rsp->valid & SRP_RSP_VALID_RSPVALID ) ?
00585                  ( ( ( void * ) rsp ) + sizeof ( *rsp ) ) : NULL );
00586 }

static size_t srp_rsp_response_data_len ( struct srp_rsp rsp  )  [inline, static]

Get length of response data portion of SCSI response.

Parameters:
rsp SCSI response
Return values:
response_data_len Response data length

Definition at line 594 of file srp.h.

References ntohl, srp_rsp::response_data_len, SRP_RSP_VALID_RSPVALID, and srp_rsp::valid.

Referenced by srp_rsp_sense_data().

00594                                                                        {
00595         return ( ( rsp->valid & SRP_RSP_VALID_RSPVALID ) ?
00596                  ntohl ( rsp->response_data_len ) : 0 );
00597 }

static void* srp_rsp_sense_data ( struct srp_rsp rsp  )  [inline, static]

Get sense data portion of SCSI response.

Parameters:
rsp SCSI response
Return values:
sense_data Sense data, or NULL if not present

Definition at line 605 of file srp.h.

References NULL, srp_rsp_response_data_len(), SRP_RSP_VALID_SNSVALID, and srp_rsp::valid.

Referenced by srp_rsp().

00605                                                                 {
00606         return ( ( rsp->valid & SRP_RSP_VALID_SNSVALID ) ?
00607                  ( ( ( void * ) rsp ) + sizeof ( *rsp ) +
00608                    srp_rsp_response_data_len ( rsp ) ) : NULL );
00609 }

static size_t srp_rsp_sense_data_len ( struct srp_rsp rsp  )  [inline, static]

Get length of sense data portion of SCSI response.

Parameters:
rsp SCSI response
Return values:
sense_data_len Sense data length

Definition at line 617 of file srp.h.

References ntohl, srp_rsp::sense_data_len, SRP_RSP_VALID_SNSVALID, and srp_rsp::valid.

Referenced by srp_rsp().

00617                                                                     {
00618         return ( ( rsp->valid & SRP_RSP_VALID_SNSVALID ) ?
00619                  ntohl ( rsp->sense_data_len ) : 0 );
00620 }

static __always_inline void* srp_aer_req_sense_data ( struct srp_aer_req aer_req  )  [inline, static]

Get sense data portion of asynchronous event request.

Parameters:
aer_req SRP asynchronous event request
Return values:
sense_data Sense data

Definition at line 728 of file srp.h.

00728                                                        {
00729         return ( ( ( void * ) aer_req ) + sizeof ( *aer_req ) );
00730 }

static __always_inline size_t srp_aer_req_sense_data_len ( struct srp_aer_req aer_req  )  [inline, static]

Get length of sense data portion of asynchronous event request.

Parameters:
aer_req SRP asynchronous event request
Return values:
sense_data_len Sense data length

Definition at line 739 of file srp.h.

References ntohl, and srp_aer_req::sense_data_len.

00739                                                            {
00740         return ( ntohl ( aer_req->sense_data_len ) );
00741 }

static __always_inline void* srp_transport_priv ( struct srp_device srp  )  [inline, static]

Get SRP transport private data.

Parameters:
srp SRP device
Return values:
priv SRP transport private data

Definition at line 850 of file srp.h.

References srp_device::transport_priv.

Referenced by ib_srp_params().

00850                                               {
00851         return ( ( void * ) srp->transport_priv );
00852 }

int srp_attach ( struct scsi_device scsi,
const char *  root_path 
)

Attach SRP device.

Parameters:
scsi SCSI device
root_path Root path

Definition at line 471 of file srp.c.

References scsi_device::backend, scsi_device::command, DBGC, ENOMEM, ib_srp_transport, srp_transport_type::parse_root_path, srp_transport_type::priv_len, ref_get(), ref_put(), srp_device::refcnt, srp_device::socket, srp_command(), strerror(), srp_device::transport, xfer_init(), and zalloc().

Referenced by ib_srpboot().

00471                                                                    {
00472         struct srp_transport_type *transport;
00473         struct srp_device *srp;
00474         int rc;
00475 
00476         /* Hard-code an IB SRP back-end for now */
00477         transport = &ib_srp_transport;
00478 
00479         /* Allocate and initialise structure */
00480         srp = zalloc ( sizeof ( *srp ) + transport->priv_len );
00481         if ( ! srp ) {
00482                 rc = -ENOMEM;
00483                 goto err_alloc;
00484         }
00485         xfer_init ( &srp->socket, &srp_xfer_operations, &srp->refcnt );
00486         srp->transport = transport;
00487         DBGC ( srp, "SRP %p using %s\n", srp, root_path );
00488 
00489         /* Parse root path */
00490         if ( ( rc = transport->parse_root_path ( srp, root_path ) ) != 0 ) {
00491                 DBGC ( srp, "SRP %p could not parse root path: %s\n",
00492                        srp, strerror ( rc ) );
00493                 goto err_parse_root_path;
00494         }
00495 
00496         /* Attach parent interface, mortalise self, and return */
00497         scsi->backend = ref_get ( &srp->refcnt );
00498         scsi->command = srp_command;
00499         ref_put ( &srp->refcnt );
00500         return 0;
00501 
00502  err_parse_root_path:
00503         ref_put ( &srp->refcnt );
00504  err_alloc:
00505         return rc;
00506 }

void srp_detach ( struct scsi_device scsi  ) 

Detach SRP device.

Parameters:
scsi SCSI device

Definition at line 513 of file srp.c.

References scsi_device::backend, scsi_device::command, container_of, NULL, ref_put(), scsi_detached_command(), srp_device::socket, and xfer_close().

Referenced by ib_srpboot().

00513                                              {
00514         struct srp_device *srp =
00515                 container_of ( scsi->backend, struct srp_device, refcnt );
00516 
00517         /* Close socket */
00518         xfer_nullify ( &srp->socket );
00519         xfer_close ( &srp->socket, 0 );
00520         scsi->command = scsi_detached_command;
00521         ref_put ( scsi->backend );
00522         scsi->backend = NULL;
00523 }


Variable Documentation

An SRP information unit tag.

An SRP asynchronous event response.

An SRP asynchronous event request.

An SRP credit response.

An SRP credit request.

An SRP SCSI response.

An SRP memory descriptor.

An SRP SCSI command.

An SRP task management request.

An SRP target logout request.

An SRP initiator logout request.

An SRP login rejection.

An SRP login response.

An SRP login request information unit.

SRP information unit common fields.

An SRP port ID pair.

An SRP port ID.


Generated on Tue Apr 6 20:01:52 2010 for gPXE by  doxygen 1.5.7.1