1 / 2

example fastpath initialization psudo code

example fastpath initialization psudo code. // first get list of interfaces then allocate memory to hold meta-interface state ifcnt = get_interfaces(iflist); struct mientry_t {int ifn; uint32_t ipaddr; uint16_t port, uint32_t bw;} micnt = 2 * ifcnt; milist = mkmilist(ifcnt*2);

regina
Download Presentation

example fastpath initialization psudo code

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. example fastpath initialization psudo code // first get list of interfaces then allocate memory to hold meta-interface state ifcnt = get_interfaces(iflist); struct mientry_t {int ifn; uint32_t ipaddr; uint16_t port, uint32_t bw;} micnt = 2 * ifcnt; milist = mkmilist(ifcnt*2); // Estimate the computational complexity and memory bandwidth requirements on NPE. npeComp = {‘firm’, my_estimated_BW, my_estimated_PPS}; // max general NPE resource counts {fltr_count, queue_count, buffer_count, stats_count} npeCounts = {my_fcnt*micnt, my_qcnt*micnt, my_bcnt*micnt, my_scnt*micnt}; // Request substrate to allocate a fastpath instance for the IPv4 code option alloc_fast_path(‘IPv4’, npeComp, npeCounts, sramSize, dramSize); // allocate two meta-interfaces for each external interface for (indx = 0, mi = 0; indx < ifcnt; ++indx) { // allocate bandwidth for all meta-interfaces on this interface my_ifBW = my_calcbw(iflist[indx].availBW); alloc_ifbw(iflist[indx].ifn, my_ifBW); do { // allocate and initialize 2 meta-interfaces for interface ifn milist[mi] = my_alloc_mi(iflist+indx, my_ifBW/2); // associated queues with MIs and initialize parameters my_simple_qinit(mi, my_qcnt); // install entries for local delivery and default routes add_default_routes(milist+mi); } while (++mi & 1); }

  2. example fastpath initialization psudo code milist_t *my_alloc_mi(ifentry_t *ifentry, int bw) { milist_t *milist = (milist_t *)calloc(1, sizeof(milist_t)); milist->ifn = ifentry->ifn; milist->ipaddr = ifentry->ipadd; milist->port = alloc_port(ifentry->ipaddr, 0, ‘UDP’); milist->bw = bw; add_udp_endpoint(milist->ipaddr,milist->port, milist->bw); } int my_simple_qinit(int mi, int qcnt) { bind_queue(mi, ‘range’, {mi * qcnt, (mi+1)*qcnt}); for (int qid = 0; qid < my_qcnt; ++qid) set_queue_params(qid, default_threshold, milist[mi].bw/my_qcnt); } add_default_routes(mientry_t *mientry) { static fid = 0; nhoplist_t *nhop; nhop = get_default_route(miptr); write_fltr(fid++, miptr->mi, nhop[0].prefix, nhop[0].action, nhop[0].attrs}); write_fltr(fid++, miptr->mi, nhop[1].prefix, nhop[1].action, nhop[1].attrs); }

More Related