drivers/scsi/elx/libefc/efc_domain.c
Source file repositories/reference/linux-study-clean/drivers/scsi/elx/libefc/efc_domain.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/scsi/elx/libefc/efc_domain.c- Extension
.c- Size
- 26481 bytes
- Lines
- 1089
- 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.
- 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
efc.h
Detected Declarations
function Copyrightfunction _efc_domain_freefunction efc_domain_freefunction efc_domain_allocfunction efc_register_domain_free_cbfunction __efc_domain_commonfunction __efc_domain_common_shutdownfunction __efc_domain_initfunction __efc_domain_wait_allocfunction NL_PORTfunction __efc_domain_allocatedfunction list_for_each_entry_safefunction __efc_domain_wait_attachfunction list_for_each_entry_safefunction __efc_domain_readyfunction list_for_each_entry_safefunction __efc_domain_wait_nports_freefunction __efc_domain_wait_shutdownfunction __efc_domain_wait_domain_lostfunction list_for_each_entry_safefunction __efc_domain_attach_internalfunction efc_domain_attachfunction efc_domain_post_eventfunction efct_domain_process_pendingfunction efc_dispatch_framefunction efc_domain_dispatch_framefunction efc_node_dispatch_frame
Annotated Snippet
if (!domain) {
domain = efc_domain_alloc(efc, fcf_wwn);
if (!domain) {
efc_log_err(efc, "efc_domain_alloc() failed\n");
rc = -1;
break;
}
efc_sm_transition(&domain->drvsm, __efc_domain_init,
NULL);
}
efc_domain_post_event(domain, EFC_EVT_DOMAIN_FOUND, drec);
break;
}
case EFC_HW_DOMAIN_LOST:
domain_trace(domain, "EFC_HW_DOMAIN_LOST:\n");
efc->hold_frames = true;
efc_domain_post_event(domain, EFC_EVT_DOMAIN_LOST, NULL);
break;
case EFC_HW_DOMAIN_ALLOC_OK:
domain_trace(domain, "EFC_HW_DOMAIN_ALLOC_OK:\n");
efc_domain_post_event(domain, EFC_EVT_DOMAIN_ALLOC_OK, NULL);
break;
case EFC_HW_DOMAIN_ALLOC_FAIL:
domain_trace(domain, "EFC_HW_DOMAIN_ALLOC_FAIL:\n");
efc_domain_post_event(domain, EFC_EVT_DOMAIN_ALLOC_FAIL,
NULL);
break;
case EFC_HW_DOMAIN_ATTACH_OK:
domain_trace(domain, "EFC_HW_DOMAIN_ATTACH_OK:\n");
efc_domain_post_event(domain, EFC_EVT_DOMAIN_ATTACH_OK, NULL);
break;
case EFC_HW_DOMAIN_ATTACH_FAIL:
domain_trace(domain, "EFC_HW_DOMAIN_ATTACH_FAIL:\n");
efc_domain_post_event(domain,
EFC_EVT_DOMAIN_ATTACH_FAIL, NULL);
break;
case EFC_HW_DOMAIN_FREE_OK:
domain_trace(domain, "EFC_HW_DOMAIN_FREE_OK:\n");
efc_domain_post_event(domain, EFC_EVT_DOMAIN_FREE_OK, NULL);
break;
case EFC_HW_DOMAIN_FREE_FAIL:
domain_trace(domain, "EFC_HW_DOMAIN_FREE_FAIL:\n");
efc_domain_post_event(domain, EFC_EVT_DOMAIN_FREE_FAIL, NULL);
break;
default:
efc_log_warn(efc, "unsupported event %#x\n", event);
}
spin_unlock_irqrestore(&efc->lock, flags);
if (efc->domain && domain->req_accept_frames) {
domain->req_accept_frames = false;
efc->hold_frames = false;
}
return rc;
}
static void
_efc_domain_free(struct kref *arg)
{
struct efc_domain *domain = container_of(arg, struct efc_domain, ref);
struct efc *efc = domain->efc;
if (efc->domain_free_cb)
(*efc->domain_free_cb)(efc, efc->domain_free_cb_arg);
kfree(domain);
}
void
efc_domain_free(struct efc_domain *domain)
{
struct efc *efc;
efc = domain->efc;
/* Hold frames to clear the domain pointer from the xport lookup */
efc->hold_frames = false;
efc_log_debug(efc, "Domain free: wwn %016llX\n", domain->fcf_wwn);
xa_destroy(&domain->lookup);
Annotation
- Immediate include surface: `efc.h`.
- Detected declarations: `function Copyright`, `function _efc_domain_free`, `function efc_domain_free`, `function efc_domain_alloc`, `function efc_register_domain_free_cb`, `function __efc_domain_common`, `function __efc_domain_common_shutdown`, `function __efc_domain_init`, `function __efc_domain_wait_alloc`, `function NL_PORT`.
- Atlas domain: Driver Families / drivers/scsi.
- Implementation status: source 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.