QoS: fix always recoding as IP
Change-Id: I7a54cdfa26652c04971999ad1f8144566e13c7bf Signed-off-by: Neale Ranns <nranns@cisco.com>
This commit is contained in:

committed by
Damjan Marion

parent
13a08cc098
commit
18668840e9
@ -135,7 +135,8 @@ typedef struct qos_record_trace_t_
|
|||||||
static inline uword
|
static inline uword
|
||||||
qos_record_inline (vlib_main_t * vm,
|
qos_record_inline (vlib_main_t * vm,
|
||||||
vlib_node_runtime_t * node,
|
vlib_node_runtime_t * node,
|
||||||
vlib_frame_t * frame, dpo_proto_t dproto, int is_l2)
|
vlib_frame_t * frame,
|
||||||
|
qos_source_t qos_src, dpo_proto_t dproto, int is_l2)
|
||||||
{
|
{
|
||||||
u32 n_left_from, *from, *to_next, next_index;
|
u32 n_left_from, *from, *to_next, next_index;
|
||||||
|
|
||||||
@ -217,7 +218,7 @@ qos_record_inline (vlib_main_t * vm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
vnet_buffer2 (b0)->qos.bits = qos0;
|
vnet_buffer2 (b0)->qos.bits = qos0;
|
||||||
vnet_buffer2 (b0)->qos.source = QOS_SOURCE_IP;
|
vnet_buffer2 (b0)->qos.source = qos_src;
|
||||||
b0->flags |= VNET_BUFFER_F_QOS_DATA_VALID;
|
b0->flags |= VNET_BUFFER_F_QOS_DATA_VALID;
|
||||||
|
|
||||||
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) &&
|
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) &&
|
||||||
@ -233,7 +234,7 @@ qos_record_inline (vlib_main_t * vm,
|
|||||||
{
|
{
|
||||||
vlib_buffer_advance (b0, -l2_len);
|
vlib_buffer_advance (b0, -l2_len);
|
||||||
next0 = vnet_l2_feature_next (b0,
|
next0 = vnet_l2_feature_next (b0,
|
||||||
l2_qos_input_next[QOS_SOURCE_IP],
|
l2_qos_input_next[qos_src],
|
||||||
L2INPUT_FEAT_L2_IP_QOS_RECORD);
|
L2INPUT_FEAT_L2_IP_QOS_RECORD);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -268,49 +269,55 @@ static inline uword
|
|||||||
ip4_qos_record (vlib_main_t * vm, vlib_node_runtime_t * node,
|
ip4_qos_record (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||||
vlib_frame_t * frame)
|
vlib_frame_t * frame)
|
||||||
{
|
{
|
||||||
return (qos_record_inline (vm, node, frame, DPO_PROTO_IP4, 0));
|
return (qos_record_inline (vm, node, frame, QOS_SOURCE_IP,
|
||||||
|
DPO_PROTO_IP4, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uword
|
static inline uword
|
||||||
ip6_qos_record (vlib_main_t * vm, vlib_node_runtime_t * node,
|
ip6_qos_record (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||||
vlib_frame_t * frame)
|
vlib_frame_t * frame)
|
||||||
{
|
{
|
||||||
return (qos_record_inline (vm, node, frame, DPO_PROTO_IP6, 0));
|
return (qos_record_inline (vm, node, frame, QOS_SOURCE_IP,
|
||||||
|
DPO_PROTO_IP6, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uword
|
static inline uword
|
||||||
mpls_qos_record (vlib_main_t * vm, vlib_node_runtime_t * node,
|
mpls_qos_record (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||||
vlib_frame_t * frame)
|
vlib_frame_t * frame)
|
||||||
{
|
{
|
||||||
return (qos_record_inline (vm, node, frame, DPO_PROTO_MPLS, 0));
|
return (qos_record_inline (vm, node, frame, QOS_SOURCE_MPLS,
|
||||||
|
DPO_PROTO_MPLS, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uword
|
static inline uword
|
||||||
vlan_ip4_qos_record (vlib_main_t * vm, vlib_node_runtime_t * node,
|
vlan_ip4_qos_record (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||||
vlib_frame_t * frame)
|
vlib_frame_t * frame)
|
||||||
{
|
{
|
||||||
return (qos_record_inline (vm, node, frame, DPO_PROTO_ETHERNET, 0));
|
return (qos_record_inline (vm, node, frame, QOS_SOURCE_VLAN,
|
||||||
|
DPO_PROTO_ETHERNET, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uword
|
static inline uword
|
||||||
vlan_ip6_qos_record (vlib_main_t * vm, vlib_node_runtime_t * node,
|
vlan_ip6_qos_record (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||||
vlib_frame_t * frame)
|
vlib_frame_t * frame)
|
||||||
{
|
{
|
||||||
return (qos_record_inline (vm, node, frame, DPO_PROTO_ETHERNET, 0));
|
return (qos_record_inline (vm, node, frame, QOS_SOURCE_VLAN,
|
||||||
|
DPO_PROTO_ETHERNET, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uword
|
static inline uword
|
||||||
vlan_mpls_qos_record (vlib_main_t * vm, vlib_node_runtime_t * node,
|
vlan_mpls_qos_record (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||||
vlib_frame_t * frame)
|
vlib_frame_t * frame)
|
||||||
{
|
{
|
||||||
return (qos_record_inline (vm, node, frame, DPO_PROTO_ETHERNET, 0));
|
return (qos_record_inline (vm, node, frame, QOS_SOURCE_VLAN,
|
||||||
|
DPO_PROTO_ETHERNET, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uword
|
static inline uword
|
||||||
l2_ip_qos_record (vlib_main_t * vm, vlib_node_runtime_t * node,
|
l2_ip_qos_record (vlib_main_t * vm, vlib_node_runtime_t * node,
|
||||||
vlib_frame_t * frame)
|
vlib_frame_t * frame)
|
||||||
{
|
{
|
||||||
return (qos_record_inline (vm, node, frame, 0, 1));
|
return (qos_record_inline (vm, node, frame, QOS_SOURCE_VLAN, 0, 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
@ -490,12 +497,15 @@ VLIB_NODE_FUNCTION_MULTIARCH (l2_ip_qos_record_node, l2_ip_qos_record);
|
|||||||
clib_error_t *
|
clib_error_t *
|
||||||
l2_ip_qos_init (vlib_main_t * vm)
|
l2_ip_qos_init (vlib_main_t * vm)
|
||||||
{
|
{
|
||||||
|
qos_source_t qs;
|
||||||
|
|
||||||
/* Initialize the feature next-node indexes */
|
/* Initialize the feature next-node indexes */
|
||||||
feat_bitmap_init_next_nodes (vm,
|
FOR_EACH_QOS_SOURCE (qs)
|
||||||
l2_ip_qos_record_node.index,
|
feat_bitmap_init_next_nodes (vm,
|
||||||
L2INPUT_N_FEAT,
|
l2_ip_qos_record_node.index,
|
||||||
l2input_get_feat_names (),
|
L2INPUT_N_FEAT,
|
||||||
l2_qos_input_next[QOS_SOURCE_IP]);
|
l2input_get_feat_names (),
|
||||||
|
l2_qos_input_next[qs]);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,12 +278,22 @@ class TestQOS(VppTestCase):
|
|||||||
#
|
#
|
||||||
# 255 QoS for all input values
|
# 255 QoS for all input values
|
||||||
#
|
#
|
||||||
output = [chr(255)] * 256
|
from_ext = 7
|
||||||
os = ''.join(output)
|
from_ip = 6
|
||||||
rows = [{'outputs': os},
|
from_mpls = 5
|
||||||
{'outputs': os},
|
from_vlan = 4
|
||||||
{'outputs': os},
|
output = [chr(from_ext)] * 256
|
||||||
{'outputs': os}]
|
os1 = ''.join(output)
|
||||||
|
output = [chr(from_vlan)] * 256
|
||||||
|
os2 = ''.join(output)
|
||||||
|
output = [chr(from_mpls)] * 256
|
||||||
|
os3 = ''.join(output)
|
||||||
|
output = [chr(from_ip)] * 256
|
||||||
|
os4 = ''.join(output)
|
||||||
|
rows = [{'outputs': os1},
|
||||||
|
{'outputs': os2},
|
||||||
|
{'outputs': os3},
|
||||||
|
{'outputs': os4}]
|
||||||
|
|
||||||
self.vapi.qos_egress_map_update(1, rows)
|
self.vapi.qos_egress_map_update(1, rows)
|
||||||
|
|
||||||
@ -336,20 +346,20 @@ class TestQOS(VppTestCase):
|
|||||||
# and the label and EOS bit have not been corrupted
|
# and the label and EOS bit have not been corrupted
|
||||||
#
|
#
|
||||||
for p in rx:
|
for p in rx:
|
||||||
self.assertEqual(p[MPLS].cos, 7)
|
self.assertEqual(p[MPLS].cos, from_ip)
|
||||||
self.assertEqual(p[MPLS].label, 32)
|
self.assertEqual(p[MPLS].label, 32)
|
||||||
self.assertEqual(p[MPLS].s, 1)
|
self.assertEqual(p[MPLS].s, 1)
|
||||||
rx = self.send_and_expect(self.pg0, p_3 * 65, self.pg1)
|
rx = self.send_and_expect(self.pg0, p_3 * 65, self.pg1)
|
||||||
for p in rx:
|
for p in rx:
|
||||||
self.assertEqual(p[MPLS].cos, 7)
|
self.assertEqual(p[MPLS].cos, from_ip)
|
||||||
self.assertEqual(p[MPLS].label, 63)
|
self.assertEqual(p[MPLS].label, 63)
|
||||||
self.assertEqual(p[MPLS].s, 0)
|
self.assertEqual(p[MPLS].s, 0)
|
||||||
h = p[MPLS].payload
|
h = p[MPLS].payload
|
||||||
self.assertEqual(h[MPLS].cos, 7)
|
self.assertEqual(h[MPLS].cos, from_ip)
|
||||||
self.assertEqual(h[MPLS].label, 33)
|
self.assertEqual(h[MPLS].label, 33)
|
||||||
self.assertEqual(h[MPLS].s, 0)
|
self.assertEqual(h[MPLS].s, 0)
|
||||||
h = h[MPLS].payload
|
h = h[MPLS].payload
|
||||||
self.assertEqual(h[MPLS].cos, 7)
|
self.assertEqual(h[MPLS].cos, from_ip)
|
||||||
self.assertEqual(h[MPLS].label, 34)
|
self.assertEqual(h[MPLS].label, 34)
|
||||||
self.assertEqual(h[MPLS].s, 1)
|
self.assertEqual(h[MPLS].s, 1)
|
||||||
|
|
||||||
@ -366,7 +376,7 @@ class TestQOS(VppTestCase):
|
|||||||
1)
|
1)
|
||||||
|
|
||||||
#
|
#
|
||||||
# MPLS x-connect - COS is preserved
|
# MPLS x-connect - COS according to pg1 map
|
||||||
#
|
#
|
||||||
route_32_eos = VppMplsRoute(self, 32, 1,
|
route_32_eos = VppMplsRoute(self, 32, 1,
|
||||||
[VppRoutePath(self.pg1.remote_ip4,
|
[VppRoutePath(self.pg1.remote_ip4,
|
||||||
@ -382,7 +392,7 @@ class TestQOS(VppTestCase):
|
|||||||
|
|
||||||
rx = self.send_and_expect(self.pg0, p_m1 * 65, self.pg1)
|
rx = self.send_and_expect(self.pg0, p_m1 * 65, self.pg1)
|
||||||
for p in rx:
|
for p in rx:
|
||||||
self.assertEqual(p[MPLS].cos, 7)
|
self.assertEqual(p[MPLS].cos, from_mpls)
|
||||||
self.assertEqual(p[MPLS].label, 33)
|
self.assertEqual(p[MPLS].label, 33)
|
||||||
self.assertEqual(p[MPLS].s, 1)
|
self.assertEqual(p[MPLS].s, 1)
|
||||||
|
|
||||||
@ -409,7 +419,7 @@ class TestQOS(VppTestCase):
|
|||||||
rx = self.send_and_expect(self.pg0, p_m2 * 65, self.pg1)
|
rx = self.send_and_expect(self.pg0, p_m2 * 65, self.pg1)
|
||||||
|
|
||||||
for p in rx:
|
for p in rx:
|
||||||
self.assertEqual(p[IP].tos, 255)
|
self.assertEqual(p[IP].tos, from_mpls)
|
||||||
|
|
||||||
#
|
#
|
||||||
# cleanup
|
# cleanup
|
||||||
|
Reference in New Issue
Block a user