From: Alexander Chesnokov <[email protected]> Add sched_autotest cases verifying that rte_sched_port_config() rejects port rates whose byte clock value is zero or does not fit in 32 bits, and accepts the boundary rate rte_get_tsc_hz() << 8, at which the byte clock value is 1.
Signed-off-by: Alexander Chesnokov <[email protected]> --- app/test/test_sched.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/test/test_sched.c b/app/test/test_sched.c index 96b48f1897..ea5bdd4272 100644 --- a/app/test/test_sched.c +++ b/app/test/test_sched.c @@ -210,6 +210,22 @@ test_sched(void) rte_sched_port_free(port); + /* Rate above the byte clock limit is rejected */ + port_param.rate = UINT64_MAX; + port = rte_sched_port_config(&port_param); + TEST_ASSERT_NULL(port, "Port config accepted rate too high\n"); + + /* Rate below the byte clock limit is rejected */ + port_param.rate = rte_get_tsc_hz() >> 24; + port = rte_sched_port_config(&port_param); + TEST_ASSERT_NULL(port, "Port config accepted rate too low\n"); + + /* Boundary rate is accepted */ + port_param.rate = rte_get_tsc_hz() << 8; + port = rte_sched_port_config(&port_param); + TEST_ASSERT_NOT_NULL(port, "Port config rejected limit rate\n"); + rte_sched_port_free(port); + return 0; } -- 2.43.0

