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 8FD68A00C3; Fri, 16 Sep 2022 18:23:38 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A7C36427EE; Fri, 16 Sep 2022 18:23:35 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by mails.dpdk.org (Postfix) with ESMTP id 0165C40156 for ; Fri, 16 Sep 2022 18:23:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663345413; x=1694881413; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jpPGAJxyJnSEEBcCnmnfuwqxF+dMaaTg6g8Chg213vs=; b=czbnWwQSj/CX45mZqXgD5rWVq9pBZzUcqOGiT+5JmIguQfL2UuuoS0VS Lkf6qY7NziASo8ppj4u45z2T717lbl5qQKERIwb6nUV0UQ6uw1Y/94OQG qZKoAfIsiDpxGBWm10zrVO7BLPGkLslrGpJR1ShsYUWxrYHqV/6IFloVG 3Mk1zL86vwC+B6bDijNiZX6cWH1BAPuHjABlgXsQgtkmeXjG1kiwRg4Gx RuB/6WhTVqs5TxwairAQYK5NXN1JcERNhDzYBnIoNxDU34oN7xwbWf8nH 1cq3lGXsqZ7IwKEeBMTPm2DZF17EYdztBUunC6srazfwNz3hJPP1LyzGn Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10472"; a="299849092" X-IronPort-AV: E=Sophos;i="5.93,320,1654585200"; d="scan'208";a="299849092" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Sep 2022 09:23:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,320,1654585200"; d="scan'208";a="680021513" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by fmsmga008.fm.intel.com with ESMTP; 16 Sep 2022 09:23:32 -0700 From: Naga Harish K S V To: jerinj@marvell.com, jay.jayatheerthan@intel.com Cc: dev@dpdk.org Subject: [PATCH v5 2/2] test/eth_tx: add testcase for queue start stop APIs Date: Fri, 16 Sep 2022 11:23:27 -0500 Message-Id: <20220916162327.2697745-2-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220916162327.2697745-1-s.v.naga.harish.k@intel.com> References: <20220915151915.2285722-1-s.v.naga.harish.k@intel.com> <20220916162327.2697745-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