drivers/net/ethernet/mellanox/mlx4/mlx4_en.h

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/mellanox/mlx4/mlx4_en.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/mellanox/mlx4/mlx4_en.h
Extension
.h
Size
23968 bytes
Lines
845
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 mlx4_en_tx_info {
	union {
		struct sk_buff *skb;
		struct page *page;
	};
	dma_addr_t	map0_dma;
	u32		map0_byte_count;
	u32		nr_txbb;
	u32		nr_bytes;
	u8		linear;
	u8		data_offset;
	u8		inl;
	u8		ts_requested;
	u8		nr_maps;
} ____cacheline_aligned_in_smp;


#define MLX4_EN_BIT_DESC_OWN	0x80000000
#define MLX4_EN_MEMTYPE_PAD	0x100


struct mlx4_en_tx_desc {
	struct mlx4_wqe_ctrl_seg ctrl;
	union {
		struct mlx4_wqe_data_seg data; /* at least one data segment */
		struct mlx4_wqe_lso_seg lso;
		struct mlx4_wqe_inline_seg inl;
	};
};

#define MLX4_EN_USE_SRQ		0x01000000

#define MLX4_EN_CX3_LOW_ID	0x1000
#define MLX4_EN_CX3_HIGH_ID	0x1005

struct mlx4_en_rx_alloc {
	struct page	*page;
	u32		page_offset;
};

#define MLX4_EN_CACHE_SIZE (2 * NAPI_POLL_WEIGHT)

enum {
	MLX4_EN_TX_RING_STATE_RECOVERING,
};

struct mlx4_en_priv;

struct mlx4_en_tx_ring {
	/* cache line used and dirtied in tx completion
	 * (mlx4_en_free_tx_buf())
	 */
	u32			last_nr_txbb;
	u32			cons;
	unsigned long		wake_queue;
	struct netdev_queue	*tx_queue;
	u32			(*free_tx_desc)(struct mlx4_en_priv *priv,
						struct mlx4_en_tx_ring *ring,
						int index,
						u64 timestamp, int napi_mode);
	struct mlx4_en_rx_ring	*recycle_ring;

	/* cache line used and dirtied in mlx4_en_xmit() */
	u32			prod ____cacheline_aligned_in_smp;
	unsigned int		tx_dropped;
	unsigned long		bytes;
	unsigned long		packets;
	unsigned long		tx_csum;
	unsigned long		tso_packets;
	unsigned long		xmit_more;
	struct mlx4_bf		bf;

	/* Following part should be mostly read */
	void __iomem		*doorbell_address;
	__be32			doorbell_qpn;
	__be32			mr_key;
	u32			size; /* number of TXBBs */
	u32			size_mask;
	u32			full_size;
	u32			buf_size;
	void			*buf;
	struct mlx4_en_tx_info	*tx_info;
	int			qpn;
	u8			queue_index;
	bool			bf_enabled;
	bool			bf_alloced;
	u8			hwtstamp_tx_type;
	u8			*bounce_buf;

	/* Not used in fast path

Annotation

Implementation Notes