From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id AE4BC7D46 for ; Wed, 23 Aug 2017 13:36:30 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Aug 2017 04:36:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,416,1498546800"; d="scan'208";a="893316389" Received: from silpixa00382658.ir.intel.com ([10.237.223.29]) by FMSMGA003.fm.intel.com with ESMTP; 23 Aug 2017 04:36:27 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: thomas@monjalon.net Date: Wed, 23 Aug 2017 12:36:24 +0100 Message-Id: <1503488186-90047-3-git-send-email-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1503488186-90047-1-git-send-email-cristian.dumitrescu@intel.com> References: <1503488186-90047-1-git-send-email-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH 2/4] test: meter autotest update X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Aug 2017 11:36:31 -0000 Signed-off-by: Cristian Dumitrescu --- test/test/test_meter.c | 138 +++++++++++++++++++++++++++++++------------------ 1 file changed, 87 insertions(+), 51 deletions(-) diff --git a/test/test/test_meter.c b/test/test/test_meter.c index 26b0565..b3232f6 100644 --- a/test/test/test_meter.c +++ b/test/test/test_meter.c @@ -82,43 +82,43 @@ static inline int tm_test_srtcm_config(void) { #define SRTCM_CFG_MSG "srtcm_config" - struct rte_meter_srtcm sm; + struct rte_meter_srtcm_profile sp; struct rte_meter_srtcm_params sparams1; /* invalid parameter test */ - if(rte_meter_srtcm_config(NULL, NULL) == 0) + if(rte_meter_srtcm_profile_config(NULL, NULL) == 0) melog(SRTCM_CFG_MSG); - if(rte_meter_srtcm_config(&sm, NULL) == 0) + if(rte_meter_srtcm_profile_config(&sp, NULL) == 0) melog(SRTCM_CFG_MSG); - if(rte_meter_srtcm_config(NULL, &sparams) == 0) + if(rte_meter_srtcm_profile_config(NULL, &sparams) == 0) melog(SRTCM_CFG_MSG); /* cbs and ebs can't both be zero */ sparams1 = sparams; sparams1.cbs = 0; sparams1.ebs = 0; - if(rte_meter_srtcm_config(&sm, &sparams1) == 0) + if(rte_meter_srtcm_profile_config(&sp, &sparams1) == 0) melog(SRTCM_CFG_MSG); /* cir should never be 0 */ sparams1 = sparams; sparams1.cir = 0; - if(rte_meter_srtcm_config(&sm, &sparams1) == 0) + if(rte_meter_srtcm_profile_config(&sp, &sparams1) == 0) melog(SRTCM_CFG_MSG); /* one of ebs and cbs can be zero, should be successful */ sparams1 = sparams; sparams1.ebs = 0; - if(rte_meter_srtcm_config(&sm, &sparams1) != 0) + if(rte_meter_srtcm_profile_config(&sp, &sparams1) != 0) melog(SRTCM_CFG_MSG); sparams1 = sparams; sparams1.cbs = 0; - if(rte_meter_srtcm_config(&sm, &sparams1) != 0) + if(rte_meter_srtcm_profile_config(&sp, &sparams1) != 0) melog(SRTCM_CFG_MSG); /* usual parameter, should be successful */ - if(rte_meter_srtcm_config(&sm, &sparams) != 0) + if(rte_meter_srtcm_profile_config(&sp, &sparams) != 0) melog(SRTCM_CFG_MSG); return 0; @@ -131,47 +131,47 @@ tm_test_srtcm_config(void) static inline int tm_test_trtcm_config(void) { - struct rte_meter_trtcm tm; + struct rte_meter_trtcm_profile tp; struct rte_meter_trtcm_params tparams1; #define TRTCM_CFG_MSG "trtcm_config" /* invalid parameter test */ - if(rte_meter_trtcm_config(NULL, NULL) == 0) + if(rte_meter_trtcm_profile_config(NULL, NULL) == 0) melog(TRTCM_CFG_MSG); - if(rte_meter_trtcm_config(&tm, NULL) == 0) + if(rte_meter_trtcm_profile_config(&tp, NULL) == 0) melog(TRTCM_CFG_MSG); - if(rte_meter_trtcm_config(NULL, &tparams) == 0) + if(rte_meter_trtcm_profile_config(NULL, &tparams) == 0) melog(TRTCM_CFG_MSG); /* cir, cbs, pir and pbs never be zero */ tparams1 = tparams; tparams1.cir = 0; - if(rte_meter_trtcm_config(&tm, &tparams1) == 0) + if(rte_meter_trtcm_profile_config(&tp, &tparams1) == 0) melog(TRTCM_CFG_MSG); tparams1 = tparams; tparams1.cbs = 0; - if(rte_meter_trtcm_config(&tm, &tparams1) == 0) + if(rte_meter_trtcm_profile_config(&tp, &tparams1) == 0) melog(TRTCM_CFG_MSG); tparams1 = tparams; tparams1.pbs = 0; - if(rte_meter_trtcm_config(&tm, &tparams1) == 0) + if(rte_meter_trtcm_profile_config(&tp, &tparams1) == 0) melog(TRTCM_CFG_MSG); tparams1 = tparams; tparams1.pir = 0; - if(rte_meter_trtcm_config(&tm, &tparams1) == 0) + if(rte_meter_trtcm_profile_config(&tp, &tparams1) == 0) melog(TRTCM_CFG_MSG); /* pir should be greater or equal to cir */ tparams1 = tparams; tparams1.pir = tparams1.cir - 1; - if(rte_meter_trtcm_config(&tm, &tparams1) == 0) + if(rte_meter_trtcm_profile_config(&tp, &tparams1) == 0) melog(TRTCM_CFG_MSG" pir < cir test"); /* usual parameter, should be successful */ - if(rte_meter_trtcm_config(&tm, &tparams) != 0) + if(rte_meter_trtcm_profile_config(&tp, &tparams) != 0) melog(TRTCM_CFG_MSG); return 0; @@ -184,41 +184,50 @@ static inline int tm_test_srtcm_color_blind_check(void) { #define SRTCM_BLIND_CHECK_MSG "srtcm_blind_check" + struct rte_meter_srtcm_profile sp; struct rte_meter_srtcm sm; uint64_t time; uint64_t hz = rte_get_tsc_hz(); /* Test green */ - if(rte_meter_srtcm_config(&sm, &sparams) != 0) + if(rte_meter_srtcm_profile_config(&sp, &sparams) != 0) + melog(SRTCM_BLIND_CHECK_MSG); + if(rte_meter_srtcm_config(&sm, &sp) != 0) melog(SRTCM_BLIND_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_srtcm_color_blind_check( - &sm, time, TM_TEST_SRTCM_CBS_DF - 1) + &sm, &sp, time, TM_TEST_SRTCM_CBS_DF - 1) != e_RTE_METER_GREEN) melog(SRTCM_BLIND_CHECK_MSG" GREEN"); /* Test yellow */ - if(rte_meter_srtcm_config(&sm, &sparams) != 0) + if(rte_meter_srtcm_profile_config(&sp, &sparams) != 0) + melog(SRTCM_BLIND_CHECK_MSG); + if(rte_meter_srtcm_config(&sm, &sp) != 0) melog(SRTCM_BLIND_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_srtcm_color_blind_check( - &sm, time, TM_TEST_SRTCM_CBS_DF + 1) + &sm, &sp, time, TM_TEST_SRTCM_CBS_DF + 1) != e_RTE_METER_YELLOW) melog(SRTCM_BLIND_CHECK_MSG" YELLOW"); - if(rte_meter_srtcm_config(&sm, &sparams) != 0) + if(rte_meter_srtcm_profile_config(&sp, &sparams) != 0) + melog(SRTCM_BLIND_CHECK_MSG); + if(rte_meter_srtcm_config(&sm, &sp) != 0) melog(SRTCM_BLIND_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_srtcm_color_blind_check( - &sm, time, (uint32_t)sm.ebs - 1) != e_RTE_METER_YELLOW) + &sm, &sp, time, (uint32_t)sp.ebs - 1) != e_RTE_METER_YELLOW) melog(SRTCM_BLIND_CHECK_MSG" YELLOW"); /* Test red */ - if(rte_meter_srtcm_config(&sm, &sparams) != 0) + if(rte_meter_srtcm_profile_config(&sp, &sparams) != 0) + melog(SRTCM_BLIND_CHECK_MSG); + if(rte_meter_srtcm_config(&sm, &sp) != 0) melog(SRTCM_BLIND_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_srtcm_color_blind_check( - &sm, time, TM_TEST_SRTCM_EBS_DF + 1) + &sm, &sp, time, TM_TEST_SRTCM_EBS_DF + 1) != e_RTE_METER_RED) melog(SRTCM_BLIND_CHECK_MSG" RED"); @@ -235,41 +244,50 @@ tm_test_trtcm_color_blind_check(void) #define TRTCM_BLIND_CHECK_MSG "trtcm_blind_check" uint64_t time; + struct rte_meter_trtcm_profile tp; struct rte_meter_trtcm tm; uint64_t hz = rte_get_tsc_hz(); /* Test green */ - if(rte_meter_trtcm_config(&tm, &tparams) != 0) + if(rte_meter_trtcm_profile_config(&tp, &tparams) != 0) + melog(TRTCM_BLIND_CHECK_MSG); + if(rte_meter_trtcm_config(&tm, &tp) != 0) melog(TRTCM_BLIND_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_trtcm_color_blind_check( - &tm, time, TM_TEST_TRTCM_CBS_DF - 1) + &tm, &tp, time, TM_TEST_TRTCM_CBS_DF - 1) != e_RTE_METER_GREEN) melog(TRTCM_BLIND_CHECK_MSG" GREEN"); /* Test yellow */ - if(rte_meter_trtcm_config(&tm, &tparams) != 0) + if(rte_meter_trtcm_profile_config(&tp, &tparams) != 0) + melog(TRTCM_BLIND_CHECK_MSG); + if(rte_meter_trtcm_config(&tm, &tp) != 0) melog(TRTCM_BLIND_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_trtcm_color_blind_check( - &tm, time, TM_TEST_TRTCM_CBS_DF + 1) + &tm, &tp, time, TM_TEST_TRTCM_CBS_DF + 1) != e_RTE_METER_YELLOW) melog(TRTCM_BLIND_CHECK_MSG" YELLOW"); - if(rte_meter_trtcm_config(&tm, &tparams) != 0) + if(rte_meter_trtcm_profile_config(&tp, &tparams) != 0) + melog(TRTCM_BLIND_CHECK_MSG); + if(rte_meter_trtcm_config(&tm, &tp) != 0) melog(TRTCM_BLIND_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_trtcm_color_blind_check( - &tm, time, TM_TEST_TRTCM_PBS_DF - 1) + &tm, &tp, time, TM_TEST_TRTCM_PBS_DF - 1) != e_RTE_METER_YELLOW) melog(TRTCM_BLIND_CHECK_MSG" YELLOW"); /* Test red */ - if(rte_meter_trtcm_config(&tm, &tparams) != 0) + if(rte_meter_trtcm_profile_config(&tp, &tparams) != 0) + melog(TRTCM_BLIND_CHECK_MSG); + if(rte_meter_trtcm_config(&tm, &tp) != 0) melog(TRTCM_BLIND_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_trtcm_color_blind_check( - &tm, time, TM_TEST_TRTCM_PBS_DF + 1) + &tm, &tp, time, TM_TEST_TRTCM_PBS_DF + 1) != e_RTE_METER_RED) melog(TRTCM_BLIND_CHECK_MSG" RED"); @@ -291,36 +309,45 @@ tm_test_srtcm_aware_check (enum rte_meter_color in[4], enum rte_meter_color out[4]) { #define SRTCM_AWARE_CHECK_MSG "srtcm_aware_check" + struct rte_meter_srtcm_profile sp; struct rte_meter_srtcm sm; uint64_t time; uint64_t hz = rte_get_tsc_hz(); - if(rte_meter_srtcm_config(&sm, &sparams) != 0) + if(rte_meter_srtcm_profile_config(&sp, &sparams) != 0) + melog(SRTCM_AWARE_CHECK_MSG); + if(rte_meter_srtcm_config(&sm, &sp) != 0) melog(SRTCM_AWARE_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_srtcm_color_aware_check( - &sm, time, TM_TEST_SRTCM_CBS_DF - 1, in[0]) != out[0]) + &sm, &sp, time, TM_TEST_SRTCM_CBS_DF - 1, in[0]) != out[0]) melog(SRTCM_AWARE_CHECK_MSG" %u:%u", in[0], out[0]); - if(rte_meter_srtcm_config(&sm, &sparams) != 0) + if(rte_meter_srtcm_profile_config(&sp, &sparams) != 0) + melog(SRTCM_AWARE_CHECK_MSG); + if(rte_meter_srtcm_config(&sm, &sp) != 0) melog(SRTCM_AWARE_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_srtcm_color_aware_check( - &sm, time, TM_TEST_SRTCM_CBS_DF + 1, in[1]) != out[1]) + &sm, &sp, time, TM_TEST_SRTCM_CBS_DF + 1, in[1]) != out[1]) melog(SRTCM_AWARE_CHECK_MSG" %u:%u", in[1], out[1]); - if(rte_meter_srtcm_config(&sm, &sparams) != 0) + if(rte_meter_srtcm_profile_config(&sp, &sparams) != 0) + melog(SRTCM_AWARE_CHECK_MSG); + if(rte_meter_srtcm_config(&sm, &sp) != 0) melog(SRTCM_AWARE_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_srtcm_color_aware_check( - &sm, time, TM_TEST_SRTCM_EBS_DF - 1, in[2]) != out[2]) + &sm, &sp, time, TM_TEST_SRTCM_EBS_DF - 1, in[2]) != out[2]) melog(SRTCM_AWARE_CHECK_MSG" %u:%u", in[2], out[2]); - if(rte_meter_srtcm_config(&sm, &sparams) != 0) + if(rte_meter_srtcm_profile_config(&sp, &sparams) != 0) + melog(SRTCM_AWARE_CHECK_MSG); + if(rte_meter_srtcm_config(&sm, &sp) != 0) melog(SRTCM_AWARE_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_srtcm_color_aware_check( - &sm, time, TM_TEST_SRTCM_EBS_DF + 1, in[3]) != out[3]) + &sm, &sp, time, TM_TEST_SRTCM_EBS_DF + 1, in[3]) != out[3]) melog(SRTCM_AWARE_CHECK_MSG" %u:%u", in[3], out[3]); return 0; @@ -389,36 +416,45 @@ tm_test_trtcm_aware_check (enum rte_meter_color in[4], enum rte_meter_color out[4]) { #define TRTCM_AWARE_CHECK_MSG "trtcm_aware_check" + struct rte_meter_trtcm_profile tp; struct rte_meter_trtcm tm; uint64_t time; uint64_t hz = rte_get_tsc_hz(); - if(rte_meter_trtcm_config(&tm, &tparams) != 0) + if(rte_meter_trtcm_profile_config(&tp, &tparams) != 0) + melog(TRTCM_AWARE_CHECK_MSG); + if(rte_meter_trtcm_config(&tm, &tp) != 0) melog(TRTCM_AWARE_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_trtcm_color_aware_check( - &tm, time, TM_TEST_TRTCM_CBS_DF - 1, in[0]) != out[0]) + &tm, &tp, time, TM_TEST_TRTCM_CBS_DF - 1, in[0]) != out[0]) melog(TRTCM_AWARE_CHECK_MSG" %u:%u", in[0], out[0]); - if(rte_meter_trtcm_config(&tm, &tparams) != 0) + if(rte_meter_trtcm_profile_config(&tp, &tparams) != 0) + melog(TRTCM_AWARE_CHECK_MSG); + if(rte_meter_trtcm_config(&tm, &tp) != 0) melog(TRTCM_AWARE_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_trtcm_color_aware_check( - &tm, time, TM_TEST_TRTCM_CBS_DF + 1, in[1]) != out[1]) + &tm, &tp, time, TM_TEST_TRTCM_CBS_DF + 1, in[1]) != out[1]) melog(TRTCM_AWARE_CHECK_MSG" %u:%u", in[1], out[1]); - if(rte_meter_trtcm_config(&tm, &tparams) != 0) + if(rte_meter_trtcm_profile_config(&tp, &tparams) != 0) + melog(TRTCM_AWARE_CHECK_MSG); + if(rte_meter_trtcm_config(&tm, &tp) != 0) melog(TRTCM_AWARE_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_trtcm_color_aware_check( - &tm, time, TM_TEST_TRTCM_PBS_DF - 1, in[2]) != out[2]) + &tm, &tp, time, TM_TEST_TRTCM_PBS_DF - 1, in[2]) != out[2]) melog(TRTCM_AWARE_CHECK_MSG" %u:%u", in[2], out[2]); - if(rte_meter_trtcm_config(&tm, &tparams) != 0) + if(rte_meter_trtcm_profile_config(&tp, &tparams) != 0) + melog(TRTCM_AWARE_CHECK_MSG); + if(rte_meter_trtcm_config(&tm, &tp) != 0) melog(TRTCM_AWARE_CHECK_MSG); time = rte_get_tsc_cycles() + hz; if(rte_meter_trtcm_color_aware_check( - &tm, time, TM_TEST_TRTCM_PBS_DF + 1, in[3]) != out[3]) + &tm, &tp, time, TM_TEST_TRTCM_PBS_DF + 1, in[3]) != out[3]) melog(TRTCM_AWARE_CHECK_MSG" %u:%u", in[3], out[3]); return 0; -- 2.7.4