X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fip%2Fip_packet.h;h=e67cec1512f1f06292573adcea12c0718a6a817e;hb=3ec09e9243dceb78e7548725281b0da8eddf72b1;hp=63a59f87668beff01850b6bdc195143fa08fe6c5;hpb=5b1379be3e25df096d97dcd217965169fc6bb1b2;p=vpp.git diff --git a/src/vnet/ip/ip_packet.h b/src/vnet/ip/ip_packet.h index 63a59f87668..e67cec1512f 100644 --- a/src/vnet/ip/ip_packet.h +++ b/src/vnet/ip/ip_packet.h @@ -48,7 +48,7 @@ typedef enum ip_protocol #define ip_protocol(n,s) IP_PROTOCOL_##s = n, #include "protocols.def" #undef ip_protocol -} ip_protocol_t; +} __clib_packed ip_protocol_t; /* TCP/UDP ports. */ typedef enum @@ -118,10 +118,35 @@ typedef enum ip_dscp_t_ #undef _ } __clib_packed ip_dscp_t; -STATIC_ASSERT_SIZEOF (ip_dscp_t, 1); - extern u8 *format_ip_dscp (u8 * s, va_list * va); +/** + * IP DSCP bit shift + * The ECN occupies the 2 least significant bits of the TC field + */ +#define IP_PACKET_TC_FIELD_DSCP_BIT_SHIFT 2 +#define IP_PACKET_TC_FIELD_ECN_MASK 0x03 + +/** + * The set of RFC defined DSCP values. + */ +#define foreach_ip_ecn \ + _(0, NON_ECN) \ + _(1, ECT_0) \ + _(2, ECT_1) \ + _(3, CE) + +typedef enum ip_ecn_t_ +{ +#define _(n,f) IP_ECN_##f = n, + foreach_ip_ecn +#undef _ +} __clib_packed ip_ecn_t; + +STATIC_ASSERT_SIZEOF (ip_ecn_t, 1); + +extern u8 *format_ip_ecn (u8 * s, va_list * va); + /* IP checksum support. */ static_always_inline u16