DPDK patches and discussions
 help / color / mirror / Atom feed
From: Shreyansh Jain <shreyansh.jain@nxp.com>
To: thomas@monjalon.net
Cc: dev@dpdk.org, Shreyansh Jain <shreyansh.jain@nxp.com>
Subject: [dpdk-dev] [PATCH v4] raw/skeleton: fix device start test
Date: Tue,  6 Feb 2018 12:13:38 +0530	[thread overview]
Message-ID: <20180206064338.29838-1-shreyansh.jain@nxp.com> (raw)
In-Reply-To: <20180205113108.19340-1-shreyansh.jain@nxp.com>

Device can only be started if firmware is loaded, as per Skeleton
rawdev driver semantics. This patch fixes original implementation
which attempted to start the device without loading firmware.

Fixes: 55ca1b0f2151 ("raw/skeleton: add test cases")
Cc: shreyansh.jain@nxp.com

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
---
v4:
 - change patch headline to raw/skeleton from raw/skeleton_rawdev

v3:
 - Moving 'Fixes' below commit message
 - patch headline made specific

v2:
 - Fixed headline from drivers/raw to raw/skeleton_rawdev
 - checkpatch for spelling mistake

 drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
index c7931d869..795f24bcb 100644
--- a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
+++ b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
@@ -297,10 +297,25 @@ test_rawdev_start_stop(void)
 	int ret;
 	struct rte_rawdev_info rdev_info = {0};
 	struct skeleton_rawdev_conf rdev_conf_get = {0};
+	char *dummy_firmware = NULL;
 
 	/* Get the current configuration */
 	rdev_info.dev_private = &rdev_conf_get;
 
+	/* Load a firmware using a dummy address area */
+	dummy_firmware = rte_zmalloc("RAWDEV SKELETON", sizeof(int) * 10, 0);
+	RTE_TEST_ASSERT(dummy_firmware != NULL,
+			"Failed to create firmware memory backing");
+
+	ret = rte_rawdev_firmware_load(TEST_DEV_ID, dummy_firmware);
+	RTE_TEST_ASSERT_SUCCESS(ret, "Firmware loading failed (%d)", ret);
+
+	/* Skeleton doesn't do anything with the firmware area - that is dummy
+	 * and can be removed.
+	 */
+	rte_free(dummy_firmware);
+	dummy_firmware = NULL;
+
 	rte_rawdev_start(TEST_DEV_ID);
 	ret = rte_rawdev_info_get(TEST_DEV_ID, (rte_rawdev_obj_t)&rdev_info);
 	RTE_TEST_ASSERT_SUCCESS(ret,
@@ -319,6 +334,10 @@ test_rawdev_start_stop(void)
 			      "Device stop failed. State is (%d)",
 			      rdev_conf_get.device_state);
 
+	/* Unloading the firmware once device is stopped */
+	ret = rte_rawdev_firmware_unload(TEST_DEV_ID);
+	RTE_TEST_ASSERT_SUCCESS(ret, "Failed to unload firmware (%d)", ret);
+
 	return TEST_SUCCESS;
 }
 
-- 
2.14.1

  parent reply	other threads:[~2018-02-06  6:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-05 11:16 [dpdk-dev] [PATCH] drivers/raw: fix incorrect device start Shreyansh Jain
2018-02-05 11:24 ` [dpdk-dev] [PATCH v2] raw/skeleton_rawdev: " Shreyansh Jain
2018-02-05 11:31   ` [dpdk-dev] [PATCH v3] raw/skeleton_rawdev: fix device start test Shreyansh Jain
2018-02-05 14:10     ` Thomas Monjalon
2018-02-05 16:25       ` Shreyansh Jain
2018-02-06  6:43     ` Shreyansh Jain [this message]
2018-02-06 16:32       ` [dpdk-dev] [PATCH v4] raw/skeleton: " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180206064338.29838-1-shreyansh.jain@nxp.com \
    --to=shreyansh.jain@nxp.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).