void init_hardware(router_state* rs) { /* reset the router */ writeReg(&rs->netfpga, CPCI_REG_CTRL, 0x00010100); usleep(2000); /* enable DMA */ //writeReg(&rs->netfpga, DMA_ENABLE_REG, 0x1); /* write 0's out to the rtable and arp table */ write_arp_cache_to_hw(rs); write_rtable_to_hw(rs); write_ctable_to_hw(rs); }
/* * NOT Threadsafe, ensure arp cache locked at least for read */ void trigger_arp_cache_modified(router_state* rs) { if (rs->is_netfpga) { /* char *info; int len; sprint_arp_cache(rs, &info, &len); printf("SW ARP CACHE \n%s", info); free(info); */ write_arp_cache_to_hw(rs); /* sprint_hw_arp_cache(rs, &info, &len); printf("HW ARP CACHE \n%s", info); free(info); */ } }