drivers/target/target_core_transport.c
Source file repositories/reference/linux-study-clean/drivers/target/target_core_transport.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/target/target_core_transport.c- Extension
.c- Size
- 102684 bytes
- Lines
- 3727
- 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/net.hlinux/delay.hlinux/string.hlinux/timer.hlinux/slab.hlinux/spinlock.hlinux/kthread.hlinux/in.hlinux/cdrom.hlinux/module.hlinux/ratelimit.hlinux/vmalloc.hlinux/unaligned.hnet/sock.hnet/tcp.hscsi/scsi_proto.hscsi/scsi_common.htarget/target_core_base.htarget/target_core_backend.htarget/target_core_fabric.htarget_core_internal.htarget_core_alua.htarget_core_pr.htarget_core_ua.htrace/events/target.h
Detected Declarations
struct sense_detailfunction init_se_kmem_cachesfunction release_se_kmem_cachesfunction scsi_get_new_indexfunction transport_subsystem_check_initfunction target_release_cmd_refcntfunction target_free_cmd_counterfunction transport_init_sessionfunction transport_alloc_session_tagsfunction transport_init_session_tagsfunction spin_lock_irqsavefunction transport_register_sessionfunction target_setup_sessionfunction transport_register_sessionfunction target_show_dynamic_sessionsfunction target_complete_naclfunction target_put_naclfunction transport_deregister_session_configfsfunction transport_free_sessionfunction core_tpg_get_initiator_node_aclfunction target_release_resfunction transport_deregister_sessionfunction target_remove_sessionfunction target_remove_from_state_listfunction target_remove_from_tmr_listfunction transport_wait_for_tasksfunction transport_lun_remove_cmdfunction target_complete_failure_workfunction transport_copy_sense_to_cmdfunction target_handle_abortfunction target_abort_workfunction target_cmd_interruptedfunction target_completefunction target_complete_cmd_with_sensefunction target_complete_cmdfunction target_set_cmd_data_lengthfunction target_complete_cmd_with_lengthfunction target_add_to_state_listfunction target_qf_do_workfunction list_for_each_entry_safefunction transport_dump_dev_statefunction transport_dump_vpd_proto_idfunction transport_set_vpd_proto_idfunction transport_dump_vpd_assocfunction transport_set_vpd_assocfunction transport_dump_vpd_ident_typefunction transport_set_vpd_ident_typefunction transport_dump_vpd_ident
Annotated Snippet
struct sense_detail {
u8 key;
u8 asc;
u8 ascq;
bool add_sense_info;
};
static const struct sense_detail sense_detail_table[] = {
[TCM_NO_SENSE] = {
.key = NOT_READY
},
[TCM_NON_EXISTENT_LUN] = {
.key = ILLEGAL_REQUEST,
.asc = 0x25 /* LOGICAL UNIT NOT SUPPORTED */
},
[TCM_UNSUPPORTED_SCSI_OPCODE] = {
.key = ILLEGAL_REQUEST,
.asc = 0x20, /* INVALID COMMAND OPERATION CODE */
},
[TCM_SECTOR_COUNT_TOO_MANY] = {
.key = ILLEGAL_REQUEST,
.asc = 0x20, /* INVALID COMMAND OPERATION CODE */
},
[TCM_UNKNOWN_MODE_PAGE] = {
.key = ILLEGAL_REQUEST,
.asc = 0x24, /* INVALID FIELD IN CDB */
},
[TCM_CHECK_CONDITION_ABORT_CMD] = {
.key = ABORTED_COMMAND,
.asc = 0x29, /* BUS DEVICE RESET FUNCTION OCCURRED */
.ascq = 0x03,
},
[TCM_INCORRECT_AMOUNT_OF_DATA] = {
.key = ABORTED_COMMAND,
.asc = 0x0c, /* WRITE ERROR */
.ascq = 0x0d, /* NOT ENOUGH UNSOLICITED DATA */
},
[TCM_INVALID_CDB_FIELD] = {
.key = ILLEGAL_REQUEST,
.asc = 0x24, /* INVALID FIELD IN CDB */
},
[TCM_INVALID_PARAMETER_LIST] = {
.key = ILLEGAL_REQUEST,
.asc = 0x26, /* INVALID FIELD IN PARAMETER LIST */
},
[TCM_TOO_MANY_TARGET_DESCS] = {
.key = ILLEGAL_REQUEST,
.asc = 0x26,
.ascq = 0x06, /* TOO MANY TARGET DESCRIPTORS */
},
[TCM_UNSUPPORTED_TARGET_DESC_TYPE_CODE] = {
.key = ILLEGAL_REQUEST,
.asc = 0x26,
.ascq = 0x07, /* UNSUPPORTED TARGET DESCRIPTOR TYPE CODE */
},
[TCM_TOO_MANY_SEGMENT_DESCS] = {
.key = ILLEGAL_REQUEST,
.asc = 0x26,
.ascq = 0x08, /* TOO MANY SEGMENT DESCRIPTORS */
},
[TCM_UNSUPPORTED_SEGMENT_DESC_TYPE_CODE] = {
.key = ILLEGAL_REQUEST,
.asc = 0x26,
.ascq = 0x09, /* UNSUPPORTED SEGMENT DESCRIPTOR TYPE CODE */
},
[TCM_PARAMETER_LIST_LENGTH_ERROR] = {
.key = ILLEGAL_REQUEST,
.asc = 0x1a, /* PARAMETER LIST LENGTH ERROR */
},
[TCM_UNEXPECTED_UNSOLICITED_DATA] = {
.key = ILLEGAL_REQUEST,
.asc = 0x0c, /* WRITE ERROR */
.ascq = 0x0c, /* UNEXPECTED_UNSOLICITED_DATA */
},
[TCM_SERVICE_CRC_ERROR] = {
.key = ABORTED_COMMAND,
.asc = 0x47, /* PROTOCOL SERVICE CRC ERROR */
.ascq = 0x05, /* N/A */
},
[TCM_SNACK_REJECTED] = {
.key = ABORTED_COMMAND,
.asc = 0x11, /* READ ERROR */
.ascq = 0x13, /* FAILED RETRANSMISSION REQUEST */
},
[TCM_WRITE_PROTECTED] = {
.key = DATA_PROTECT,
.asc = 0x27, /* WRITE PROTECTED */
},
[TCM_ADDRESS_OUT_OF_RANGE] = {
.key = ILLEGAL_REQUEST,
Annotation
- Immediate include surface: `linux/net.h`, `linux/delay.h`, `linux/string.h`, `linux/timer.h`, `linux/slab.h`, `linux/spinlock.h`, `linux/kthread.h`, `linux/in.h`.
- Detected declarations: `struct sense_detail`, `function init_se_kmem_caches`, `function release_se_kmem_caches`, `function scsi_get_new_index`, `function transport_subsystem_check_init`, `function target_release_cmd_refcnt`, `function target_free_cmd_counter`, `function transport_init_session`, `function transport_alloc_session_tags`, `function transport_init_session_tags`.
- 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.