]> git.proxmox.com Git - mirror_frr.git/blob - pimd/pim_vxlan.h
pimd: header changes for pim-vxlan staggered processing
[mirror_frr.git] / pimd / pim_vxlan.h
1 /* PIM support for VxLAN BUM flooding
2 *
3 * Copyright (C) 2019 Cumulus Networks, Inc.
4 *
5 * This file is part of FRR.
6 *
7 * FRR is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
10 * later version.
11 *
12 * FRR is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 * This program is free software; you can redistribute it and/or modify
17 * it under the terms of the GNU General Public License as published by
18 * the Free Software Foundation; either version 2 of the License, or
19 * (at your option) any later version.
20 */
21
22 #ifndef PIM_VXLAN_H
23 #define PIM_VXLAN_H
24
25 /* global timer used for miscellaneous staggered processing */
26 #define PIM_VXLAN_WORK_TIME 1
27 /* number of SG entries processed at one shot */
28 #define PIM_VXLAN_WORK_MAX 500
29 /* frequency of periodic NULL registers */
30 #define PIM_VXLAN_NULL_REG_INTERVAL 60 /* seconds */
31
32 #define vxlan_mlag (vxlan_info.mlag)
33
34 enum pim_vxlan_sg_flags {
35 PIM_VXLAN_SGF_NONE = 0,
36 PIM_VXLAN_SGF_DEL_IN_PROG = (1 << 0),
37 PIM_VXLAN_SGF_OIF_INSTALLED = (1 << 1)
38 };
39
40 struct pim_vxlan_sg {
41 struct pim_instance *pim;
42
43 /* key */
44 struct prefix_sg sg;
45 char sg_str[PIM_SG_LEN];
46
47 enum pim_vxlan_sg_flags flags;
48 struct pim_upstream *up;
49 struct listnode *work_node; /* to pim_vxlan.work_list */
50
51 /* termination info (only applicable to termination XG mroutes)
52 * term_if - termination device ipmr-lo is added to the OIL
53 * as local/IGMP membership to allow termination of vxlan traffic
54 */
55 struct interface *term_oif;
56
57 /* origination info
58 * iif - lo/vrf or peerlink (on MLAG setups)
59 * peerlink_oif - added to the OIL to send encapsulated BUM traffic to
60 * the MLAG peer switch
61 */
62 struct interface *iif;
63 /* on a MLAG setup the peerlink is added as a static OIF */
64 struct interface *orig_oif;
65 };
66
67 enum pim_vxlan_mlag_flags {
68 PIM_VXLAN_MLAGF_NONE = 0,
69 PIM_VXLAN_MLAGF_ENABLED = (1 << 0)
70 };
71
72 enum pim_vxlan_mlag_role {
73 PIM_VXLAN_MLAG_ROLE_SECONDARY = 0,
74 PIM_VXLAN_MLAG_ROLE_PRIMARY
75 };
76
77 struct pim_vxlan_mlag {
78 enum pim_vxlan_mlag_flags flags;
79 enum pim_vxlan_mlag_role role;
80 bool peer_state;
81 /* routed interface setup on top of MLAG peerlink */
82 struct interface *peerlink_rif;
83 struct in_addr reg_addr;
84 };
85
86 enum pim_vxlan_flags {
87 PIM_VXLANF_NONE = 0,
88 PIM_VXLANF_WORK_INITED = (1 << 0)
89 };
90
91 struct pim_vxlan {
92 enum pim_vxlan_flags flags;
93
94 struct thread *work_timer;
95 struct list *work_list;
96 struct listnode *next_work;
97 int max_work_cnt;
98
99 struct pim_vxlan_mlag mlag;
100 };
101
102 extern struct pim_vxlan_sg *pim_vxlan_sg_find(struct pim_instance *pim,
103 struct prefix_sg *sg);
104 extern struct pim_vxlan_sg *pim_vxlan_sg_add(struct pim_instance *pim,
105 struct prefix_sg *sg);
106 extern void pim_vxlan_sg_del(struct pim_instance *pim, struct prefix_sg *sg);
107
108 #endif /* PIM_VXLAN_H */