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 83A6DA00C3; Mon, 26 Sep 2022 04:04:25 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DBCF8410EA; Mon, 26 Sep 2022 04:04:21 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 978AD40695 for ; Mon, 26 Sep 2022 04:04:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1664157858; x=1695693858; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jpPGAJxyJnSEEBcCnmnfuwqxF+dMaaTg6g8Chg213vs=; b=cekBkad9aBMeMHqhDbRkl5NlaULYbq9fazYjLephKGT9dgHaEcBU/vvW 3EiPax/POO2OoUlRz1YvVZiO6DbZnyeywMWM0tb0uiVfTNSss0whiJIFO i0eI0mtyHdK+kkgdmbTf3b9GV/pcICUZv48mDFnbzN+Tc8DYtROkKrnW3 aXzaOu2bwdCmym9eJt0YtJApsViqCrcYBTxfKFm3p8LLNc2Vkj6D3GcFX CRQzi/X8jB8t9VmE2vUW1kX85KBi8ImrPNBgNusDSCJLv8Se0HwQdIP7U PXf+JjNLH2QA5aau2IJrquQdJ+du9IOBz+sHsWo3TX3mB+mOPN2gz2DgO g==; X-IronPort-AV: E=McAfee;i="6500,9779,10481"; a="300899172" X-IronPort-AV: E=Sophos;i="5.93,345,1654585200"; d="scan'208";a="300899172" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2022 19:04:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,345,1654585200"; d="scan'208";a="865946518" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by fmsmga006.fm.intel.com with ESMTP; 25 Sep 2022 19:04:17 -0700 From: Naga Harish K S V To: jay.jayatheerthan@intel.com, jerinjacobk@gmail.com Cc: dev@dpdk.org Subject: [PATCH v6 2/2] test/eth_tx: add testcase for queue start stop APIs Date: Sun, 25 Sep 2022 21:04:13 -0500 Message-Id: <20220926020413.1432591-2-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220926020413.1432591-1-s.v.naga.harish.k@intel.com> References: <20220916162327.2697745-1-s.v.naga.harish.k@intel.com> <20220926020413.1432591-1-s.v.naga.harish.k@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Added testcase for rte_event_eth_tx_adapter_queue_start() and rte_event_eth_tx_adapter_queue_stop() APIs. Signed-off-by: Naga Harish K S V --- app/test/test_event_eth_tx_adapter.c | 86 ++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/app/test/test_event_eth_tx_adapter.c b/app/test/test_event_eth_tx_adapter.c index 98debfdd2c..c19a87a86a 100644 --- a/app/test/test_event_eth_tx_adapter.c +++ b/app/test/test_event_eth_tx_adapter.c @@ -711,6 +711,90 @@ tx_adapter_instance_get(void) return TEST_SUCCESS; } +static int +tx_adapter_queue_start_stop(void) +{ + int err; + uint16_t eth_dev_id; + struct rte_eth_dev_info dev_info; + + /* Case 1: Test without adding eth Tx queue */ + err = rte_event_eth_tx_adapter_queue_start(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + err = rte_event_eth_tx_adapter_queue_stop(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Case 2: Test with wrong eth port */ + eth_dev_id = rte_eth_dev_count_total() + 1; + err = rte_event_eth_tx_adapter_queue_start(eth_dev_id, + TEST_ETH_QUEUE_ID); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + err = rte_event_eth_tx_adapter_queue_stop(eth_dev_id, + TEST_ETH_QUEUE_ID); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Case 3: Test with wrong tx queue */ + err = rte_eth_dev_info_get(TEST_ETHDEV_ID, &dev_info); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_tx_adapter_queue_start(TEST_ETHDEV_ID, + dev_info.max_tx_queues + 1); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + err = rte_event_eth_tx_adapter_queue_stop(TEST_ETHDEV_ID, + dev_info.max_tx_queues + 1); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Case 4: Test with right instance, port & rxq */ + /* Add queue to tx adapter */ + err = rte_event_eth_tx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_tx_adapter_queue_stop(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_tx_adapter_queue_start(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + /* Add another queue to tx adapter */ + err = rte_event_eth_tx_adapter_queue_add(TEST_INST_ID, + TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 1); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + err = rte_event_eth_tx_adapter_queue_stop(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 1); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + err = rte_event_eth_tx_adapter_queue_start(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 1); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + /* Case 5: Test with right instance, port & wrong rxq */ + err = rte_event_eth_tx_adapter_queue_stop(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 2); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + err = rte_event_eth_tx_adapter_queue_start(TEST_ETHDEV_ID, + TEST_ETH_QUEUE_ID + 2); + TEST_ASSERT(err == -EINVAL, "Expected -EINVAL got %d", err); + + /* Delete all queues from the Tx adapter */ + err = rte_event_eth_tx_adapter_queue_del(TEST_INST_ID, + TEST_ETHDEV_ID, + -1); + TEST_ASSERT(err == 0, "Expected 0 got %d", err); + + return TEST_SUCCESS; +} + static int tx_adapter_dynamic_device(void) { @@ -770,6 +854,8 @@ static struct unit_test_suite event_eth_tx_tests = { tx_adapter_service), TEST_CASE_ST(tx_adapter_create, tx_adapter_free, tx_adapter_instance_get), + TEST_CASE_ST(tx_adapter_create, tx_adapter_free, + tx_adapter_queue_start_stop), TEST_CASE_ST(NULL, NULL, tx_adapter_dynamic_device), TEST_CASES_END() /**< NULL terminate unit test array */ } -- 2.25.1