Lines Matching full:dd

116 handle_default_change(struct dpdk_lpm_data *dd, struct rib_cmd_info *rc)  in handle_default_change()  argument
119 rte_ext = (struct rte_lpm_external *)dd->lpm; in handle_default_change()
123 uint32_t nhidx = fib_get_nhop_idx(dd->fd, rc->rc_nh_new); in handle_default_change()
137 get_parent_rule(struct dpdk_lpm_data *dd, struct in_addr addr, int plen, in get_parent_rule() argument
142 rt = rt_get_inet_parent(dd->fibnum, addr, plen); in get_parent_rule()
151 *nhop_idx = fib_get_nhop_idx(dd->fd, rt_get_raw_nhop(rt)); in get_parent_rule()
161 handle_gu_change(struct dpdk_lpm_data *dd, const struct rib_cmd_info *rc, in handle_gu_change() argument
178 nhidx = fib_get_nhop_idx(dd->fd, rc->rc_nh_new); in handle_gu_change()
180 FIB_PRINTF(LOG_INFO, dd->fd, "nhop limit reached, need rebuild"); in handle_gu_change()
184 ret = rte_lpm_add(dd->lpm, ip, plen, nhidx); in handle_gu_change()
185 FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK GU: %s %s/%d nhop %u -> %u ret: %d", in handle_gu_change()
188 rc->rc_nh_old != NULL ? fib_get_nhop_idx(dd->fd, rc->rc_nh_old) : 0, in handle_gu_change()
196 get_parent_rule(dd, addr, plen, &parent_plen, &parent_nhop_idx); in handle_gu_change()
198 ret = rte_lpm_delete(dd->lpm, ip, plen, parent_plen, parent_nhop_idx); in handle_gu_change()
199 FIB_PRINTF(LOG_DEBUG, dd->fd, "DPDK: %s %s/%d -> /%d nhop %u -> %u ret: %d", in handle_gu_change()
200 "DEL", abuf, plen, parent_plen, fib_get_nhop_idx(dd->fd, rc->rc_nh_old), in handle_gu_change()
205 FIB_PRINTF(LOG_INFO, dd->fd, "error: %d", ret); in handle_gu_change()
217 struct dpdk_lpm_data *dd; in handle_rtable_change_cb() local
223 dd = (struct dpdk_lpm_data *)_data; in handle_rtable_change_cb()
227 ret = handle_gu_change(dd, rc, addr4, plen); in handle_rtable_change_cb()
229 ret = handle_default_change(dd, rc); in handle_rtable_change_cb()
232 FIB_PRINTF(LOG_INFO, dd->fd, "error handling route"); in handle_rtable_change_cb()
239 struct dpdk_lpm_data *dd = (struct dpdk_lpm_data *)_data; in destroy_table() local
241 if (dd->lpm != NULL) in destroy_table()
242 rte_lpm_free(dd->lpm); in destroy_table()
243 free(dd, M_RTABLE); in destroy_table()
249 struct dpdk_lpm_data *dd = (struct dpdk_lpm_data *)_data; in add_route_cb() local
261 FIB_PRINTF(LOG_DEBUG, dd->fd, "Operating on %s/%d", abuf, plen); in add_route_cb()
269 FIB_PRINTF(LOG_DEBUG, dd->fd, "Adding default route"); in add_route_cb()
270 return (handle_default_change(dd, &rc)); in add_route_cb()
273 uint32_t nhidx = fib_get_nhop_idx(dd->fd, nh); in add_route_cb()
275 FIB_PRINTF(LOG_INFO, dd->fd, "unable to get nhop index"); in add_route_cb()
278 ret = rte_lpm_add(dd->lpm, ntohl(addr4.s_addr), plen, nhidx); in add_route_cb()
279 FIB_PRINTF(LOG_DEBUG, dd->fd, "ADD %p %s/%d nh %u = %d", in add_route_cb()
280 dd->lpm, abuf, plen, nhidx, ret); in add_route_cb()
283 FIB_PRINTF(LOG_INFO, dd->fd, "rte_lpm_add() returned %d", ret); in add_route_cb()
285 dd->hit_tables = 1; in add_route_cb()
288 dd->routes_failed++; in add_route_cb()
291 dd->routes_added++; in add_route_cb()
299 struct dpdk_lpm_data *dd; in check_dump_success() local
301 dd = (struct dpdk_lpm_data *)_data; in check_dump_success()
303 FIB_PRINTF(LOG_INFO, dd->fd, "scan completed. added: %zu failed: %zu", in check_dump_success()
304 dd->routes_added, dd->routes_failed); in check_dump_success()
305 if (dd->hit_tables || dd->routes_failed > 0) in check_dump_success()
308 FIB_PRINTF(LOG_INFO, dd->fd, in check_dump_success()
310 dd->fibnum, dd->routes_added); in check_dump_success()
313 dp->arg = dd->lpm; in check_dump_success()
319 estimate_scale(const struct dpdk_lpm_data *dd_src, struct dpdk_lpm_data *dd) in estimate_scale() argument
324 dd->number_tbl8s = dd_src->number_tbl8s * 2; in estimate_scale()
326 dd->number_tbl8s = dd_src->number_tbl8s; in estimate_scale()
334 struct dpdk_lpm_data *dd; in build_table() local
337 dd = malloc(sizeof(struct dpdk_lpm_data), M_RTABLE, M_NOWAIT | M_ZERO); in build_table()
338 if (dd == NULL) { in build_table()
342 dd->fibnum = dd_prev->fibnum; in build_table()
343 dd->fd = fd; in build_table()
345 estimate_scale(dd_prev, dd); in build_table()
347 struct rte_lpm_config cfg = {.number_tbl8s = dd->number_tbl8s}; in build_table()
351 free(dd, M_RTABLE); in build_table()
354 dd->lpm = lpm; in build_table()
356 ext->nh_idx = fib_get_nhop_array(dd->fd); in build_table()
358 FIB_PRINTF(LOG_INFO, fd, "allocated %u tbl8s", dd->number_tbl8s); in build_table()
360 return (dd); in build_table()
366 struct dpdk_lpm_data *dd, dd_base; in init_table() local
373 dd = &dd_base; in init_table()
376 dd = (struct dpdk_lpm_data *)_old_data; in init_table()
380 dd = build_table(dd, fd); in init_table()
381 if (dd == NULL) { in init_table()
386 *data = dd; in init_table()