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