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"
33 #include "pim_mroute.h"
35 enum pim_spt_switchover
{
40 /* stats for updates rxed from the MLAG component during the life of a
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
;
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
;
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
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)
81 struct thread_master
*master
;
86 struct pim_assert_metric infinite_assert_metric
;
87 long rpf_cache_refresh_delay_msec
;
88 uint32_t register_suppress_time
;
90 uint32_t register_probe_time
;
94 * What is the default vrf that we work in
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
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
;
119 struct pim_instance
{
124 enum pim_spt_switchover switchover
;
128 /* The name of the register-accept prefix-list */
129 char *register_plist
;
131 struct hash
*rpf_hash
;
133 void *ssm_info
; /* per-vrf SSM configuration */
135 int send_v6_secondary
;
137 struct thread
*thread
;
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
;
146 struct interface
*regiface
;
148 // List of static routes;
149 struct list
*static_routes
;
151 // Upstream vrf specific information
152 struct rb_pim_upstream_head upstream_head
;
153 struct timer_wheel
*upstream_sg_wheel
;
158 struct list
*rp_list
;
159 struct route_table
*rp_table
;
161 int iface_vif_index
[MAXVIFS
];
164 struct rb_pim_oil_head channel_oil_head
;
166 struct pim_msdp msdp
;
167 struct pim_vxlan_instance vxlan
;
169 struct list
*ssmpingd_list
;
170 pim_addr ssmpingd_group_addr
;
172 unsigned int gm_socket_if_count
;
174 struct thread
*t_gm_recv
;
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
;
182 bool ecmp_rebalance_enable
;
183 /* No. of Dual active I/fs in pim_instance */
184 uint32_t inst_mlag_intf_cnt
;
187 struct bsm_scope global_scope
;
190 uint64_t bsm_dropped
;
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
;
200 int64_t nexthop_lookups
;
201 int64_t nexthop_lookups_avoided
;
202 int64_t last_route_change_time
;
204 uint64_t gm_rx_drop_sys
;
207 void pim_vrf_init(void);
208 void pim_vrf_terminate(void);
210 extern struct pim_router
*router
;
212 struct pim_instance
*pim_get_pim_instance(vrf_id_t vrf_id
);