diff options
author | Neale Ranns <nranns@cisco.com> | 2019-11-25 13:04:44 +0000 |
---|---|---|
committer | Ole Trøan <otroan@employees.org> | 2019-12-03 19:36:26 +0000 |
commit | 9534696b4637185c9f296375e63c50d8976d153d (patch) | |
tree | 7e5bce5d492b6b376e42f9df175e18202f93af68 /src/vnet/ip/ip6_packet.h | |
parent | c8972fe506c78530a3e4085453e86a0b85b245ef (diff) |
ipip: Tunnel flags controlling copying data to/from payload/encap
Type: feature
Signed-off-by: Neale Ranns <nranns@cisco.com>
Change-Id: I9467f11775936754406892b8e9e275f989ac9b30
Diffstat (limited to 'src/vnet/ip/ip6_packet.h')
-rw-r--r-- | src/vnet/ip/ip6_packet.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/vnet/ip/ip6_packet.h b/src/vnet/ip/ip6_packet.h index ed96ece1e7f..8c0698440e3 100644 --- a/src/vnet/ip/ip6_packet.h +++ b/src/vnet/ip/ip6_packet.h @@ -396,6 +396,20 @@ ip6_traffic_class_network_order (const ip6_header_t * ip6) & 0x0ff00000) >> 20; } +static_always_inline ip_dscp_t +ip6_dscp_network_order (const ip6_header_t * ip6) +{ + return (clib_net_to_host_u32 (ip6->ip_version_traffic_class_and_flow_label) + & 0x0fc00000) >> 22; +} + +static_always_inline ip_ecn_t +ip6_ecn_network_order (const ip6_header_t * ip6) +{ + return (clib_net_to_host_u32 (ip6->ip_version_traffic_class_and_flow_label) + & 0x00300000) >> 20; +} + static_always_inline void ip6_set_traffic_class_network_order (ip6_header_t * ip6, ip_dscp_t dscp) { @@ -406,6 +420,26 @@ ip6_set_traffic_class_network_order (ip6_header_t * ip6, ip_dscp_t dscp) ip6->ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (tmp); } +static_always_inline void +ip6_set_dscp_network_order (ip6_header_t * ip6, ip_dscp_t dscp) +{ + u32 tmp = + clib_net_to_host_u32 (ip6->ip_version_traffic_class_and_flow_label); + tmp &= 0xf03fffff; + tmp |= (dscp << 22); + ip6->ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (tmp); +} + +static_always_inline void +ip6_set_ecn_network_order (ip6_header_t * ip6, ip_ecn_t ecn) +{ + u32 tmp = + clib_net_to_host_u32 (ip6->ip_version_traffic_class_and_flow_label); + tmp &= 0xffcfffff; + tmp |= (ecn << 20); + ip6->ip_version_traffic_class_and_flow_label = clib_host_to_net_u32 (tmp); +} + always_inline void * ip6_next_header (ip6_header_t * i) { |