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 2A2C4A00C5; Thu, 15 Sep 2022 17:19:32 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id AAF75427F9; Thu, 15 Sep 2022 17:19:25 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 3457A40156 for ; Thu, 15 Sep 2022 17:19:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663255162; x=1694791162; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jpPGAJxyJnSEEBcCnmnfuwqxF+dMaaTg6g8Chg213vs=; b=KRJUHHmtFzIzmPDAr4/FQSdg9i3k4LBL0ZLrqzTO5AJLe4blmArCAWLt RUJgNpEALL2SrZasTBIrnmS2IXEt1q3temphM5X5a1WFjwG9VpB9jIDzT iPc6c+1+Qnbo6HDiX5i3sKVPPmejGeLNrtXlZKnjS063EoGLayKveMmni lbsLg8qcI5VSj8WR2Q1FRInCH5NPhY4ZfP3+mIUI/d80hznbU4nr5mg0Z NARoze9F7E6he5VsC5GfYrM8u77k8UvWBa1Ts4p/JsTS6fCbEc7nhDHac VPqXWesKaBfOHD3kyoPme8gJpyCQIVEbqcoLVODMhRNabB2ffle3wXYvd w==; X-IronPort-AV: E=McAfee;i="6500,9779,10471"; a="300103231" X-IronPort-AV: E=Sophos;i="5.93,318,1654585200"; d="scan'208";a="300103231" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Sep 2022 08:19:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,318,1654585200"; d="scan'208";a="679559449" Received: from txandevlnx322.an.intel.com ([10.123.117.44]) by fmsmga008.fm.intel.com with ESMTP; 15 Sep 2022 08:19:19 -0700 From: Naga Harish K S V To: jerinj@marvell.com, jay.jayatheerthan@intel.com Cc: dev@dpdk.org Subject: [PATCH v3 2/2] test/eth_tx: add testcase for queue start stop APIs Date: Thu, 15 Sep 2022 10:19:15 -0500 Message-Id: <20220915151915.2285722-2-s.v.naga.harish.k@intel.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220915151915.2285722-1-s.v.naga.harish.k@intel.com> References: <20220915095329.2217018-1-s.v.naga.harish.k@intel.com> <20220915151915.2285722-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