]> git.proxmox.com Git - mirror_frr.git/blame - pimd/pim_instance.h
*: auto-convert to SPDX License IDs
[mirror_frr.git] / pimd / pim_instance.h
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
c2cf4b02
DS
2/*
3 * PIM for FRR - PIM Instance
4 * Copyright (C) 2017 Cumulus Networks, Inc.
5 * Donald Sharp
c2cf4b02
DS
6 */
7#ifndef __PIM_INSTANCE_H__
8#define __PIM_INSTANCE_H__
9
d6749d74
DS
10#include <mlag.h>
11
2ad78035
DS
12#include "pim_str.h"
13#include "pim_msdp.h"
d17612dd 14#include "pim_assert.h"
361b5843 15#include "pim_bsm.h"
b583b035 16#include "pim_vxlan_instance.h"
7315ecda 17#include "pim_oil.h"
dd3364cb 18#include "pim_upstream.h"
a5fa9822 19#include "pim_mroute.h"
d17612dd 20
c2cf4b02
DS
21enum pim_spt_switchover {
22 PIM_SPT_IMMEDIATE,
23 PIM_SPT_INFINITY,
24};
25
05ca004b
AK
26/* stats for updates rxed from the MLAG component during the life of a
27 * session
28 */
29struct pim_mlag_msg_stats {
30 uint32_t mroute_add_rx;
31 uint32_t mroute_add_tx;
32 uint32_t mroute_del_rx;
33 uint32_t mroute_del_tx;
34 uint32_t mlag_status_updates;
35 uint32_t pim_status_updates;
36 uint32_t vxlan_updates;
37 uint32_t peer_zebra_status_updates;
38};
39
40struct pim_mlag_stats {
41 /* message stats are reset when the connection to mlagd flaps */
42 struct pim_mlag_msg_stats msg;
43 uint32_t mlagd_session_downs;
44 uint32_t peer_session_downs;
45 uint32_t peer_zebra_downs;
46};
47
48enum pim_mlag_flags {
49 PIM_MLAGF_NONE = 0,
50 /* connection to the local MLAG daemon is up */
51 PIM_MLAGF_LOCAL_CONN_UP = (1 << 0),
52 /* connection to the MLAG daemon on the peer switch is up. note
53 * that there is no direct connection between FRR and the peer MLAG
54 * daemon. this is just a peer-session status provided by the local
55 * MLAG daemon.
56 */
57 PIM_MLAGF_PEER_CONN_UP = (1 << 1),
58 /* status update rxed from the local daemon */
59 PIM_MLAGF_STATUS_RXED = (1 << 2),
60 /* initial dump of data done post peerlink flap */
61 PIM_MLAGF_PEER_REPLAY_DONE = (1 << 3),
62 /* zebra is up on the peer */
63 PIM_MLAGF_PEER_ZEBRA_UP = (1 << 4)
64};
65
36417fcc
DS
66struct pim_router {
67 struct thread_master *master;
046b1aa7
DS
68
69 uint32_t debugs;
5b45753e
DS
70
71 int t_periodic;
d17612dd 72 struct pim_assert_metric infinite_assert_metric;
da03883e 73 long rpf_cache_refresh_delay_msec;
e8b7548c 74 uint32_t register_suppress_time;
75373cca 75 int packet_process;
e8b7548c 76 uint32_t register_probe_time;
75700af6 77 uint16_t multipath;
4dfe9ad2
DS
78
79 /*
80 * What is the default vrf that we work in
81 */
82 vrf_id_t vrf_id;
d6749d74 83
05ca004b 84 enum mlag_role mlag_role;
36b5b98f
SK
85 uint32_t pim_mlag_intf_cnt;
86 /* if true we have registered with MLAG */
87 bool mlag_process_register;
88 /* if true local MLAG process reported that it is connected
89 * with the peer MLAG process
90 */
91 bool connected_to_mlag;
92 /* Holds the client data(unencoded) that need to be pushed to MCLAGD*/
93 struct stream_fifo *mlag_fifo;
94 struct stream *mlag_stream;
95 struct thread *zpthread_mlag_write;
05ca004b
AK
96 struct in_addr anycast_vtep_ip;
97 struct in_addr local_vtep_ip;
98 struct pim_mlag_stats mlag_stats;
99 enum pim_mlag_flags mlag_flags;
100 char peerlink_rif[INTERFACE_NAMSIZ];
101 struct interface *peerlink_rif_p;
36417fcc
DS
102};
103
c2cf4b02
DS
104/* Per VRF PIM DB */
105struct pim_instance {
d3cc1e45 106 // vrf_id_t vrf_id;
c2cf4b02
DS
107 struct vrf *vrf;
108
109 struct {
110 enum pim_spt_switchover switchover;
111 char *plist;
112 } spt;
113
f4e74bd0
DS
114 /* The name of the register-accept prefix-list */
115 char *register_plist;
116
c2cf4b02
DS
117 struct hash *rpf_hash;
118
119 void *ssm_info; /* per-vrf SSM configuration */
120
121 int send_v6_secondary;
122
123 struct thread *thread;
124 int mroute_socket;
94619539 125 int reg_sock; /* Socket to send register msg */
c2cf4b02
DS
126 int64_t mroute_socket_creation;
127 int64_t mroute_add_events;
128 int64_t mroute_add_last;
129 int64_t mroute_del_events;
130 int64_t mroute_del_last;
131
132 struct interface *regiface;
4e0bc0f0
DS
133
134 // List of static routes;
135 struct list *static_routes;
9b29ea95
DS
136
137 // Upstream vrf specific information
dd3364cb 138 struct rb_pim_upstream_head upstream_head;
9b29ea95 139 struct timer_wheel *upstream_sg_wheel;
d9c9a9ee 140
89b68082
DS
141 /*
142 * RP information
143 */
d9c9a9ee 144 struct list *rp_list;
89b68082 145 struct route_table *rp_table;
f88df3a6 146
f88df3a6 147 int iface_vif_index[MAXVIFS];
ccf696e8 148 int mcast_if_count;
611925dc 149
7315ecda 150 struct rb_pim_oil_head channel_oil_head;
2ad78035
DS
151
152 struct pim_msdp msdp;
b583b035 153 struct pim_vxlan_instance vxlan;
71ad9915
DS
154
155 struct list *ssmpingd_list;
1c56018f 156 pim_addr ssmpingd_group_addr;
19b807ca 157
df655593
DL
158 unsigned int gm_socket_if_count;
159 int gm_socket;
160 struct thread *t_gm_recv;
161
8934215f 162 unsigned int gm_group_count;
229a20e2 163 unsigned int gm_watermark_limit;
19b807ca
DS
164 unsigned int keep_alive_time;
165 unsigned int rp_keep_alive_time;
da11e325 166
4795fff7
DS
167 bool ecmp_enable;
168 bool ecmp_rebalance_enable;
36b5b98f
SK
169 /* No. of Dual active I/fs in pim_instance */
170 uint32_t inst_mlag_intf_cnt;
171
361b5843 172 /* Bsm related */
173 struct bsm_scope global_scope;
174 uint64_t bsm_rcvd;
175 uint64_t bsm_sent;
176 uint64_t bsm_dropped;
4795fff7 177
da11e325
DS
178 /* If we need to rescan all our upstreams */
179 struct thread *rpf_cache_refresher;
bfc92019
DS
180 int64_t rpf_cache_refresh_requests;
181 int64_t rpf_cache_refresh_events;
182 int64_t rpf_cache_refresh_last;
183 int64_t scan_oil_events;
184 int64_t scan_oil_last;
185
186 int64_t nexthop_lookups;
187 int64_t nexthop_lookups_avoided;
188 int64_t last_route_change_time;
df655593
DL
189
190 uint64_t gm_rx_drop_sys;
c2cf4b02
DS
191};
192
193void pim_vrf_init(void);
194void pim_vrf_terminate(void);
195
e34e07e6
DL
196extern struct pim_router *router;
197
c2cf4b02
DS
198struct pim_instance *pim_get_pim_instance(vrf_id_t vrf_id);
199
200#endif