From patchwork Sat Oct 3 09:05:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jayatheerthan, Jay" X-Patchwork-Id: 79566 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0E813A04BA; Sat, 3 Oct 2020 11:12:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7D5711D429; Sat, 3 Oct 2020 11:12:22 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id C397C1D428; Sat, 3 Oct 2020 11:12:19 +0200 (CEST) IronPort-SDR: iCiOhJA/VWCzbqc2VmAyNQlPPQWm0Yjdo3UezCXjde/TEV0sEu4QDU0tcA8t4sY+gjfqgzjuLw HETtMhtEPhyw== X-IronPort-AV: E=McAfee;i="6000,8403,9762"; a="142570741" X-IronPort-AV: E=Sophos;i="5.77,331,1596524400"; d="scan'208";a="142570741" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2020 02:12:15 -0700 IronPort-SDR: g0BLXR8qe9Wu4+Zgw03RlyeZiN6tLMg0E17xW3FgBj5slfS5CBjlmQsb9HiBHH7CZZxihX3TTj IAD1oPIGgP5w== X-IronPort-AV: E=Sophos;i="5.77,331,1596524400"; d="scan'208";a="351839761" Received: from unknown (HELO localhost.localdomain) ([10.190.210.212]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2020 02:12:13 -0700 From: "Jayatheerthan, Jay" To: jerinj@marvell.com, thomas@monjalon.net, nikhil.rao@intel.com Cc: dev@dpdk.org, stable@dpdk.org, jay.jayatheerthan@intel.com Date: Sat, 3 Oct 2020 14:35:40 +0530 Message-Id: <20201003090541.32449-1-jay.jayatheerthan@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH 1/2] app/test: uninit vdevs in event eth Rx adapter autotest X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" From: "Jay Jayatheerthan" adapter_multi_eth_add_del() does vdev init but doesn't uninit them. This causes issues when running event_eth_rx_adapter_autotest multiple times. The fix does vdev uninit before exiting the test. Signed-off-by: Jay Jayatheerthan Reviewed-by: Nikhil Rao --- app/test/test_event_eth_rx_adapter.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c index dd3bce71b..71c946164 100644 --- a/app/test/test_event_eth_rx_adapter.c +++ b/app/test/test_event_eth_rx_adapter.c @@ -464,7 +464,7 @@ adapter_multi_eth_add_del(void) int err; struct rte_event ev; - uint16_t port_index, drv_id = 0; + uint16_t port_index, port_index_base, drv_id = 0; char driver_name[50]; struct rte_event_eth_rx_adapter_queue_conf queue_config; @@ -484,6 +484,7 @@ adapter_multi_eth_add_del(void) /* add the max port for rx_adapter */ port_index = rte_eth_dev_count_total(); + port_index_base = port_index; for (; port_index < RTE_MAX_ETHPORTS; port_index += 1) { snprintf(driver_name, sizeof(driver_name), "%s%u", "net_null", drv_id); @@ -513,6 +514,17 @@ adapter_multi_eth_add_del(void) TEST_ASSERT(err == 0, "Expected 0 got %d", err); } + /* delete vdev ports */ + for (drv_id = 0, port_index = port_index_base; + port_index < RTE_MAX_ETHPORTS; + drv_id += 1, port_index += 1) { + snprintf(driver_name, sizeof(driver_name), "%s%u", "net_null", + drv_id); + err = rte_vdev_uninit(driver_name); + TEST_ASSERT(err == 0, "Failed driver %s got %d", + driver_name, err); + } + return TEST_SUCCESS; } From patchwork Sat Oct 3 09:05:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jayatheerthan, Jay" X-Patchwork-Id: 79567 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id A217BA04BA; Sat, 3 Oct 2020 11:12:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7B36D1D501; Sat, 3 Oct 2020 11:12:24 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id 90A521D428; Sat, 3 Oct 2020 11:12:21 +0200 (CEST) IronPort-SDR: Kk3k5ahU6pH4wJ3f+ijLWCkUmonoh+0gAdEKQoPOuM8aZuzcjHVxX48KZwd4SMmn6u1ekzoo70 8ug29RaG1fYg== X-IronPort-AV: E=McAfee;i="6000,8403,9762"; a="142570744" X-IronPort-AV: E=Sophos;i="5.77,331,1596524400"; d="scan'208";a="142570744" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2020 02:12:17 -0700 IronPort-SDR: 50Ddlm5vtiHFiOCuJm2FR+OT+jVqyLWY4pHclQ9nF1RzqElygmxrGQBoYh7cRmSZ2tKijKCaBL SOPVwQd0e6/g== X-IronPort-AV: E=Sophos;i="5.77,331,1596524400"; d="scan'208";a="351839767" Received: from unknown (HELO localhost.localdomain) ([10.190.210.212]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Oct 2020 02:12:15 -0700 From: "Jayatheerthan, Jay" To: jerinj@marvell.com, thomas@monjalon.net, nikhil.rao@intel.com Cc: dev@dpdk.org, stable@dpdk.org, jay.jayatheerthan@intel.com Date: Sat, 3 Oct 2020 14:35:41 +0530 Message-Id: <20201003090541.32449-2-jay.jayatheerthan@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201003090541.32449-1-jay.jayatheerthan@intel.com> References: <20201003090541.32449-1-jay.jayatheerthan@intel.com> Subject: [dpdk-dev] [PATCH 2/2] app/test: add net null dev creation in Rx adapter autotest X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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" From: "Jay Jayatheerthan" Allows creation of net_null if vdev EAL option is not specified and uninit vdev created in the test. The change also adds error checks for vdev init and uninit. Signed-off-by: Jay Jayatheerthan Reviewed-by: Nikhil Rao --- app/test/test_event_eth_rx_adapter.c | 61 +++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/app/test/test_event_eth_rx_adapter.c b/app/test/test_event_eth_rx_adapter.c index 71c946164..dbf85be35 100644 --- a/app/test/test_event_eth_rx_adapter.c +++ b/app/test/test_event_eth_rx_adapter.c @@ -30,6 +30,8 @@ struct event_eth_rx_adapter_test_params { }; static struct event_eth_rx_adapter_test_params default_params; +static bool event_dev_created; +static bool eth_dev_created; static inline int port_init_common(uint16_t port, const struct rte_eth_conf *port_conf, @@ -202,7 +204,10 @@ testsuite_setup(void) if (!count) { printf("Failed to find a valid event device," " testing with event_skeleton device\n"); - rte_vdev_init("event_skeleton", NULL); + err = rte_vdev_init("event_skeleton", NULL); + TEST_ASSERT(err == 0, "Failed to create event_skeleton. err=%d", + err); + event_dev_created = true; } struct rte_event_dev_config config = { @@ -222,6 +227,15 @@ testsuite_setup(void) TEST_ASSERT(err == 0, "Event device initialization failed err %d\n", err); + count = rte_eth_dev_count_total(); + if (!count) { + printf("Testing with net_null device\n"); + err = rte_vdev_init("net_null", NULL); + TEST_ASSERT(err == 0, "Failed to create net_null. err=%d", + err); + eth_dev_created = true; + } + /* * eth devices like octeontx use event device to receive packets * so rte_eth_dev_start invokes rte_event_dev_start internally, so @@ -249,7 +263,10 @@ testsuite_setup_rx_intr(void) if (!count) { printf("Failed to find a valid event device," " testing with event_skeleton device\n"); - rte_vdev_init("event_skeleton", NULL); + err = rte_vdev_init("event_skeleton", NULL); + TEST_ASSERT(err == 0, "Failed to create event_skeleton. err=%d", + err); + event_dev_created = true; } struct rte_event_dev_config config = { @@ -270,6 +287,15 @@ testsuite_setup_rx_intr(void) TEST_ASSERT(err == 0, "Event device initialization failed err %d\n", err); + count = rte_eth_dev_count_total(); + if (!count) { + printf("Testing with net_null device\n"); + err = rte_vdev_init("net_null", NULL); + TEST_ASSERT(err == 0, "Failed to create net_null. err=%d", + err); + eth_dev_created = true; + } + /* * eth devices like octeontx use event device to receive packets * so rte_eth_dev_start invokes rte_event_dev_start internally, so @@ -292,21 +318,52 @@ testsuite_setup_rx_intr(void) static void testsuite_teardown(void) { + int err; uint32_t i; RTE_ETH_FOREACH_DEV(i) rte_eth_dev_stop(i); + if (eth_dev_created) { + err = rte_vdev_uninit("net_null"); + if (err) + printf("Failed to delete net_null. err=%d", err); + eth_dev_created = false; + } + rte_mempool_free(default_params.mp); + if (event_dev_created) { + err = rte_vdev_uninit("event_skeleton"); + if (err) + printf("Failed to delete event_skeleton. err=%d", err); + event_dev_created = false; + } + + memset(&default_params, 0, sizeof(default_params)); } static void testsuite_teardown_rx_intr(void) { + int err; if (!default_params.rx_intr_port_inited) return; rte_eth_dev_stop(default_params.rx_intr_port); + if (eth_dev_created) { + err = rte_vdev_uninit("net_null"); + if (err) + printf("Failed to delete net_null. err=%d", err); + eth_dev_created = false; + } rte_mempool_free(default_params.mp); + if (event_dev_created) { + err = rte_vdev_uninit("event_skeleton"); + if (err) + printf("Failed to delete event_skeleton. err=%d", err); + event_dev_created = false; + } + + memset(&default_params, 0, sizeof(default_params)); } static int