iPXE
Data Structures | Macros | 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...
 

Macros

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

Typedefs

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

Functions

 FILE_LICENCE (BSD2)
 
static const void * srp_rsp_response_data (const struct srp_rsp *rsp)
 Get response data portion of SCSI response. More...
 
static size_t srp_rsp_response_data_len (const struct srp_rsp *rsp)
 Get length of response data portion of SCSI response. More...
 
static const void * srp_rsp_sense_data (const struct srp_rsp *rsp)
 Get sense data portion of SCSI response. More...
 
static size_t srp_rsp_sense_data_len (const struct srp_rsp *rsp)
 Get length of sense data portion of SCSI response. More...
 
static __always_inline void * srp_aer_req_sense_data (struct srp_aer_req *aer_req)
 Get sense data portion of asynchronous event request. More...
 
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. More...
 
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. More...
 

Detailed Description

SCSI RDMA Protocol.

Definition in file srp.h.

Macro Definition Documentation

◆ SRP_TAG_MAGIC

#define SRP_TAG_MAGIC   0x69505845

SRP tag magic marker.

Definition at line 33 of file srp.h.

◆ SRP_LOGIN_REQ

#define SRP_LOGIN_REQ   0x00

Type of an SRP login request.

Definition at line 95 of file srp.h.

◆ SRP_LOGIN_REQ_FMT_IDBD

#define SRP_LOGIN_REQ_FMT_IDBD   0x04

Require indirect data buffer descriptor format.

Definition at line 98 of file srp.h.

◆ SRP_LOGIN_REQ_FMT_DDBD

#define SRP_LOGIN_REQ_FMT_DDBD   0x02

Require direct data buffer descriptor format.

Definition at line 101 of file srp.h.

◆ SRP_LOGIN_REQ_FLAG_AESOLNT

#define SRP_LOGIN_REQ_FLAG_AESOLNT   0x40

Use solicited notification for asynchronous events.

Definition at line 104 of file srp.h.

◆ SRP_LOGIN_REQ_FLAG_CRSOLNT

#define SRP_LOGIN_REQ_FLAG_CRSOLNT   0x20

Use solicited notification for credit request.

Definition at line 107 of file srp.h.

◆ SRP_LOGIN_REQ_FLAG_LOSOLNT

#define SRP_LOGIN_REQ_FLAG_LOSOLNT   0x10

Use solicited notification for logouts.

Definition at line 110 of file srp.h.

◆ SRP_LOGIN_REQ_MCA_MASK

#define SRP_LOGIN_REQ_MCA_MASK   0x03

Multi-channel action mask.

Definition at line 113 of file srp.h.

◆ SRP_LOGIN_REQ_MCA_SINGLE_CHANNEL

#define SRP_LOGIN_REQ_MCA_SINGLE_CHANNEL   0x00

Single RDMA channel operation.

Definition at line 116 of file srp.h.

◆ SRP_LOGIN_REQ_MCA_MULTIPLE_CHANNELS

#define SRP_LOGIN_REQ_MCA_MULTIPLE_CHANNELS   0x01

Multiple independent RDMA channel operation.

Definition at line 119 of file srp.h.

◆ SRP_LOGIN_RSP

#define SRP_LOGIN_RSP   0xc0

Type of an SRP login response.

Definition at line 163 of file srp.h.

◆ SRP_LOGIN_RSP_FMT_IDBD

#define SRP_LOGIN_RSP_FMT_IDBD   0x04

Indirect data buffer descriptor format supported.

Definition at line 166 of file srp.h.

◆ SRP_LOGIN_RSP_FMT_DDBD

#define SRP_LOGIN_RSP_FMT_DDBD   0x02

Direct data buffer descriptor format supported.

Definition at line 169 of file srp.h.

◆ SRP_LOGIN_RSP_FLAG_SOLNTSUP

#define SRP_LOGIN_RSP_FLAG_SOLNTSUP   0x10

