drivers/net/ethernet/meta/fbnic/fbnic_fw.h

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/meta/fbnic/fbnic_fw.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/meta/fbnic/fbnic_fw.h
Extension
.h
Size
10656 bytes
Lines
364
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 fbnic_fw_mbx {
	u8 ready, head, tail;
	struct {
		struct fbnic_tlv_msg	*msg;
		dma_addr_t		addr;
	} buf_info[FBNIC_IPC_MBX_DESC_LEN];
};

// FW_VER_MAX_SIZE must match ETHTOOL_FWVERS_LEN
#define FBNIC_FW_VER_MAX_SIZE			32
// Formatted version is in the format XX.YY.ZZ_RRR_COMMIT
#define FBNIC_FW_CAP_RESP_COMMIT_MAX_SIZE	(FBNIC_FW_VER_MAX_SIZE - 13)
#define FBNIC_FW_LOG_VERSION			1
#define FBNIC_FW_LOG_MAX_SIZE			256
/*
 * The max amount of logs which can fit in a single mailbox message. Firmware
 * assumes each mailbox message is 4096B. The amount of messages supported is
 * calculated as 4096 minus headers for message, arrays, and length minus the
 * size of length divided by headers for each array plus the maximum LOG size,
 * and the size of MSEC and INDEX. Put another way:
 *
 * MAX_LOG_HISTORY = ((4096 - TLV_HDR_SZ * 5 - LENGTH_SZ)
 *                    / (FBNIC_FW_LOG_MAX_SIZE + TLV_HDR_SZ * 3 + MSEC_SZ
 *                       + INDEX_SZ))
 */
#define FBNIC_FW_MAX_LOG_HISTORY		14
#define FBNIC_MBX_RX_TO_SEC			10

struct fbnic_fw_ver {
	u32 version;
	char commit[FBNIC_FW_CAP_RESP_COMMIT_MAX_SIZE];
};

struct fbnic_fw_cap {
	struct {
		struct fbnic_fw_ver mgmt, bootloader;
	} running;
	struct {
		struct fbnic_fw_ver mgmt, bootloader, undi;
	} stored;
	u8	active_slot;
	u8	bmc_mac_addr[4][ETH_ALEN];
	u8	bmc_present		: 1;
	u8	need_bmc_tcam_reinit	: 1;
	u8	need_bmc_macda_sync	: 1;
	u8	all_multi		: 1;
	u8	link_speed;
	u8	link_fec;
	u32	anti_rollback_version;
};

struct fbnic_fw_completion {
	u32 msg_type;
	struct completion done;
	struct kref ref_count;
	int result;
	union {
		struct {
			u32 size;
		} coredump_info;
		struct {
			u32 size;
			u16 stride;
			u8 *data[];
		} coredump;
		struct {
			u32 offset;
			u32 length;
		} fw_update;
		struct {
			u16 length;
			u8 offset;
			u8 page;
			u8 bank;
			u8 data[] __aligned(sizeof(u32)) __counted_by(length);
		} qsfp;
		struct {
			s32 millivolts;
			s32 millidegrees;
		} tsene;
	} u;
};

u64 __fbnic_mbx_rd_desc(struct fbnic_dev *fbd, int mbx_idx, int desc_idx);
void fbnic_mbx_init(struct fbnic_dev *fbd);
void fbnic_mbx_clean(struct fbnic_dev *fbd);
int fbnic_mbx_set_cmpl(struct fbnic_dev *fbd,
		       struct fbnic_fw_completion *cmpl_data);
void fbnic_mbx_clear_cmpl(struct fbnic_dev *fbd,
			  struct fbnic_fw_completion *cmpl_data);

Annotation

Implementation Notes