summaryrefslogtreecommitdiff
path: root/bgpd/bgp_nht.c
diff options
context:
space:
mode:
authorPhilippe Guibert <philippe.guibert@6wind.com>2023-12-11 17:23:50 +0100
committerPhilippe Guibert <philippe.guibert@6wind.com>2023-12-11 21:03:33 +0100
commit9cb66bdceb524fbe58614caab27fd6bdbc060c29 (patch)
tree219fc311a7df48ca8c7a03d9b4c0d7dead9b2d0e /bgpd/bgp_nht.c
parent4a2ece949e5ff82d9c3caf7273d31be9a3b3e93c (diff)
bgpd: move l3nhg functions in separate bgp_nhg.[ch] file
This rework separates l3nhg functionality from the nexthop tracking code, by introducing two bgp_nhg.[ch] files. The calling functions are renamed from bgp_l3nhg* to bgp_nhg*. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
Diffstat (limited to 'bgpd/bgp_nht.c')
-rw-r--r--bgpd/bgp_nht.c87
1 files changed, 0 insertions, 87 deletions
diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c
index 10c0382f6f..05fd0dc4e7 100644
--- a/bgpd/bgp_nht.c
+++ b/bgpd/bgp_nht.c
@@ -1569,90 +1569,3 @@ void bgp_nht_dereg_enhe_cap_intfs(struct peer *peer)
0);
}
}
-
-/****************************************************************************
- * L3 NHGs are used for fast failover of nexthops in the dplane. These are
- * the APIs for allocating L3 NHG ids. Management of the L3 NHG itself is
- * left to the application using it.
- * PS: Currently EVPN host routes is the only app using L3 NHG for fast
- * failover of remote ES links.
- ***************************************************************************/
-static bitfield_t bgp_nh_id_bitmap;
-static uint32_t bgp_l3nhg_start;
-
-/* XXX - currently we do nothing on the callbacks */
-static void bgp_l3nhg_add_cb(const char *name)
-{
-}
-
-static void bgp_l3nhg_modify_cb(const struct nexthop_group_cmd *nhgc)
-{
-}
-
-static void bgp_l3nhg_add_nexthop_cb(const struct nexthop_group_cmd *nhgc,
- const struct nexthop *nhop)
-{
-}
-
-static void bgp_l3nhg_del_nexthop_cb(const struct nexthop_group_cmd *nhgc,
- const struct nexthop *nhop)
-{
-}
-
-static void bgp_l3nhg_del_cb(const char *name)
-{
-}
-
-static void bgp_l3nhg_zebra_init(void)
-{
- static bool bgp_l3nhg_zebra_inited;
- if (bgp_l3nhg_zebra_inited)
- return;
-
- bgp_l3nhg_zebra_inited = true;
- bgp_l3nhg_start = zclient_get_nhg_start(ZEBRA_ROUTE_BGP);
- nexthop_group_init(bgp_l3nhg_add_cb, bgp_l3nhg_modify_cb,
- bgp_l3nhg_add_nexthop_cb, bgp_l3nhg_del_nexthop_cb,
- bgp_l3nhg_del_cb);
-}
-
-
-void bgp_l3nhg_init(void)
-{
- uint32_t id_max;
-
- id_max = MIN(ZEBRA_NHG_PROTO_SPACING - 1, 16 * 1024);
- bf_init(bgp_nh_id_bitmap, id_max);
- bf_assign_zero_index(bgp_nh_id_bitmap);
-
- if (BGP_DEBUG(nht, NHT) || BGP_DEBUG(evpn_mh, EVPN_MH_ES))
- zlog_debug("bgp l3_nhg range %u - %u", bgp_l3nhg_start + 1,
- bgp_l3nhg_start + id_max);
-}
-
-void bgp_l3nhg_finish(void)
-{
- bf_free(bgp_nh_id_bitmap);
-}
-
-uint32_t bgp_l3nhg_id_alloc(void)
-{
- uint32_t nhg_id = 0;
-
- bgp_l3nhg_zebra_init();
- bf_assign_index(bgp_nh_id_bitmap, nhg_id);
- if (nhg_id)
- nhg_id += bgp_l3nhg_start;
-
- return nhg_id;
-}
-
-void bgp_l3nhg_id_free(uint32_t nhg_id)
-{
- if (!nhg_id || (nhg_id <= bgp_l3nhg_start))
- return;
-
- nhg_id -= bgp_l3nhg_start;
-
- bf_release_index(bgp_nh_id_bitmap, nhg_id);
-}