2 * PIM for FRR - PIM Instance
3 * Copyright (C) 2017 Cumulus Networks, Inc.
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.
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.
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,
21 #ifndef __PIM_INSTANCE_H__
22 #define __PIM_INSTANCE_H__
28 #include "pim_assert.h"
30 #include "pim_vxlan_instance.h"
32 #include "pim_upstream.h"
34 #if defined(HAVE_LINUX_MROUTE_H)
35 #include <linux/mroute.h>
38 Below: from <linux/mroute.h>
46 enum pim_spt_switchover
{
51 /* stats for updates rxed from the MLAG component during the life of a
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
;
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
;
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
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)
92 struct thread_master
*master
;
97 struct pim_assert_metric infinite_assert_metric
;
98 long rpf_cache_refresh_delay_msec
;
99 uint32_t register_suppress_time
;
101 uint32_t register_probe_time
;
104 * What is the default vrf that we work in
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
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
;
129 struct pim_instance
{
134 enum pim_spt_switchover switchover
;
138 /* The name of the register-accept prefix-list */
139 char *register_plist
;
141 struct hash
*rpf_hash
;
143 void *ssm_info
; /* per-vrf SSM configuration */
145 int send_v6_secondary
;
147 struct thread
*thread
;
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
;
155 struct interface
*regiface
;
157 // List of static routes;
158 struct list
*static_routes
;
160 // Upstream vrf specific information
161 struct rb_pim_upstream_head upstream_head
;
162 struct timer_wheel
*upstream_sg_wheel
;
167 struct list
*rp_list
;
168 struct route_table
*rp_table
;
170 int iface_vif_index
[MAXVIFS
];
173 struct rb_pim_oil_head channel_oil_head
;
175 struct pim_msdp msdp
;
176 struct pim_vxlan_instance vxlan
;
178 struct list
*ssmpingd_list
;
179 struct in_addr ssmpingd_group_addr
;
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
;
187 bool ecmp_rebalance_enable
;
188 /* No. of Dual active I/fs in pim_instance */
189 uint32_t inst_mlag_intf_cnt
;
192 struct bsm_scope global_scope
;
195 uint64_t bsm_dropped
;
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
;
205 int64_t nexthop_lookups
;
206 int64_t nexthop_lookups_avoided
;
207 int64_t last_route_change_time
;
210 void pim_vrf_init(void);
211 void pim_vrf_terminate(void);
213 struct pim_instance
*pim_get_pim_instance(vrf_id_t vrf_id
);