]>
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" |
a5fa9822 | 33 | #include "pim_mroute.h" |
d17612dd | 34 | |
c2cf4b02 DS |
35 | enum pim_spt_switchover { |
36 | PIM_SPT_IMMEDIATE, | |
37 | PIM_SPT_INFINITY, | |
38 | }; | |
39 | ||
05ca004b AK |
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 | ||
36417fcc DS |
80 | struct pim_router { |
81 | struct thread_master *master; | |
046b1aa7 DS |
82 | |
83 | uint32_t debugs; | |
5b45753e DS |
84 | |
85 | int t_periodic; | |
d17612dd | 86 | struct pim_assert_metric infinite_assert_metric; |
da03883e | 87 | long rpf_cache_refresh_delay_msec; |
e8b7548c | 88 | uint32_t register_suppress_time; |
75373cca | 89 | int packet_process; |
e8b7548c | 90 | uint32_t register_probe_time; |
75700af6 | 91 | uint16_t multipath; |
4dfe9ad2 DS |
92 | |
93 | /* | |
94 | * What is the default vrf that we work in | |
95 | */ | |
96 | vrf_id_t vrf_id; | |
d6749d74 | 97 | |
05ca004b | 98 | enum mlag_role mlag_role; |
36b5b98f SK |
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; | |
05ca004b AK |
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; | |
36417fcc DS |
116 | }; |
117 | ||
c2cf4b02 DS |
118 | /* Per VRF PIM DB */ |
119 | struct pim_instance { | |
d3cc1e45 | 120 | // vrf_id_t vrf_id; |
c2cf4b02 DS |
121 | struct vrf *vrf; |
122 | ||
123 | struct { | |
124 | enum pim_spt_switchover switchover; | |
125 | char *plist; | |
126 | } spt; | |
127 | ||
f4e74bd0 DS |
128 | /* The name of the register-accept prefix-list */ |
129 | char *register_plist; | |
130 | ||
c2cf4b02 DS |
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; | |
94619539 | 139 | int reg_sock; /* Socket to send register msg */ |
c2cf4b02 DS |
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; | |
4e0bc0f0 DS |
147 | |
148 | // List of static routes; | |
149 | struct list *static_routes; | |
9b29ea95 DS |
150 | |
151 | // Upstream vrf specific information | |
dd3364cb | 152 | struct rb_pim_upstream_head upstream_head; |
9b29ea95 | 153 | struct timer_wheel *upstream_sg_wheel; |
d9c9a9ee | 154 | |
89b68082 DS |
155 | /* |
156 | * RP information | |
157 | */ | |
d9c9a9ee | 158 | struct list *rp_list; |
89b68082 | 159 | struct route_table *rp_table; |
f88df3a6 | 160 | |
f88df3a6 | 161 | int iface_vif_index[MAXVIFS]; |
ccf696e8 | 162 | int mcast_if_count; |
611925dc | 163 | |
7315ecda | 164 | struct rb_pim_oil_head channel_oil_head; |
2ad78035 DS |
165 | |
166 | struct pim_msdp msdp; | |
b583b035 | 167 | struct pim_vxlan_instance vxlan; |
71ad9915 DS |
168 | |
169 | struct list *ssmpingd_list; | |
1c56018f | 170 | pim_addr ssmpingd_group_addr; |
19b807ca | 171 | |
df655593 DL |
172 | unsigned int gm_socket_if_count; |
173 | int gm_socket; | |
174 | struct thread *t_gm_recv; | |
175 | ||
8934215f | 176 | unsigned int gm_group_count; |
229a20e2 | 177 | unsigned int gm_watermark_limit; |
19b807ca DS |
178 | unsigned int keep_alive_time; |
179 | unsigned int rp_keep_alive_time; | |
da11e325 | 180 | |
4795fff7 DS |
181 | bool ecmp_enable; |
182 | bool ecmp_rebalance_enable; | |
36b5b98f SK |
183 | /* No. of Dual active I/fs in pim_instance */ |
184 | uint32_t inst_mlag_intf_cnt; | |
185 | ||
361b5843 | 186 | /* Bsm related */ |
187 | struct bsm_scope global_scope; | |
188 | uint64_t bsm_rcvd; | |
189 | uint64_t bsm_sent; | |
190 | uint64_t bsm_dropped; | |
4795fff7 | 191 | |
da11e325 DS |
192 | /* If we need to rescan all our upstreams */ |
193 | struct thread *rpf_cache_refresher; | |
bfc92019 DS |
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; | |
df655593 DL |
203 | |
204 | uint64_t gm_rx_drop_sys; | |
c2cf4b02 DS |
205 | }; |
206 | ||
207 | void pim_vrf_init(void); | |
208 | void pim_vrf_terminate(void); | |
209 | ||
e34e07e6 DL |
210 | extern struct pim_router *router; |
211 | ||
c2cf4b02 DS |
212 | struct pim_instance *pim_get_pim_instance(vrf_id_t vrf_id); |
213 | ||
214 | #endif |