summaryrefslogtreecommitdiffstats
path: root/src/vnet/qos/qos_mark.c
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2018-07-16 04:14:21 -0700
committerDamjan Marion <dmarion@me.com>2018-07-20 09:32:52 +0000
commit0809f6c0300f85cf5cf5d49df1aa8f1e2d080f6c (patch)
treeb86838680e4ed002f41df5831b7313efc831193e /src/vnet/qos/qos_mark.c
parentc34b2e0f7cf891d8a5ecb91a6a2fb067cf33b3af (diff)
QoS: marking and recording for MPLS and VLAN
Change-Id: Icec79aa9039d5d7835d311fde0b7c1a0c76c9eb1 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'src/vnet/qos/qos_mark.c')
-rw-r--r--src/vnet/qos/qos_mark.c90
1 files changed, 80 insertions, 10 deletions
diff --git a/src/vnet/qos/qos_mark.c b/src/vnet/qos/qos_mark.c
index 38c66cba40c..3b69bf5c2c3 100644
--- a/src/vnet/qos/qos_mark.c
+++ b/src/vnet/qos/qos_mark.c
@@ -36,7 +36,15 @@ qos_mark_ip_enable_disable (u32 sw_if_index, u8 enable)
void
qos_mark_vlan_enable_disable (u32 sw_if_index, u8 enable)
{
- vnet_feature_enable_disable ("interface-output", "vlan-qos-mark",
+ /*
+ * one cannot run a feature on a sub-interface, so we need
+ * to enable a feature on all the L3 output paths
+ */
+ vnet_feature_enable_disable ("ip6-output", "vlan-ip6-qos-mark",
+ sw_if_index, enable, NULL, 0);
+ vnet_feature_enable_disable ("ip4-output", "vlan-ip4-qos-mark",
+ sw_if_index, enable, NULL, 0);
+ vnet_feature_enable_disable ("mpls-output", "vlan-mpls-qos-mark",
sw_if_index, enable, NULL, 0);
}
@@ -239,8 +247,22 @@ mpls_qos_mark (vlib_main_t * vm, vlib_node_runtime_t * node,
}
static inline uword
-vlan_qos_mark (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+vlan_mpls_qos_mark (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
+{
+ return (qos_mark_inline (vm, node, frame, QOS_SOURCE_VLAN, 0));
+}
+
+static inline uword
+vlan_ip4_qos_mark (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
+{
+ return (qos_mark_inline (vm, node, frame, QOS_SOURCE_VLAN, 0));
+}
+
+static inline uword
+vlan_ip6_qos_mark (vlib_main_t * vm, vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return (qos_mark_inline (vm, node, frame, QOS_SOURCE_VLAN, 0));
}
@@ -311,9 +333,10 @@ VNET_FEATURE_INIT (mpls_qos_mark_node, static) = {
.arc_name = "mpls-output",
.node_name = "mpls-qos-mark",
};
-VLIB_REGISTER_NODE (vlan_qos_mark_node) = {
- .function = vlan_qos_mark,
- .name = "vlan-qos-mark",
+
+VLIB_REGISTER_NODE (vlan_ip4_qos_mark_node) = {
+ .function = vlan_ip4_qos_mark,
+ .name = "vlan-ip4-qos-mark",
.vector_size = sizeof (u32),
.format_trace = format_qos_mark_trace,
.type = VLIB_NODE_TYPE_INTERNAL,
@@ -326,11 +349,58 @@ VLIB_REGISTER_NODE (vlan_qos_mark_node) = {
},
};
-VLIB_NODE_FUNCTION_MULTIARCH (vlan_qos_mark_node, vlan_qos_mark);
+VLIB_NODE_FUNCTION_MULTIARCH (vlan_ip4_qos_mark_node, vlan_ip4_qos_mark);
+
+VNET_FEATURE_INIT (vlan_ip4_qos_mark_node, static) = {
+ .arc_name = "ip4-output",
+ .node_name = "vlan-ip4-qos-mark",
+ .runs_after = VNET_FEATURES ("ip4-qos-mark"),
+};
+
+VLIB_REGISTER_NODE (vlan_ip6_qos_mark_node) = {
+ .function = vlan_ip6_qos_mark,
+ .name = "vlan-ip6-qos-mark",
+ .vector_size = sizeof (u32),
+ .format_trace = format_qos_mark_trace,
+ .type = VLIB_NODE_TYPE_INTERNAL,
+
+ .n_errors = 0,
+ .n_next_nodes = 1,
-VNET_FEATURE_INIT (vlan_qos_mark_node, static) = {
- .arc_name = "interface-output",
- .node_name = "vlan-qos-mark",
+ .next_nodes = {
+ [0] = "error-drop",
+ },
+};
+
+VLIB_NODE_FUNCTION_MULTIARCH (vlan_ip6_qos_mark_node, vlan_ip6_qos_mark);
+
+VNET_FEATURE_INIT (vlan_ip6_qos_mark_node, static) = {
+ .arc_name = "ip6-output",
+ .node_name = "vlan-ip6-qos-mark",
+ .runs_after = VNET_FEATURES ("ip6-qos-mark"),
+};
+
+VLIB_REGISTER_NODE (vlan_mpls_qos_mark_node) = {
+ .function = vlan_mpls_qos_mark,
+ .name = "vlan-mpls-qos-mark",
+ .vector_size = sizeof (u32),
+ .format_trace = format_qos_mark_trace,
+ .type = VLIB_NODE_TYPE_INTERNAL,
+
+ .n_errors = 0,
+ .n_next_nodes = 1,
+
+ .next_nodes = {
+ [0] = "error-drop",
+ },
+};
+
+VLIB_NODE_FUNCTION_MULTIARCH (vlan_mpls_qos_mark_node, vlan_mpls_qos_mark);
+
+VNET_FEATURE_INIT (vlan_mpls_qos_mark_node, static) = {
+ .arc_name = "mpls-output",
+ .node_name = "vlan-mpls-qos-mark",
+ .runs_after = VNET_FEATURES ("mpls-qos-mark"),
};
/* *INDENT-ON* */