Solicited notification is supported.

Definition at line 172 of file srp.h.

◆ SRP_LOGIN_RSP_MCR_MASK

#define SRP_LOGIN_RSP_MCR_MASK   0x03

Multi-channel result mask.

Definition at line 175 of file srp.h.

◆ SRP_LOGIN_RSP_MCR_NO_EXISTING_CHANNELS

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

◆ SRP_LOGIN_RSP_MCR_EXISTING_CHANNELS_TERMINATED

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

◆ SRP_LOGIN_RSP_MCR_EXISTING_CHANNELS_CONTINUE

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

◆ SRP_LOGIN_REJ

#define SRP_LOGIN_REJ   0xc2

Type of an SRP login rejection.

Definition at line 222 of file srp.h.

◆ SRP_LOGIN_REJ_REASON_UNKNOWN

#define SRP_LOGIN_REJ_REASON_UNKNOWN   0x00010000UL

Unable to establish RDMA channel, no reason specified.

Definition at line 225 of file srp.h.

◆ SRP_LOGIN_REJ_REASON_INSUFFICIENT_RESOURCES

#define SRP_LOGIN_REJ_REASON_INSUFFICIENT_RESOURCES   0x00010001UL

Insufficient RDMA channel resources.

Definition at line 228 of file srp.h.

◆ SRP_LOGIN_REJ_REASON_BAD_MAX_I_T_IU_LEN

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

◆ SRP_LOGIN_REJ_REASON_CANNOT_ASSOCIATE

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

◆ SRP_LOGIN_REJ_REASON_UNSUPPORTED_BUFFER_FORMAT

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

◆ SRP_LOGIN_REJ_REASON_NO_MULTIPLE_CHANNELS

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

◆ SRP_LOGIN_REJ_REASON_NO_MORE_CHANNELS

#define SRP_LOGIN_REJ_REASON_NO_MORE_CHANNELS   0x00010006UL

RDMA channel limit reached for this initiator.

Definition at line 243 of file srp.h.

◆ SRP_LOGIN_REJ_REASON_DEFINED

#define SRP_LOGIN_REJ_REASON_DEFINED (   reason)    ( ( (reason) & 0xfffffff0UL ) == 0x00010000UL )

SRP login rejection reason is defined.

Definition at line 246 of file srp.h.

◆ SRP_LOGIN_REJ_FMT_IDBD

#define SRP_LOGIN_REJ_FMT_IDBD   0x04

Indirect data buffer descriptor format supported.

Definition at line 250 of file srp.h.

◆ SRP_LOGIN_REJ_FMT_DDBD

#define SRP_LOGIN_REJ_FMT_DDBD   0x02

Direct data buffer descriptor format supported.

Definition at line 253 of file srp.h.

◆ SRP_I_LOGOUT

#define SRP_I_LOGOUT   0x03

Type of an SRP initiator logout request.

Definition at line 276 of file srp.h.

◆ SRP_T_LOGOUT

#define SRP_T_LOGOUT   0x80

Type of an SRP target logout request.

Definition at line 310 of file srp.h.

◆ SRP_T_LOGOUT_FLAG_SOLNT

#define SRP_T_LOGOUT_FLAG_SOLNT   0x01

The initiator specified solicited notification of logouts.

Definition at line 313 of file srp.h.

◆ SRP_T_LOGOUT_REASON_UNKNOWN

#define SRP_T_LOGOUT_REASON_UNKNOWN   0x00000000UL

No reason specified.

Definition at line 316 of file srp.h.

◆ SRP_T_LOGOUT_REASON_INACTIVE

#define SRP_T_LOGOUT_REASON_INACTIVE   0x00000001UL

Inactive RDMA channel (reclaiming resources)

Definition at line 319 of file srp.h.

◆ SRP_T_LOGOUT_REASON_INVALID_TYPE

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

◆ SRP_T_LOGOUT_REASON_SPURIOUS_RESPONSE

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

