> From: dev <dev-boun...@dpdk.org> On Behalf Of Vladimir Medvedkin > Sent: Monday 8 November 2021 17:37 > To: dev@dpdk.org > Subject: [dpdk-dev] [PATCH 1/2] doc: add programmer's guide for the RIB > library > > Currently, programmer's guide for the RIB library is missing. > This commit adds it. > > Signed-off-by: Vladimir Medvedkin <vladimir.medved...@intel.com> > --- > doc/guides/prog_guide/img/rib_internals.svg | 148 +++++++++++++++++ > doc/guides/prog_guide/img/rib_pic.svg | 152 +++++++++++++++++ > doc/guides/prog_guide/index.rst | 1 + > doc/guides/prog_guide/rib_lib.rst | 172 ++++++++++++++++++++ > 4 files changed, 473 insertions(+) > create mode 100644 doc/guides/prog_guide/img/rib_internals.svg > create mode 100644 doc/guides/prog_guide/img/rib_pic.svg > create mode 100644 doc/guides/prog_guide/rib_lib.rst >
<snip> > + RIB prefix independent convergence > + > +In case of a next hop failure, we need to replace an active failed next hop > with a > +feasible next hop for every corresponding route without waiting for the > routing daemon > +recalculation process to complete. > +To achieve this we can link all existing routes with the same active next hop > in a linked list, > +saving the feasible next hop ID and a pointer inside the extension space of > each ``rte_rib_node``. > + > +.. code-block:: c > + > + struct my_route_ext { > + struct rte_rib_node *next; > + uint64_t feasible_nh; > + }; > + > + struct rte_rib_conf conf; > + conf.ext_sz = sizeof(struct my_route_ext); > + rib = rte_rib_create("test", 0, &conf); > + ... > + /* routing daemon task */ > + struct rte_rib_node *route = rte_rib_insert(rib, RTE_IPV4(192,0,2,0), > 24); > + rte_rib_set_nh(route, active_nh_from_rd); > + struct my_route_ext *ext = rte_rib_get_ext(route); > + ext->feasible_nh = feasible_nh_from_rd; > + list_insert(nh_table[active_nh_from_rd].list_head, route); > + ... > + /* dataplane monitoring thread */ > + /* nexthop id fail_nh fails */ ^^^^^^^ > + route = NULL; > + do { > + route = get_next(nh_table[fail_nh].list_head, route); > + uint32_t ip; > + uint8_t depth; > + rte_rib_get_ip(route, &ip); > + rte_rib_get_depth(route, &depth); > + ext = rte_rib_get_ext(route); > + uint64_t new_nh = ext->feasible_nh; > + /* do update to the dataplane, for example to the fib */ > + rte_fib_add(fib, ip, depth, new_nh); > + /* update nexthop if necessary */ ^^^^^^^ These two comments are showing as spelling errors on aspell but I think they are ok as this is technically a code comment and nexthop often appears in the code without a space. > + rte_rib_set_nh(route, new_nh); > + } while (route != NULL); > + > -- > 2.25.1 Reviewed-by: Conor Walsh <conor.wa...@intel.com>