iPXE
Data Structures | Defines | Typedefs | Functions
srp.h File Reference

SCSI RDMA Protocol. More...

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

Go to the source code of this file.

Data Structures

union  srp_tag
 An SRP information unit tag. More...
union  srp_port_id
 An SRP port ID. 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  sbft_table
 SRP Boot Firmware Table. More...
struct  sbft_scsi_subtable
 sBFT SCSI subtable More...
struct  sbft_srp_subtable
 sBFT SRP subtable More...

Defines

#define SRP_TAG_MAGIC   0x69505845
 SRP tag magic marker.
#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_REASON_DEFINED(reason)   ( ( (reason) & 0xfffffff0UL ) == 0x00010000UL )
 SRP login rejection reason is defined.
#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 SBFT_SIG   ACPI_SIGNATURE ( 's', 'B', 'F', 'T' )
 SRP Boot Firmware Table signature.

Typedefs

typedef uint16_t sbft_off_t
 An offset from the start of the sBFT.

Functions

 FILE_LICENCE (BSD2)
static const void * srp_rsp_response_data (const struct srp_rsp *rsp)
 Get response data portion of SCSI response.
static size_t srp_rsp_response_data_len (const struct srp_rsp *rsp)
 Get length of response data portion of SCSI response.
static const void * srp_rsp_sense_data (const struct srp_rsp *rsp)
 Get sense data portion of SCSI response.
