summaryrefslogtreecommitdiff
path: root/drivers/raw
diff options
context:
space:
mode:
authorShreyansh Jain <shreyansh.jain@nxp.com>2018-02-06 12:13:38 +0530
committerThomas Monjalon <thomas@monjalon.net>2018-02-06 17:32:34 +0100
commita76ec6fe90341dca7f17e000630a88ea6de22c26 (patch)
treefa0e090400cb995b411049df93e7a1f8008d548f /drivers/raw
parentc6e536e38437fc44f2e23270e85115ce91618fb2 (diff)
downloaddpdk-next-eventdev-a76ec6fe90341dca7f17e000630a88ea6de22c26.zip
dpdk-next-eventdev-a76ec6fe90341dca7f17e000630a88ea6de22c26.tar.gz
dpdk-next-eventdev-a76ec6fe90341dca7f17e000630a88ea6de22c26.tar.xz
raw/skeleton: fix device start test
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>
Diffstat (limited to 'drivers/raw')
-rw-r--r--drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c b/drivers/raw/skeleton_rawdev/skeleton_rawdev_test.c
index c7931d8..795f24b 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;
}