ReactOS 0.4.16-dev-927-g467dec4
ZeroCopyRx.c File Reference

Go to the source code of this file.

Classes

struct  my_custom_pbuf
 

Typedefs

typedef struct my_custom_pbuf my_custom_pbuf_t
 

Functions

 LWIP_MEMPOOL_DECLARE (RX_POOL, 10, sizeof(my_custom_pbuf_t), "Zero-copy RX PBUF pool")
 
void my_pbuf_free_custom (void *p)
 
void eth_rx_irq ()
 

Typedef Documentation

◆ my_custom_pbuf_t

Function Documentation

◆ eth_rx_irq()

void eth_rx_irq ( )

Definition at line 25 of file ZeroCopyRx.c.

26{
27 dma_descriptor* dma_desc = get_RX_DMA_descriptor_from_ethernet();
29
30 my_pbuf->p.custom_free_function = my_pbuf_free_custom;
31 my_pbuf->dma_descriptor = dma_desc;
32
33 invalidate_cpu_cache(dma_desc->rx_data, dma_desc->rx_length);
34
35 struct pbuf* p = pbuf_alloced_custom(PBUF_RAW,
36 dma_desc->rx_length,
38 &my_pbuf->p,
39 dma_desc->rx_data,
40 dma_desc->max_buffer_size);
41
42 if(netif->input(p, netif) != ERR_OK) {
43 pbuf_free(p);
44 }
45}
void my_pbuf_free_custom(void *p)
Definition: ZeroCopyRx.c:9
GLfloat GLfloat p
Definition: glext.h:8902
@ ERR_OK
Definition: err.h:55
#define LWIP_MEMPOOL_ALLOC(name)
Definition: memp.h:122
u8_t pbuf_free(struct pbuf *p)
Definition: pbuf.c:727
@ PBUF_REF
Definition: pbuf.h:160
@ PBUF_RAW
Definition: pbuf.h:111
struct pbuf_custom p
Definition: ZeroCopyRx.c:3
void * dma_descriptor
Definition: ZeroCopyRx.c:4
Definition: netif.h:269
netif_input_fn input
Definition: netif.h:297
Definition: pbuf.h:186

◆ LWIP_MEMPOOL_DECLARE()

LWIP_MEMPOOL_DECLARE ( RX_POOL  ,
10  ,
sizeof(my_custom_pbuf_t ,
"Zero-copy RX PBUF pool"   
)

◆ my_pbuf_free_custom()

void my_pbuf_free_custom ( void p)

Definition at line 9 of file ZeroCopyRx.c.

10{
11 SYS_ARCH_DECL_PROTECT(old_level);
12
14
15 // invalidate data cache here - lwIP and/or application may have written into buffer!
16 // (invalidate is faster than flushing, and no one needs the correct data in the buffer)
17 invalidate_cpu_cache(p->payload, p->tot_len);
18
19 SYS_ARCH_PROTECT(old_level);
20 free_rx_dma_descriptor(my_pbuf->dma_descriptor);
21 LWIP_MEMPOOL_FREE(RX_POOL, my_pbuf);
22 SYS_ARCH_UNPROTECT(old_level);
23}
#define SYS_ARCH_UNPROTECT(lev)
Definition: cc.h:39
#define SYS_ARCH_PROTECT(lev)
Definition: cc.h:38
#define SYS_ARCH_DECL_PROTECT(lev)
Definition: cc.h:37
#define LWIP_MEMPOOL_FREE(name, x)
Definition: memp.h:127

Referenced by eth_rx_irq().