drivers/net/ethernet/freescale/enetc/enetc.h

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/freescale/enetc/enetc.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/freescale/enetc/enetc.h
Extension
.h
Size
19013 bytes
Lines
700
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 enetc_mac_filter {
	union {
		char mac_addr[ETH_ALEN];
		DECLARE_BITMAP(mac_hash_table, ENETC_MADDR_HASH_TBL_SZ);
	};
	int mac_addr_cnt;
};

struct enetc_tx_swbd {
	union {
		struct sk_buff *skb;
		struct xdp_frame *xdp_frame;
	};
	dma_addr_t dma;
	struct page *page;	/* valid only if is_xdp_tx */
	u16 page_offset;	/* valid only if is_xdp_tx */
	u16 len;
	enum dma_data_direction dir;
	u8 is_dma_page:1;
	u8 check_wb:1;
	u8 do_twostep_tstamp:1;
	u8 is_eof:1;
	u8 is_xdp_tx:1;
	u8 is_xdp_redirect:1;
	u8 qbv_en:1;
};

struct enetc_skb_cb {
	u8 flag;
	bool udp;
	u16 correction_off;
	u16 origin_tstamp_off;
};

#define ENETC_SKB_CB(skb) ((struct enetc_skb_cb *)((skb)->cb))

struct enetc_lso_t {
	bool	ipv6;
	bool	tcp;
	u8	l3_hdr_len;
	u8	hdr_len; /* LSO header length */
	u8	l3_start;
	u16	lso_seg_size;
	int	total_len; /* total data length, not include LSO header */
};

#define ENETC_LSO_MAX_DATA_LEN		SZ_256K

#define ENETC_RX_MAXFRM_SIZE	ENETC_MAC_MAXFRM_SIZE
#define ENETC_RXB_TRUESIZE	(PAGE_SIZE >> 1)
#define ENETC_RXB_PAD		NET_SKB_PAD /* add extra space if needed */
#define ENETC_RXB_DMA_SIZE	\
	min(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - ENETC_RXB_PAD, 0xffff)
#define ENETC_RXB_DMA_SIZE_XDP	\
	min(SKB_WITH_OVERHEAD(ENETC_RXB_TRUESIZE) - XDP_PACKET_HEADROOM, 0xffff)

struct enetc_rx_swbd {
	dma_addr_t dma;
	struct page *page;
	u16 page_offset;
	enum dma_data_direction dir;
	u16 len;
};

/* ENETC overhead: optional extension BD + 1 BD gap */
#define ENETC_TXBDS_NEEDED(val)	((val) + 2)
/* For LS1028A, max # of chained Tx BDs is 15, including head and
 * extension BD.
 */
#define ENETC_MAX_SKB_FRAGS	13
/* For ENETC v4 and later versions, max # of chained Tx BDs is 63,
 * including head and extension BD, but the range of MAX_SKB_FRAGS
 * is 17 ~ 45, so set ENETC4_MAX_SKB_FRAGS to MAX_SKB_FRAGS.
 */
#define ENETC4_MAX_SKB_FRAGS		MAX_SKB_FRAGS
#define ENETC_TXBDS_MAX_NEEDED(x)	ENETC_TXBDS_NEEDED((x) + 1)

struct enetc_ring_stats {
	unsigned long packets;
	unsigned long bytes;
	unsigned long rx_alloc_errs;
	unsigned long xdp_drops;
	unsigned long xdp_tx;
	unsigned long xdp_tx_drops;
	unsigned long xdp_redirect;
	unsigned long xdp_redirect_failures;
	unsigned long recycles;
	unsigned long recycle_failures;
	unsigned long win_drop;
};

Annotation

Implementation Notes