drivers/net/ethernet/sfc/mcdi.h

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/sfc/mcdi.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/sfc/mcdi.h
Extension
.h
Size
18728 bytes
Lines
458
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct efx_mcdi_iface {
	struct efx_nic *efx;
	enum efx_mcdi_state state;
	enum efx_mcdi_mode mode;
	wait_queue_head_t wq;
	spinlock_t iface_lock;
	bool new_epoch;
	unsigned int credits;
	unsigned int seqno;
	int resprc;
	int resprc_raw;
	size_t resp_hdr_len;
	size_t resp_data_len;
	spinlock_t async_lock;
	struct list_head async_list;
	struct timer_list async_timer;
#ifdef CONFIG_SFC_MCDI_LOGGING
	char *logging_buffer;
	bool logging_enabled;
#endif
	unsigned int proxy_rx_handle;
	int proxy_rx_status;
	wait_queue_head_t proxy_rx_wq;
};

struct efx_mcdi_mon {
	struct efx_buffer dma_buf;
	struct mutex update_lock;
	unsigned long last_update;
	struct device *device;
	struct efx_mcdi_mon_attribute *attrs;
	struct attribute_group group;
	const struct attribute_group *groups[2];
	unsigned int n_attrs;
};

struct efx_mcdi_mtd_partition {
	struct efx_mtd_partition common;
	bool updating;
	u16 nvram_type;
	u16 fw_subtype;
};

#define to_efx_mcdi_mtd_partition(mtd)				\
	container_of(mtd, struct efx_mcdi_mtd_partition, common.mtd)

/**
 * struct efx_mcdi_data - extra state for NICs that implement MCDI
 * @iface: Interface/protocol state
 * @hwmon: Hardware monitor state
 * @fn_flags: Flags for this function, as returned by %MC_CMD_DRV_ATTACH.
 */
struct efx_mcdi_data {
	struct efx_mcdi_iface iface;
#ifdef CONFIG_SFC_MCDI_MON
	struct efx_mcdi_mon hwmon;
#endif
	u32 fn_flags;
};

static inline struct efx_mcdi_iface *efx_mcdi(struct efx_nic *efx)
{
	EFX_WARN_ON_PARANOID(!efx->mcdi);
	return &efx->mcdi->iface;
}

#ifdef CONFIG_SFC_MCDI_MON
static inline struct efx_mcdi_mon *efx_mcdi_mon(struct efx_nic *efx)
{
	EFX_WARN_ON_PARANOID(!efx->mcdi);
	return &efx->mcdi->hwmon;
}
#endif

int efx_mcdi_init(struct efx_nic *efx);
void efx_mcdi_detach(struct efx_nic *efx);
void efx_mcdi_fini(struct efx_nic *efx);

int efx_mcdi_rpc(struct efx_nic *efx, unsigned cmd, const efx_dword_t *inbuf,
		 size_t inlen, efx_dword_t *outbuf, size_t outlen,
		 size_t *outlen_actual);
int efx_mcdi_rpc_quiet(struct efx_nic *efx, unsigned cmd,
		       const efx_dword_t *inbuf, size_t inlen,
		       efx_dword_t *outbuf, size_t outlen,
		       size_t *outlen_actual);

int efx_mcdi_rpc_start(struct efx_nic *efx, unsigned cmd,
		       const efx_dword_t *inbuf, size_t inlen);
int efx_mcdi_rpc_finish(struct efx_nic *efx, unsigned cmd, size_t inlen,
			efx_dword_t *outbuf, size_t outlen,

Annotation

Implementation Notes