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 763D7A0C4C; Tue, 21 Sep 2021 11:46:09 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 39FB140DF7; Tue, 21 Sep 2021 11:46:09 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 438964003C for ; Tue, 21 Sep 2021 11:46:07 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10113"; a="308871724" X-IronPort-AV: E=Sophos;i="5.85,310,1624345200"; d="scan'208";a="308871724" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Sep 2021 02:46:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,310,1624345200"; d="scan'208";a="549417492" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by FMSMGA003.fm.intel.com with ESMTP; 21 Sep 2021 02:46:03 -0700 From: Naga Harish K S V To: jerinj@marvell.com, jay.jayatheerthan@intel.com Cc: dev@dpdk.org Date: Tue, 21 Sep 2021 04:45:56 -0500 Message-Id: <20210921094559.1788022-2-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210921094559.1788022-1-s.v.naga.harish.k@intel.com> References: <20210918131140.3543317-1-s.v.naga.harish.k@intel.com> <20210921094559.1788022-1-s.v.naga.harish.k@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 2/5] test/event: add unit test for event buffer size config api 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" this patch adds unit test for rte_event_eth_rx_adapter_create_with_params api and validate all possible input combinations. Signed-off-by: Naga Harish K S V --- app/test/test_event_eth_rx_adapter.c | 53 +++++++++++++++++++++++++--- 1 file changed, 49 insertions(+), 4 deletions(-) diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c index add4d8a678..3c0f0ad7cc 100644 --- a/app/test/test_event_eth_rx_adapter.c +++ b/app/test/test_event_eth_rx_adapter.c @@ -428,6 +428,50 @@ adapter_create_free(void) return TEST_SUCCESS; } +static int +adapter_create_free_v2(void) +{ + int err; + + struct rte_event_port_conf rx_p_conf = { + .dequeue_depth = 8, + .enqueue_depth = 8, + .new_event_threshold = 1200, + }; + + struct rte_event_eth_rx_adapter_params rxa_params = { + .event_buf_size = 1024 + }; + + err = rte_event_eth_rx_adapter_create_with_params(TEST_INST_ID, + TEST_DEV_ID, NULL, NULL); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + err = rte_event_eth_rx_adapter_create_with_params(TEST_INST_ID, + TEST_DEV_ID, &rx_p_conf, &rxa_params); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_create_with_params(TEST_INST_ID, + TEST_DEV_ID, &rx_p_conf, &rxa_params); + TEST_ASSERT(err == -EEXIST, "Expected -EEXIST %d got %d", -EEXIST, err); + + rxa_params.event_buf_size = 0; + err = rte_event_eth_rx_adapter_create_with_params(TEST_INST_ID, + TEST_DEV_ID, &rx_p_conf, &rxa_params); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + err = rte_event_eth_rx_adapter_free(TEST_INST_ID); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_rx_adapter_free(TEST_INST_ID); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL %d got %d", -EINVAL, err); + + err = rte_event_eth_rx_adapter_free(1); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL %d got %d", -EINVAL, err); + + return TEST_SUCCESS; +} + static int adapter_queue_add_del(void) { @@ -435,7 +479,7 @@ adapter_queue_add_del(void) struct rte_event ev; uint32_t cap; - struct rte_event_eth_rx_adapter_queue_conf queue_config; + struct rte_event_eth_rx_adapter_queue_conf queue_config = {0}; err = rte_event_eth_rx_adapter_caps_get(TEST_DEV_ID, TEST_ETHDEV_ID, &cap); @@ -523,7 +567,7 @@ adapter_multi_eth_add_del(void) uint16_t port_index, port_index_base, drv_id = 0; char driver_name[50]; - struct rte_event_eth_rx_adapter_queue_conf queue_config; + struct rte_event_eth_rx_adapter_queue_conf queue_config = {0}; ev.queue_id = 0; ev.sched_type = RTE_SCHED_TYPE_ATOMIC; @@ -594,7 +638,7 @@ adapter_intr_queue_add_del(void) struct rte_event ev; uint32_t cap; uint16_t eth_port; - struct rte_event_eth_rx_adapter_queue_conf queue_config; + struct rte_event_eth_rx_adapter_queue_conf queue_config = {0}; if (!default_params.rx_intr_port_inited) return 0; @@ -687,7 +731,7 @@ adapter_start_stop(void) ev.sched_type = RTE_SCHED_TYPE_ATOMIC; ev.priority = 0; - struct rte_event_eth_rx_adapter_queue_conf queue_config; + struct rte_event_eth_rx_adapter_queue_conf queue_config = {0}; queue_config.rx_queue_flags = 0; if (default_params.caps & @@ -753,6 +797,7 @@ static struct unit_test_suite event_eth_rx_tests = { .teardown = testsuite_teardown, .unit_test_cases = { TEST_CASE_ST(NULL, NULL, adapter_create_free), + TEST_CASE_ST(NULL, NULL, adapter_create_free_v2), TEST_CASE_ST(adapter_create, adapter_free, adapter_queue_add_del), TEST_CASE_ST(adapter_create, adapter_free, -- 2.25.1