STRUCT UFSHCD_LRB(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct ufshcd_lrb(9) β€” the local reference block, bestie

okay so like, this is from the Kernel API Manual, and it's literally the glow-up guide to struct ufshcd_lrb. no cap, this is the main character of UFS command tracking πŸŽ€


🌸 NAME 🌸

struct ufshcd_lrb β€” local reference block. that's it. that's the vibe. it's the little block that holds all the deets for one command. iconic behavior honestly πŸ’–


✨ SYNOPSIS ✨

struct ufshcd_lrb {
    struct utp_transfer_req_desc *utr_descriptor_ptr;
    struct utp_upiu_req *ucd_req_ptr;
    struct utp_upiu_rsp *ucd_rsp_ptr;
    struct ufshcd_sg_entry *ucd_prdt_ptr;
    dma_addr_t utrd_dma_addr;
    dma_addr_t ucd_req_dma_addr;
    dma_addr_t ucd_rsp_dma_addr;
    dma_addr_t ucd_prdt_dma_addr;
    int scsi_status;
    int command_type;
    u8 lun;
    bool intr_cmd;
    bool req_abort_skip;
    ktime_t issue_time_stamp;
    u64 issue_time_stamp_local_clock;
    ktime_t compl_time_stamp;
    u64 compl_time_stamp_local_clock;
  #ifdef CONFIG_SCSI_UFS_CRYPTO;
    int crypto_key_slot;
    u64 data_unit_num;
  #endif;
};

look at all those fields, bestie. it's giving organized. it's giving prepared. it's giving everything u need in one place πŸ¦‹


🧚 Members 🧚

the pointers (the real ones)

  • utr_descriptor_ptr β€” the UTRD address of the command. like, where the whole thing lives in memory, yk?
  • ucd_req_ptr β€” the UCD address of the command 🫢
  • ucd_rsp_ptr β€” the Response UPIU address for this command. the reply guy, basically.
  • ucd_prdt_ptr β€” the PRDT address of the command. slay.

the dma addresses (for debug, lowkey important)

  • utrd_dma_addr β€” UTRD dma address for debug. yes, for debug. πŸ‘€
  • ucd_req_dma_addr β€” UPIU request dma address for debug πŸ”₯
  • ucd_rsp_dma_addr β€” UPIU response dma address for debug πŸ’€
  • ucd_prdt_dma_addr β€” PRDT dma address for debug. we love a debug trail, fr fr.

the status + type girlies

  • scsi_status β€” SCSI status of the command. how did it go? this knows.
  • command_type β€” literally says "SCSI, UFS, Query." pick a lane, babe πŸ’…

the identifiers

  • lun β€” LUN of the command. the whole logical unit number, not a vibe check.

the booleans (yes/no energy)

  • intr_cmd β€” Interrupt command. and here's the tea: it doesn't participate in interrupt aggregation. not invited to the party, periodt πŸ™ˆ
  • req_abort_skip β€” skip request abort task flag. it's a flag, bestie, it does what it says on the tin.

the timestamps (for the girlies who love data)

  • issue_time_stamp β€” time stamp for debug purposes (CLOCK_MONOTONIC) ⏱️
  • issue_time_stamp_local_clock β€” time stamp for debug purposes (local_clock). different clock, same debug energy.
  • compl_time_stamp β€” time stamp for statistics (CLOCK_MONOTONIC). this one's for the numbers, the stats, the math ✨
  • compl_time_stamp_local_clock β€” time stamp for debug purposes (local_clock). yes another one. we love thorough documentation.

the crypto section (conditional! very exclusive)

only here if CONFIG_SCSI_UFS_CRYPTO is defined, so it's giving VIP section πŸ§šβ€β™€οΈ

  • crypto_key_slot β€” the key slot to use for inline crypto (-1 if none). so if it's -1, no key, no crypto, no tea.
  • data_unit_num β€” the data unit number for the first block for inline crypto. the first block! the opener! the main character of the data unit.

πŸ’œ SEE ALSO πŸ’œ

like, go read the Kernel file ./include/ufs/ufshcd.h first, and then these icons:

struct uic_command(9), struct ufs_query_req(9), struct ufs_query_res(9), struct ufs_query(9), struct ufs_dev_cmd(9), struct ufs_clk_info(9), struct tx_eqtr_iter(9), struct ufshcd_tx_eq_settings(9), struct ufshcd_tx_eqtr_data(9), struct ufshcd_tx_eqtr_record(9), struct ufshcd_tx_eq_params(9), struct ufs_hba_variant_ops(9), struct ufs_clk_gating(9), struct ufs_clk_scaling(9), struct ufs_event_hist(9), struct ufs_stats(9), enum ufshcd_state(9), enum ufshcd_pmc_policy(9), struct ufshcd_mcq_opr_info_t(9), struct ufs_hba(9), struct ufs_hw_queue(9), ufshcd_rmwl(9), ufshcd_set_variant(9), ufshcd_get_variant(9)

that's the whole friend group right there. no skips. 🌈


okay and finally, the sign-off bestie: this page is from ./include/ufs and it says October 2026 on the cover. so like, it's literally from the future or whatever. periodt. πŸ’…βœ¨

current mood: struct ufshcd_lrb is the blueprint, and everyone else is just living in it.

πŸ“¦ where this page comes from