aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
Diffstat (limited to 'src/vnet')
-rw-r--r--src/vnet/ip/ip4_inlines.h11
-rw-r--r--src/vnet/session/transport_types.h3
-rw-r--r--src/vnet/udp/udp.c5
3 files changed, 12 insertions, 7 deletions
diff --git a/src/vnet/ip/ip4_inlines.h b/src/vnet/ip/ip4_inlines.h
index 00a47125b8a..9a6c8c7f8fb 100644
--- a/src/vnet/ip/ip4_inlines.h
+++ b/src/vnet/ip/ip4_inlines.h
@@ -98,9 +98,9 @@ ip4_compute_flow_hash (const ip4_header_t * ip,
}
always_inline void *
-vlib_buffer_push_ip4_custom (vlib_main_t * vm, vlib_buffer_t * b,
- ip4_address_t * src, ip4_address_t * dst,
- int proto, u8 csum_offload, u8 is_df)
+vlib_buffer_push_ip4_custom (vlib_main_t *vm, vlib_buffer_t *b,
+ ip4_address_t *src, ip4_address_t *dst, int proto,
+ u8 csum_offload, u8 is_df, u8 dscp)
{
ip4_header_t *ih;
@@ -108,7 +108,8 @@ vlib_buffer_push_ip4_custom (vlib_main_t * vm, vlib_buffer_t * b,
ih = vlib_buffer_push_uninit (b, sizeof (ip4_header_t));
ih->ip_version_and_header_length = 0x45;
- ih->tos = 0;
+ ip4_header_set_dscp (ih, dscp);
+ ip4_header_set_ecn (ih, 0);
ih->length = clib_host_to_net_u16 (vlib_buffer_length_in_chain (vm, b));
/* No fragments */
@@ -152,7 +153,7 @@ vlib_buffer_push_ip4 (vlib_main_t * vm, vlib_buffer_t * b,
u8 csum_offload)
{
return vlib_buffer_push_ip4_custom (vm, b, src, dst, proto, csum_offload,
- 1 /* is_df */ );
+ 1 /* is_df */, 0);
}
#endif /* included_ip_ip4_inlines_h */
diff --git a/src/vnet/session/transport_types.h b/src/vnet/session/transport_types.h
index 9ea1f2102b4..188c21ad9d5 100644
--- a/src/vnet/session/transport_types.h
+++ b/src/vnet/session/transport_types.h
@@ -106,6 +106,7 @@ typedef struct _transport_connection
u32 c_index; /**< Connection index in transport pool */
u32 thread_index; /**< Worker-thread index */
u8 flags; /**< Transport specific flags */
+ u8 dscp; /**< Differentiated Services Code Point */
/*fib_node_index_t rmt_fei;
dpo_id_t rmt_dpo; */
@@ -146,6 +147,7 @@ typedef struct _transport_connection
#define c_stats connection.stats
#define c_pacer connection.pacer
#define c_flags connection.flags
+#define c_dscp connection.dscp
#define s_ho_handle pacer.bytes_per_sec
} transport_connection_t;
@@ -209,6 +211,7 @@ typedef enum transport_endpt_cfg_flags_
_ (u32, next_node_index) \
_ (u32, next_node_opaque) \
_ (u16, mss) \
+ _ (u8, dscp) \
_ (u8, transport_flags) \
/* clang-format on */
diff --git a/src/vnet/udp/udp.c b/src/vnet/udp/udp.c
index 40e0053bb96..b27f0d7b27c 100644
--- a/src/vnet/udp/udp.c
+++ b/src/vnet/udp/udp.c
@@ -247,8 +247,8 @@ udp_push_header (transport_connection_t * tc, vlib_buffer_t * b)
vlib_buffer_push_udp (b, uc->c_lcl_port, uc->c_rmt_port, 1);
if (tc->is_ip4)
vlib_buffer_push_ip4_custom (vm, b, &uc->c_lcl_ip4, &uc->c_rmt_ip4,
- IP_PROTOCOL_UDP, 1 /* csum offload */ ,
- 0 /* is_df */ );
+ IP_PROTOCOL_UDP, 1 /* csum offload */,
+ 0 /* is_df */, uc->c_dscp);
else
vlib_buffer_push_ip6 (vm, b, &uc->c_lcl_ip6, &uc->c_rmt_ip6,
IP_PROTOCOL_UDP);
@@ -385,6 +385,7 @@ conn_alloc:
uc->c_is_ip4 = rmt->is_ip4;
uc->c_proto = TRANSPORT_PROTO_UDP;
uc->c_fib_index = rmt->fib_index;
+ uc->c_dscp = rmt->dscp;
uc->mss = rmt->mss ? rmt->mss : udp_default_mtu (um, uc->c_is_ip4);
uc->flags |= UDP_CONN_F_OWNS_PORT;
if (rmt->transport_flags & TRANSPORT_CFG_F_CONNECTED)