drivers/target/iscsi/iscsi_target_erl0.c
Source file repositories/reference/linux-study-clean/drivers/target/iscsi/iscsi_target_erl0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/target/iscsi/iscsi_target_erl0.c- Extension
.c- Size
- 26641 bytes
- Lines
- 938
- Domain
- Driver Families
- Bucket
- drivers/target
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/sched/signal.hscsi/iscsi_proto.htarget/target_core_base.htarget/target_core_fabric.htarget/iscsi/iscsi_target_core.hiscsi_target_seq_pdu_list.hiscsi_target_erl0.hiscsi_target_erl1.hiscsi_target_erl2.hiscsi_target_util.hiscsi_target.h
Detected Declarations
function iscsit_dataout_check_sequencefunction iscsit_dataout_within_command_recovery_checkfunction iscsi_check_pre_dataoutfunction iscsit_dataout_check_unsolicited_sequencefunction iscsit_dataout_check_sequencefunction iscsi_set_dataout_sequence_valuesfunction iscsit_dataout_check_datasnfunction iscsit_dataout_pre_datapduinorder_yesfunction iscsit_dataout_pre_datapduinorder_nofunction iscsit_dataout_update_r2tfunction iscsit_dataout_update_datapduinorder_nofunction iscsit_dataout_post_crc_passedfunction iscsit_dataout_post_crc_failedfunction iscsit_handle_data_outfunction iscsit_handle_data_outfunction iscsit_handle_time2retain_timeoutfunction iscsit_start_time2retain_handlerfunction iscsit_stop_time2retain_timerfunction iscsit_connection_reinstatement_rcfrfunction iscsit_cause_connection_reinstatementfunction iscsit_fall_back_to_erl0function iscsit_handle_connection_cleanupfunction iscsit_take_action_for_connection_exitexport iscsit_cause_connection_reinstatement
Annotated Snippet
if (conn->sess->sess_ops->DataPDUInOrder) {
if (seq->status ==
DATAOUT_SEQUENCE_WITHIN_COMMAND_RECOVERY &&
(seq->offset != be32_to_cpu(hdr->offset) ||
seq->data_sn != be32_to_cpu(hdr->datasn)))
goto dump;
} else {
if (seq->status ==
DATAOUT_SEQUENCE_WITHIN_COMMAND_RECOVERY &&
seq->data_sn != be32_to_cpu(hdr->datasn))
goto dump;
}
if (seq->status == DATAOUT_SEQUENCE_COMPLETE)
goto dump;
if (seq->status != DATAOUT_SEQUENCE_COMPLETE)
seq->status = 0;
}
return DATAOUT_NORMAL;
dump:
pr_err("Dumping DataOUT PDU Offset: %u Length: %d DataSN:"
" 0x%08x\n", hdr->offset, payload_length, hdr->datasn);
return iscsit_dump_data_payload(conn, payload_length, 1);
}
static int iscsit_dataout_check_unsolicited_sequence(
struct iscsit_cmd *cmd,
unsigned char *buf)
{
u32 first_burst_len;
struct iscsit_conn *conn = cmd->conn;
struct iscsi_data *hdr = (struct iscsi_data *) buf;
u32 payload_length = ntoh24(hdr->dlength);
if ((be32_to_cpu(hdr->offset) < cmd->seq_start_offset) ||
((be32_to_cpu(hdr->offset) + payload_length) > cmd->seq_end_offset)) {
pr_err("Command ITT: 0x%08x with Offset: %u,"
" Length: %u outside of Unsolicited Sequence %u:%u while"
" DataSequenceInOrder=Yes.\n", cmd->init_task_tag,
be32_to_cpu(hdr->offset), payload_length, cmd->seq_start_offset,
cmd->seq_end_offset);
return DATAOUT_CANNOT_RECOVER;
}
first_burst_len = (cmd->first_burst_len + payload_length);
if (first_burst_len > conn->sess->sess_ops->FirstBurstLength) {
pr_err("Total %u bytes exceeds FirstBurstLength: %u"
" for this Unsolicited DataOut Burst.\n",
first_burst_len, conn->sess->sess_ops->FirstBurstLength);
transport_send_check_condition_and_sense(&cmd->se_cmd,
TCM_INCORRECT_AMOUNT_OF_DATA, 0);
return DATAOUT_CANNOT_RECOVER;
}
/*
* Perform various MaxBurstLength and ISCSI_FLAG_CMD_FINAL sanity
* checks for the current Unsolicited DataOUT Sequence.
*/
if (hdr->flags & ISCSI_FLAG_CMD_FINAL) {
/*
* Ignore ISCSI_FLAG_CMD_FINAL checks while DataPDUInOrder=No, end of
* sequence checks are handled in
* iscsit_dataout_datapduinorder_no_fbit().
*/
if (!conn->sess->sess_ops->DataPDUInOrder)
goto out;
if ((first_burst_len != cmd->se_cmd.data_length) &&
(first_burst_len != conn->sess->sess_ops->FirstBurstLength)) {
pr_err("Unsolicited non-immediate data"
" received %u does not equal FirstBurstLength: %u, and"
" does not equal ExpXferLen %u.\n", first_burst_len,
conn->sess->sess_ops->FirstBurstLength,
cmd->se_cmd.data_length);
transport_send_check_condition_and_sense(&cmd->se_cmd,
TCM_INCORRECT_AMOUNT_OF_DATA, 0);
return DATAOUT_CANNOT_RECOVER;
}
} else {
if (first_burst_len == conn->sess->sess_ops->FirstBurstLength) {
pr_err("Command ITT: 0x%08x reached"
" FirstBurstLength: %u, but ISCSI_FLAG_CMD_FINAL is not set. protocol"
" error.\n", cmd->init_task_tag,
conn->sess->sess_ops->FirstBurstLength);
return DATAOUT_CANNOT_RECOVER;
Annotation
- Immediate include surface: `linux/sched/signal.h`, `scsi/iscsi_proto.h`, `target/target_core_base.h`, `target/target_core_fabric.h`, `target/iscsi/iscsi_target_core.h`, `iscsi_target_seq_pdu_list.h`, `iscsi_target_erl0.h`, `iscsi_target_erl1.h`.
- Detected declarations: `function iscsit_dataout_check_sequence`, `function iscsit_dataout_within_command_recovery_check`, `function iscsi_check_pre_dataout`, `function iscsit_dataout_check_unsolicited_sequence`, `function iscsit_dataout_check_sequence`, `function iscsi_set_dataout_sequence_values`, `function iscsit_dataout_check_datasn`, `function iscsit_dataout_pre_datapduinorder_yes`, `function iscsit_dataout_pre_datapduinorder_no`, `function iscsit_dataout_update_r2t`.
- Atlas domain: Driver Families / drivers/target.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.