vcl: add DSCP support in VCL
Type: feature
Signed-off-by: Filip Tehlar <ftehlar@cisco.com>
Change-Id: I835675267c997b5dc92a0aaccdb58648bc786bb9
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index 285985e..66d4180 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -168,6 +168,7 @@
u32 rcvbuf_size; // VPP-TBD: Hack until support setsockopt(SO_RCVBUF)
transport_endpt_ext_cfg_t *ext_config;
+ u8 dscp;
#if VCL_ELOG
elog_track_t elog_track;
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 207e208..107b109 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -219,6 +219,7 @@
memset (mp, 0, sizeof (*mp));
mp->client_index = wrk->api_client_handle;
mp->context = s->session_index;
+ mp->dscp = s->dscp;
mp->wrk_index = wrk->vpp_wrk_index;
mp->is_ip4 = s->transport.is_ip4;
mp->parent_handle = s->parent_handle;
@@ -3608,6 +3609,18 @@
rv = VPPCOM_EINVAL;
break;
+ case VPPCOM_ATTR_SET_DSCP:
+ if (buffer && buflen && (*buflen >= sizeof (u8)))
+ {
+ session->dscp = *(u8 *) buffer;
+
+ VDBG (2, "VPPCOM_ATTR_SET_DSCP: %u (0x%x), buflen %d,",
+ *(u8 *) buffer, *(u8 *) buffer, *buflen);
+ }
+ else
+ rv = VPPCOM_EINVAL;
+ break;
+
case VPPCOM_ATTR_SET_TX_FIFO_LEN:
if (buffer && buflen && (*buflen == sizeof (u32)))
{
diff --git a/src/vcl/vppcom.h b/src/vcl/vppcom.h
index 19a01c7..46517ad 100644
--- a/src/vcl/vppcom.h
+++ b/src/vcl/vppcom.h
@@ -145,6 +145,7 @@
VPPCOM_ATTR_GET_VRF,
VPPCOM_ATTR_GET_DOMAIN,
VPPCOM_ATTR_SET_ENDPT_EXT_CFG,
+ VPPCOM_ATTR_SET_DSCP,
} vppcom_attr_op_t;
typedef struct _vcl_poll
diff --git a/src/vnet/session/application_interface.h b/src/vnet/session/application_interface.h
index ca8dc38..733a462 100644
--- a/src/vnet/session/application_interface.h
+++ b/src/vnet/session/application_interface.h
@@ -408,6 +408,7 @@
u32 ckpair_index;
u8 crypto_engine;
u8 flags;
+ u8 dscp;
uword ext_config;
} __clib_packed session_connect_msg_t;
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index fe4e732..7565b43 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -173,6 +173,7 @@
a->sep.port = mp->port;
a->sep.transport_proto = mp->proto;
a->sep.peer.fib_index = mp->vrf;
+ a->sep.dscp = mp->dscp;
clib_memcpy_fast (&a->sep.peer.ip, &mp->lcl_ip, sizeof (mp->lcl_ip));
if (mp->is_ip4)
{