drivers/net/ethernet/sfc/falcon/net_driver.h

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

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/sfc/falcon/net_driver.h
Extension
.h
Size
49485 bytes
Lines
1337
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 ef4_buffer {
	void *addr;
	dma_addr_t dma_addr;
	unsigned int len;
};

/**
 * struct ef4_special_buffer - DMA buffer entered into buffer table
 * @buf: Standard &struct ef4_buffer
 * @index: Buffer index within controller;s buffer table
 * @entries: Number of buffer table entries
 *
 * The NIC has a buffer table that maps buffers of size %EF4_BUF_SIZE.
 * Event and descriptor rings are addressed via one or more buffer
 * table entries (and so can be physically non-contiguous, although we
 * currently do not take advantage of that).  On Falcon and Siena we
 * have to take care of allocating and initialising the entries
 * ourselves.  On later hardware this is managed by the firmware and
 * @index and @entries are left as 0.
 */
struct ef4_special_buffer {
	struct ef4_buffer buf;
	unsigned int index;
	unsigned int entries;
};

/**
 * struct ef4_tx_buffer - buffer state for a TX descriptor
 * @skb: When @flags & %EF4_TX_BUF_SKB, the associated socket buffer to be
 *	freed when descriptor completes
 * @option: When @flags & %EF4_TX_BUF_OPTION, a NIC-specific option descriptor.
 * @dma_addr: DMA address of the fragment.
 * @flags: Flags for allocation and DMA mapping type
 * @len: Length of this fragment.
 *	This field is zero when the queue slot is empty.
 * @unmap_len: Length of this fragment to unmap
 * @dma_offset: Offset of @dma_addr from the address of the backing DMA mapping.
 * Only valid if @unmap_len != 0.
 */
struct ef4_tx_buffer {
	const struct sk_buff *skb;
	union {
		ef4_qword_t option;
		dma_addr_t dma_addr;
	};
	unsigned short flags;
	unsigned short len;
	unsigned short unmap_len;
	unsigned short dma_offset;
};
#define EF4_TX_BUF_CONT		1	/* not last descriptor of packet */
#define EF4_TX_BUF_SKB		2	/* buffer is last part of skb */
#define EF4_TX_BUF_MAP_SINGLE	8	/* buffer was mapped with dma_map_single() */
#define EF4_TX_BUF_OPTION	0x10	/* empty buffer for option descriptor */

/**
 * struct ef4_tx_queue - An Efx TX queue
 *
 * This is a ring buffer of TX fragments.
 * Since the TX completion path always executes on the same
 * CPU and the xmit path can operate on different CPUs,
 * performance is increased by ensuring that the completion
 * path and the xmit path operate on different cache lines.
 * This is particularly important if the xmit path is always
 * executing on one CPU which is different from the completion
 * path.  There is also a cache line for members which are
 * read but not written on the fast path.
 *
 * @efx: The associated Efx NIC
 * @queue: DMA queue number
 * @channel: The associated channel
 * @core_txq: The networking core TX queue structure
 * @buffer: The software buffer ring
 * @cb_page: Array of pages of copy buffers.  Carved up according to
 *	%EF4_TX_CB_ORDER into %EF4_TX_CB_SIZE-sized chunks.
 * @txd: The hardware descriptor ring
 * @ptr_mask: The size of the ring minus 1.
 * @initialised: Has hardware queue been initialised?
 * @tx_min_size: Minimum transmit size for this queue. Depends on HW.
 * @read_count: Current read pointer.
 *	This is the number of buffers that have been removed from both rings.
 * @old_write_count: The value of @write_count when last checked.
 *	This is here for performance reasons.  The xmit path will
 *	only get the up-to-date value of @write_count if this
 *	variable indicates that the queue is empty.  This is to
 *	avoid cache-line ping-pong between the xmit path and the
 *	completion path.
 * @merge_events: Number of TX merged completion events
 * @insert_count: Current insert pointer
 *	This is the number of buffers that have been added to the

Annotation

Implementation Notes