From patchwork Thu Sep 8 17:12:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Naga Harish K, S V" X-Patchwork-Id: 116099 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 10E4FA0548; Thu, 8 Sep 2022 19:12:54 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C230C427EA; Thu, 8 Sep 2022 19:12:50 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id AF19B4021F for ; Thu, 8 Sep 2022 19:12:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662657168; x=1694193168; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jpPGAJxyJnSEEBcCnmnfuwqxF+dMaaTg6g8Chg213vs=; b=IGHhP046QD/nokVjv12/WOOrgf6OgokASknvDzN7ZzwDxsk5Nmzce//f /qXns0uoPuWbENC5XTnrliI4+7NSuza6TMjWq2WbYeI996wvA47rkIgp1 vAQxwr69T5wR2G0geO3F94XzFT4LQ/BEy8B+YCP89o4sdxEx7ItiU+xea 9jA43TrSUB1yFMu/lK44GZAGbsLIkXSXzmh06M7L0T3OxEbYqAEseAL6e AN2EPhp7mx6iJQJ8z66LTQqpi/SZgNGHbcbl1GkAYqBzFpwTLviUdXyh9 eocU1/+fhTHL7C1AK20mgmWLdLGpc4XEvkjy+JsXTNsholTHnSV3lQi9t Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10464"; a="295999011" X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="295999011" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Sep 2022 10:12:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,300,1654585200"; d="scan'208";a="943433091" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by fmsmga005.fm.intel.com with ESMTP; 08 Sep 2022 10:12:47 -0700 From: Naga Harish K S V To: jay.jayatheerthan@intel.com, jerinj@marvell.com Cc: dev@dpdk.org Subject: [PATCH 2/3] test/eth_tx: add testcase for queue start stop APIs Date: Thu, 8 Sep 2022 12:12:41 -0500 Message-Id: <20220908171242.3804375-2-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220908171242.3804375-1-s.v.naga.harish.k@intel.com> References: <20220908171242.3804375-1-s.v.naga.harish.k@intel.com> MIME-Version: 1.0 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 */ }