FD.io VPP  v20.05-21-gb1500e9ff
Vector Packet Processing
tunnel_dp.h
Go to the documentation of this file.
1 /*
2  * tunnel_dp.h: data-plane functions tunnels.
3  *
4  * Copyright (c) 2019 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef __TUNNEL_DP_H__
19 #define __TUNNEL_DP_H__
20 
21 #include <vnet/tunnel/tunnel.h>
22 
25  const ip4_header_t * inner, ip4_header_t * outer)
26 {
27  if (flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP)
29  if (flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN)
30  ip4_header_set_ecn (outer, ip4_header_get_ecn (inner));
31  if ((flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DF) &&
32  ip4_header_get_df (inner))
33  ip4_header_set_df (outer);
34 }
35 
38  const ip6_header_t * inner, ip4_header_t * outer)
39 {
40  if (flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP)
42  if (flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN)
43  ip4_header_set_ecn (outer, ip6_ecn_network_order ((inner)));
44 }
45 
48  const ip6_header_t * inner, ip6_header_t * outer)
49 {
50  if (flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP)
52  if (flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN)
54 }
55 
58  const ip4_header_t * inner, ip6_header_t * outer)
59 {
60  if (flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_DSCP)
62  if (flags & TUNNEL_ENCAP_DECAP_FLAG_ENCAP_COPY_ECN)
64 }
65 
68  ip4_header_t * inner, const ip6_header_t * outer)
69 {
70  if (flags & TUNNEL_ENCAP_DECAP_FLAG_DECAP_COPY_ECN)
72 }
73 
76  ip6_header_t * inner, const ip6_header_t * outer)
77 {
78  if (flags & TUNNEL_ENCAP_DECAP_FLAG_DECAP_COPY_ECN)
80 }
81 
84  ip6_header_t * inner, const ip4_header_t * outer)
85 {
86  if (flags & TUNNEL_ENCAP_DECAP_FLAG_DECAP_COPY_ECN)
88 }
89 
92  ip4_header_t * inner, const ip4_header_t * outer)
93 {
94  if (flags & TUNNEL_ENCAP_DECAP_FLAG_DECAP_COPY_ECN)
96 }
97 
98 #endif
99 
100 /*
101  * fd.io coding-style-patch-verification: ON
102  *
103  * Local Variables:
104  * eval: (c-set-style "gnu")
105  * End:
106  */
static ip_dscp_t ip4_header_get_dscp(const ip4_header_t *ip4)
Definition: ip4_packet.h:299
static void ip4_header_set_ecn_w_chksum(ip4_header_t *ip4, ip_ecn_t ecn)
Definition: ip4_packet.h:287
static void ip4_header_set_dscp(ip4_header_t *ip4, ip_dscp_t dscp)
Definition: ip4_packet.h:268
static_always_inline ip_ecn_t ip6_ecn_network_order(const ip6_header_t *ip6)
Definition: ip6_packet.h:334
#define static_always_inline
Definition: clib.h:106
static_always_inline void tunnel_decap_fixup_6o6(tunnel_encap_decap_flags_t flags, ip6_header_t *inner, const ip6_header_t *outer)
Definition: tunnel_dp.h:75
static_always_inline void tunnel_encap_fixup_6o6(tunnel_encap_decap_flags_t flags, const ip6_header_t *inner, ip6_header_t *outer)
Definition: tunnel_dp.h:47
static_always_inline void tunnel_decap_fixup_4o4(tunnel_encap_decap_flags_t flags, ip4_header_t *inner, const ip4_header_t *outer)
Definition: tunnel_dp.h:91
static_always_inline void tunnel_encap_fixup_4o6(tunnel_encap_decap_flags_t flags, const ip4_header_t *inner, ip6_header_t *outer)
Definition: tunnel_dp.h:57
static void ip4_header_set_ecn(ip4_header_t *ip4, ip_ecn_t ecn)
Definition: ip4_packet.h:280
static void ip4_header_set_df(ip4_header_t *ip4)
Definition: ip4_packet.h:311
enum tunnel_encap_decap_flags_t_ tunnel_encap_decap_flags_t
static_always_inline void ip6_set_dscp_network_order(ip6_header_t *ip6, ip_dscp_t dscp)
Definition: ip6_packet.h:351
u32 flags
Definition: vhost_user.h:248
static_always_inline ip_dscp_t ip6_dscp_network_order(const ip6_header_t *ip6)
Definition: ip6_packet.h:327
static_always_inline void ip6_set_ecn_network_order(ip6_header_t *ip6, ip_ecn_t ecn)
Definition: ip6_packet.h:361
static_always_inline void tunnel_encap_fixup_4o4(tunnel_encap_decap_flags_t flags, const ip4_header_t *inner, ip4_header_t *outer)
Definition: tunnel_dp.h:24
static_always_inline void tunnel_decap_fixup_4o6(tunnel_encap_decap_flags_t flags, ip4_header_t *inner, const ip6_header_t *outer)
Definition: tunnel_dp.h:67
static_always_inline void tunnel_decap_fixup_6o4(tunnel_encap_decap_flags_t flags, ip6_header_t *inner, const ip4_header_t *outer)
Definition: tunnel_dp.h:83
static u8 ip4_header_get_df(const ip4_header_t *ip4)
Definition: ip4_packet.h:325
static_always_inline void tunnel_encap_fixup_6o4(tunnel_encap_decap_flags_t flags, const ip6_header_t *inner, ip4_header_t *outer)
Definition: tunnel_dp.h:37
static ip_ecn_t ip4_header_get_ecn(const ip4_header_t *ip4)
Definition: ip4_packet.h:305