Skip to content

Commit

Permalink
bgpd: backpressure - Add a typesafe list for Zebra L2VNI and L3VNI
Browse files Browse the repository at this point in the history
- For L2vni, struct bgp_master holds a type safe list of all the
  VNIs(struct bgpevpn) that needs to be processed.
- For L3vni, struct bgp_master holds a type safe list of all the
  BGP_VRFs(struct bgp) that needs to be processed.

Future commits will use this.

Ticket :#3864371

Signed-off-by: Rajasekar Raja <[email protected]>
  • Loading branch information
raja-rajasekar committed Aug 28, 2024
1 parent 962de0f commit 76c5dee
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
4 changes: 4 additions & 0 deletions bgpd/bgp_evpn_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,15 @@ struct bgpevpn {
/* List of local ESs */
struct list *local_es_evi_list;

struct zebra_l2_vni_item zl2vni;

QOBJ_FIELDS;
};

DECLARE_QOBJ_TYPE(bgpevpn);

DECLARE_LIST(zebra_l2_vni, struct bgpevpn, zl2vni);

/* Mapping of Import RT to VNIs.
* The Import RTs of all VNIs are maintained in a hash table with each
* RT linking to all VNIs that will import routes matching this RT.
Expand Down
2 changes: 2 additions & 0 deletions bgpd/bgp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ static __attribute__((__noreturn__)) void bgp_exit(int status)
bgp_nhg_finish();

zebra_announce_fini(&bm->zebra_announce_head);
zebra_l2_vni_fini(&bm->zebra_l2_vni_head);
zebra_l3_vni_fini(&bm->zebra_l3_vni_head);

/* reverse bgp_dump_init */
bgp_dump_finish();
Expand Down
2 changes: 2 additions & 0 deletions bgpd/bgpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -8424,6 +8424,8 @@ void bgp_master_init(struct event_loop *master, const int buffer_size,
bm = &bgp_master;

zebra_announce_init(&bm->zebra_announce_head);
zebra_l2_vni_init(&bm->zebra_l2_vni_head);
zebra_l3_vni_init(&bm->zebra_l3_vni_head);
bm->bgp = list_new();
bm->listen_sockets = list_new();
bm->port = BGP_PORT_DEFAULT;
Expand Down
12 changes: 12 additions & 0 deletions bgpd/bgpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
#include "asn.h"

PREDECL_LIST(zebra_announce);
PREDECL_LIST(zebra_l2_vni);
PREDECL_LIST(zebra_l3_vni);

/* For union sockunion. */
#include "queue.h"
Expand Down Expand Up @@ -203,6 +205,12 @@ struct bgp_master {
/* To preserve ordering of installations into zebra across all Vrfs */
struct zebra_announce_head zebra_announce_head;

/* To preserve ordering of processing of L2 VNIs in BGP */
struct zebra_l2_vni_head zebra_l2_vni_head;

/* To preserve ordering of processing of BGP-VRFs for L3 VNIs */
struct zebra_l3_vni_head zebra_l3_vni_head;

QOBJ_FIELDS;
};
DECLARE_QOBJ_TYPE(bgp_master);
Expand Down Expand Up @@ -859,10 +867,14 @@ struct bgp {
/* BGP route flap dampening configuration */
struct bgp_damp_config damp[AFI_MAX][SAFI_MAX];

struct zebra_l3_vni_item zl3vni;

QOBJ_FIELDS;
};
DECLARE_QOBJ_TYPE(bgp);

DECLARE_LIST(zebra_l3_vni, struct bgp, zl3vni);

struct bgp_interface {
#define BGP_INTERFACE_MPLS_BGP_FORWARDING (1 << 0)
/* L3VPN multi domain switching */
Expand Down

0 comments on commit 76c5dee

Please sign in to comment.