From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id D201FA0471 for ; Fri, 21 Jun 2019 17:57:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D502E1D582; Fri, 21 Jun 2019 17:57:26 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 73BB41D556 for ; Fri, 21 Jun 2019 17:57:25 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Jun 2019 08:57:25 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,400,1557212400"; d="scan'208";a="183441182" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.223.2]) by fmsmga004.fm.intel.com with ESMTP; 21 Jun 2019 08:57:24 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson , shreyansh.jain@nxp.com Date: Fri, 21 Jun 2019 16:56:59 +0100 Message-Id: <20190621155659.29297-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190621155659.29297-1-bruce.richardson@intel.com> References: <20190619170802.7691-1-bruce.richardson@intel.com> <20190621155659.29297-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 4/4] rawdev: pass 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. Cc: shreyansh.jain@nxp.com Signed-off-by: Bruce Richardson --- Since this change only affects the internals of the drivers, it's not an ABI or API change --- 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 d7177ea75..ad700e21c 100644 --- a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c +++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c @@ -427,8 +427,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