drivers/net/ethernet/alibaba/eea/eea_rx.c
Source file repositories/reference/linux-study-clean/drivers/net/ethernet/alibaba/eea/eea_rx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ethernet/alibaba/eea/eea_rx.c- Extension
.c- Size
- 16956 bytes
- Lines
- 815
- 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.
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
net/netdev_rx_queue.hnet/page_pool/helpers.heea_adminq.heea_net.heea_pci.heea_ring.h
Detected Declarations
struct eea_rx_ctxfunction eea_rx_meta_putfunction eea_free_rx_bufferfunction eea_rx_meta_dma_sync_for_devicefunction meta_align_offsetfunction eea_alloc_rx_bufferfunction eea_consume_rx_bufferfunction eea_free_rx_hdrfunction eea_alloc_rx_hdrfunction eea_rx_meta_dma_sync_for_cpufunction eea_harden_check_overflowfunction eea_harden_check_sizefunction process_remain_buffunction process_first_buffunction eea_submit_skbfunction eea_rx_desc_to_ctxfunction eea_cleanrxfunction eea_rx_dma_sync_hdrfunction eea_rx_postfunction eea_pollfunction eea_free_rx_buffersfunction eea_destroy_page_poolfunction enet_rx_stopfunction enet_rx_startfunction eea_free_rxfunction eea_rx_meta_init
Annotated Snippet
struct eea_rx_ctx {
u32 len;
u32 hdr_len;
u16 flags;
bool more;
struct eea_rx_meta *meta;
struct eea_rx_ctx_stats stats;
};
static struct eea_rx_meta *eea_rx_meta_get(struct eea_net_rx *rx)
{
struct eea_rx_meta *meta;
if (!rx->free)
return NULL;
meta = rx->free;
rx->free = meta->next;
return meta;
}
static void eea_rx_meta_put(struct eea_net_rx *rx, struct eea_rx_meta *meta)
{
meta->next = rx->free;
rx->free = meta;
}
static void eea_free_rx_buffer(struct eea_net_rx *rx, struct eea_rx_meta *meta,
bool allow_direct)
{
u32 drain_count;
drain_count = EEA_PAGE_FRAGS_NUM - meta->frags;
if (page_pool_unref_page(meta->page, drain_count) == 0)
page_pool_put_unrefed_page(rx->pp, meta->page, -1,
allow_direct);
meta->page = NULL;
}
static void eea_rx_meta_dma_sync_for_device(struct eea_net_rx *rx,
struct eea_rx_meta *meta)
{
u32 len;
if (meta->sync_for_cpu <= meta->offset + rx->headroom)
return;
len = meta->sync_for_cpu - meta->offset - rx->headroom;
dma_sync_single_for_device(rx->enet->edev->dma_dev,
meta->dma + meta->offset + rx->headroom,
len, DMA_FROM_DEVICE);
meta->sync_for_cpu = 0;
}
static void meta_align_offset(struct eea_net_rx *rx, struct eea_rx_meta *meta)
{
int h, b;
h = rx->headroom;
b = meta->offset + h;
/* For better performance, we align the buffer address to
* EEA_RX_BUF_ALIGN, as required by the device design.
*/
b = ALIGN(b, EEA_RX_BUF_ALIGN);
meta->offset = b - h;
}
static int eea_alloc_rx_buffer(struct eea_net_rx *rx, struct eea_rx_meta *meta)
{
struct page *page;
if (meta->page) {
eea_rx_meta_dma_sync_for_device(rx, meta);
return 0;
}
page = page_pool_dev_alloc_pages(rx->pp);
if (!page)
return -ENOMEM;
page_pool_fragment_page(page, EEA_PAGE_FRAGS_NUM);
Annotation
- Immediate include surface: `net/netdev_rx_queue.h`, `net/page_pool/helpers.h`, `eea_adminq.h`, `eea_net.h`, `eea_pci.h`, `eea_ring.h`.
- Detected declarations: `struct eea_rx_ctx`, `function eea_rx_meta_put`, `function eea_free_rx_buffer`, `function eea_rx_meta_dma_sync_for_device`, `function meta_align_offset`, `function eea_alloc_rx_buffer`, `function eea_consume_rx_buffer`, `function eea_free_rx_hdr`, `function eea_alloc_rx_hdr`, `function eea_rx_meta_dma_sync_for_cpu`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.