static size_t srp_rsp_sense_data_len (const 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.
int srp_open (struct interface *block, struct interface *socket, union srp_port_id *initiator, union srp_port_id *target, uint32_t memory_handle, struct scsi_lun *lun)
 Open SRP device.

Detailed Description

SCSI RDMA Protocol.

Definition in file srp.h.


Define Documentation

#define SRP_TAG_MAGIC   0x69505845

SRP tag magic marker.

Definition at line 33 of file srp.h.

Referenced by srp_cmd(), and srp_login().

#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.

Single RDMA channel operation.

Definition at line 116 of file srp.h.

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 srpdev_deliver().

#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.

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

Definition at line 178 of file srp.h.

One or more existing RDMA channels were terminated.

Definition at line 181 of file srp.h.

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 srpdev_deliver().

#define SRP_LOGIN_REJ_REASON_UNKNOWN   0x00010000UL

Unable to establish RDMA channel, no reason specified.

Definition at line 225 of file srp.h.

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.

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_REASON_DEFINED (   reason)    ( ( (reason) & 0xfffffff0UL ) == 0x00010000UL )

SRP login rejection reason is defined.

Definition at line 246 of file srp.h.

Referenced by srp_login_rej().

#define SRP_LOGIN_REJ_FMT_IDBD   0x04

Indirect data buffer descriptor format supported.

Definition at line 250 of file srp.h.

#define SRP_LOGIN_REJ_FMT_DDBD   0x02

Direct data buffer descriptor format supported.

Definition at line 253 of file srp.h.

#define SRP_I_LOGOUT   0x03

Type of an SRP initiator logout request.

Definition at line 276 of file srp.h.

#define SRP_T_LOGOUT   0x80

Type of an SRP target logout request.

Definition at line 310 of file srp.h.

#define SRP_T_LOGOUT_FLAG_SOLNT   0x01

The initiator specified solicited notification of logouts.

Definition at line 313 of file srp.h.

#define SRP_T_LOGOUT_REASON_UNKNOWN   0x00000000UL

No reason specified.

Definition at line 316 of file srp.h.

#define SRP_T_LOGOUT_REASON_INACTIVE   0x00000001UL

Inactive RDMA channel (reclaiming resources)

Definition at line 319 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 322 of file srp.h.

#define SRP_T_LOGOUT_REASON_SPURIOUS_RESPONSE   0x00000003UL

SRP initiator port sent response with no corresponding request.

Definition at line 325 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 328 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 331 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 334 of file srp.h.

#define SRP_T_LOGOUT_INVALID_IU_LEN   0x00000008UL

Invalid length for IU type.

Definition at line 337 of file srp.h.

#define SRP_TSK_MGMT   0x01

Type of an SRP task management request.

Definition at line 383 of file srp.h.

#define SRP_TSK_MGMT_FLAG_UCSOLNT   0x04

Use solicited notification for unsuccessful completions.

Definition at line 386 of file srp.h.

#define SRP_TSK_MGMT_FLAG_SCSOLNT   0x02

Use solicited notification for successful completions.

Definition at line 389 of file srp.h.

#define SRP_TSK_MGMT_FUNC_ABORT_TASK   0x01

The task manager shall perform an ABORT TASK function.

Definition at line 392 of file srp.h.

The task manager shall perform an ABORT TASK SET function.

Definition at line 395 of file srp.h.

The task manager shall perform a CLEAR TASK SET function.

Definition at line 398 of file srp.h.

The task manager shall perform a LOGICAL UNIT RESET function.

Definition at line 401 of file srp.h.

#define SRP_TSK_MGMT_FUNC_CLEAR_ACA   0x40

The task manager shall perform a CLEAR ACA function.

Definition at line 404 of file srp.h.

#define SRP_CMD   0x02

Type of an SRP SCSI command.

Definition at line 460 of file srp.h.

Referenced by srp_cmd().

#define SRP_CMD_FLAG_UCSOLNT   0x04

Use solicited notification for unsuccessful completions.

Definition at line 463 of file srp.h.

#define SRP_CMD_FLAG_SCSOLNT   0x02

Use solicited notification for successful completions.

Definition at line 466 of file srp.h.

#define SRP_CMD_DO_FMT_MASK   0xf0

Data-out buffer format mask.

Definition at line 469 of file srp.h.

#define SRP_CMD_DO_FMT_DIRECT   0x10

Direct data-out buffer format.

Definition at line 472 of file srp.h.

Referenced by srp_cmd().

#define SRP_CMD_DO_FMT_INDIRECT   0x20

Indirect data-out buffer format.

Definition at line 475 of file srp.h.

#define SRP_CMD_DI_FMT_MASK   0x0f

Data-in buffer format mask.

Definition at line 478 of file srp.h.

#define SRP_CMD_DI_FMT_DIRECT   0x01

Direct data-in buffer format.

Definition at line 481 of file srp.h.

Referenced by srp_cmd().

#define SRP_CMD_DI_FMT_INDIRECT   0x02

Indirect data-in buffer format.

Definition at line 484 of file srp.h.

#define SRP_CMD_TASK_ATTR_SIMPLE   0x00

Use the rules for a simple task attribute.

Definition at line 487 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 490 of file srp.h.

#define SRP_CMD_TASK_ATTR_ORDERED   0x02

Use the rules for an ordered task attribute.

Definition at line 493 of file srp.h.

Use the rules for an automatic contingent allegiance task attribute.

Definition at line 496 of file srp.h.

#define SRP_RSP   0xc1

Type of an SRP SCSI response.

Definition at line 558 of file srp.h.

Referenced by srpdev_deliver().

#define SRP_RSP_FLAG_SOLNT   0x01

The initiator specified solicited notification of this response.

Definition at line 561 of file srp.h.

#define SRP_RSP_VALID_DIUNDER   0x20

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

Definition at line 564 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 567 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 570 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 573 of file srp.h.

Referenced by srp_rsp().

#define SRP_RSP_VALID_SNSVALID   0x02

Sense data list length field is valid.

Definition at line 576 of file srp.h.

Referenced by srp_rsp(), 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 579 of file srp.h.

Referenced by srp_rsp(), srp_rsp_response_data(), and srp_rsp_response_data_len().

#define SRP_CRED_REQ   0x81

Type of an SRP credit request.

Definition at line 655 of file srp.h.

#define SRP_CRED_REQ_FLAG_SOLNT   0x01

The initiator specified solicited notification of credit requests.

Definition at line 658 of file srp.h.

#define SRP_CRED_RSP   0x41

Type of an SRP credit response.

Definition at line 681 of file srp.h.

#define SRP_AER_REQ   0x82

Type of an SRP asynchronous event request.

Definition at line 720 of file srp.h.

#define SRP_AER_REQ_FLAG_SOLNT   0x01

The initiator specified solicited notification of asynchronous events.

Definition at line 723 of file srp.h.

#define SRP_AER_RSP   0x42

Type of an SRP asynchronous event response.

Definition at line 768 of file srp.h.

#define SBFT_SIG   ACPI_SIGNATURE ( 's', 'B', 'F', 'T' )

SRP Boot Firmware Table signature.

Definition at line 783 of file srp.h.

Referenced by ib_sbft_install().


Typedef Documentation

An offset from the start of the sBFT.

Definition at line 786 of file srp.h.


Function Documentation

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

Get response data portion of SCSI response.

Parameters:
rspSCSI response
Return values:
response_dataResponse data, or NULL if not present

Definition at line 587 of file srp.h.

References NULL, SRP_RSP_VALID_RSPVALID, and srp_rsp::valid.

                                                                               {
        return ( ( rsp->valid & SRP_RSP_VALID_RSPVALID ) ?
                 ( ( ( const void * ) rsp ) + sizeof ( *rsp ) ) : NULL );
}
static size_t srp_rsp_response_data_len ( const struct srp_rsp rsp) [inline, static]

Get length of response data portion of SCSI response.

Parameters:
rspSCSI response
Return values:
response_data_lenResponse data length

Definition at line 598 of file srp.h.

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

Referenced by srp_rsp(), and srp_rsp_sense_data().

                                                                             {
        return ( ( rsp->valid & SRP_RSP_VALID_RSPVALID ) ?
                 ntohl ( rsp->response_data_len ) : 0 );
}
static const void* srp_rsp_sense_data ( const struct srp_rsp rsp) [inline, static]

Get sense data portion of SCSI response.

Parameters:
rspSCSI response
Return values:
sense_dataSense data, or NULL if not present

Definition at line 609 of file srp.h.

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

Referenced by srp_rsp().

                                                                            {
        return ( ( rsp->valid & SRP_RSP_VALID_SNSVALID ) ?
                 ( ( ( const void * ) rsp ) + sizeof ( *rsp ) +
                   srp_rsp_response_data_len ( rsp ) ) : NULL );
}
static size_t srp_rsp_sense_data_len ( const struct srp_rsp rsp) [inline, static]

Get length of sense data portion of SCSI response.

Parameters:
rspSCSI response
Return values:
sense_data_lenSense data length

Definition at line 621 of file srp.h.

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

Referenced by srp_rsp().

                                                                          {
        return ( ( rsp->valid & SRP_RSP_VALID_SNSVALID ) ?
                 ntohl ( rsp->sense_data_len ) : 0 );
}
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_reqSRP asynchronous event request
Return values:
sense_dataSense data

Definition at line 732 of file srp.h.

                                                       {
        return ( ( ( void * ) aer_req ) + sizeof ( *aer_req ) );
}
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_reqSRP asynchronous event request
Return values:
sense_data_lenSense data length

Definition at line 743 of file srp.h.

References ntohl, and srp_aer_req::sense_data_len.

                                                           {
        return ( ntohl ( aer_req->sense_data_len ) );
}
int srp_open ( struct interface block,
struct interface socket,
union srp_port_id initiator,
union srp_port_id target,
uint32_t  memory_handle,
struct scsi_lun lun 
)

Open SRP device.

Parameters:
blockBlock control interface
socketSocket interface
initiatorInitiator port ID
targetTarget port ID
memory_handleRDMA memory handle
lunSCSI LUN
Return values:
rcReturn status code

Definition at line 713 of file srp.c.

References assert, srp_device::commands, DBGC, srp_port_id::dwords, ENOMEM, INIT_LIST_HEAD, intf_init(), intf_plug_plug(), srp_device::memory_handle, ntohl, NULL, rc, ref_init, ref_put, srp_device::refcnt, srp_device::scsi, scsi_open(), srp_device::socket, srp_login(), srp_new_tag(), srpdev_close(), strerror(), tag, and zalloc().

Referenced by ib_srp_open().

                                                              {
        struct srp_device *srpdev;
        int tag;
        int rc;

        /* Allocate and initialise structure */
        srpdev = zalloc ( sizeof ( *srpdev ) );
        if ( ! srpdev ) {
                rc = -ENOMEM;
                goto err_zalloc;
        }
        ref_init ( &srpdev->refcnt, NULL );
        intf_init ( &srpdev->scsi, &srpdev_scsi_desc, &srpdev->refcnt );
        intf_init ( &srpdev->socket, &srpdev_socket_desc, &srpdev->refcnt );
        INIT_LIST_HEAD ( &srpdev->commands );
        srpdev->memory_handle = memory_handle;
        DBGC ( srpdev, "SRP %p %08x%08x%08x%08x->%08x%08x%08x%08x\n", srpdev,
               ntohl ( initiator->dwords[0] ), ntohl ( initiator->dwords[1] ),
               ntohl ( initiator->dwords[2] ), ntohl ( initiator->dwords[3] ),
               ntohl ( target->dwords[0] ), ntohl ( target->dwords[1] ),
               ntohl ( target->dwords[2] ), ntohl ( target->dwords[3] ) );

        /* Attach to socket interface and initiate login */
        intf_plug_plug ( &srpdev->socket, socket );
        tag = srp_new_tag ( srpdev );
        assert ( tag >= 0 ); /* Cannot fail when no commands in progress */
        if ( ( rc = srp_login ( srpdev, initiator, target, tag ) ) != 0 )
                goto err_login;

        /* Attach SCSI device to parent interface */
        if ( ( rc = scsi_open ( block, &srpdev->scsi, lun ) ) != 0 ) {
                DBGC ( srpdev, "SRP %p could not create SCSI device: %s\n",
                       srpdev, strerror ( rc ) );
                goto err_scsi_open;
        }

        /* Mortalise self and return */
        ref_put ( &srpdev->refcnt );
        return 0;

 err_scsi_open:
 err_login:
        srpdev_close ( srpdev, rc );
        ref_put ( &srpdev->refcnt );
 err_zalloc:
        return rc;
}