◆ SRP_T_LOGOUT_REASON_MCA

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

◆ SRP_T_LOGOUT_UNSUPPORTED_DATA_OUT_FORMAT

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

◆ SRP_T_LOGOUT_UNSUPPORTED_DATA_IN_FORMAT

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

◆ SRP_T_LOGOUT_INVALID_IU_LEN

#define SRP_T_LOGOUT_INVALID_IU_LEN   0x00000008UL

Invalid length for IU type.

Definition at line 337 of file srp.h.

◆ SRP_TSK_MGMT

#define SRP_TSK_MGMT   0x01

Type of an SRP task management request.

Definition at line 383 of file srp.h.

◆ SRP_TSK_MGMT_FLAG_UCSOLNT

#define SRP_TSK_MGMT_FLAG_UCSOLNT   0x04

Use solicited notification for unsuccessful completions.

Definition at line 386 of file srp.h.

◆ SRP_TSK_MGMT_FLAG_SCSOLNT

#define SRP_TSK_MGMT_FLAG_SCSOLNT   0x02

Use solicited notification for successful completions.

Definition at line 389 of file srp.h.

◆ SRP_TSK_MGMT_FUNC_ABORT_TASK

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

◆ SRP_TSK_MGMT_FUNC_ABORT_TASK_SET

#define SRP_TSK_MGMT_FUNC_ABORT_TASK_SET   0x02

The task manager shall perform an ABORT TASK SET function.

Definition at line 395 of file srp.h.

◆ SRP_TSK_MGMT_FUNC_CLEAR_TASK_SET

#define SRP_TSK_MGMT_FUNC_CLEAR_TASK_SET   0x04

The task manager shall perform a CLEAR TASK SET function.

Definition at line 398 of file srp.h.

◆ SRP_TSK_MGMT_FUNC_LOGICAL_UNIT_RESET

#define SRP_TSK_MGMT_FUNC_LOGICAL_UNIT_RESET   0x08

The task manager shall perform a LOGICAL UNIT RESET function.

Definition at line 401 of file srp.h.

◆ SRP_TSK_MGMT_FUNC_CLEAR_ACA

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

◆ SRP_CMD

#define SRP_CMD   0x02

Type of an SRP SCSI command.

Definition at line 460 of file srp.h.

◆ SRP_CMD_FLAG_UCSOLNT

#define SRP_CMD_FLAG_UCSOLNT   0x04

Use solicited notification for unsuccessful completions.

Definition at line 463 of file srp.h.

◆ SRP_CMD_FLAG_SCSOLNT

#define SRP_CMD_FLAG_SCSOLNT   0x02

Use solicited notification for successful completions.

Definition at line 466 of file srp.h.

◆ SRP_CMD_DO_FMT_MASK

#define SRP_CMD_DO_FMT_MASK   0xf0

Data-out buffer format mask.

Definition at line 469 of file srp.h.

◆ SRP_CMD_DO_FMT_DIRECT

#define SRP_CMD_DO_FMT_DIRECT   0x10

Direct data-out buffer format.

Definition at line 472 of file srp.h.

◆ SRP_CMD_DO_FMT_INDIRECT

#define SRP_CMD_DO_FMT_INDIRECT   0x20

Indirect data-out buffer format.

Definition at line 475 of file srp.h.

◆ SRP_CMD_DI_FMT_MASK

#define SRP_CMD_DI_FMT_MASK   0x0f

Data-in buffer format mask.

Definition at line 478 of file srp.h.

◆ SRP_CMD_DI_FMT_DIRECT

#define SRP_CMD_DI_FMT_DIRECT   0x01

Direct data-in buffer format.

Definition at line 481 of file srp.h.

◆ SRP_CMD_DI_FMT_INDIRECT

#define SRP_CMD_DI_FMT_INDIRECT   0x02

Indirect data-in buffer format.

Definition at line 484 of file srp.h.

