]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_instance.h
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / pimd / pim_instance.h
1 // SPDX-License-Identifier: GPL-2.0-or-later
2 /*
3 * PIM for FRR - PIM Instance
4 * Copyright (C) 2017 Cumulus Networks, Inc.
5 * Donald Sharp
6 */
7 #ifndef __PIM_INSTANCE_H__
8 #define __PIM_INSTANCE_H__
9
10 #include <mlag.h>
11
12 #include "pim_str.h"
13 #include "pim_msdp.h"
14 #include "pim_assert.h"
15 #include "pim_bsm.h"
16 #include "pim_vxlan_instance.h"
17 #include "pim_oil.h"
18 #include "pim_upstream.h"
19 #include "pim_mroute.h"
20
21 enum pim_spt_switchover {
22 PIM_SPT_IMMEDIATE,
23 PIM_SPT_INFINITY,
24 };
25
26 /* stats for updates rxed from the MLAG component during the life of a
27 * session
28 */
29 struct 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
40 struct 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
48 enum 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
66 struct pim_router {
67 struct thread_master *master;
68
69 uint32_t debugs;
70
71 int t_periodic;
72 struct pim_assert_metric infinite_assert_metric;
73 long rpf_cache_refresh_delay_msec;
74 uint32_t register_suppress_time;
75 int packet_process;
76 uint32_t register_probe_time;
77 uint16_t multipath;
78
79 /*
80 * What is the default vrf that we work in
81 */
82 vrf_id_t vrf_id;
83
84 enum mlag_role mlag_role;
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;
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;
102 };
103
104 /* Per VRF PIM DB */
105 struct pim_instance {
106 // vrf_id_t vrf_id;
107 struct vrf *vrf;
108
109 struct {
110 enum pim_spt_switchover switchover;
111 char *plist;
112 } spt;
113
114 /* The name of the register-accept prefix-list */
115 char *register_plist;
116
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;
125 int reg_sock; /* Socket to send register msg */
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;
133
134 // List of static routes;
135 struct list *static_routes;
136
137 // Upstream vrf specific information
138 struct rb_pim_upstream_head upstream_head;
139 struct timer_wheel *upstream_sg_wheel;
140
141 /*
142 * RP information
143 */
144 struct list *rp_list;
145 struct route_table *rp_table;
146
147 int iface_vif_index[MAXVIFS];
148 int mcast_if_count;
149
150 struct rb_pim_oil_head channel_oil_head;
151
152 struct pim_msdp msdp;
153 struct pim_vxlan_instance vxlan;
154
155 struct list *ssmpingd_list;
156 pim_addr ssmpingd_group_addr;
157
158 unsigned int gm_socket_if_count;
159 int gm_socket;
160 struct thread *t_gm_recv;
161
162 unsigned int gm_group_count;
163 unsigned int gm_watermark_limit;
164 unsigned int keep_alive_time;
165 unsigned int rp_keep_alive_time;
166
167 bool ecmp_enable;
168 bool ecmp_rebalance_enable;
169 /* No. of Dual active I/fs in pim_instance */
170 uint32_t inst_mlag_intf_cnt;
171
172 /* Bsm related */
173 struct bsm_scope global_scope;
174 uint64_t bsm_rcvd;
175 uint64_t bsm_sent;
176 uint64_t bsm_dropped;
177
178 /* If we need to rescan all our upstreams */
179 struct thread *rpf_cache_refresher;
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;
189
190 uint64_t gm_rx_drop_sys;
191 };
192
193 void pim_vrf_init(void);
194 void pim_vrf_terminate(void);
195
196 extern struct pim_router *router;
197
198 struct pim_instance *pim_get_pim_instance(vrf_id_t vrf_id);
199
200 #endif