drivers/scsi/bfa/bfad_bsg.c
Source file repositories/reference/linux-study-clean/drivers/scsi/bfa/bfad_bsg.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/bfa/bfad_bsg.c- Extension
.c- Size
- 99995 bytes
- Lines
- 3613
- Domain
- Driver Families
- Bucket
- drivers/scsi
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/uaccess.hbfad_drv.hbfad_im.hbfad_bsg.h
Detected Declarations
function bfad_iocmd_ioc_enablefunction bfad_iocmd_ioc_disablefunction bfad_iocmd_ioc_get_infofunction bfad_iocmd_ioc_get_attrfunction bfad_iocmd_ioc_get_statsfunction bfad_iocmd_ioc_get_fwstatsfunction bfad_iocmd_ioc_reset_statsfunction bfad_iocmd_ioc_set_namefunction bfad_iocmd_iocfc_get_attrfunction bfad_iocmd_ioc_fw_sig_invfunction bfad_iocmd_iocfc_set_intrfunction bfad_iocmd_port_enablefunction bfad_iocmd_port_disablefunction bfad_iocmd_port_get_attrfunction bfad_iocmd_port_get_statsfunction bfad_iocmd_port_reset_statsfunction bfad_iocmd_set_port_cfgfunction bfad_iocmd_port_cfg_maxfrsizefunction bfad_iocmd_port_cfg_bbcrfunction bfad_iocmd_port_get_bbcr_attrfunction bfad_iocmd_lport_get_attrfunction bfad_iocmd_lport_get_statsfunction bfad_iocmd_lport_reset_statsfunction bfad_iocmd_lport_get_iostatsfunction bfad_iocmd_lport_get_rportsfunction bfad_iocmd_rport_get_attrfunction bfad_iocmd_rport_get_addrfunction bfad_iocmd_rport_get_statsfunction bfad_iocmd_rport_clr_statsfunction bfad_iocmd_rport_set_speedfunction bfad_iocmd_vport_get_attrfunction bfad_iocmd_vport_get_statsfunction bfad_iocmd_vport_clr_statsfunction bfad_iocmd_fabric_get_lportsfunction bfad_iocmd_qos_set_bwfunction bfad_iocmd_ratelimfunction bfad_iocmd_ratelim_speedfunction bfad_iocmd_cfg_fcpimfunction bfad_iocmd_fcpim_get_modstatsfunction bfad_iocmd_fcpim_clr_modstatsfunction bfad_iocmd_fcpim_get_del_itn_statsfunction bfad_iocmd_itnim_get_attrfunction bfad_iocmd_itnim_get_iostatsfunction bfad_iocmd_itnim_reset_statsfunction bfad_iocmd_itnim_get_itnstatsfunction bfad_iocmd_fcport_enablefunction bfad_iocmd_fcport_disablefunction bfad_iocmd_ioc_get_pcifn_cfg
Annotated Snippet
sizeof(struct bfa_fw_stats_s)) != BFA_STATUS_OK) {
iocmd->status = BFA_STATUS_VERSION_FAIL;
goto out;
}
iocmd_bufptr = (char *)iocmd + sizeof(struct bfa_bsg_ioc_fwstats_s);
spin_lock_irqsave(&bfad->bfad_lock, flags);
iocmd->status = bfa_ioc_fw_stats_get(&bfad->bfa.ioc, iocmd_bufptr);
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
if (iocmd->status != BFA_STATUS_OK) {
bfa_trc(bfad, iocmd->status);
goto out;
}
out:
bfa_trc(bfad, 0x6666);
return 0;
}
static int
bfad_iocmd_ioc_reset_stats(struct bfad_s *bfad, void *cmd, unsigned int v_cmd)
{
struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd;
unsigned long flags;
if (v_cmd == IOCMD_IOC_RESET_STATS) {
bfa_ioc_clear_stats(&bfad->bfa);
iocmd->status = BFA_STATUS_OK;
} else if (v_cmd == IOCMD_IOC_RESET_FWSTATS) {
spin_lock_irqsave(&bfad->bfad_lock, flags);
iocmd->status = bfa_ioc_fw_stats_clear(&bfad->bfa.ioc);
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
}
return 0;
}
static int
bfad_iocmd_ioc_set_name(struct bfad_s *bfad, void *cmd, unsigned int v_cmd)
{
struct bfa_bsg_ioc_name_s *iocmd = (struct bfa_bsg_ioc_name_s *) cmd;
if (v_cmd == IOCMD_IOC_SET_ADAPTER_NAME)
strcpy(bfad->adapter_name, iocmd->name);
else if (v_cmd == IOCMD_IOC_SET_PORT_NAME)
strcpy(bfad->port_name, iocmd->name);
iocmd->status = BFA_STATUS_OK;
return 0;
}
static int
bfad_iocmd_iocfc_get_attr(struct bfad_s *bfad, void *cmd)
{
struct bfa_bsg_iocfc_attr_s *iocmd = (struct bfa_bsg_iocfc_attr_s *)cmd;
iocmd->status = BFA_STATUS_OK;
bfa_iocfc_get_attr(&bfad->bfa, &iocmd->iocfc_attr);
return 0;
}
static int
bfad_iocmd_ioc_fw_sig_inv(struct bfad_s *bfad, void *cmd)
{
struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd;
unsigned long flags;
spin_lock_irqsave(&bfad->bfad_lock, flags);
iocmd->status = bfa_ioc_fwsig_invalidate(&bfad->bfa.ioc);
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
return 0;
}
static int
bfad_iocmd_iocfc_set_intr(struct bfad_s *bfad, void *cmd)
{
struct bfa_bsg_iocfc_intr_s *iocmd = (struct bfa_bsg_iocfc_intr_s *)cmd;
unsigned long flags;
spin_lock_irqsave(&bfad->bfad_lock, flags);
iocmd->status = bfa_iocfc_israttr_set(&bfad->bfa, &iocmd->attr);
spin_unlock_irqrestore(&bfad->bfad_lock, flags);
return 0;
}
static int
bfad_iocmd_port_enable(struct bfad_s *bfad, void *cmd)
{
Annotation
- Immediate include surface: `linux/uaccess.h`, `bfad_drv.h`, `bfad_im.h`, `bfad_bsg.h`.
- Detected declarations: `function bfad_iocmd_ioc_enable`, `function bfad_iocmd_ioc_disable`, `function bfad_iocmd_ioc_get_info`, `function bfad_iocmd_ioc_get_attr`, `function bfad_iocmd_ioc_get_stats`, `function bfad_iocmd_ioc_get_fwstats`, `function bfad_iocmd_ioc_reset_stats`, `function bfad_iocmd_ioc_set_name`, `function bfad_iocmd_iocfc_get_attr`, `function bfad_iocmd_ioc_fw_sig_inv`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.