reduce the size of the RX buffer for MPB version and minor optimizations
This commit is contained in:
parent
30bf7d20a3
commit
3e1a0bc7d6
1 changed files with 27 additions and 26 deletions
|
@ -67,6 +67,10 @@
|
|||
// set to 1 if you want to use the message passing buffer
|
||||
#define MMNIF_USE_MPB 0
|
||||
|
||||
#if USE_CACHE && MMNIF_USE_MBP
|
||||
#error MBP version uses implicitly the cache
|
||||
#endif
|
||||
|
||||
/* Cache line wrappers */
|
||||
#define CLINE_SHIFT 5
|
||||
#define CLINE_SIZE (1UL << CLINE_SHIFT)
|
||||
|
@ -87,7 +91,7 @@
|
|||
*/
|
||||
|
||||
#if MMNIF_USE_MPB
|
||||
#define MMNIF_RX_BUFFERLEN (7*1024)
|
||||
#define MMNIF_RX_BUFFERLEN (2*1024)
|
||||
#else
|
||||
#define MMNIF_RX_BUFFERLEN (8*1024)
|
||||
#endif
|
||||
|
@ -718,6 +722,7 @@ realloc:
|
|||
#if MMNIF_USE_MPB
|
||||
asm volatile (".byte 0x0f; .byte 0x0a;\n");
|
||||
#endif
|
||||
|
||||
if (mmnif_commit_packet(dest_ip, write_address))
|
||||
{
|
||||
DEBUGPRINTF("mmnif_tx(): packet somehow lost during commit\n");
|
||||
|
@ -875,11 +880,12 @@ realloc:
|
|||
#else
|
||||
memcpy_put(write_address, pbuff, size);
|
||||
#endif
|
||||
*((int *)RCCE_fool_write_combine_buffer) = 1;
|
||||
|
||||
*((int *)RCCE_fool_write_combine_buffer) = 1;
|
||||
#if MMNIF_USE_MPB
|
||||
asm volatile (".byte 0x0f; .byte 0x0a;\n");
|
||||
#endif
|
||||
|
||||
if (mmnif_commit_packet_bypass(dest->dest_ip, write_address, dest->remote_socket))
|
||||
{
|
||||
DEBUGPRINTF("mmnif_tx(): packet somehow lost during commit\n");
|
||||
|
@ -985,7 +991,7 @@ err_t mmnif_init(struct netif *netif)
|
|||
DEBUGPRINTF("RCCE_shmalloc : %p (size %u)\n", header_start_address, MMNIF_CORES * header_size);
|
||||
|
||||
// map physical address in the virtual address space
|
||||
header_start_address = (void*) map_region(0, (size_t) header_start_address, (MMNIF_CORES * header_size) >> PAGE_SHIFT, MAP_KERNEL_SPACE | MAP_NO_CACHE);
|
||||
header_start_address = (void*) map_region(0, (size_t) header_start_address, (MMNIF_CORES * header_size) >> PAGE_SHIFT, MAP_KERNEL_SPACE | MAP_WT | MAP_NO_CACHE);
|
||||
DEBUGPRINTF("map_region : %p\n", header_start_address);
|
||||
mmnif->rx_buff = (mm_rx_buffer_t *) (header_start_address + (header_size) * (own_ip_address - router_ip_address));
|
||||
|
||||
|
@ -999,11 +1005,11 @@ err_t mmnif_init(struct netif *netif)
|
|||
#if MMNIF_USE_MPB
|
||||
heap_start_address = RCCE_malloc(RCCE_LINE_SIZE);
|
||||
DEBUGPRINTF("MessagePassingBuffer allocated @ : %p\n", heap_start_address);
|
||||
for (i = heap_size / RCCE_LINE_SIZE; i > 0; i--)
|
||||
for (i = heap_size / RCCE_LINE_SIZE - 1; i > 0; i--)
|
||||
{
|
||||
if (!RCCE_malloc(RCCE_LINE_SIZE))
|
||||
{
|
||||
//DEBUGPRINTF("mmnif init(): allocating shared memory failed\n");
|
||||
DEBUGPRINTF("mmnif init(): allocating shared memory failed\n");
|
||||
//return ERR_MEM;
|
||||
}
|
||||
}
|
||||
|
@ -1016,10 +1022,10 @@ err_t mmnif_init(struct netif *netif)
|
|||
#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;
|
||||
heap_start_address = map_region(0, heap_start_address, (MMNIF_CORES * heap_size) >> PAGE_SHIFT, MAP_KERNEL_SPACE | MAP_NO_CACHE | MAP_MPE);
|
||||
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_REMAP);
|
||||
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);
|
||||
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 // MMNIF_USE_MPB
|
||||
DEBUGPRINTF("map_region : %p\n", header_start_address);
|
||||
|
@ -1040,31 +1046,22 @@ err_t mmnif_init(struct netif *netif)
|
|||
DEBUGPRINTF("mmnif init(): allocating shared memory failed\n");
|
||||
return ERR_MEM;
|
||||
}
|
||||
|
||||
#if !MMNIF_USE_MPB
|
||||
memset(mmnif->rx_buff, 0x00, header_size);
|
||||
memset(mmnif->rx_heap, 0x00, heap_size);
|
||||
|
||||
*((int *)RCCE_fool_write_combine_buffer) = 1;
|
||||
#if USE_CACHE
|
||||
#else
|
||||
asm volatile (".byte 0x0f; .byte 0x0a;\n");
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if (own_ip_address == router_ip_address)
|
||||
{
|
||||
kprintf("Test0: MEMCPY 2048B");
|
||||
tmp1 = get_clock_tick();
|
||||
for (n = 0; n < 4096; n++)
|
||||
{
|
||||
memcpy(mmnif->rx_heap + heap_size, mmnif->rx_heap, 2048);
|
||||
for(i=0; i<header_size; i++)
|
||||
((uint8_t*)mmnif->rx_buff)[i] = 0x00;
|
||||
for(i=0; i<heap_size; i++)
|
||||
((uint8_t*)mmnif->rx_heap)[i] = 0x00;
|
||||
|
||||
*((int *)RCCE_fool_write_combine_buffer) = 1;
|
||||
#if USE_CACHE
|
||||
asm volatile (".byte 0x0f; .byte 0x0a;\n");
|
||||
#endif
|
||||
memcpy(mmnif->rx_heap, mmnif->rx_heap, 2048);
|
||||
} tmp2 = get_clock_tick();
|
||||
kprintf("memcpy'd' %d bytes in %d ticks\n", n * 2048, (tmp2 - tmp1));
|
||||
}
|
||||
*((int *)RCCE_fool_write_combine_buffer) = 1;
|
||||
asm volatile (".byte 0x0f; .byte 0x0a;\n");
|
||||
#endif
|
||||
|
||||
/* set initial values
|
||||
|
@ -1261,6 +1258,10 @@ anotherpacket:
|
|||
i += q->len;
|
||||
}
|
||||
|
||||
#if MMNIF_USE_MPB
|
||||
asm volatile (".byte 0x0f; .byte 0x0a;\n");
|
||||
#endif
|
||||
|
||||
/* indicate that the copy process is done and the packet can be freed
|
||||
* note that we did not lock here because we are the only one editing this value
|
||||
*/
|
||||
|
|
Loading…
Add table
Reference in a new issue