drivers/net/ethernet/marvell/octeon_ep/octep_rx.h

Source file repositories/reference/linux-study-clean/drivers/net/ethernet/marvell/octeon_ep/octep_rx.h

File Facts

System
Linux kernel
Corpus path
drivers/net/ethernet/marvell/octeon_ep/octep_rx.h
Extension
.h
Size
5666 bytes
Lines
225
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 octep_oq_desc_hw {
	dma_addr_t buffer_ptr;
	u64 info_ptr;
};

static_assert(sizeof(struct octep_oq_desc_hw) == 16);

#define OCTEP_OQ_DESC_SIZE    (sizeof(struct octep_oq_desc_hw))

/* Rx offload flags */
#define OCTEP_RX_OFFLOAD_VLAN_STRIP	BIT(0)
#define OCTEP_RX_OFFLOAD_IPV4_CKSUM	BIT(1)
#define OCTEP_RX_OFFLOAD_UDP_CKSUM	BIT(2)
#define OCTEP_RX_OFFLOAD_TCP_CKSUM	BIT(3)

#define OCTEP_RX_OFFLOAD_CKSUM		(OCTEP_RX_OFFLOAD_IPV4_CKSUM | \
					 OCTEP_RX_OFFLOAD_UDP_CKSUM | \
					 OCTEP_RX_OFFLOAD_TCP_CKSUM)

#define OCTEP_RX_IP_CSUM(flags)		((flags) & \
					 (OCTEP_RX_OFFLOAD_IPV4_CKSUM | \
					  OCTEP_RX_OFFLOAD_TCP_CKSUM | \
					  OCTEP_RX_OFFLOAD_UDP_CKSUM))

/* bit 0 is vlan strip */
#define OCTEP_RX_CSUM_IP_VERIFIED	BIT(1)
#define OCTEP_RX_CSUM_L4_VERIFIED	BIT(2)

#define OCTEP_RX_CSUM_VERIFIED(flags)	((flags) & \
					 (OCTEP_RX_CSUM_L4_VERIFIED | \
					  OCTEP_RX_CSUM_IP_VERIFIED))

/* Extended Response Header in packet data received from Hardware.
 * Includes metadata like checksum status.
 * this is valid only if hardware/firmware published support for this.
 * This is at offset 0 of packet data (skb->data).
 */
struct octep_oq_resp_hw_ext {
	/* Reserved. */
	u64 rsvd:48;

	/* offload flags */
	u16 rx_ol_flags;
};

static_assert(sizeof(struct octep_oq_resp_hw_ext) == 8);

#define  OCTEP_OQ_RESP_HW_EXT_SIZE   (sizeof(struct octep_oq_resp_hw_ext))

/* Length of Rx packet DMA'ed by Octeon to Host.
 * this is in bigendian; so need to be converted to cpu endian.
 * Octeon writes this at the beginning of Rx buffer (skb->data).
 */
struct octep_oq_resp_hw {
	/* The Length of the packet. */
	__be64 length;
};

static_assert(sizeof(struct octep_oq_resp_hw) == 8);

#define OCTEP_OQ_RESP_HW_SIZE   (sizeof(struct octep_oq_resp_hw))

/* Pointer to data buffer.
 * Driver keeps a pointer to the data buffer that it made available to
 * the Octeon device. Since the descriptor ring keeps physical (bus)
 * addresses, this field is required for the driver to keep track of
 * the virtual address pointers. The fields are operated by
 * OS-dependent routines.
 */
struct octep_rx_buffer {
	struct page *page;

	/* length from rx hardware descriptor after converting to cpu endian */
	u64 len;
};

#define OCTEP_OQ_RECVBUF_SIZE    (sizeof(struct octep_rx_buffer))

/* Output Queue statistics. Each output queue has four stats fields. */
struct octep_oq_stats {
	/* Number of packets received from the Device. */
	u64 packets;

	/* Number of bytes received from the Device. */
	u64 bytes;

	/* Number of times failed to allocate buffers. */
	u64 alloc_failures;
};

Annotation

Implementation Notes