|
iPXE
|
iSCSI protocol More...
#include <stdint.h>#include <ipxe/socket.h>#include <ipxe/scsi.h>#include <ipxe/chap.h>#include <ipxe/refcnt.h>#include <ipxe/xfer.h>#include <ipxe/process.h>#include <ipxe/acpi.h>#include <ipxe/settings.h>Go to the source code of this file.
Data Structures | |
| union | iscsi_segment_lengths |
| iSCSI segment lengths More... | |
| struct | iscsi_bhs_common |
| iSCSI basic header segment common fields More... | |
| struct | iscsi_bhs_common_response |
| iSCSI basic header segment common request fields More... | |
| struct | iscsi_bhs_login_request |
| iSCSI login request basic header segment More... | |
| struct | iscsi_bhs_login_response |
| iSCSI login response basic header segment More... | |
| struct | iscsi_bhs_scsi_command |
| iSCSI SCSI command basic header segment More... | |
| struct | iscsi_bhs_scsi_response |
| iSCSI SCSI response basic header segment More... | |
| struct | iscsi_bhs_data_in |
| iSCSI data-in basic header segment More... | |
| struct | iscsi_bhs_data_out |
| iSCSI data-out basic header segment More... | |
| struct | iscsi_bhs_r2t |
| iSCSI request to transfer basic header segment More... | |
| struct | iscsi_nop_in |
| iSCSI NOP-In basic header segment More... | |
| union | iscsi_bhs |
| An iSCSI basic header segment. More... | |
| struct | iscsi_session |
| An iSCSI session. More... | |
Macros | |
| #define | ISCSI_PORT 3260 |
| Default iSCSI port. | |
| #define | ISCSI_FIRST_BURST_LEN 65536 |
| Default iSCSI first burst length. | |
| #define | ISCSI_MAX_BURST_LEN 262144 |
| Default iSCSI maximum burst length. | |
| #define | ISCSI_MAX_RECV_DATA_SEG_LEN 8192 |
| Default iSCSI maximum receive data segment length. | |
| #define | ISCSI_AHS_LEN(segment_lengths) |
| The length of the additional header segment, in dwords. | |
| #define | ISCSI_DATA_LEN(segment_lengths) |
| The length of the data segment, in bytes, excluding any padding. | |
| #define | ISCSI_DATA_PAD_LEN(segment_lengths) |
| The padding of the data segment, in bytes. | |
| #define | ISCSI_SET_LENGTHS(segment_lengths, ahs_len, data_len) |
| Set additional header and data segment lengths. | |
| #define | ISCSI_OPCODE_MASK 0x3f |
| Opcode mask. | |
| #define | ISCSI_FLAG_IMMEDIATE 0x40 |
| Immediate delivery. | |
| #define | ISCSI_FLAG_FINAL 0x80 |
| Final PDU of a sequence. | |
| #define | ISCSI_TAG_MAGIC 0x18ae0000 |
| iSCSI tag magic marker | |
| #define | ISCSI_TAG_RESERVED 0xffffffff |
| iSCSI reserved tag value | |
| #define | ISCSI_OPCODE_LOGIN_REQUEST 0x03 |
| Login request opcode. | |
| #define | ISCSI_LOGIN_FLAG_TRANSITION 0x80 |
| Willingness to transition to next stage. | |
| #define | ISCSI_LOGIN_FLAG_CONTINUE 0x40 |
| Key=value pairs continued in subsequent request. | |
| #define | ISCSI_LOGIN_CSG_MASK 0x0c |
| #define | ISCSI_LOGIN_CSG_SECURITY_NEGOTIATION 0x00 |
| #define | ISCSI_LOGIN_CSG_OPERATIONAL_NEGOTIATION 0x04 |
| #define | ISCSI_LOGIN_CSG_FULL_FEATURE_PHASE 0x0c |
| #define | ISCSI_LOGIN_NSG_MASK 0x03 |
| #define | ISCSI_LOGIN_NSG_SECURITY_NEGOTIATION 0x00 |
| #define | ISCSI_LOGIN_NSG_OPERATIONAL_NEGOTIATION 0x01 |
| #define | ISCSI_LOGIN_NSG_FULL_FEATURE_PHASE 0x03 |
| #define | ISCSI_ISID_IANA 0x40000000 |
| ISID IANA format marker. | |
| #define | IANA_EN_FEN_SYSTEMS 10019 |
| Fen Systems Ltd. | |
| #define | ISCSI_OPCODE_LOGIN_RESPONSE 0x23 |
| Login response opcode. | |
| #define | ISCSI_STATUS_SUCCESS 0x00 |
| #define | ISCSI_STATUS_REDIRECT 0x01 |
| #define | ISCSI_STATUS_INITIATOR_ERROR 0x02 |
| #define | ISCSI_STATUS_INITIATOR_ERROR_AUTHENTICATION 0x01 |
| #define | ISCSI_STATUS_INITIATOR_ERROR_AUTHORISATION 0x02 |
| #define | ISCSI_STATUS_INITIATOR_ERROR_NOT_FOUND 0x03 |
| #define | ISCSI_STATUS_INITIATOR_ERROR_REMOVED 0x04 |
| #define | ISCSI_STATUS_TARGET_ERROR 0x03 |
| #define | ISCSI_STATUS_TARGET_ERROR_UNAVAILABLE 0x01 |
| #define | ISCSI_STATUS_TARGET_ERROR_NO_RESOURCES 0x02 |
| #define | ISCSI_OPCODE_SCSI_COMMAND 0x01 |
| SCSI command opcode. | |
| #define | ISCSI_COMMAND_FLAG_READ 0x40 |
| Command will read data. | |
| #define | ISCSI_COMMAND_FLAG_WRITE 0x20 |
| Command will write data. | |
| #define | ISCSI_COMMAND_ATTR_UNTAGGED 0x00 |
| #define | ISCSI_COMMAND_ATTR_SIMPLE 0x01 |
| #define | ISCSI_COMMAND_ATTR_ORDERED 0x02 |
| #define | ISCSI_COMMAND_ATTR_HEAD_OF_QUEUE 0x03 |
| #define | ISCSI_COMMAND_ATTR_ACA 0x04 |
| #define | ISCSI_OPCODE_SCSI_RESPONSE 0x21 |
| SCSI response opcode. | |
| #define | ISCSI_RESPONSE_COMMAND_COMPLETE 0x00 |
| SCSI command completed at target. | |
| #define | ISCSI_RESPONSE_TARGET_FAILURE 0x01 |
| SCSI target failure. | |
| #define | ISCSI_RESPONSE_FLAG_OVERFLOW 0x20 |
| Data overflow occurred. | |
| #define | ISCSI_RESPONSE_FLAG_UNDERFLOW 0x40 |
| Data underflow occurred. | |
| #define | ISCSI_OPCODE_DATA_IN 0x25 |
| Data-in opcode. | |
| #define | ISCSI_DATA_FLAG_ACKNOWLEDGE 0x40 |
| Data requires acknowledgement. | |
| #define | ISCSI_DATA_FLAG_OVERFLOW 0x04 |
| Data overflow occurred. | |
| #define | ISCSI_DATA_FLAG_UNDERFLOW 0x02 |
| Data underflow occurred. | |
| #define | ISCSI_DATA_FLAG_STATUS 0x01 |
| SCSI status code and overflow/underflow flags are valid. | |
| #define | ISCSI_OPCODE_DATA_OUT 0x05 |
| Data-out opcode. | |
| #define | ISCSI_OPCODE_R2T 0x31 |
| R2T opcode. | |
| #define | ISCSI_OPCODE_NOP_IN 0x20 |
| NOP-In opcode. | |
| #define | ISCSI_STATUS_SECURITY_NEGOTIATION_PHASE |
| iSCSI session is currently in the security negotiation phase | |
| #define | ISCSI_STATUS_OPERATIONAL_NEGOTIATION_PHASE |
| iSCSI session is currently in the operational parameter negotiation phase | |
| #define | ISCSI_STATUS_FULL_FEATURE_PHASE ISCSI_LOGIN_CSG_FULL_FEATURE_PHASE |
| iSCSI session is currently in the full feature phase | |
| #define | ISCSI_STATUS_PHASE_MASK ( ISCSI_LOGIN_CSG_MASK | ISCSI_LOGIN_NSG_MASK ) |
| Mask for all iSCSI session phases. | |
| #define | ISCSI_STATUS_STRINGS_SECURITY 0x0100 |
| iSCSI session needs to send the initial security negotiation strings | |
| #define | ISCSI_STATUS_STRINGS_CHAP_ALGORITHM 0x0200 |
| iSCSI session needs to send the CHAP_A string | |
| #define | ISCSI_STATUS_STRINGS_CHAP_RESPONSE 0x0400 |
| iSCSI session needs to send the CHAP response | |
| #define | ISCSI_STATUS_STRINGS_CHAP_CHALLENGE 0x0800 |
| iSCSI session needs to send the mutual CHAP challenge | |
| #define | ISCSI_STATUS_STRINGS_OPERATIONAL 0x1000 |
| iSCSI session needs to send the operational negotiation strings | |
| #define | ISCSI_STATUS_STRINGS_MASK 0xff00 |
| Mask for all iSCSI "needs to send" flags. | |
| #define | ISCSI_STATUS_AUTH_FORWARD_REQUIRED 0x00010000 |
| Target has requested forward (initiator) authentication. | |
| #define | ISCSI_STATUS_AUTH_REVERSE_REQUIRED 0x00020000 |
| Initiator requires target (reverse) authentication. | |
| #define | ISCSI_STATUS_AUTH_REVERSE_OK 0x00040000 |
| Target authenticated itself correctly. | |
| #define | ISCSI_DEFAULT_IQN_PREFIX "iqn.2010-04.org.ipxe" |
| Default initiator IQN prefix. | |
Enumerations | |
| enum | iscsi_tx_state { ISCSI_TX_IDLE = 0 , ISCSI_TX_BHS , ISCSI_TX_AHS , ISCSI_TX_DATA } |
| State of an iSCSI TX engine. More... | |
| enum | iscsi_rx_state { ISCSI_RX_BHS = 0 , ISCSI_RX_AHS , ISCSI_RX_DATA , ISCSI_RX_DATA_PADDING } |
| State of an iSCSI RX engine. More... | |
Functions | |
| FILE_LICENCE (GPL2_OR_LATER_OR_UBDL) | |
| FILE_SECBOOT (PERMITTED) | |
| const struct setting initiator_iqn_setting | __setting (SETTING_SANBOOT_EXTRA, initiator-iqn) |
iSCSI protocol
Definition in file iscsi.h.
| #define ISCSI_PORT 3260 |
Default iSCSI port.
Definition at line 24 of file iscsi.h.
Referenced by iscsi_handle_targetaddress_value(), and iscsi_parse_root_path().
| #define ISCSI_FIRST_BURST_LEN 65536 |
Default iSCSI first burst length.
Definition at line 27 of file iscsi.h.
Referenced by iscsi_build_login_request_strings().
| #define ISCSI_MAX_BURST_LEN 262144 |
Default iSCSI maximum burst length.
Definition at line 30 of file iscsi.h.
Referenced by iscsi_build_login_request_strings(), and iscsi_open_connection().
| #define ISCSI_MAX_RECV_DATA_SEG_LEN 8192 |
Default iSCSI maximum receive data segment length.
Definition at line 33 of file iscsi.h.
Referenced by iscsi_build_login_request_strings().
| #define ISCSI_AHS_LEN | ( | segment_lengths | ) |
The length of the additional header segment, in dwords.
Definition at line 58 of file iscsi.h.
Referenced by iscsi_socket_deliver().
| #define ISCSI_DATA_LEN | ( | segment_lengths | ) |
The length of the data segment, in bytes, excluding any padding.
Definition at line 62 of file iscsi.h.
Referenced by iscsi_rx_bhs(), iscsi_rx_scsi_response(), iscsi_socket_deliver(), iscsi_tx_data_out(), iscsi_tx_login_request(), and iscsi_tx_step().
| #define ISCSI_DATA_PAD_LEN | ( | segment_lengths | ) |
The padding of the data segment, in bytes.
Definition at line 66 of file iscsi.h.
Referenced by iscsi_socket_deliver(), iscsi_tx_data_out(), and iscsi_tx_login_request().
| #define ISCSI_SET_LENGTHS | ( | segment_lengths, | |
| ahs_len, | |||
| data_len ) |
Set additional header and data segment lengths.
Definition at line 70 of file iscsi.h.
Referenced by iscsi_start_data_out(), and iscsi_start_login().
| #define ISCSI_OPCODE_MASK 0x3f |
Opcode mask.
Definition at line 97 of file iscsi.h.
Referenced by iscsi_rx_data(), iscsi_tx_data(), and iscsi_tx_done().
| #define ISCSI_FLAG_IMMEDIATE 0x40 |
| #define ISCSI_FLAG_FINAL 0x80 |
Final PDU of a sequence.
Definition at line 103 of file iscsi.h.
Referenced by iscsi_data_out_done(), iscsi_rx_data_in(), iscsi_start_command(), and iscsi_start_data_out().
| #define ISCSI_TAG_MAGIC 0x18ae0000 |
| #define ISCSI_TAG_RESERVED 0xffffffff |
| #define ISCSI_OPCODE_LOGIN_REQUEST 0x03 |
Login request opcode.
Definition at line 174 of file iscsi.h.
Referenced by iscsi_start_login(), iscsi_tx_data(), and iscsi_tx_done().
| #define ISCSI_LOGIN_FLAG_TRANSITION 0x80 |
Willingness to transition to next stage.
Definition at line 177 of file iscsi.h.
Referenced by iscsi_rx_login_response(), and iscsi_start_login().
| #define ISCSI_LOGIN_FLAG_CONTINUE 0x40 |
| #define ISCSI_LOGIN_CSG_MASK 0x0c |
Definition at line 183 of file iscsi.h.
Referenced by iscsi_start_login().
| #define ISCSI_LOGIN_CSG_SECURITY_NEGOTIATION 0x00 |
Definition at line 184 of file iscsi.h.
Referenced by iscsi_start_login().
| #define ISCSI_LOGIN_CSG_OPERATIONAL_NEGOTIATION 0x04 |
Definition at line 185 of file iscsi.h.
Referenced by iscsi_start_login().
| #define ISCSI_LOGIN_NSG_MASK 0x03 |
Definition at line 189 of file iscsi.h.
Referenced by iscsi_rx_login_response().
| #define ISCSI_LOGIN_NSG_OPERATIONAL_NEGOTIATION 0x01 |
Definition at line 191 of file iscsi.h.
Referenced by iscsi_rx_login_response().
| #define ISCSI_LOGIN_NSG_FULL_FEATURE_PHASE 0x03 |
Definition at line 192 of file iscsi.h.
Referenced by iscsi_rx_login_response().
| #define ISCSI_ISID_IANA 0x40000000 |
| #define IANA_EN_FEN_SYSTEMS 10019 |
Fen Systems Ltd.
IANA enterprise number
Permission is hereby granted to use Fen Systems Ltd.'s IANA enterprise number with this iSCSI implementation.
Definition at line 202 of file iscsi.h.
Referenced by iscsi_start_login().
| #define ISCSI_OPCODE_LOGIN_RESPONSE 0x23 |
| #define ISCSI_STATUS_REDIRECT 0x01 |
Definition at line 248 of file iscsi.h.
Referenced by iscsi_rx_login_response().
| #define ISCSI_STATUS_INITIATOR_ERROR 0x02 |
Definition at line 249 of file iscsi.h.
Referenced by iscsi_status_to_rc().
| #define ISCSI_STATUS_INITIATOR_ERROR_AUTHENTICATION 0x01 |
Definition at line 250 of file iscsi.h.
Referenced by iscsi_status_to_rc().
| #define ISCSI_STATUS_INITIATOR_ERROR_AUTHORISATION 0x02 |
Definition at line 251 of file iscsi.h.
Referenced by iscsi_status_to_rc().
| #define ISCSI_STATUS_INITIATOR_ERROR_NOT_FOUND 0x03 |
Definition at line 252 of file iscsi.h.
Referenced by iscsi_status_to_rc().
| #define ISCSI_STATUS_INITIATOR_ERROR_REMOVED 0x04 |
Definition at line 253 of file iscsi.h.
Referenced by iscsi_status_to_rc().
| #define ISCSI_STATUS_TARGET_ERROR 0x03 |
Definition at line 254 of file iscsi.h.
Referenced by iscsi_status_to_rc().
| #define ISCSI_STATUS_TARGET_ERROR_UNAVAILABLE 0x01 |
Definition at line 255 of file iscsi.h.
Referenced by iscsi_status_to_rc().
| #define ISCSI_STATUS_TARGET_ERROR_NO_RESOURCES 0x02 |
Definition at line 256 of file iscsi.h.
Referenced by iscsi_status_to_rc().
| #define ISCSI_OPCODE_SCSI_COMMAND 0x01 |
| #define ISCSI_COMMAND_FLAG_READ 0x40 |
Command will read data.
Definition at line 289 of file iscsi.h.
Referenced by iscsi_start_command().
| #define ISCSI_COMMAND_FLAG_WRITE 0x20 |
Command will write data.
Definition at line 292 of file iscsi.h.
Referenced by iscsi_start_command().
| #define ISCSI_COMMAND_ATTR_SIMPLE 0x01 |
Definition at line 296 of file iscsi.h.
Referenced by iscsi_start_command().
| #define ISCSI_OPCODE_SCSI_RESPONSE 0x21 |
| #define ISCSI_RESPONSE_COMMAND_COMPLETE 0x00 |
SCSI command completed at target.
Definition at line 340 of file iscsi.h.
Referenced by iscsi_rx_scsi_response().
| #define ISCSI_RESPONSE_TARGET_FAILURE 0x01 |
| #define ISCSI_RESPONSE_FLAG_OVERFLOW 0x20 |
| #define ISCSI_RESPONSE_FLAG_UNDERFLOW 0x40 |
| #define ISCSI_OPCODE_DATA_IN 0x25 |
| #define ISCSI_DATA_FLAG_ACKNOWLEDGE 0x40 |
| #define ISCSI_DATA_FLAG_OVERFLOW 0x04 |
Data overflow occurred.
Definition at line 393 of file iscsi.h.
Referenced by iscsi_rx_scsi_response().
| #define ISCSI_DATA_FLAG_UNDERFLOW 0x02 |
Data underflow occurred.
Definition at line 396 of file iscsi.h.
Referenced by iscsi_rx_scsi_response().
| #define ISCSI_DATA_FLAG_STATUS 0x01 |
SCSI status code and overflow/underflow flags are valid.
Definition at line 399 of file iscsi.h.
Referenced by iscsi_rx_data_in().
| #define ISCSI_OPCODE_DATA_OUT 0x05 |
Data-out opcode.
Definition at line 435 of file iscsi.h.
Referenced by iscsi_start_data_out(), iscsi_tx_data(), and iscsi_tx_done().
| #define ISCSI_OPCODE_R2T 0x31 |
| #define ISCSI_OPCODE_NOP_IN 0x20 |
| #define ISCSI_STATUS_SECURITY_NEGOTIATION_PHASE |
iSCSI session is currently in the security negotiation phase
Definition at line 670 of file iscsi.h.
Referenced by iscsi_open_connection().
| #define ISCSI_STATUS_OPERATIONAL_NEGOTIATION_PHASE |
iSCSI session is currently in the operational parameter negotiation phase
Definition at line 677 of file iscsi.h.
Referenced by iscsi_rx_login_response().
| #define ISCSI_STATUS_FULL_FEATURE_PHASE ISCSI_LOGIN_CSG_FULL_FEATURE_PHASE |
iSCSI session is currently in the full feature phase
Definition at line 682 of file iscsi.h.
Referenced by iscsi_rx_login_response(), and iscsi_scsi_window().
| #define ISCSI_STATUS_PHASE_MASK ( ISCSI_LOGIN_CSG_MASK | ISCSI_LOGIN_NSG_MASK ) |
Mask for all iSCSI session phases.
Definition at line 685 of file iscsi.h.
Referenced by iscsi_rx_login_response(), iscsi_scsi_window(), and iscsi_start_login().
| #define ISCSI_STATUS_STRINGS_SECURITY 0x0100 |
iSCSI session needs to send the initial security negotiation strings
Definition at line 688 of file iscsi.h.
Referenced by iscsi_build_login_request_strings(), and iscsi_open_connection().
| #define ISCSI_STATUS_STRINGS_CHAP_ALGORITHM 0x0200 |
iSCSI session needs to send the CHAP_A string
Definition at line 691 of file iscsi.h.
Referenced by iscsi_build_login_request_strings(), and iscsi_handle_authmethod_value().
| #define ISCSI_STATUS_STRINGS_CHAP_RESPONSE 0x0400 |
iSCSI session needs to send the CHAP response
Definition at line 694 of file iscsi.h.
Referenced by iscsi_build_login_request_strings(), and iscsi_handle_chap_c_value().
| #define ISCSI_STATUS_STRINGS_CHAP_CHALLENGE 0x0800 |
iSCSI session needs to send the mutual CHAP challenge
Definition at line 697 of file iscsi.h.
Referenced by iscsi_build_login_request_strings(), and iscsi_handle_chap_c_value().
| #define ISCSI_STATUS_STRINGS_OPERATIONAL 0x1000 |
iSCSI session needs to send the operational negotiation strings
Definition at line 700 of file iscsi.h.
Referenced by iscsi_build_login_request_strings(), and iscsi_rx_login_response().
| #define ISCSI_STATUS_STRINGS_MASK 0xff00 |
Mask for all iSCSI "needs to send" flags.
Definition at line 703 of file iscsi.h.
Referenced by iscsi_login_request_done(), and iscsi_rx_login_response().
| #define ISCSI_STATUS_AUTH_FORWARD_REQUIRED 0x00010000 |
Target has requested forward (initiator) authentication.
Definition at line 706 of file iscsi.h.
Referenced by ibft_fill_target_chap(), and iscsi_handle_authmethod_value().
| #define ISCSI_STATUS_AUTH_REVERSE_REQUIRED 0x00020000 |
Initiator requires target (reverse) authentication.
Definition at line 709 of file iscsi.h.
Referenced by ibft_fill_target_reverse_chap(), iscsi_open_connection(), and iscsi_rx_login_response().
| #define ISCSI_STATUS_AUTH_REVERSE_OK 0x00040000 |
Target authenticated itself correctly.
Definition at line 712 of file iscsi.h.
Referenced by iscsi_handle_chap_r_value(), and iscsi_rx_login_response().
| #define ISCSI_DEFAULT_IQN_PREFIX "iqn.2010-04.org.ipxe" |
Default initiator IQN prefix.
Definition at line 715 of file iscsi.h.
Referenced by iscsi_fetch_settings().
| enum iscsi_tx_state |
State of an iSCSI TX engine.
| Enumerator | |
|---|---|
| ISCSI_TX_IDLE | Nothing to send. |
| ISCSI_TX_BHS | Sending the basic header segment. |
| ISCSI_TX_AHS | Sending the additional header segment. |
| ISCSI_TX_DATA | Sending the data segment. |
Definition at line 521 of file iscsi.h.
| enum iscsi_rx_state |
State of an iSCSI RX engine.
Definition at line 533 of file iscsi.h.
| FILE_LICENCE | ( | GPL2_OR_LATER_OR_UBDL | ) |
| FILE_SECBOOT | ( | PERMITTED | ) |
|
extern |
References __setting, and SETTING_SANBOOT_EXTRA.