drivers/net/ethernet/sfc/siena/mcdi.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sfc/siena/mcdi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/sfc/siena/mcdi.c- Extension
.c- Size
- 63663 bytes
- Lines
- 2261
- Domain
- Driver Families
- Bucket
- drivers/net
- 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
linux/delay.hlinux/moduleparam.hlinux/atomic.hnet_driver.hnic.hio.hfarch_regs.hmcdi_pcol.h
Detected Declarations
struct efx_mcdi_async_paramfunction efx_siena_mcdi_initfunction efx_siena_mcdi_detachfunction efx_siena_mcdi_finifunction efx_mcdi_send_requestfunction efx_mcdi_errnofunction efx_mcdi_read_response_headerfunction efx_mcdi_poll_oncefunction efx_mcdi_pollfunction efx_siena_mcdi_poll_rebootfunction efx_mcdi_acquire_asyncfunction efx_mcdi_acquire_syncfunction efx_mcdi_await_completionfunction efx_mcdi_complete_syncfunction efx_mcdi_releasefunction efx_mcdi_complete_asyncfunction efx_mcdi_ev_cplfunction efx_mcdi_timeout_asyncfunction efx_mcdi_check_supportedfunction efx_mcdi_get_proxy_handlefunction _efx_mcdi_rpc_finishfunction efx_mcdi_get_proxy_handlefunction efx_mcdi_proxy_abortfunction efx_mcdi_ev_proxy_responsefunction efx_mcdi_proxy_waitfunction _efx_mcdi_rpcfunction _efx_mcdi_rpc_evb_retryfunction efx_siena_mcdi_rpcfunction efx_siena_mcdi_rpc_quietfunction efx_siena_mcdi_rpc_startfunction _efx_mcdi_rpc_asyncfunction efx_siena_mcdi_rpc_asyncfunction efx_siena_mcdi_rpc_async_quietfunction efx_siena_mcdi_rpc_finishfunction efx_siena_mcdi_rpc_finish_quietfunction efx_siena_mcdi_display_errorfunction efx_siena_mcdi_mode_pollfunction efx_siena_mcdi_flush_asyncfunction efx_siena_mcdi_mode_eventfunction efx_mcdi_ev_deathfunction efx_mcdi_ev_bistfunction efx_mcdi_abandonfunction efx_handle_drain_eventfunction efx_siena_mcdi_process_eventfunction efx_siena_mcdi_print_fwverfunction efx_mcdi_drv_attachfunction efx_siena_mcdi_get_board_cfgfunction efx_siena_mcdi_log_ctrl
Annotated Snippet
struct efx_mcdi_async_param {
struct list_head list;
unsigned int cmd;
size_t inlen;
size_t outlen;
bool quiet;
efx_mcdi_async_completer *complete;
unsigned long cookie;
/* followed by request/response buffer */
};
static void efx_mcdi_timeout_async(struct timer_list *t);
static int efx_mcdi_drv_attach(struct efx_nic *efx, bool driver_operating,
bool *was_attached_out);
static bool efx_mcdi_poll_once(struct efx_nic *efx);
static void efx_mcdi_abandon(struct efx_nic *efx);
#ifdef CONFIG_SFC_SIENA_MCDI_LOGGING
static bool efx_siena_mcdi_logging_default;
module_param_named(mcdi_logging_default, efx_siena_mcdi_logging_default,
bool, 0644);
MODULE_PARM_DESC(mcdi_logging_default,
"Enable MCDI logging on newly-probed functions");
#endif
int efx_siena_mcdi_init(struct efx_nic *efx)
{
struct efx_mcdi_iface *mcdi;
bool already_attached;
int rc = -ENOMEM;
efx->mcdi = kzalloc_obj(*efx->mcdi);
if (!efx->mcdi)
goto fail;
mcdi = efx_mcdi(efx);
mcdi->efx = efx;
#ifdef CONFIG_SFC_SIENA_MCDI_LOGGING
/* consuming code assumes buffer is page-sized */
mcdi->logging_buffer = (char *)__get_free_page(GFP_KERNEL);
if (!mcdi->logging_buffer)
goto fail1;
mcdi->logging_enabled = efx_siena_mcdi_logging_default;
#endif
init_waitqueue_head(&mcdi->wq);
init_waitqueue_head(&mcdi->proxy_rx_wq);
spin_lock_init(&mcdi->iface_lock);
mcdi->state = MCDI_STATE_QUIESCENT;
mcdi->mode = MCDI_MODE_POLL;
spin_lock_init(&mcdi->async_lock);
INIT_LIST_HEAD(&mcdi->async_list);
timer_setup(&mcdi->async_timer, efx_mcdi_timeout_async, 0);
(void)efx_siena_mcdi_poll_reboot(efx);
mcdi->new_epoch = true;
/* Recover from a failed assertion before probing */
rc = efx_siena_mcdi_handle_assertion(efx);
if (rc)
goto fail2;
/* Let the MC (and BMC, if this is a LOM) know that the driver
* is loaded. We should do this before we reset the NIC.
*/
rc = efx_mcdi_drv_attach(efx, true, &already_attached);
if (rc) {
netif_err(efx, probe, efx->net_dev,
"Unable to register driver with MCPU\n");
goto fail2;
}
if (already_attached)
/* Not a fatal error */
netif_err(efx, probe, efx->net_dev,
"Host already registered with MCPU\n");
if (efx->mcdi->fn_flags &
(1 << MC_CMD_DRV_ATTACH_EXT_OUT_FLAG_PRIMARY))
efx->primary = efx;
return 0;
fail2:
#ifdef CONFIG_SFC_SIENA_MCDI_LOGGING
free_page((unsigned long)mcdi->logging_buffer);
fail1:
#endif
kfree(efx->mcdi);
efx->mcdi = NULL;
fail:
return rc;
}
Annotation
- Immediate include surface: `linux/delay.h`, `linux/moduleparam.h`, `linux/atomic.h`, `net_driver.h`, `nic.h`, `io.h`, `farch_regs.h`, `mcdi_pcol.h`.
- Detected declarations: `struct efx_mcdi_async_param`, `function efx_siena_mcdi_init`, `function efx_siena_mcdi_detach`, `function efx_siena_mcdi_fini`, `function efx_mcdi_send_request`, `function efx_mcdi_errno`, `function efx_mcdi_read_response_header`, `function efx_mcdi_poll_once`, `function efx_mcdi_poll`, `function efx_siena_mcdi_poll_reboot`.
- Atlas domain: Driver Families / drivers/net.
- 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.