FD.io VPP  v18.01-8-g0eacf49
Vector Packet Processing
udp_encap.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 #ifndef __UDP_ENCAP_H__
17 #define __UDP_ENCAP_H__
18 
19 #include <vnet/ip/ip.h>
20 #include <vnet/udp/udp.h>
21 #include <vnet/fib/fib_node.h>
22 
23 /**
24  * UDP encapsualtion.
25  * A representation of the encapsulation of packets in UDP-over-IP.
26  * This is encapsulation only, there is no tunnel interface, hence
27  * it is uni-directional. For decap register a handler with the UDP port
28  * dispatcher.
29  */
30 
31 /**
32  * Fixup behaviour. Actions performed on the encap in the data-plance
33  */
35 {
37  /**
38  * UDP source port contains an entropy/hash value for load-balancing by downstream peers.
39  */
42 
43 /**
44  * The UDP encap represenation
45  */
46 typedef struct udp_encap_t_
47 {
48  /**
49  * The first cacheline contains the data used in the data-plane
50  */
51  CLIB_CACHE_LINE_ALIGN_MARK (cacheline0);
52 
53  /**
54  * The headers to paint, in packet painting order
55  */
56  union
57  {
58  struct
59  {
62  } __attribute__ ((packed)) ip4;
63  struct
64  {
67  } __attribute__ ((packed)) ip6;
68  } __attribute__ ((packed)) ue_hdrs;
69 
70  /**
71  * Flags controlling fixup behaviour
72  */
74 
75  /**
76  * The DPO used to forward to the next node in the VLIB graph
77  */
79 
80  /**
81  * the protocol of the IP header imposed
82  */
84 
85  CLIB_CACHE_LINE_ALIGN_MARK (cacheline1);
86 
87  /**
88  * linkage into the FIB graph
89  */
91 
92  /**
93  * The ID given by the user/client.
94  * This ID is used by the client for modifications.
95  */
97 
98  /**
99  * Tracking information for the IP destination
100  */
103 
104  /**
105  * The FIB index in which the encap destination resides
106  */
108 } udp_encap_t;
109 
111  fib_protocol_t proto,
112  index_t fib_index,
113  const ip46_address_t * src_ip,
114  const ip46_address_t * dst_ip,
115  u16 src_port,
116  u16 dst_port,
118 
119 extern index_t udp_encap_find (u32 id);
120 extern void udp_encap_lock (u32 id);
121 extern void udp_encap_unlock (u32 id);
122 extern u8 *format_udp_encap (u8 * s, va_list * args);
123 extern void udp_encap_unlock_w_index (index_t uei);
124 extern void udp_encap_contribute_forwarding (u32 id,
125  dpo_proto_t proto,
126  dpo_id_t * dpo);
127 
128 /**
129  * Pool of encaps
130  */
132 
133 static inline udp_encap_t *
135 {
136  return (pool_elt_at_index (udp_encap_pool, uei));
137 }
138 
139 /*
140  * fd.io coding-style-patch-verification: ON
141  *
142  * Local Variables:
143  * eval: (c-set-style "gnu")
144  * End:
145  */
146 
147 #endif
fib_protocol_t ue_ip_proto
the protocol of the IP header imposed
Definition: udp_encap.h:83
u32 ue_fib_sibling
Definition: udp_encap.h:102
void udp_encap_unlock_w_index(index_t uei)
Definition: udp_encap.c:205
CLIB_CACHE_LINE_ALIGN_MARK(cacheline0)
The first cacheline contains the data used in the data-plane.
The UDP encap represenation.
Definition: udp_encap.h:46
fib_node_index_t ue_fib_entry_index
Tracking information for the IP destination.
Definition: udp_encap.h:101
u32 index_t
A Data-Path Object is an object that represents actions that are applied to packets are they are swit...
Definition: dpo.h:41
dpo_id_t ue_dpo
The DPO used to forward to the next node in the VLIB graph.
Definition: udp_encap.h:78
fib_node_t ue_fib_node
linkage into the FIB graph
Definition: udp_encap.h:90
struct udp_encap_t_::@293::@295 ip6
enum fib_protocol_t_ fib_protocol_t
Protocol Type.
u32 ue_id
The ID given by the user/client.
Definition: udp_encap.h:96
u8 * format_udp_encap(u8 *s, va_list *args)
Definition: udp_encap.c:309
enum dpo_proto_t_ dpo_proto_t
Data path protocol.
index_t udp_encap_add_and_lock(u32 id, fib_protocol_t proto, index_t fib_index, const ip46_address_t *src_ip, const ip46_address_t *dst_ip, u16 src_port, u16 dst_port, udp_encap_fixup_flags_t flags)
Definition: udp_encap.c:62
enum udp_encap_fixup_flags_t_ udp_encap_fixup_flags_t
UDP encapsualtion.
udp_encap_fixup_flags_t_
UDP encapsualtion.
Definition: udp_encap.h:34
The identity of a DPO is a combination of its type and its instance number/index of objects of that t...
Definition: dpo.h:166
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
Definition: pool.h:459
UDP source port contains an entropy/hash value for load-balancing by downstream peers.
Definition: udp_encap.h:40
void udp_encap_contribute_forwarding(u32 id, dpo_proto_t proto, dpo_id_t *dpo)
Definition: udp_encap.c:158
ip6_header_t ue_ip6
Definition: udp_encap.h:65
ip4_header_t ue_ip4
Definition: udp_encap.h:60
An node in the FIB graph.
Definition: fib_node.h:286
index_t ue_fib_index
The FIB index in which the encap destination resides.
Definition: udp_encap.h:107
udp_encap_t * udp_encap_pool
Pool of encaps.
Definition: udp_encap.c:34
u32 fib_node_index_t
A typedef of a node index.
Definition: fib_types.h:29
void udp_encap_lock(u32 id)
Definition: udp_encap.c:192
unsigned int u32
Definition: types.h:88
struct udp_encap_t_::@293::@294 ip4
udp_header_t ue_udp
Definition: udp_encap.h:61
unsigned short u16
Definition: types.h:57
unsigned char u8
Definition: types.h:56
union udp_encap_t_::@293 ue_hdrs
The headers to paint, in packet painting order.
void udp_encap_unlock(u32 id)
Definition: udp_encap.c:223
udp_encap_fixup_flags_t ue_flags
Flags controlling fixup behaviour.
Definition: udp_encap.h:73
u32 flags
Definition: vhost-user.h:77
index_t udp_encap_find(u32 id)
Definition: udp_encap.c:179
static udp_encap_t * udp_encap_get(index_t uei)
Definition: udp_encap.h:134