X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fip%2Fip6_packet.h;h=03aac1bd4d40e93d57f2d526b18ec0b77033891a;hb=f2984bbb0;hp=e823214dac98bb21ba0f18df20a2a37ee3ecc47a;hpb=f126e746fc01c75bc99329d10ce9127b26b23814;p=vpp.git diff --git a/src/vnet/ip/ip6_packet.h b/src/vnet/ip/ip6_packet.h index e823214dac9..03aac1bd4d4 100644 --- a/src/vnet/ip/ip6_packet.h +++ b/src/vnet/ip/ip6_packet.h @@ -49,9 +49,12 @@ typedef union u16 as_u16[8]; u32 as_u32[4]; u64 as_u64[2]; + u64x2 as_u128; uword as_uword[16 / sizeof (uword)]; } -ip6_address_t; +__clib_packed ip6_address_t; + +STATIC_ASSERT_SIZEOF (ip6_address_t, 16); typedef struct { @@ -307,31 +310,37 @@ typedef struct ip6_address_t src_address, dst_address; } ip6_header_t; +#define IP6_PACKET_TC_MASK 0x0FF00000 +#define IP6_PACKET_DSCP_MASK 0x0FC00000 +#define IP6_PACKET_ECN_MASK 0x00300000 +#define IP6_PACKET_FL_MASK 0x000FFFFF + always_inline ip_dscp_t ip6_traffic_class (const ip6_header_t * i) { - return (i->ip_version_traffic_class_and_flow_label & 0x0FF00000) >> 20; + return (i->ip_version_traffic_class_and_flow_label & IP6_PACKET_TC_MASK) >> + 20; } static_always_inline ip_dscp_t ip6_traffic_class_network_order (const ip6_header_t * ip6) { return (clib_net_to_host_u32 (ip6->ip_version_traffic_class_and_flow_label) - & 0x0ff00000) >> 20; + & IP6_PACKET_TC_MASK) >> 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; + & IP6_PACKET_DSCP_MASK) >> 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; + & IP6_PACKET_ECN_MASK) >> 20; } static_always_inline void