FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
adj_mcast.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2016 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @brief Mcast Adjacency
18  *
19  * The multicast adjacency forwards IP traffic on an interface toward a multicast
20  * group address. This is a different type of adjacency to a unicast adjacency
21  * since the application of the MAC header is different, and so the VLIB node
22  * visited is also different. DPO types have different VLIB nodes.
23  */
24 
25 #ifndef __ADJ_MCAST_H__
26 #define __ADJ_MCAST_H__
27 
28 #include <vnet/adj/adj_types.h>
29 #include <vnet/adj/adj_midchain.h>
30 
31 /**
32  * @brief
33  * Add (and lock) a new or lock an existing mcast adjacency
34  *
35  * @param proto
36  * The protocol for the neighbours that we wish to mcast
37  *
38  * @param link_type
39  * A description of the protocol of the packets that will forward
40  * through this adj. On an ethernet interface this is the MAC header's
41  * ether-type
42  *
43  * @param sw_if_index
44  * The interface on which to mcast
45  */
47  vnet_link_t link_type,
49 
50 /**
51  * @brief
52  * Update the rewrite string for an existing adjacecny.
53  *
54  * @param
55  * The index of the adj to update
56  *
57  * @param
58  * The new rewrite
59  *
60  * @param
61  * The offset in the rewrite a which to write in packet's
62  * IP Address
63  */
64 extern void adj_mcast_update_rewrite(adj_index_t adj_index,
65  u8 *rewrite,
66  u8 offset);
67 
68 /**
69  * @brief
70  * Update the rewrite string for an existing adjacecny and
71  * Convert the adjacency into a midchain
72  *
73  * @param
74  * The index of the adj to update
75  *
76  * @param fixup
77  * The function that will be invoked at paket switch time to 'fixup'
78  * the rewrite applied with necessary per-packet info (i.e. length, checksums).
79  * @param fixup_data
80  * Context data set by the caller that is provided as an argument in the
81  * fixup function.
82  *
83  * @param flags
84  * Flags controlling the adjacency behaviour
85  *
86  * @param
87  * The new rewrite
88  */
91  const void *fixup_data,
93  u8 *rewrite,
94  u8 offset,
95  u32 mask);
96 /**
97  * @brief Walk the multicast Adjacencies on a given interface
98  */
99 extern void adj_mcast_walk (u32 sw_if_index,
100  fib_protocol_t adj_nh_proto,
101  adj_walk_cb_t cb,
102  void *ctx);
103 
104 /**
105  * @brief Format/display a mcast adjacency.
106  */
107 extern u8* format_adj_mcast(u8* s, va_list *ap);
108 extern u8* format_adj_mcast_midchain(u8* s, va_list *ap);
109 
110 /**
111  * @brief Get the sze of the mcast adj DB. Test purposes only.
112  */
113 extern u32 adj_mcast_db_size(void);
114 
115 /**
116  * @brief
117  * Module initialisation
118  */
119 extern void adj_mcast_module_init(void);
120 
121 #endif
u32 sw_if_index
Definition: ipsec_gre.api:37
void adj_mcast_midchain_update_rewrite(adj_index_t adj_index, adj_midchain_fixup_t fixup, const void *fixup_data, adj_flags_t flags, u8 *rewrite, u8 offset, u32 mask)
Update the rewrite string for an existing adjacecny and Convert the adjacency into a midchain...
Definition: adj_mcast.c:136
u32 flags
Definition: vhost_user.h:115
void adj_mcast_module_init(void)
Module initialisation.
Definition: adj_mcast.c:469
unsigned char u8
Definition: types.h:56
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u8 * format_adj_mcast_midchain(u8 *s, va_list *ap)
Definition: adj_mcast.c:346
unsigned int u32
Definition: types.h:88
long ctx[MAX_CONNS]
Definition: main.c:144
adj_index_t adj_mcast_add_or_lock(fib_protocol_t proto, vnet_link_t link_type, u32 sw_if_index)
Mcast Adjacency.
Definition: adj_mcast.c:51
adj_walk_rc_t(* adj_walk_cb_t)(adj_index_t ai, void *ctx)
Call back function when walking adjacencies.
Definition: adj_types.h:50
void(* adj_midchain_fixup_t)(vlib_main_t *vm, struct ip_adjacency_t_ *adj, vlib_buffer_t *b0, const void *data)
A function type for post-rewrite fixups on midchain adjacency.
Definition: adj.h:152
u32 adj_index_t
An index for adjacencies.
Definition: adj_types.h:30
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
enum adj_flags_t_ adj_flags_t
Flags on an IP adjacency.
template key/value backing page structure
Definition: bihash_doc.h:44
void adj_mcast_walk(u32 sw_if_index, fib_protocol_t adj_nh_proto, adj_walk_cb_t cb, void *ctx)
Walk the multicast Adjacencies on a given interface.
Definition: adj_mcast.c:313
void adj_mcast_update_rewrite(adj_index_t adj_index, u8 *rewrite, u8 offset)
Update the rewrite string for an existing adjacecny.
Definition: adj_mcast.c:102
u8 * format_adj_mcast(u8 *s, va_list *ap)
Format/display a mcast adjacency.
Definition: adj_mcast.c:328
u32 adj_mcast_db_size(void)
Get the sze of the mcast adj DB.
Definition: adj_mcast.c:446