]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_instance.h
pimd: Convert the channel_oil_list|hash to a rb_tree
[mirror_frr.git] / pimd / pim_instance.h
1 /*
2 * PIM for FRR - PIM Instance
3 * Copyright (C) 2017 Cumulus Networks, Inc.
4 * Donald Sharp
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; see the file COPYING; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
19 * MA 02110-1301 USA
20 */
21 #ifndef __PIM_INSTANCE_H__
22 #define __PIM_INSTANCE_H__
23
24 #include <mlag.h>
25
26 #include "pim_str.h"
27 #include "pim_msdp.h"
28 #include "pim_assert.h"
29 #include "pim_bsm.h"
30 #include "pim_vxlan_instance.h"
31 #include "pim_oil.h"
32
33 #if defined(HAVE_LINUX_MROUTE_H)
34 #include <linux/mroute.h>
35 #else
36 /*
37 Below: from <linux/mroute.h>
38 */
39
40 #ifndef MAXVIFS
41 #define MAXVIFS (256)
42 #endif
43 #endif
44
45 enum pim_spt_switchover {
46 PIM_SPT_IMMEDIATE,
47 PIM_SPT_INFINITY,
48 };
49
50 struct pim_router {
51 struct thread_master *master;
52
53 uint32_t debugs;
54
55 int t_periodic;
56 struct pim_assert_metric infinite_assert_metric;
57 long rpf_cache_refresh_delay_msec;
58 int32_t register_suppress_time;
59 int packet_process;
60 int32_t register_probe_time;
61
62 /*
63 * What is the default vrf that we work in
64 */
65 vrf_id_t vrf_id;
66
67 enum mlag_role role;
68 uint32_t pim_mlag_intf_cnt;
69 /* if true we have registered with MLAG */
70 bool mlag_process_register;
71 /* if true local MLAG process reported that it is connected
72 * with the peer MLAG process
73 */
74 bool connected_to_mlag;
75 /* Holds the client data(unencoded) that need to be pushed to MCLAGD*/
76 struct stream_fifo *mlag_fifo;
77 struct stream *mlag_stream;
78 struct thread *zpthread_mlag_write;
79 };
80
81 /* Per VRF PIM DB */
82 struct pim_instance {
83 vrf_id_t vrf_id;
84 struct vrf *vrf;
85
86 struct {
87 enum pim_spt_switchover switchover;
88 char *plist;
89 } spt;
90
91 struct hash *rpf_hash;
92
93 void *ssm_info; /* per-vrf SSM configuration */
94
95 int send_v6_secondary;
96
97 struct thread *thread;
98 int mroute_socket;
99 int64_t mroute_socket_creation;
100 int64_t mroute_add_events;
101 int64_t mroute_add_last;
102 int64_t mroute_del_events;
103 int64_t mroute_del_last;
104
105 struct interface *regiface;
106
107 // List of static routes;
108 struct list *static_routes;
109
110 // Upstream vrf specific information
111 struct list *upstream_list;
112 struct hash *upstream_hash;
113 struct timer_wheel *upstream_sg_wheel;
114
115 /*
116 * RP information
117 */
118 struct list *rp_list;
119 struct route_table *rp_table;
120
121 int iface_vif_index[MAXVIFS];
122
123 struct rb_pim_oil_head channel_oil_head;
124
125 struct pim_msdp msdp;
126 struct pim_vxlan_instance vxlan;
127
128 struct list *ssmpingd_list;
129 struct in_addr ssmpingd_group_addr;
130
131 unsigned int keep_alive_time;
132 unsigned int rp_keep_alive_time;
133
134 bool ecmp_enable;
135 bool ecmp_rebalance_enable;
136 /* No. of Dual active I/fs in pim_instance */
137 uint32_t inst_mlag_intf_cnt;
138
139 /* Bsm related */
140 struct bsm_scope global_scope;
141 uint64_t bsm_rcvd;
142 uint64_t bsm_sent;
143 uint64_t bsm_dropped;
144
145 /* If we need to rescan all our upstreams */
146 struct thread *rpf_cache_refresher;
147 int64_t rpf_cache_refresh_requests;
148 int64_t rpf_cache_refresh_events;
149 int64_t rpf_cache_refresh_last;
150 int64_t scan_oil_events;
151 int64_t scan_oil_last;
152
153 int64_t nexthop_lookups;
154 int64_t nexthop_lookups_avoided;
155 int64_t last_route_change_time;
156 };
157
158 void pim_vrf_init(void);
159 void pim_vrf_terminate(void);
160
161 struct pim_instance *pim_get_pim_instance(vrf_id_t vrf_id);
162
163 #endif