From ada6dc727a813239c7b2e6996cb513cad2394bec Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Fri, 23 Sep 2011 11:52:43 -0700 Subject: [PATCH] add the possibility to enable the L1 cache for the receive buffer --- drivers/net/rckemac.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/net/rckemac.c b/drivers/net/rckemac.c index 07b538ad..3dafb0f4 100644 --- a/drivers/net/rckemac.c +++ b/drivers/net/rckemac.c @@ -43,6 +43,15 @@ #include #include +/* enables the cache for the receive buffers */ +//#define RX_CACHING 1 + +#ifdef RX_CACHING +#define CL1INV asm volatile ( ".byte 0x0f; .byte 0x0a;\n" ) // CL1FLUSHMB +#else +#define CL1INV +#endif + /* Limits */ #define BUFFER_ORDER 9 #define BUFFER_NUM (1 << BUFFER_ORDER) @@ -379,6 +388,8 @@ static void rckemacif_rx_handler(struct netif* netif, unsigned int write_offset) } again: + CL1INV; // invalidate L1 cache entries of the receiver buffers + read_offset++; if (read_offset < 1 || read_offset > rckemacif->rx_buffer_max) { read_offset = 1; @@ -586,7 +597,11 @@ err_t rckemacif_init(struct netif* netif) rckemacif->core = core; /* allocate the receive buffer */ +#ifdef RX_CACHING + rckemacif->rx_buffer = mem_allocation(BUFFER_SIZE, MAP_KERNEL_SPACE|MAP_MPE); +#else rckemacif->rx_buffer = mem_allocation(BUFFER_SIZE, MAP_KERNEL_SPACE|MAP_NO_CACHE); +#endif if (!(rckemacif->rx_buffer)) { LWIP_DEBUGF(NETIF_DEBUG, ("rckemacif_init: out of memory\n")); kfree(rckemacif, sizeof(rckemacif_t));