]>
Commit | Line | Data |
---|---|---|
c2cf4b02 DS |
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 | ||
d6749d74 DS |
24 | #include <mlag.h> |
25 | ||
2ad78035 DS |
26 | #include "pim_str.h" |
27 | #include "pim_msdp.h" | |
d17612dd | 28 | #include "pim_assert.h" |
361b5843 | 29 | #include "pim_bsm.h" |
b583b035 | 30 | #include "pim_vxlan_instance.h" |
7315ecda | 31 | #include "pim_oil.h" |
dd3364cb | 32 | #include "pim_upstream.h" |
2ad78035 | 33 | |
f88df3a6 DS |
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 | |
d17612dd | 45 | |
c2cf4b02 DS |
46 | enum pim_spt_switchover { |
47 | PIM_SPT_IMMEDIATE, | |
48 | PIM_SPT_INFINITY, | |
49 | }; | |
50 | ||
05ca004b AK |
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 | ||
36417fcc DS |
91 | struct pim_router { |
92 | struct thread_master *master; | |
046b1aa7 DS |
93 | |
94 | uint32_t debugs; | |
5b45753e DS |
95 | |
96 | int t_periodic; | |
d17612dd | 97 | struct pim_assert_metric infinite_assert_metric; |
da03883e | 98 | long rpf_cache_refresh_delay_msec; |
2925dff5 | 99 | int32_t register_suppress_time; |
75373cca | 100 | int packet_process; |
a6c5db59 | 101 | int32_t register_probe_time; |
4dfe9ad2 DS |
102 | |
103 | /* | |
104 | * What is the default vrf that we work in | |
105 | */ | |
106 | vrf_id_t vrf_id; | |
d6749d74 | 107 | |
05ca004b | 108 | enum mlag_role mlag_role; |
36b5b98f SK |
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; | |
05ca004b AK |
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; | |
36417fcc DS |
126 | }; |
127 | ||
c2cf4b02 DS |
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 | struct hash *rpf_hash; | |
139 | ||
140 | void *ssm_info; /* per-vrf SSM configuration */ | |
141 | ||
142 | int send_v6_secondary; | |
143 | ||
144 | struct thread *thread; | |
145 | int mroute_socket; | |
146 | int64_t mroute_socket_creation; | |
147 | int64_t mroute_add_events; | |
148 | int64_t mroute_add_last; | |
149 | int64_t mroute_del_events; | |
150 | int64_t mroute_del_last; | |
151 | ||
152 | struct interface *regiface; | |
4e0bc0f0 DS |
153 | |
154 | // List of static routes; | |
155 | struct list *static_routes; | |
9b29ea95 DS |
156 | |
157 | // Upstream vrf specific information | |
dd3364cb | 158 | struct rb_pim_upstream_head upstream_head; |
9b29ea95 | 159 | struct timer_wheel *upstream_sg_wheel; |
d9c9a9ee | 160 | |
89b68082 DS |
161 | /* |
162 | * RP information | |
163 | */ | |
d9c9a9ee | 164 | struct list *rp_list; |
89b68082 | 165 | struct route_table *rp_table; |
f88df3a6 | 166 | |
f88df3a6 | 167 | int iface_vif_index[MAXVIFS]; |
611925dc | 168 | |
7315ecda | 169 | struct rb_pim_oil_head channel_oil_head; |
2ad78035 DS |
170 | |
171 | struct pim_msdp msdp; | |
b583b035 | 172 | struct pim_vxlan_instance vxlan; |
71ad9915 DS |
173 | |
174 | struct list *ssmpingd_list; | |
175 | struct in_addr ssmpingd_group_addr; | |
19b807ca DS |
176 | |
177 | unsigned int keep_alive_time; | |
178 | unsigned int rp_keep_alive_time; | |
da11e325 | 179 | |
4795fff7 DS |
180 | bool ecmp_enable; |
181 | bool ecmp_rebalance_enable; | |
36b5b98f SK |
182 | /* No. of Dual active I/fs in pim_instance */ |
183 | uint32_t inst_mlag_intf_cnt; | |
184 | ||
361b5843 | 185 | /* Bsm related */ |
186 | struct bsm_scope global_scope; | |
187 | uint64_t bsm_rcvd; | |
188 | uint64_t bsm_sent; | |
189 | uint64_t bsm_dropped; | |
4795fff7 | 190 | |
da11e325 DS |
191 | /* If we need to rescan all our upstreams */ |
192 | struct thread *rpf_cache_refresher; | |
bfc92019 DS |
193 | int64_t rpf_cache_refresh_requests; |
194 | int64_t rpf_cache_refresh_events; | |
195 | int64_t rpf_cache_refresh_last; | |
196 | int64_t scan_oil_events; | |
197 | int64_t scan_oil_last; | |
198 | ||
199 | int64_t nexthop_lookups; | |
200 | int64_t nexthop_lookups_avoided; | |
201 | int64_t last_route_change_time; | |
c2cf4b02 DS |
202 | }; |
203 | ||
204 | void pim_vrf_init(void); | |
205 | void pim_vrf_terminate(void); | |
206 | ||
207 | struct pim_instance *pim_get_pim_instance(vrf_id_t vrf_id); | |
208 | ||
209 | #endif |