drivers/target/iscsi/iscsi_target_erl1.c
Source file repositories/reference/linux-study-clean/drivers/target/iscsi/iscsi_target_erl1.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/target/iscsi/iscsi_target_erl1.c- Extension
.c- Size
- 32075 bytes
- Lines
- 1239
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/list.hlinux/slab.hscsi/iscsi_proto.htarget/target_core_base.htarget/target_core_fabric.htarget/iscsi/iscsi_transport.htarget/iscsi/iscsi_target_core.hiscsi_target_seq_pdu_list.hiscsi_target_datain_values.hiscsi_target_device.hiscsi_target_tpg.hiscsi_target_util.hiscsi_target_erl0.hiscsi_target_erl1.hiscsi_target_erl2.hiscsi_target.h
Detected Declarations
function iscsit_dump_data_payloadfunction iscsit_send_recovery_r2t_for_snackfunction iscsit_handle_r2t_snackfunction iscsit_create_recovery_datain_values_datasequenceinorder_yesfunction iscsit_create_recovery_datain_values_datasequenceinorder_nofunction iscsit_handle_recovery_datainfunction iscsit_handle_recovery_datain_or_r2tfunction iscsit_handle_status_snackfunction list_for_each_entryfunction iscsit_handle_data_ackfunction iscsit_send_recovery_r2tfunction iscsit_dataout_datapduinorder_no_fbitfunction iscsit_recalculate_dataout_valuesfunction iscsit_recover_dataout_sequencefunction iscsit_attach_ooo_cmdsnfunction list_for_each_entryfunction iscsit_remove_ooo_cmdsnfunction iscsit_clear_ooo_cmdsns_for_connfunction iscsit_execute_ooo_cmdsnsfunction list_for_each_entry_safefunction iscsi_check_received_cmdsnfunction iscsit_free_all_ooo_cmdsnsfunction iscsit_handle_ooo_cmdsnfunction iscsit_set_dataout_timeout_valuesfunction list_for_each_entryfunction iscsit_handle_dataout_timeoutfunction iscsit_mod_dataout_timerfunction iscsit_start_dataout_timerfunction iscsit_stop_dataout_timerexport iscsit_stop_dataout_timer
Annotated Snippet
if (rx_got != size) {
ret = DATAOUT_CANNOT_RECOVER;
break;
}
offset += size;
}
kfree(buf);
return ret;
}
/*
* Used for retransmitting R2Ts from a R2T SNACK request.
*/
static int iscsit_send_recovery_r2t_for_snack(
struct iscsit_cmd *cmd,
struct iscsi_r2t *r2t)
{
/*
* If the struct iscsi_r2t has not been sent yet, we can safely
* ignore retransmission
* of the R2TSN in question.
*/
spin_lock_bh(&cmd->r2t_lock);
if (!r2t->sent_r2t) {
spin_unlock_bh(&cmd->r2t_lock);
return 0;
}
r2t->sent_r2t = 0;
spin_unlock_bh(&cmd->r2t_lock);
iscsit_add_cmd_to_immediate_queue(cmd, cmd->conn, ISTATE_SEND_R2T);
return 0;
}
static int iscsit_handle_r2t_snack(
struct iscsit_cmd *cmd,
unsigned char *buf,
u32 begrun,
u32 runlength)
{
u32 last_r2tsn;
struct iscsi_r2t *r2t;
/*
* Make sure the initiator is not requesting retransmission
* of R2TSNs already acknowledged by a TMR TASK_REASSIGN.
*/
if ((cmd->cmd_flags & ICF_GOT_DATACK_SNACK) &&
(begrun <= cmd->acked_data_sn)) {
pr_err("ITT: 0x%08x, R2T SNACK requesting"
" retransmission of R2TSN: 0x%08x to 0x%08x but already"
" acked to R2TSN: 0x%08x by TMR TASK_REASSIGN,"
" protocol error.\n", cmd->init_task_tag, begrun,
(begrun + runlength), cmd->acked_data_sn);
return iscsit_reject_cmd(cmd, ISCSI_REASON_PROTOCOL_ERROR, buf);
}
if (runlength) {
if ((begrun + runlength) > cmd->r2t_sn) {
pr_err("Command ITT: 0x%08x received R2T SNACK"
" with BegRun: 0x%08x, RunLength: 0x%08x, exceeds"
" current R2TSN: 0x%08x, protocol error.\n",
cmd->init_task_tag, begrun, runlength, cmd->r2t_sn);
return iscsit_reject_cmd(cmd,
ISCSI_REASON_BOOKMARK_INVALID, buf);
}
last_r2tsn = (begrun + runlength);
} else
last_r2tsn = cmd->r2t_sn;
while (begrun < last_r2tsn) {
r2t = iscsit_get_holder_for_r2tsn(cmd, begrun);
if (!r2t)
return -1;
if (iscsit_send_recovery_r2t_for_snack(cmd, r2t) < 0)
return -1;
begrun++;
}
return 0;
}
/*
* Generates Offsets and NextBurstLength based on Begrun and Runlength
* carried in a Data SNACK or ExpDataSN in TMR TASK_REASSIGN.
Annotation
- Immediate include surface: `linux/list.h`, `linux/slab.h`, `scsi/iscsi_proto.h`, `target/target_core_base.h`, `target/target_core_fabric.h`, `target/iscsi/iscsi_transport.h`, `target/iscsi/iscsi_target_core.h`, `iscsi_target_seq_pdu_list.h`.
- Detected declarations: `function iscsit_dump_data_payload`, `function iscsit_send_recovery_r2t_for_snack`, `function iscsit_handle_r2t_snack`, `function iscsit_create_recovery_datain_values_datasequenceinorder_yes`, `function iscsit_create_recovery_datain_values_datasequenceinorder_no`, `function iscsit_handle_recovery_datain`, `function iscsit_handle_recovery_datain_or_r2t`, `function iscsit_handle_status_snack`, `function list_for_each_entry`, `function iscsit_handle_data_ack`.
- 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.