drivers/target/tcm_fc/tfc_cmd.c
Source file repositories/reference/linux-study-clean/drivers/target/tcm_fc/tfc_cmd.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/target/tcm_fc/tfc_cmd.c- Extension
.c- Size
- 13857 bytes
- Lines
- 563
- Domain
- Driver Families
- Bucket
- drivers/target
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/moduleparam.hlinux/utsname.hlinux/init.hlinux/slab.hlinux/kthread.hlinux/types.hlinux/string.hlinux/configfs.hlinux/ctype.hlinux/hash.hlinux/unaligned.hscsi/scsi_tcq.hscsi/libfc.htarget/target_core_base.htarget/target_core_fabric.htcm_fc.h
Detected Declarations
function Copyrightfunction ft_dump_cmdfunction ft_free_cmdfunction ft_release_cmdfunction ft_check_stop_freefunction ft_queue_statusfunction TX_RDYfunction ft_recv_seqfunction SAM_STAT_GOODfunction ft_send_resp_codefunction ft_send_resp_code_and_freefunction ft_send_tmfunction ft_queue_tm_respfunction ft_aborted_taskfunction ft_recv_cmdfunction ft_recv_reqfunction ft_send_work
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2010 Cisco Systems, Inc.
*/
/* XXX TBD some includes may be extraneous */
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/utsname.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <linux/kthread.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/configfs.h>
#include <linux/ctype.h>
#include <linux/hash.h>
#include <linux/unaligned.h>
#include <scsi/scsi_tcq.h>
#include <scsi/libfc.h>
#include <target/target_core_base.h>
#include <target/target_core_fabric.h>
#include "tcm_fc.h"
/*
* Dump cmd state for debugging.
*/
static void _ft_dump_cmd(struct ft_cmd *cmd, const char *caller)
{
struct fc_exch *ep;
struct fc_seq *sp;
struct se_cmd *se_cmd;
struct scatterlist *sg;
int count;
se_cmd = &cmd->se_cmd;
pr_debug("%s: cmd %p sess %p seq %p se_cmd %p\n",
caller, cmd, cmd->sess, cmd->seq, se_cmd);
pr_debug("%s: cmd %p data_nents %u len %u se_cmd_flags <0x%x>\n",
caller, cmd, se_cmd->t_data_nents,
se_cmd->data_length, se_cmd->se_cmd_flags);
for_each_sg(se_cmd->t_data_sg, sg, se_cmd->t_data_nents, count)
pr_debug("%s: cmd %p sg %p page %p "
"len 0x%x off 0x%x\n",
caller, cmd, sg,
sg_page(sg), sg->length, sg->offset);
sp = cmd->seq;
if (sp) {
ep = fc_seq_exch(sp);
pr_debug("%s: cmd %p sid %x did %x "
"ox_id %x rx_id %x seq_id %x e_stat %x\n",
caller, cmd, ep->sid, ep->did, ep->oxid, ep->rxid,
sp->id, ep->esb_stat);
}
}
void ft_dump_cmd(struct ft_cmd *cmd, const char *caller)
{
if (unlikely(ft_debug_logging))
_ft_dump_cmd(cmd, caller);
}
static void ft_free_cmd(struct ft_cmd *cmd)
{
struct fc_frame *fp;
struct ft_sess *sess;
if (!cmd)
return;
sess = cmd->sess;
fp = cmd->req_frame;
if (fr_seq(fp))
fc_seq_release(fr_seq(fp));
fc_frame_free(fp);
target_free_tag(sess->se_sess, &cmd->se_cmd);
ft_sess_put(sess); /* undo get from lookup at recv */
}
void ft_release_cmd(struct se_cmd *se_cmd)
{
struct ft_cmd *cmd = container_of(se_cmd, struct ft_cmd, se_cmd);
ft_free_cmd(cmd);
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/utsname.h`, `linux/init.h`, `linux/slab.h`, `linux/kthread.h`, `linux/types.h`, `linux/string.h`.
- Detected declarations: `function Copyright`, `function ft_dump_cmd`, `function ft_free_cmd`, `function ft_release_cmd`, `function ft_check_stop_free`, `function ft_queue_status`, `function TX_RDY`, `function ft_recv_seq`, `function SAM_STAT_GOOD`, `function ft_send_resp_code`.
- Atlas domain: Driver Families / drivers/target.
- Implementation status: source implementation candidate.
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.