increase the performance of the eMAC device by enabling write combining
This commit is contained in:
parent
be766af0fb
commit
710523582e
1 changed files with 27 additions and 5 deletions
|
@ -101,9 +101,6 @@
|
|||
#define CLINE_ALIGN(_x) (((_x) + CLINE_SIZE - 1) & CLINE_MASK)
|
||||
#define CLINE_PACKETS(_x) (CLINE_ALIGN(_x) >> CLINE_SHIFT)
|
||||
|
||||
/* Flush */
|
||||
#define CL1FLUSH __asm__ volatile (".byte 0x0F; .byte 0x0A;\n")
|
||||
|
||||
/* Read 16bit from buffer */
|
||||
#define U16(_addr) (256 * (*((uint8_t*) (_addr + 1))) + (*((uint8_t*)(_addr))))
|
||||
|
||||
|
@ -113,6 +110,26 @@
|
|||
|
||||
static struct netif* mynetif;
|
||||
|
||||
#if 0
|
||||
inline static void *memcpy_noprefetching(void* dest, const void *src, size_t count)
|
||||
{
|
||||
int32_t i, j, k;
|
||||
|
||||
if (BUILTIN_EXPECT(!dest || !src, 0))
|
||||
return dest;
|
||||
|
||||
asm volatile (
|
||||
"cld; rep movsl\n\t"
|
||||
"movl %4, %%ecx\n\t"
|
||||
"andl $3, %%ecx\n\t"
|
||||
"rep movsb\n\t"
|
||||
: "=&c"(i), "=&D"(j), "=&S"(k)
|
||||
: "0"(count/4), "g"(count), "1"(dest), "2"(src) : "memory","cc");
|
||||
|
||||
return dest;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int read_emac(int num_emac, int offset, int core)
|
||||
{
|
||||
int ret;
|
||||
|
@ -246,6 +263,9 @@ again:
|
|||
|
||||
*((volatile int*) rckemacif->tx_buffer) = 2;
|
||||
|
||||
// flush write combining buffers
|
||||
*(int *)RCCE_fool_write_combine_buffer = 1;
|
||||
|
||||
/* set new write offset */
|
||||
//LWIP_DEBUGF(NETIF_DEBUG, ("Update tx write offset: %d (read offset %d)\n", rckemacif->tx_write_offset, read_offset));
|
||||
write_emac(rckemacif->num_emac, EMAC_TX_CONTROL+EMAC_TX_BUFFER_WRITE_OFFSET, rckemacif->core, rckemacif->tx_write_offset);
|
||||
|
@ -439,7 +459,6 @@ static void rckemacif_handler(struct state* s)
|
|||
|
||||
nexttry:
|
||||
/* check for updated write offset */
|
||||
CL1FLUSH;
|
||||
write_offset = *((volatile unsigned int*) (rckemacif->rx_buffer)) & 0xFFFF;
|
||||
//write_offset = read_emac(rckemacif->num_emac, EMAC_RX_CONTROL + EMAC_RX_BUFFER_WRITE_OFFSET, rckemacif->core);
|
||||
if ((write_offset != 0) && (rckemacif->rx_read_offset != write_offset)) {
|
||||
|
@ -500,7 +519,7 @@ err_t rckemacif_init(struct netif* netif)
|
|||
rckemacif->rx_buffer_max = CLINE_PACKETS(BUFFER_SIZE) - 1;
|
||||
|
||||
/* allocate the send buffers */
|
||||
rckemacif->tx_buffer = mem_allocation(BUFFER_SIZE, MAP_KERNEL_SPACE|MAP_NO_CACHE);
|
||||
rckemacif->tx_buffer = mem_allocation(BUFFER_SIZE, MAP_KERNEL_SPACE|MAP_NO_CACHE|MAP_WT|MAP_MPE);
|
||||
if (!(rckemacif->tx_buffer)) {
|
||||
LWIP_DEBUGF(NETIF_DEBUG, ("rckemacif_init: out of memory\n"));
|
||||
kfree(rckemacif->rx_buffer, BUFFER_SIZE);
|
||||
|
@ -762,6 +781,9 @@ err_t rckemacif_init(struct netif* netif)
|
|||
|
||||
rckemacif->ethaddr = (struct eth_addr *)netif->hwaddr;
|
||||
|
||||
// flush write combining buffers
|
||||
*(int *)RCCE_fool_write_combine_buffer = 1;
|
||||
|
||||
tcpip_callback(netif_set_link_up, netif);
|
||||
|
||||
return ERR_OK;
|
||||
|
|
Loading…
Add table
Reference in a new issue