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 BA503A04DD; Mon, 21 Sep 2020 23:44:29 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 725B21D974; Mon, 21 Sep 2020 23:44:29 +0200 (CEST) Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by dpdk.org (Postfix) with ESMTP id 153CA1D974 for ; Mon, 21 Sep 2020 23:44:28 +0200 (CEST) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20200921214428euoutp028fdf130a8a1a0cdef8b1f88577f25b1f~26prf-KeS2583425834euoutp02H for ; Mon, 21 Sep 2020 21:44:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20200921214428euoutp028fdf130a8a1a0cdef8b1f88577f25b1f~26prf-KeS2583425834euoutp02H DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1600724668; bh=Przc74oN7326C6PmvbUGBD7HgSxOZKyI0KOEHxowJPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vU8w5HAcOm6beheq4VFx5IY/jBr3vOcbjNmZjZr+gOiyyzWedHol1iWqBqTZ1Fmhj fBdrEopf0IAz9u+ESH/uqAP4nZ2VSFgBWRbbcCBWJiVS2lCMJJ8uJGHQAz/zXwR6lA NA/4cxIhIFL2zUF1J3ARktBc6D97QXSASVtOYfuU= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20200921214428eucas1p197672e130e0b050fcfac6507ff4ff183~26prTrDva2047720477eucas1p1p; Mon, 21 Sep 2020 21:44:28 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id DF.BE.06456.CBE196F5; Mon, 21 Sep 2020 22:44:28 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20200921214427eucas1p1f55e4da85bf76c8f73a840b47e01b04d~26pquVe5n1835318353eucas1p1b; Mon, 21 Sep 2020 21:44:27 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20200921214427eusmtrp1fed08a88126cb90eac1d7e9104ba2a8b~26pqtyD-_0669006690eusmtrp1N; Mon, 21 Sep 2020 21:44:27 +0000 (GMT) X-AuditID: cbfec7f2-7efff70000001938-67-5f691ebcebe4 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id B2.E6.06017.BBE196F5; Mon, 21 Sep 2020 22:44:27 +0100 (BST) Received: from Padamandas.fritz.box (unknown [106.210.88.70]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20200921214426eusmtip2fb37240eb082831e40dd93e2d18d3a6b~26pqA_PEP3136931369eusmtip2R; Mon, 21 Sep 2020 21:44:26 +0000 (GMT) From: Lukasz Wojciechowski To: Nipun Gupta , Hemant Agrawal , Shreyansh Jain Cc: dev@dpdk.org, l.wojciechow@partner.samsung.com, stable@dpdk.org Date: Mon, 21 Sep 2020 23:44:20 +0200 Message-Id: <20200921214420.29171-2-l.wojciechow@partner.samsung.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200921214420.29171-1-l.wojciechow@partner.samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrLIsWRmVeSWpSXmKPExsWy7djPc7p75DLjDWY08Fq8+7SdyWLl441s Fs961jFanDt+mtHi3/sONot/HX/YHdg8fi1Yyuqx8d0OJo+D7/YwBTBHcdmkpOZklqUW6dsl cGU87WtjLJjKW7H4yAXWBsY27i5GTg4JAROJO1fmMnUxcnEICaxglHi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IzSzgLrFl8VSwGmEBT4m9178zgdgsAqoSB39MB6vhFXCV +Hb0HhvEAnmJ1RsOgNVzCrhJTDjTxwZygxBQzdnnahMY+RYwMqxiFEktLc5Nzy020itOzC0u zUvXS87P3cQIDMptx35u2cHY9S74EKMAB6MSD++BqRnxQqyJZcWVuYcYJTiYlUR4nc6ejhPi TUmsrEotyo8vKs1JLT7EaAp000RmKdHkfGDE5JXEG5oamltYGpobmxubWSiJ83YIHIwREkhP LEnNTk0tSC2C6WPi4JRqYEz22ni0JGtrxumXqy90asVbBAXUti7edPTXel3DDdP5t5S9Xyv/ 9HONpuWazJu34kpe1rw0evuJNXD5hKCp0q3fdiQmzj9/xOSJwHZFs7ubdkoukTl0auKfHimD kAONH8ynvUreUnF4+dUG5tCS5A9enGvPmLt72Ol2+h3P+rm+3vvxUX2RGdlKLMUZiYZazEXF iQA2tYjlYAIAAA== X-CMS-MailID: 20200921214427eucas1p1f55e4da85bf76c8f73a840b47e01b04d X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20200921214427eucas1p1f55e4da85bf76c8f73a840b47e01b04d X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20200921214427eucas1p1f55e4da85bf76c8f73a840b47e01b04d References: <20200921214420.29171-1-l.wojciechow@partner.samsung.com> Subject: [dpdk-dev] [PATCH v1 2/2] raw/skeleton: allow closing already closed rawdev 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" 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 --- drivers/raw/skeleton/skeleton_rawdev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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) } break; case SKELETON_FW_READY: + SKELETON_PMD_DEBUG("Device already in stopped state"); + break; case SKELETON_FW_ERROR: default: - SKELETON_PMD_DEBUG("Device already in stopped state"); + SKELETON_PMD_DEBUG("Device in impossible state"); ret = -EINVAL; break; } -- 2.17.1