]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_instance.h
Merge pull request #10770 from chiragshah6/evpn_dev3
[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 #include "pim_upstream.h"
33
34 #if defined(HAVE_LINUX_MROUTE_H)
35 #include <linux/mroute.h>
36 #else
37 /*
38 Below: from <linux/mroute.h>
39 */
40
41 #ifndef MAXVIFS
42 #define MAXVIFS (256)
43 #endif
44 #endif
45
46 enum pim_spt_switchover {
47 PIM_SPT_IMMEDIATE,
48 PIM_SPT_INFINITY,
49 };
50
51 /* stats for updates rxed from the MLAG component during the life of a
52 * session
53 */
54 struct pim_mlag_msg_stats {
55 uint32_t mroute_add_rx;
56 uint32_t mroute_add_tx;
57 uint32_t mroute_del_rx;
58 uint32_t mroute_del_tx;
59 uint32_t mlag_status_updates;
60 uint32_t pim_status_updates;
61 uint32_t vxlan_updates;
62 uint32_t peer_zebra_status_updates;
63 };
64
65 struct pim_mlag_stats {
66 /* message stats are reset when the connection to mlagd flaps */
67 struct pim_mlag_msg_stats msg;
68 uint32_t mlagd_session_downs;
69 uint32_t peer_session_downs;
70 uint32_t peer_zebra_downs;
71 };
72
73 enum pim_mlag_flags {
74 PIM_MLAGF_NONE = 0,
75 /* connection to the local MLAG daemon is up */
76 PIM_MLAGF_LOCAL_CONN_UP = (1 << 0),
77 /* connection to the MLAG daemon on the peer switch is up. note
78 * that there is no direct connection between FRR and the peer MLAG
79 * daemon. this is just a peer-session status provided by the local
80 * MLAG daemon.
81 */
82 PIM_MLAGF_PEER_CONN_UP = (1 << 1),
83 /* status update rxed from the local daemon */
84 PIM_MLAGF_STATUS_RXED = (1 << 2),
85 /* initial dump of data done post peerlink flap */
86 PIM_MLAGF_PEER_REPLAY_DONE = (1 << 3),
87 /* zebra is up on the peer */
88 PIM_MLAGF_PEER_ZEBRA_UP = (1 << 4)
89 };
90
91 struct pim_router {
92 struct thread_master *master;
93
94 uint32_t debugs;
95
96 int t_periodic;
97 struct pim_assert_metric infinite_assert_metric;
98 long rpf_cache_refresh_delay_msec;
99 uint32_t register_suppress_time;
100 int packet_process;
101 uint32_t register_probe_time;
102
103 /*
104 * What is the default vrf that we work in
105 */
106 vrf_id_t vrf_id;
107
108 enum mlag_role mlag_role;
109 uint32_t pim_mlag_intf_cnt;
110 /* if true we have registered with MLAG */
111 bool mlag_process_register;
112 /* if true local MLAG process reported that it is connected
113 * with the peer MLAG process
114 */
115 bool connected_to_mlag;
116 /* Holds the client data(unencoded) that need to be pushed to MCLAGD*/
117 struct stream_fifo *mlag_fifo;
118 struct stream *mlag_stream;
119 struct thread *zpthread_mlag_write;
120 struct in_addr anycast_vtep_ip;
121 struct in_addr local_vtep_ip;
122 struct pim_mlag_stats mlag_stats;
123 enum pim_mlag_flags mlag_flags;
124 char peerlink_rif[INTERFACE_NAMSIZ];
125 struct interface *peerlink_rif_p;
126 };
127
128 /* Per VRF PIM DB */
129 struct pim_instance {
130 // vrf_id_t vrf_id;
131 struct vrf *vrf;
132
133 struct {
134 enum pim_spt_switchover switchover;
135 char *plist;
136 } spt;
137
138 /* The name of the register-accept prefix-list */
139 char *register_plist;
140
141 struct hash *rpf_hash;
142
143 void *ssm_info; /* per-vrf SSM configuration */
144
145 int send_v6_secondary;
146
147 struct thread *thread;
148 int mroute_socket;
149 int64_t mroute_socket_creation;
150 int64_t mroute_add_events;
151 int64_t mroute_add_last;
152 int64_t mroute_del_events;
153 int64_t mroute_del_last;
154
155 struct interface *regiface;
156
157 // List of static routes;
158 struct list *static_routes;
159
160 // Upstream vrf specific information
161 struct rb_pim_upstream_head upstream_head;
162 struct timer_wheel *upstream_sg_wheel;
163
164 /*
165 * RP information
166 */
167 struct list *rp_list;
168 struct route_table *rp_table;
169
170 int iface_vif_index[MAXVIFS];
171 int mcast_if_count;
172
173 struct rb_pim_oil_head channel_oil_head;
174
175 struct pim_msdp msdp;
176 struct pim_vxlan_instance vxlan;
177
178 struct list *ssmpingd_list;
179 struct in_addr ssmpingd_group_addr;
180
181 unsigned int igmp_group_count;
182 unsigned int igmp_watermark_limit;
183 unsigned int keep_alive_time;
184 unsigned int rp_keep_alive_time;
185
186 bool ecmp_enable;
187 bool ecmp_rebalance_enable;
188 /* No. of Dual active I/fs in pim_instance */
189 uint32_t inst_mlag_intf_cnt;
190
191 /* Bsm related */
192 struct bsm_scope global_scope;
193 uint64_t bsm_rcvd;
194 uint64_t bsm_sent;
195 uint64_t bsm_dropped;
196
197 /* If we need to rescan all our upstreams */
198 struct thread *rpf_cache_refresher;
199 int64_t rpf_cache_refresh_requests;
200 int64_t rpf_cache_refresh_events;
201 int64_t rpf_cache_refresh_last;
202 int64_t scan_oil_events;
203 int64_t scan_oil_last;
204
205 int64_t nexthop_lookups;
206 int64_t nexthop_lookups_avoided;
207 int64_t last_route_change_time;
208 };
209
210 void pim_vrf_init(void);
211 void pim_vrf_terminate(void);
212
213 extern struct pim_router *router;
214
215 struct pim_instance *pim_get_pim_instance(vrf_id_t vrf_id);
216
217 #endif