target_submit_cmd(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– target_submit_cmd β€” NAME πŸ’–

okay so bestie, welcome to the Kernel API Manual ✨ this one is all about target_submit_cmd β€” it looks up an unpacked LUN and submits an uninitialized se_cmd. that's the whole vibe πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

void target_submit_cmd (struct se_cmd *se_cmd , struct se_session *se_sess , unsigned char *cdb , unsigned char *sense , u64 unpacked_lun , u32 data_length , int task_attr , int data_dir , int flags );

like, yes, that is a lot of arguments. she's an icon, she's high-maintenance, we love her πŸ’œ


🌸 ARGUMENTS 🌸

  • se_cmd β€” the command descriptor you're submitting. the main character of this whole situation πŸ‘‘
  • se_sess β€” the associated se_sess for the endpoint. her plus-one 🫢
  • cdb β€” pointer to the SCSI CDB
  • sense β€” pointer to the SCSI sense buffer
  • unpacked_lun β€” the unpacked LUN to reference for struct se_lun
  • data_length β€” the fabric's expected data transfer length
  • task_attr β€” the SAM task attribute
  • data_dir β€” the DMA data direction
  • flags β€” flags for command submission, straight from target_sc_flags_tables

ngl that's a full roster but every single one is doing her job okay 😭


✨ DESCRIPTION ✨

Task tags are supported β€” but only if the caller has set se_cmd->tag. no tag, no tag support, that's the rule πŸ’…

This may only be called from process context, and it also currently assumes internal allocation of the fabric payload buffer by target-core. so like, don't come at her from interrupt context, she's not built for that energy πŸ™ˆ

It also assumes internal target core SGL memory allocation.

⚠️ okay this next part is important, so listen up bestie: this function must only be used by drivers that do their own sync during shutdown and that do not use target_stop_session. and if there's a failure? this function will call into the fabric driver's queue_status with a CHECK_CONDITION. literally it will snitch to queue_status, that's the whole move πŸ’€

πŸŽ€ SEE ALSO πŸŽ€

Kernel file ./drivers/target/target_core_transport.c

like a whole friend group fr fr 🌈


✨ and that's the page! ✨ this one lives in ./drivers/target, dated October 2026, and honestly? she ate. go read the kernel source bestie, ily, bye πŸ’–πŸ¦‹πŸŽ€

πŸ“¦ where this page comes from