◆ SRP_CMD_TASK_ATTR_SIMPLE

#define SRP_CMD_TASK_ATTR_SIMPLE   0x00

Use the rules for a simple task attribute.

Definition at line 487 of file srp.h.

◆ SRP_CMD_TASK_ATTR_QUEUE_HEAD

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

◆ SRP_CMD_TASK_ATTR_ORDERED

#define SRP_CMD_TASK_ATTR_ORDERED   0x02

Use the rules for an ordered task attribute.

Definition at line 493 of file srp.h.

◆ SRP_CMD_TASK_ATTR_AUTOMATIC_CONTINGENT_ALLEGIANCE

#define SRP_CMD_TASK_ATTR_AUTOMATIC_CONTINGENT_ALLEGIANCE   0x08

Use the rules for an automatic contingent allegiance task attribute.

Definition at line 496 of file srp.h.

◆ SRP_RSP

#define SRP_RSP   0xc1

Type of an SRP SCSI response.

Definition at line 558 of file srp.h.

◆ SRP_RSP_FLAG_SOLNT

#define SRP_RSP_FLAG_SOLNT   0x01

The initiator specified solicited notification of this response.

Definition at line 561 of file srp.h.

◆ SRP_RSP_VALID_DIUNDER

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

◆ SRP_RSP_VALID_DIOVER

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

◆ SRP_RSP_VALID_DOUNDER

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

◆ SRP_RSP_VALID_DOOVER

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

◆ SRP_RSP_VALID_SNSVALID

#define SRP_RSP_VALID_SNSVALID   0x02

Sense data list length field is valid.

Definition at line 576 of file srp.h.

◆ SRP_RSP_VALID_RSPVALID

#define SRP_RSP_VALID_RSPVALID   0x01

Response data list length field is valid.

Definition at line 579 of file srp.h.

◆ SRP_CRED_REQ

#define SRP_CRED_REQ   0x81

Type of an SRP credit request.

Definition at line 655 of file srp.h.

◆ SRP_CRED_REQ_FLAG_SOLNT

#define SRP_CRED_REQ_FLAG_SOLNT   0x01

The initiator specified solicited notification of credit requests.

Definition at line 658 of file srp.h.

◆ SRP_CRED_RSP

#define SRP_CRED_RSP   0x41

Type of an SRP credit response.

Definition at line 681 of file srp.h.

◆ SRP_AER_REQ

#define SRP_AER_REQ   0x82

Type of an SRP asynchronous event request.

Definition at line 720 of file srp.h.

◆ SRP_AER_REQ_FLAG_SOLNT

#define SRP_AER_REQ_FLAG_SOLNT   0x01

The initiator specified solicited notification of asynchronous events.

Definition at line 723 of file srp.h.

◆ SRP_AER_RSP

#define SRP_AER_RSP   0x42

Type of an SRP asynchronous event response.

Definition at line 768 of file srp.h.

◆ SBFT_SIG

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

SRP Boot Firmware Table signature.

Definition at line 783 of file srp.h.

Typedef Documentation

◆ sbft_off_t

An offset from the start of the sBFT.

Definition at line 786 of file srp.h.

Function Documentation

◆ FILE_LICENCE()

FILE_LICENCE ( BSD2  )

◆ srp_rsp_response_data()

static const void* srp_rsp_response_data ( const struct srp_rsp rsp)
inlinestatic

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.

587  {
588  return ( ( rsp->valid & SRP_RSP_VALID_RSPVALID ) ?
589  ( ( ( const void * ) rsp ) + sizeof ( *rsp ) ) : NULL );
590 }
uint64_t rsp
Definition: librm.h:267
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
#define SRP_RSP_VALID_RSPVALID
Response data list length field is valid.
Definition: srp.h:579

References NULL, rsp, and SRP_RSP_VALID_RSPVALID.

◆ srp_rsp_response_data_len()

