From 4ec5d69ed67472f548575b080abc32eed7d9496c Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Thu, 13 Oct 2011 15:44:55 -0700 Subject: [PATCH] use the correct memcpy routince for the MPB --- drivers/net/mmnif.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/net/mmnif.c b/drivers/net/mmnif.c index 1a0030d3..90f5a5fe 100644 --- a/drivers/net/mmnif.c +++ b/drivers/net/mmnif.c @@ -65,7 +65,7 @@ #define USE_CACHE 0 // set to 1 if you want to use the message passing buffer -#define MMNIF_USE_MPB 0 +#define MMNIF_USE_MPB 1 #if USE_CACHE && MMNIF_USE_MBP #error MBP version uses implicitly the cache @@ -124,7 +124,6 @@ static spinlock_t pseudolock; */ static unsigned int own_ip_address = 0xC0A80000; /* 192.168.0.0 */ static unsigned int router_ip_address = 0xC0A80001; /* 192.168.0.1 */ -//static unsigned int budget_overflow_count = 0; /* "message passing buffer" specific constants: * - start address @@ -691,11 +690,12 @@ realloc: { //DEBUGPRINTF("mmnif_tx(): concurrency"); + //chances--; //if (chances <= 0) // goto drop_packet; + //if (chances % 17 == 0) + // mmnif_trigger_irq(dest_ip); - //chances--; - //mmnif_trigger_irq(dest_ip); NOP8;NOP8;NOP8;NOP8;NOP8;NOP8;NOP8;NOP8; //udelay(10); goto realloc; @@ -1007,26 +1007,24 @@ err_t mmnif_init(struct netif *netif) if (!RCCE_malloc(RCCE_LINE_SIZE)) { DEBUGPRINTF("mmnif init(): allocating shared memory failed\n"); - //return ERR_MEM; + return ERR_MEM; } } - #else // align size to the granularity of a page size heap_size = (heap_size + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1); - heap_start_address = (void*) RCCE_shmalloc(heap_size * MMNIF_CORES); DEBUGPRINTF("RCCE_shmalloc : %p (size %u)\n", header_start_address, MMNIF_CORES * header_size); // map physical address in the virtual address space #if USE_CACHE //heap_start_address = map_region(0, heap_start_address, (MMNIF_CORES*heap_size) >> PAGE_SHIFT, MAP_KERNEL_SPACE|MAP_MPE); - uint32_t n = (uint32_t) heap_start_address; + //uint32_t n = (uint32_t) heap_start_address; heap_start_address = map_region(0, heap_start_address, (MMNIF_CORES * heap_size) >> PAGE_SHIFT, MAP_KERNEL_SPACE | MAP_NO_CACHE | MAP_MPE | MAP_WT); map_region(heap_start_address + (heap_size) * (own_ip_address - router_ip_address), n + (heap_size) * (own_ip_address - router_ip_address), header_size >> PAGE_SHIFT, MAP_KERNEL_SPACE | MAP_MPE | MAP_WT | MAP_REMAP); #else heap_start_address = (void*) map_region(0, (size_t) heap_start_address, (MMNIF_CORES * heap_size) >> PAGE_SHIFT, MAP_KERNEL_SPACE | MAP_NO_CACHE | MAP_MPE | MAP_WT); -#endif // USE_CAHCE +#endif // USE_CACHE #endif // MMNIF_USE_MPB DEBUGPRINTF("map_region : %p\n", header_start_address); @@ -1034,9 +1032,6 @@ err_t mmnif_init(struct netif *netif) mmnif->rx_heap = heap_start_address; heap_start_address = heap_start_address - (own_ip_address - router_ip_address) * 0x2000; DEBUGPRINTF("heap_start_address : %p\n", heap_start_address); - -// heap_start_address = 0xC0000000; -// mmnif->rx_heap = heap_start_address + (heap_size) * (own_ip_address - router_ip_address); #else mmnif->rx_heap = heap_start_address + (heap_size) * (own_ip_address - router_ip_address); #endif @@ -1248,7 +1243,7 @@ anotherpacket: /* copy packet to pbuf structure going through linked list */ for (q = p, i = 0; q != NULL; q = q->next) { -#if !USE_CACHE || !MMNIF_USE_MBP +#if !USE_CACHE && !MMNIF_USE_MBP memcpy_from_nc((uint8_t *) q->payload, &packet[i], q->len); #elif MMNIF_USE_MPB memcpy_get((uint8_t *) q->payload, &packet[i], q->len); @@ -1258,6 +1253,7 @@ anotherpacket: i += q->len; } + *((int *)RCCE_fool_write_combine_buffer) = 1; #if MMNIF_USE_MPB asm volatile (".byte 0x0f; .byte 0x0a;\n"); #endif