[v1,2/2] raw/skeleton: allow closing already closed rawdev
diff mbox series

Message ID 20200921214420.29171-2-l.wojciechow@partner.samsung.com
State Accepted
Delegated to: Thomas Monjalon
Headers show
  • [v1,1/2] raw/skeleton: reset rawdev test statistics
Related show


Context Check Description
ci/iol-broadcom-Functional success Functional Testing PASS
ci/travis-robot success Travis build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/checkpatch success coding style OK

Commit Message

Lukasz Wojciechowski Sept. 21, 2020, 9:44 p.m. UTC
This patch return OK code (0) from skeleton_rawdev_close function
if firmware is in SKELETON_FW_READY state. Formerly it returned
-EINVAL error code.

Returning an error here is troublesome as it disallows proper release
of the rawdev. The rte_rawdev_pmd_release function from librte_rawdev
library calls drivers' rawdev_close handler and continues execution
only in case of errorless call.
(see lib/librte_rawdev/rte_rawdev.c:540)

The SKELETON_FW_READY state is reached after creation, reset, unload
or close of the device. The device should be ok to be released in
such situations.

To reproduce issue fixed by this patch, call rawdev_autotest
from dpdk-test app for few times. As the device is not properly
released, the next calls will fail.

Fixes: 61c592a8d035 ("raw/skeleton: introduce skeleton rawdev driver")
Cc: shreyansh.jain@nxp.com

Cc: stable@dpdk.org

Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
 drivers/raw/skeleton/skeleton_rawdev.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff mbox series

diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c
index f8b47a391..aa3beaad1 100644
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -190,9 +190,11 @@  static int skeleton_rawdev_close(struct rte_rawdev *dev)
+		SKELETON_PMD_DEBUG("Device already in stopped state");
+		break;
-		SKELETON_PMD_DEBUG("Device already in stopped state");
+		SKELETON_PMD_DEBUG("Device in impossible state");
 		ret = -EINVAL;