static size_t srp_rsp_response_data_len ( const struct srp_rsp rsp)
inlinestatic

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.

598  {
599  return ( ( rsp->valid & SRP_RSP_VALID_RSPVALID ) ?
600  ntohl ( rsp->response_data_len ) : 0 );
601 }
#define ntohl(value)
Definition: byteswap.h:134
uint64_t rsp
Definition: librm.h:267
#define SRP_RSP_VALID_RSPVALID
Response data list length field is valid.
Definition: srp.h:579

References ntohl, rsp, and SRP_RSP_VALID_RSPVALID.

Referenced by srp_rsp(), and srp_rsp_sense_data().

◆ srp_rsp_sense_data()

static const void* srp_rsp_sense_data ( const struct srp_rsp rsp)
inlinestatic

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.

609  {
610  return ( ( rsp->valid & SRP_RSP_VALID_SNSVALID ) ?
611  ( ( ( const void * ) rsp ) + sizeof ( *rsp ) +
613 }
#define SRP_RSP_VALID_SNSVALID
Sense data list length field is valid.
Definition: srp.h:576
static size_t srp_rsp_response_data_len(const struct srp_rsp *rsp)
Get length of response data portion of SCSI response.
Definition: srp.h:598
uint64_t rsp
Definition: librm.h:267
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321

References NULL, rsp, srp_rsp_response_data_len(), and SRP_RSP_VALID_SNSVALID.

Referenced by srp_rsp().

◆ srp_rsp_sense_data_len()

static size_t srp_rsp_sense_data_len ( const struct srp_rsp rsp)
inlinestatic

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.

621  {
622  return ( ( rsp->valid & SRP_RSP_VALID_SNSVALID ) ?
623  ntohl ( rsp->sense_data_len ) : 0 );
624 }
#define SRP_RSP_VALID_SNSVALID
Sense data list length field is valid.
Definition: srp.h:576
#define ntohl(value)
Definition: byteswap.h:134
uint64_t rsp
Definition: librm.h:267

References ntohl, rsp, and SRP_RSP_VALID_SNSVALID.

Referenced by srp_rsp().

◆ srp_aer_req_sense_data()

static __always_inline void* srp_aer_req_sense_data ( struct srp_aer_req aer_req)
inlinestatic

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.

732  {
733  return ( ( ( void * ) aer_req ) + sizeof ( *aer_req ) );
734 }

◆ srp_aer_req_sense_data_len()

static __always_inline size_t srp_aer_req_sense_data_len ( struct srp_aer_req aer_req)
inlinestatic

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.

743  {
744  return ( ntohl ( aer_req->sense_data_len ) );
745 }
#define ntohl(value)
Definition: byteswap.h:134
uint32_t sense_data_len
Sense data list length.
Definition: srp.h:714

References ntohl, and srp_aer_req::sense_data_len.

◆ srp_open()

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.

715  {
716  struct srp_device *srpdev;
717  int tag;
718  int rc;
719 
720  /* Allocate and initialise structure */
721  srpdev = zalloc ( sizeof ( *srpdev ) );
722  if ( ! srpdev ) {
723  rc = -ENOMEM;
724  goto err_zalloc;
725  }
726  ref_init ( &srpdev->refcnt, NULL );
727  intf_init ( &srpdev->scsi, &srpdev_scsi_desc, &srpdev->refcnt );
728  intf_init ( &srpdev->socket, &srpdev_socket_desc, &srpdev->refcnt );
729  INIT_LIST_HEAD ( &srpdev->commands );
730  srpdev->memory_handle = memory_handle;
731  DBGC ( srpdev, "SRP %p %08x%08x%08x%08x->%08x%08x%08x%08x\n", srpdev,
732  ntohl ( initiator->dwords[0] ), ntohl ( initiator->dwords[1] ),
733  ntohl ( initiator->dwords[2] ), ntohl ( initiator->dwords[3] ),
734  ntohl ( target->dwords[0] ), ntohl ( target->dwords[1] ),
735  ntohl ( target->dwords[2] ), ntohl ( target->dwords[3] ) );
736 
737  /* Attach to socket interface and initiate login */
738  intf_plug_plug ( &srpdev->socket, socket );
739  tag = srp_new_tag ( srpdev );
740  assert ( tag >= 0 ); /* Cannot fail when no commands in progress */
741  if ( ( rc = srp_login ( srpdev, initiator, target, tag ) ) != 0 )
742  goto err_login;
743 
744  /* Attach SCSI device to parent interface */
745  if ( ( rc = scsi_open ( block, &srpdev->scsi, lun ) ) != 0 ) {
746  DBGC ( srpdev, "SRP %p could not create SCSI device: %s\n",
747  srpdev, strerror ( rc ) );
748  goto err_scsi_open;
749  }
750 
751  /* Mortalise self and return */
752  ref_put ( &srpdev->refcnt );
753  return 0;
754 
755  err_scsi_open:
756  err_login:
757  srpdev_close ( srpdev, rc );
758  ref_put ( &srpdev->refcnt );
759  err_zalloc:
760  return rc;
761 }
static void srpdev_close(struct srp_device *srpdev, int rc)
Close SRP device.
Definition: srp.c:225
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
struct refcnt refcnt
Reference count.
Definition: srp.c:104
uint32_t dwords[4]
Definition: srp.h:38
static struct interface_descriptor srpdev_socket_desc
SRP device socket interface descriptor.
Definition: srp.c:687
#define ref_init(refcnt, free)
Initialise a reference counter.
Definition: refcnt.h:64
#define DBGC(...)
Definition: compiler.h:505
void intf_plug_plug(struct interface *a, struct interface *b)
Plug two object interfaces together.
Definition: interface.c:107
#define ntohl(value)
Definition: byteswap.h:134
int scsi_open(struct interface *block, struct interface *scsi, struct scsi_lun *lun)
Open SCSI device.
Definition: scsi.c:984
struct list_head commands
List of active commands.
Definition: srp.c:117
#define ENOMEM
Not enough space.
Definition: errno.h:534
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
uint8_t lun
Logical Unit Number.
Definition: edd.h:32
static int srp_new_tag(struct srp_device *srpdev)
Choose an SRP command tag.
Definition: srp.c:270
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
void * zalloc(size_t size)
Allocate cleared memory.
Definition: malloc.c:624
uint32_t memory_handle
RDMA memory handle.
Definition: srp.c:112
static struct interface_descriptor srpdev_scsi_desc
SRP device SCSI interface descriptor.
Definition: srp.c:699
An SRP device.
Definition: srp.c:102
static int srp_login(struct srp_device *srpdev, union srp_port_id *initiator, union srp_port_id *target, uint32_t tag)
Transmit SRP login request.
Definition: srp.c:291
#define INIT_LIST_HEAD(list)
Initialise a list head.
Definition: list.h:45
struct interface scsi
SCSI command issuing interface.
Definition: srp.c:107
uint8_t block[3][8]
DES-encrypted blocks.
Definition: mschapv2.h:12
struct interface socket
Underlying data transfer interface.
Definition: srp.c:109
static void intf_init(struct interface *intf, struct interface_descriptor *desc, struct refcnt *refcnt)
Initialise an object interface.
Definition: interface.h:203
uint64_t tag
Identity tag.
Definition: edd.h:30
#define NULL
NULL pointer (VOID *)
Definition: Base.h:321
#define ref_put(refcnt)
Drop reference to object.
Definition: refcnt.h:106

References assert(), block, srp_device::commands, DBGC, srp_port_id::dwords, ENOMEM, INIT_LIST_HEAD, intf_init(), intf_plug_plug(), lun, 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(), srpdev_scsi_desc, srpdev_socket_desc, strerror(), tag, and zalloc().

Referenced by ib_srp_open().