From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B2B0DA0C45; Thu, 28 Oct 2021 09:07:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A00A7410F6; Thu, 28 Oct 2021 09:07:23 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 982B940DDB for ; Thu, 28 Oct 2021 09:07:21 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10150"; a="230606379" X-IronPort-AV: E=Sophos;i="5.87,189,1631602800"; d="scan'208";a="230606379" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Oct 2021 00:07:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.87,189,1631602800"; d="scan'208";a="498254837" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by orsmga008.jf.intel.com with ESMTP; 28 Oct 2021 00:07:06 -0700 From: Naga Harish K S V To: jerinj@marvell.com, jay.jayatheerthan@intel.com Cc: dev@dpdk.org Date: Thu, 28 Oct 2021 02:06:40 -0500 Message-Id: <20211028070640.3051397-3-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20211028070640.3051397-1-s.v.naga.harish.k@intel.com> References: <20211028045430.2989816-1-s.v.naga.harish.k@intel.com> <20211028070640.3051397-1-s.v.naga.harish.k@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 3/3] test/event: add unit test for Rx adapter X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" add unit test for rte_event_eth_rx_adapter_queue_stats_get() and rte_event_eth_rx_adapter_queue_stats_reset() apis. Signed-off-by: Naga Harish K S V --- app/test/test_event_eth_rx_adapter.c | 60 ++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c index 1419f6f64d..7cb91b152f 100644 --- a/app/test/test_event_eth_rx_adapter.c +++ b/app/test/test_event_eth_rx_adapter.c @@ -471,6 +471,64 @@ adapter_queue_event_buf_test(void) return TEST_SUCCESS; } +static int +adapter_queue_stats_test(void) +{ + int err; + struct rte_event ev; + uint32_t cap; + struct rte_event_eth_rx_adapter_queue_conf queue_config = {0}; + struct rte_event_eth_rx_adapter_queue_stats q_stats; + + err = rte_event_eth_rx_adapter_queue_stats_get(TEST_INST_ID, + TEST_ETHDEV_ID, 0, + &q_stats); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + err = rte_event_eth_rx_adapter_queue_stats_reset(TEST_INST_ID, + TEST_ETHDEV_ID, 0); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + err = rte_event_eth_rx_adapter_caps_get(TEST_DEV_ID, TEST_ETHDEV_ID, + &cap); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + ev.queue_id = 0; + ev.sched_type = RTE_SCHED_TYPE_ATOMIC; + ev.priority = 0; + + queue_config.rx_queue_flags = 0; + if (cap & RTE_EVENT_ETH_RX_ADAPTER_CAP_OVERRIDE_FLOW_ID) { + ev.flow_id = 1; + queue_config.rx_queue_flags = + RTE_EVENT_ETH_RX_ADAPTER_QUEUE_FLOW_ID_VALID; + } + queue_config.ev = ev; + queue_config.servicing_weight = 1; + queue_config.event_buf_size = 1024; + + err = rte_event_eth_rx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, 0, + &queue_config); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_queue_stats_get(TEST_INST_ID, + TEST_ETHDEV_ID, 0, + &q_stats); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_queue_stats_reset(TEST_INST_ID, + TEST_ETHDEV_ID, 0); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_queue_del(TEST_INST_ID, + TEST_ETHDEV_ID, + 0); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + return TEST_SUCCESS; +} + static void adapter_free(void) { @@ -940,6 +998,8 @@ static struct unit_test_suite event_eth_rx_tests = { TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_conf), TEST_CASE_ST(adapter_create_with_params, adapter_free, adapter_queue_event_buf_test), + TEST_CASE_ST(adapter_create_with_params, adapter_free, + adapter_queue_stats_test), TEST_CASES_END() /**< NULL terminate unit test array */ } }; -- 2.25.1