drivers/net/ethernet/intel/fm10k/fm10k_mbx.h

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/intel/fm10k/fm10k_mbx.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/intel/fm10k/fm10k_mbx.h
Extension
.h
Size
11117 bytes
Lines
295
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 fm10k_mbx_ops {
	s32 (*connect)(struct fm10k_hw *, struct fm10k_mbx_info *);
	void (*disconnect)(struct fm10k_hw *, struct fm10k_mbx_info *);
	bool (*rx_ready)(struct fm10k_mbx_info *);
	bool (*tx_ready)(struct fm10k_mbx_info *, u16);
	bool (*tx_complete)(struct fm10k_mbx_info *);
	s32 (*enqueue_tx)(struct fm10k_hw *, struct fm10k_mbx_info *,
			  const u32 *);
	s32 (*process)(struct fm10k_hw *, struct fm10k_mbx_info *);
	s32 (*register_handlers)(struct fm10k_mbx_info *,
				 const struct fm10k_msg_data *);
};

struct fm10k_mbx_fifo {
	u32 *buffer;
	u16 head;
	u16 tail;
	u16 size;
};

/* size of buffer to be stored in mailbox for FIFOs */
#define FM10K_MBX_TX_BUFFER_SIZE	512
#define FM10K_MBX_RX_BUFFER_SIZE	128
#define FM10K_MBX_BUFFER_SIZE \
	(FM10K_MBX_TX_BUFFER_SIZE + FM10K_MBX_RX_BUFFER_SIZE)

/* minimum and maximum message size in dwords */
#define FM10K_MBX_MSG_MAX_SIZE \
	((FM10K_MBX_TX_BUFFER_SIZE - 1) & (FM10K_MBX_RX_BUFFER_SIZE - 1))
#define FM10K_VFMBX_MSG_MTU	((FM10K_VFMBMEM_LEN / 2) - 1)

#define FM10K_MBX_INIT_TIMEOUT	2000 /* number of retries on mailbox */
#define FM10K_MBX_INIT_DELAY	500  /* microseconds between retries */

struct fm10k_mbx_info {
	/* function pointers for mailbox operations */
	struct fm10k_mbx_ops ops;
	const struct fm10k_msg_data *msg_data;

	/* message FIFOs */
	struct fm10k_mbx_fifo rx;
	struct fm10k_mbx_fifo tx;

	/* delay for handling timeouts */
	u32 timeout;
	u32 udelay;

	/* mailbox state info */
	u32 mbx_reg, mbmem_reg, mbx_lock, mbx_hdr;
	u16 max_size, mbmem_len;
	u16 tail, tail_len, pulled;
	u16 head, head_len, pushed;
	u16 local, remote;
	enum fm10k_mbx_state state;

	/* result of last mailbox test */
	s32 test_result;

	/* statistics */
	u64 tx_busy;
	u64 tx_dropped;
	u64 tx_messages;
	u64 tx_dwords;
	u64 tx_mbmem_pulled;
	u64 rx_messages;
	u64 rx_dwords;
	u64 rx_mbmem_pushed;
	u64 rx_parse_err;

	/* Buffer to store messages */
	u32 buffer[FM10K_MBX_BUFFER_SIZE];
};

s32 fm10k_pfvf_mbx_init(struct fm10k_hw *, struct fm10k_mbx_info *,
			const struct fm10k_msg_data *, u8);
s32 fm10k_sm_mbx_init(struct fm10k_hw *, struct fm10k_mbx_info *,
		      const struct fm10k_msg_data *);

#endif /* _FM10K_MBX_H_ */

Annotation

Implementation Notes