From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C3C4AA0526; Tue, 21 Jul 2020 11:52:14 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 96B631C00F; Tue, 21 Jul 2020 11:52:10 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 8115D1C00D for ; Tue, 21 Jul 2020 11:52:08 +0200 (CEST) IronPort-SDR: 0DIMkA+2KgVEEJNUErXURGyjv1PhFNqKsy+LcvxNZifRPTOVn5gPvoG+p01MiV3HGm64yHyGCH VXDGPqONrY0w== X-IronPort-AV: E=McAfee;i="6000,8403,9688"; a="234952340" X-IronPort-AV: E=Sophos;i="5.75,378,1589266800"; d="scan'208";a="234952340" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jul 2020 02:52:08 -0700 IronPort-SDR: KSlq8q+9oU2tXpCWdT7hTmTSE24U+SeaMl7ObZskICErjL6lBARMUGSCI1T5jcYHGHtRkmiwrU 9ZHj0LlBd8ag== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.75,378,1589266800"; d="scan'208";a="488023648" Received: from silpixa00399126.ir.intel.com ([10.237.222.36]) by fmsmga005.fm.intel.com with ESMTP; 21 Jul 2020 02:52:06 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: cheng1.jiang@intel.com, patrick.fu@intel.com, kevin.laatz@intel.com, Bruce Richardson Date: Tue, 21 Jul 2020 10:51:22 +0100 Message-Id: <20200721095140.719297-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200721095140.719297-1-bruce.richardson@intel.com> References: <20200721095140.719297-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 20.11 02/20] raw/ioat: support multiple devices being tested 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" The current selftest function uses a single global variable to track state which implies that only a single instance can have the selftest function called on it. Change this to an array to allow multiple instances to be tested. Signed-off-by: Bruce Richardson --- drivers/raw/ioat/ioat_rawdev_test.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/raw/ioat/ioat_rawdev_test.c b/drivers/raw/ioat/ioat_rawdev_test.c index c463a82ad..e5b50ae9f 100644 --- a/drivers/raw/ioat/ioat_rawdev_test.c +++ b/drivers/raw/ioat/ioat_rawdev_test.c @@ -8,10 +8,13 @@ #include "rte_rawdev.h" #include "rte_ioat_rawdev.h" +#define MAX_SUPPORTED_RAWDEVS 64 +#define TEST_SKIPPED 77 + int ioat_rawdev_test(uint16_t dev_id); /* pre-define to keep compiler happy */ static struct rte_mempool *pool; -static unsigned short expected_ring_size; +static unsigned short expected_ring_size[MAX_SUPPORTED_RAWDEVS]; static int test_enqueue_copies(int dev_id) @@ -148,10 +151,16 @@ ioat_rawdev_test(uint16_t dev_id) unsigned int nb_xstats; unsigned int i; + if (dev_id >= MAX_SUPPORTED_RAWDEVS) { + printf("Skipping test. Cannot test rawdevs with id's greater than %d\n", + MAX_SUPPORTED_RAWDEVS); + return TEST_SKIPPED; + } + rte_rawdev_info_get(dev_id, &info, sizeof(p)); - if (p.ring_size != expected_ring_size) { + if (p.ring_size != expected_ring_size[dev_id]) { printf("Error, initial ring size is not as expected (Actual: %d, Expected: %d)\n", - (int)p.ring_size, expected_ring_size); + (int)p.ring_size, expected_ring_size[dev_id]); return -1; } @@ -166,7 +175,7 @@ ioat_rawdev_test(uint16_t dev_id) IOAT_TEST_RINGSIZE, (int)p.ring_size); return -1; } - expected_ring_size = p.ring_size; + expected_ring_size[dev_id] = p.ring_size; if (rte_rawdev_start(dev_id) != 0) { printf("Error with rte_rawdev_start()\n"); -- 2.25.1