minor optimization, using of the flag MAP_REMAP to enable the cache
This commit is contained in:
parent
69d2114654
commit
30bf7d20a3
1 changed files with 12 additions and 18 deletions
|
@ -87,9 +87,9 @@
|
|||
*/
|
||||
|
||||
#if MMNIF_USE_MPB
|
||||
#define MMNIF_RX_BUFFERLEN 7*1024
|
||||
#define MMNIF_RX_BUFFERLEN (7*1024)
|
||||
#else
|
||||
#define MMNIF_RX_BUFFERLEN 8*1024
|
||||
#define MMNIF_RX_BUFFERLEN (8*1024)
|
||||
#endif
|
||||
|
||||
#define MMNIF_MAX_DESCRIPTORS 64
|
||||
|
@ -706,18 +706,16 @@ realloc:
|
|||
|
||||
for (q = p, i = 0; q != 0; q = q->next)
|
||||
{
|
||||
#if !MMNIF_USE_MBO && !USE_CACHE
|
||||
#if !MMNIF_USE_MBP
|
||||
memcpy_to_nc((char*) write_address+ i, q->payload, q->len);
|
||||
#elif MMNIF_USE_MPB
|
||||
memcpy_put((char*) write_address + i, q->payload, q->len);
|
||||
#else
|
||||
memcpy((char*) write_address+ i, q->payload, q->len);
|
||||
memcpy_put((char*) write_address + i, q->payload, q->len);
|
||||
#endif
|
||||
i += q->len;
|
||||
}
|
||||
|
||||
*((int *)RCCE_fool_write_combine_buffer) = 1;
|
||||
#if USE_CACHE || MMNIF_USE_MPB
|
||||
#if MMNIF_USE_MPB
|
||||
asm volatile (".byte 0x0f; .byte 0x0a;\n");
|
||||
#endif
|
||||
if (mmnif_commit_packet(dest_ip, write_address))
|
||||
|
@ -868,23 +866,19 @@ realloc:
|
|||
* reserved for us because it has the status "pending"
|
||||
*/
|
||||
|
||||
#if MMNIF_USE_MPB
|
||||
#if MMNIF_USE_MPB
|
||||
asm volatile (".byte 0x0f; .byte 0x0a;\n");
|
||||
#endif
|
||||
|
||||
#if !MMNIF_USE_MBO && !USE_CACHE
|
||||
memcpy_to_nc((void*) write_address, pbuff, CLINE_ALIGN(size));
|
||||
#elif MMNIF_USE_MPB
|
||||
memcpy_put(write_address, pbuff, CLINE_ALIGN(size));
|
||||
#if !MMNIF_USE_MPB
|
||||
memcpy_to_nc((void*) write_address, pbuff, size);
|
||||
#else
|
||||
memcpy((void*) write_address, pbuff, CLINE_ALIGN(size));
|
||||
memcpy_put(write_address, pbuff, size);
|
||||
#endif
|
||||
*((int *)RCCE_fool_write_combine_buffer) = 1;
|
||||
|
||||
#if USE_CACHE
|
||||
#if MMNIF_USE_MPB
|
||||
asm volatile (".byte 0x0f; .byte 0x0a;\n");
|
||||
#endif
|
||||
#endif
|
||||
if (mmnif_commit_packet_bypass(dest->dest_ip, write_address, dest->remote_socket))
|
||||
{
|
||||
|
@ -1021,8 +1015,9 @@ err_t mmnif_init(struct netif *netif)
|
|||
// 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;
|
||||
heap_start_address = map_region(0, heap_start_address, (MMNIF_CORES * heap_size) >> PAGE_SHIFT, MAP_KERNEL_SPACE | MAP_NO_CACHE | MAP_MPE);
|
||||
remap_region(heap_start_address + (heap_size) * (own_ip_address - router_ip_address), n + (heap_size) * (own_ip_address - router_ip_address), 1, MAP_KERNEL_SPACE | 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);
|
||||
#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);
|
||||
#endif // USE_CAHCE
|
||||
|
@ -1365,10 +1360,9 @@ static int mmnif_rx_bypass(struct netif *netif, int s, void *data, uint32_t len)
|
|||
DEBUGPRINTF("\n RECIEVED - %p with legth: %d\n", packet, length);
|
||||
hex_dump(length, packet);
|
||||
|
||||
#endif /* */
|
||||
#endif
|
||||
if (len >= length)
|
||||
memcpy(data, (void*) mmnif->rx_buff->desc_table[rdesc].addr, mmnif->rx_buff->desc_table[rdesc].len);
|
||||
|
||||
else
|
||||
goto drop_packet;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue