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 70BB7A0487 for ; Tue, 2 Jul 2019 11:56:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6D0A91B9AC; Tue, 2 Jul 2019 11:56:27 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id C22342BC8 for ; Tue, 2 Jul 2019 11:56:24 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jul 2019 02:56:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,442,1557212400"; d="scan'208";a="184471064" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.223.2]) by fmsmga001.fm.intel.com with ESMTP; 02 Jul 2019 02:56:23 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , Hemant Agrawal Date: Tue, 2 Jul 2019 10:56:08 +0100 Message-Id: <20190702095608.20722-4-bruce.richardson@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190702095608.20722-1-bruce.richardson@intel.com> References: <20190619170802.7691-1-bruce.richardson@intel.com> <20190702095608.20722-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v3 3/3] rawdev: pass the device id as parameter to selftest 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" When running self-tests, the driver needs to know the device on which to run the tests, so we need to take the device ID as parameter. Only the skeleton driver is providing this selftest capability right now, so we can easily update it for this change. Signed-off-by: Bruce Richardson Acked-by: Hemant Agrawal --- drivers/raw/skeleton_rawdev/skeleton_rawdev.c | 8 +++++--- drivers/raw/skeleton_rawdev/skeleton_rawdev.h | 2 +- drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c | 3 ++- lib/librte_rawdev/rte_rawdev.c | 2 +- lib/librte_rawdev/rte_rawdev_pmd.h | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev.c b/drivers/raw/skeleton_rawdev/skeleton_rawdev.c index 709be7691..42471fbd1 100644 --- a/drivers/raw/skeleton_rawdev/skeleton_rawdev.c +++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev.c @@ -583,6 +583,8 @@ skeleton_rawdev_create(const char *name, goto cleanup; } + ret = rawdev->dev_id; /* return the rawdev id of new device */ + rawdev->dev_ops = &skeleton_rawdev_ops; rawdev->device = &vdev->device; @@ -720,19 +722,19 @@ skeleton_rawdev_probe(struct rte_vdev_device *vdev) /* In case of invalid argument, selftest != 1; ignore other values */ ret = skeleton_rawdev_create(name, vdev, rte_socket_id()); - if (!ret) { + if (ret >= 0) { /* In case command line argument for 'selftest' was passed; * if invalid arguments were passed, execution continues but * without selftest. */ if (selftest == 1) - test_rawdev_skeldev(); + test_rawdev_skeldev(ret); } /* Device instance created; Second instance not possible */ skeldev_init_once = 1; - return ret; + return ret < 0 ? ret : 0; } static int diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev.h b/drivers/raw/skeleton_rawdev/skeleton_rawdev.h index 5045b5922..c3f92e72a 100644 --- a/drivers/raw/skeleton_rawdev/skeleton_rawdev.h +++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev.h @@ -131,6 +131,6 @@ skeleton_rawdev_get_priv(const struct rte_rawdev *rawdev) return rawdev->dev_private; } -int test_rawdev_skeldev(void); +int test_rawdev_skeldev(uint16_t dev_id); #endif /* __SKELETON_RAWDEV_H__ */ diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c index a6be99aee..9ecfdee81 100644 --- a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c +++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c @@ -426,8 +426,9 @@ static void skeldev_test_run(int (*setup)(void), } int -test_rawdev_skeldev(void) +test_rawdev_skeldev(uint16_t dev_id) { + test_dev_id = dev_id; testsuite_setup(); SKELDEV_TEST_RUN(NULL, NULL, test_rawdev_count); diff --git a/lib/librte_rawdev/rte_rawdev.c b/lib/librte_rawdev/rte_rawdev.c index 2b2f45d7c..15de2d413 100644 --- a/lib/librte_rawdev/rte_rawdev.c +++ b/lib/librte_rawdev/rte_rawdev.c @@ -378,7 +378,7 @@ rte_rawdev_selftest(uint16_t dev_id) struct rte_rawdev *dev = &rte_rawdevs[dev_id]; RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_selftest, -ENOTSUP); - return (*dev->dev_ops->dev_selftest)(); + return (*dev->dev_ops->dev_selftest)(dev_id); } int diff --git a/lib/librte_rawdev/rte_rawdev_pmd.h b/lib/librte_rawdev/rte_rawdev_pmd.h index 5e6cf1d16..aa6af4a37 100644 --- a/lib/librte_rawdev/rte_rawdev_pmd.h +++ b/lib/librte_rawdev/rte_rawdev_pmd.h @@ -499,7 +499,7 @@ typedef int (*rawdev_firmware_unload_t)(struct rte_rawdev *dev); * @return * Return 0 on success */ -typedef int (*rawdev_selftest_t)(void); +typedef int (*rawdev_selftest_t)(uint16_t dev_id); /** Rawdevice operations function pointer table */ struct rte_rawdev_ops { -- 2.21.0