aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMatias Elo <matias.elo@nokia.com>2022-03-21 10:30:59 +0200
committerPetri Savolainen <petri.savolainen@nokia.com>2022-04-13 10:08:40 +0300
commit5a50017bf23f6c383c964fb1bbd1366f64a8aac7 (patch)
treeee6a761cacb0625dd4dfcc983f792a5c89911116 /test
parent56a6c027ace7d4bcd8ca6e78ec7655bef98eb0c0 (diff)
validation: tm: test tm queue threshold according to capabilities
Use new capabilities (odp_tm_capabilities_t.tm_queue_threshold) in TM queue threshold tests. Signed-off-by: Matias Elo <matias.elo@nokia.com> Reviewed-by: Petri Savolainen <petri.savolainen@nokia.com>
Diffstat (limited to 'test')
-rw-r--r--test/validation/api/traffic_mngr/traffic_mngr.c36
1 files changed, 27 insertions, 9 deletions
diff --git a/test/validation/api/traffic_mngr/traffic_mngr.c b/test/validation/api/traffic_mngr/traffic_mngr.c
index 87cec3da3..116c9ed6d 100644
--- a/test/validation/api/traffic_mngr/traffic_mngr.c
+++ b/test/validation/api/traffic_mngr/traffic_mngr.c
@@ -3479,7 +3479,8 @@ static int test_threshold(const char *threshold_name,
odp_tm_threshold_params_t threshold_params;
odp_tm_queue_t tm_queue;
pkt_info_t pkt_info;
- uint32_t num_pkts, pkt_len, pkts_sent;
+ uint32_t pkt_len, pkts_sent;
+ uint32_t num_pkts = 0;
odp_tm_threshold_params_init(&threshold_params);
if (max_pkts != 0) {
@@ -3488,16 +3489,19 @@ static int test_threshold(const char *threshold_name,
threshold_params.enable_max_pkts = true;
num_pkts = 2 * max_pkts;
pkt_len = 256;
- } else if (max_bytes != 0) {
+ }
+
+ if (max_bytes != 0) {
max_bytes = MIN(max_bytes, MAX_PKTS * MAX_PAYLOAD / 3);
threshold_params.max_bytes = max_bytes;
threshold_params.enable_max_bytes = true;
num_pkts = 2 * max_bytes / MAX_PAYLOAD;
pkt_len = MAX_PAYLOAD;
- } else {
- return -1;
}
+ if (max_pkts == 0 && max_bytes == 0)
+ return -1;
+
/* Pick a tm_queue and set the tm_queue's threshold profile and then
* send in twice the amount of traffic as suggested by the thresholds
* and make sure at least SOME pkts get dropped. */
@@ -4624,14 +4628,24 @@ static int traffic_mngr_check_thresholds_byte_and_packet(void)
return ODP_TEST_ACTIVE;
}
-static void traffic_mngr_test_thresholds(void)
+static void traffic_mngr_test_thresholds_byte(void)
{
- CU_ASSERT(test_threshold("thresh_A", "shaper_A", "node_1_2_1", 0,
- 16, 0) == 0);
- CU_ASSERT(test_threshold("thresh_B", "shaper_B", "node_1_2_1", 1,
+ CU_ASSERT(test_threshold("thresh_byte", "shaper_B", "node_1_2_1", 1,
0, 6400) == 0);
}
+static void traffic_mngr_test_thresholds_packet(void)
+{
+ CU_ASSERT(test_threshold("thresh_packet", "shaper_A", "node_1_2_1", 0,
+ 16, 0) == 0);
+}
+
+static void traffic_mngr_test_thresholds_byte_and_packet(void)
+{
+ CU_ASSERT(test_threshold("thresh_byte_and_packet", "shaper_A", "node_1_2_1", 0,
+ 16, 6400) == 0);
+}
+
static int traffic_mngr_check_queue_stats(void)
{
if (tm_capabilities.queue_stats.all_counters == 0)
@@ -4972,7 +4986,11 @@ odp_testinfo_t traffic_mngr_suite[] = {
traffic_mngr_check_shaper),
ODP_TEST_INFO_CONDITIONAL(traffic_mngr_test_scheduler,
traffic_mngr_check_scheduler),
- ODP_TEST_INFO_CONDITIONAL(traffic_mngr_test_thresholds,
+ ODP_TEST_INFO_CONDITIONAL(traffic_mngr_test_thresholds_byte,
+ traffic_mngr_check_thresholds_byte),
+ ODP_TEST_INFO_CONDITIONAL(traffic_mngr_test_thresholds_packet,
+ traffic_mngr_check_thresholds_packet),
+ ODP_TEST_INFO_CONDITIONAL(traffic_mngr_test_thresholds_byte_and_packet,
traffic_mngr_check_thresholds_byte_and_packet),
ODP_TEST_INFO_CONDITIONAL(traffic_mngr_test_byte_wred,
traffic_mngr_check_byte_wred),