mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-14 06:50:17 +00:00
bgpd: move rd id bitfield to bgp_master
currently, we have a rd_id bitfield to assign an unique index for auto RD. This bitfield currently resides under struct bgp which seems wrong. We need to shift this to a global space as this ID space is really global per box. One more reason to keep it at a global data structure is, the ID space could be used by both VNIs and VRFs. Signed-off-by: Mitesh Kanjariya <mitesh@cumulusnetworks.com>
This commit is contained in:
parent
90384b2471
commit
e9eb5f63ed
@ -3443,7 +3443,7 @@ struct bgpevpn *bgp_evpn_new(struct bgp *bgp, vni_t vni,
|
|||||||
vpn->import_rtl->cmp = (int (*)(void *, void *))evpn_route_target_cmp;
|
vpn->import_rtl->cmp = (int (*)(void *, void *))evpn_route_target_cmp;
|
||||||
vpn->export_rtl = list_new();
|
vpn->export_rtl = list_new();
|
||||||
vpn->export_rtl->cmp = (int (*)(void *, void *))evpn_route_target_cmp;
|
vpn->export_rtl->cmp = (int (*)(void *, void *))evpn_route_target_cmp;
|
||||||
bf_assign_index(bgp->rd_idspace, vpn->rd_id);
|
bf_assign_index(bm->rd_idspace, vpn->rd_id);
|
||||||
derive_rd_rt_for_vni(bgp, vpn);
|
derive_rd_rt_for_vni(bgp, vpn);
|
||||||
|
|
||||||
/* Initialize EVPN route table. */
|
/* Initialize EVPN route table. */
|
||||||
@ -3475,7 +3475,7 @@ void bgp_evpn_free(struct bgp *bgp, struct bgpevpn *vpn)
|
|||||||
bgp_evpn_unmap_vni_from_its_rts(bgp, vpn);
|
bgp_evpn_unmap_vni_from_its_rts(bgp, vpn);
|
||||||
list_delete_and_null(&vpn->import_rtl);
|
list_delete_and_null(&vpn->import_rtl);
|
||||||
list_delete_and_null(&vpn->export_rtl);
|
list_delete_and_null(&vpn->export_rtl);
|
||||||
bf_release_index(bgp->rd_idspace, vpn->rd_id);
|
bf_release_index(bm->rd_idspace, vpn->rd_id);
|
||||||
hash_release(bgp->vnihash, vpn);
|
hash_release(bgp->vnihash, vpn);
|
||||||
QOBJ_UNREG(vpn);
|
QOBJ_UNREG(vpn);
|
||||||
XFREE(MTYPE_BGP_EVPN, vpn);
|
XFREE(MTYPE_BGP_EVPN, vpn);
|
||||||
@ -3937,7 +3937,6 @@ void bgp_evpn_cleanup(struct bgp *bgp)
|
|||||||
if (bgp->l2vnis)
|
if (bgp->l2vnis)
|
||||||
list_delete_and_null(&bgp->l2vnis);
|
list_delete_and_null(&bgp->l2vnis);
|
||||||
bgp->l2vnis = NULL;
|
bgp->l2vnis = NULL;
|
||||||
bf_free(bgp->rd_idspace);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3967,9 +3966,6 @@ void bgp_evpn_init(struct bgp *bgp)
|
|||||||
bgp->l2vnis = list_new();
|
bgp->l2vnis = list_new();
|
||||||
bgp->l2vnis->cmp =
|
bgp->l2vnis->cmp =
|
||||||
(int (*)(void *, void *))vni_hash_cmp;
|
(int (*)(void *, void *))vni_hash_cmp;
|
||||||
bf_init(bgp->rd_idspace, UINT16_MAX);
|
|
||||||
/*assign 0th index in the bitfield, so that we start with id 1*/
|
|
||||||
bf_assign_zero_index(bgp->rd_idspace);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void bgp_evpn_vrf_delete(struct bgp *bgp_vrf)
|
void bgp_evpn_vrf_delete(struct bgp *bgp_vrf)
|
||||||
|
@ -7401,6 +7401,12 @@ void bgp_master_init(struct thread_master *master)
|
|||||||
|
|
||||||
bgp_process_queue_init();
|
bgp_process_queue_init();
|
||||||
|
|
||||||
|
/* init the rd id space.
|
||||||
|
assign 0th index in the bitfield,
|
||||||
|
so that we start with id 1 */
|
||||||
|
bf_init(bm->rd_idspace, UINT16_MAX);
|
||||||
|
bf_assign_zero_index(bm->rd_idspace);
|
||||||
|
|
||||||
/* Enable multiple instances by default. */
|
/* Enable multiple instances by default. */
|
||||||
bgp_option_set(BGP_OPT_MULTIPLE_INSTANCE);
|
bgp_option_set(BGP_OPT_MULTIPLE_INSTANCE);
|
||||||
|
|
||||||
|
@ -137,6 +137,9 @@ struct bgp_master {
|
|||||||
/* clang-format off */
|
/* clang-format off */
|
||||||
#define RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */
|
#define RMAP_DEFAULT_UPDATE_TIMER 5 /* disabled by default */
|
||||||
|
|
||||||
|
/* Id space for automatic RD derivation for an EVI/VRF */
|
||||||
|
bitfield_t rd_idspace;
|
||||||
|
|
||||||
QOBJ_FIELDS
|
QOBJ_FIELDS
|
||||||
};
|
};
|
||||||
DECLARE_QOBJ_TYPE(bgp_master)
|
DECLARE_QOBJ_TYPE(bgp_master)
|
||||||
@ -409,9 +412,6 @@ struct bgp {
|
|||||||
/* Hash table of VRF import RTs to VRFs */
|
/* Hash table of VRF import RTs to VRFs */
|
||||||
struct hash *vrf_import_rt_hash;
|
struct hash *vrf_import_rt_hash;
|
||||||
|
|
||||||
/* Id space for automatic RD derivation for an EVI */
|
|
||||||
bitfield_t rd_idspace;
|
|
||||||
|
|
||||||
/* L3-VNI corresponding to this vrf */
|
/* L3-VNI corresponding to this vrf */
|
||||||
vni_t l3vni;
|
vni_t l3vni;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user