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 667B6A04C0; Tue, 29 Sep 2020 13:47:46 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7A74D1D725; Tue, 29 Sep 2020 13:47:44 +0200 (CEST) Received: from new2-smtp.messagingengine.com (new2-smtp.messagingengine.com [66.111.4.224]) by dpdk.org (Postfix) with ESMTP id A99561D725 for ; Tue, 29 Sep 2020 13:47:41 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.nyi.internal (Postfix) with ESMTP id 50A9B580826; Tue, 29 Sep 2020 07:47:37 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 29 Sep 2020 07:47:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=fm2; bh= k2XNs2GCyVqFS//ChxdlrA2Dap8Xmfxnt4vbAKjwgho=; b=wJI7a5dGSVBC7dzA bhj/IbUuEPcq1PtJvCnTyCwCj901QdnboJuQYQt1Rv73lSQeM9t3a+K25g+Y+huL ibGyRvtNWXFpgOVZLL4+0Afml9R37PkhSG12nFonhiHBeeB4FFOBcgaF3IvtnbuE 6Y8A30VnuMOfxEdCDw3Qccz4XmhXGwuatuK3ndHIZYbMAcSFMLPFdQt//zLFQtt8 7nYsDyta2duXIT+akD1RE1y9G1b3HPBXOW77YYY3Yz0Tog2+7Fcmc+IzlptVw6wl eaZDhcE2V1EgbeV+x1T5EXs0qKNJBvajWH1+IqgeD1WKjv4SPCp88BJSTZ5RwdGw H73sag== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm3; bh=k2XNs2GCyVqFS//ChxdlrA2Dap8Xmfxnt4vbAKjwg ho=; b=YS2vxJejkTA/zMdPhLDdk1ohHQWrqjXTbWifTo5MIfjXwe+3RpM+riSHj P7Eo5/rsIvqeOmjmoAT/cS44Ct+HpWByt3fFDvBptFT5M3m37yjixQQ08b+pZB3g 1dn7cTB8INh7sH9pKZVqdslKi6+Ypz5i00767GUggAOMx4UMmSyOrM6yKmURXYI8 z3DOjri06k3V4WQIGp14RF/a2FLDvzdzKws3nOmanSYJHCAfEmiRxKmz1kyPgGas zX+tYZ08eqYa4zSXFxP3KXiOwdhcNTDmgrPmuAqqKpbkMY+oRLV0CCIWztsuRsVl PK2D8wwWQPPEq+qrCxott/2qZobuw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdekgdeghecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhmrghs ucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenucggtf frrghtthgvrhhnpedugefgvdefudfftdefgeelgffhueekgfffhfeujedtteeutdejueei iedvffegheenucfkphepjeejrddufeegrddvtdefrddukeegnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepthhhohhmrghssehmohhnjhgrlhho nhdrnhgvth X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 6CFB4306467D; Tue, 29 Sep 2020 07:47:34 -0400 (EDT) From: Thomas Monjalon To: Andrew Rybchenko Cc: dev@dpdk.org, ferruh.yigit@intel.com, Liron Himi , Ray Kinsella , Neil Horman , Rahul Lakkireddy , Gaetan Rivet , Jakub Grajciar , Matan Azrad , Shahaf Shuler , Viacheslav Ovsiienko , Zyta Szpak , Stephen Hemminger , "K. Y. Srinivasan" , Haiyang Zhang , Long Li , Maxime Coquelin , Chenbo Xia , Zhihong Wang Date: Tue, 29 Sep 2020 13:47:32 +0200 Message-ID: <2950783.NWLOan7DQ0@thomas> In-Reply-To: References: <20200913220711.3768597-1-thomas@monjalon.net> <20200928231437.414489-30-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v3 29/29] ethdev: allow close function to return an error 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" 29/09/2020 13:05, Andrew Rybchenko: > On 9/29/20 2:14 AM, Thomas Monjalon wrote: > > The API function rte_eth_dev_close() was returning void. > > The return type is changed to int for notifying of errors. > > > > If an error happens during a close operation, > > the status of the port is undefined, > > a maximum of resources having been freed. [...] > > @@ -135,7 +135,6 @@ Deprecation Notices > > invalid port ID, unsupported operation, failed operation): > > > > - ``rte_eth_dev_stop`` > > - - ``rte_eth_dev_close`` > > Many thanks for continuing my unfinished job. It is not finished. Would you take rte_eth_dev_stop? > > rte_pmd_mvneta_remove(struct rte_vdev_device *vdev) > > { > > uint16_t port_id; > > + int ret = 0; > > > > RTE_ETH_FOREACH_DEV(port_id) { > > if (rte_eth_devices[port_id].device != &vdev->device) > > continue; > > - rte_eth_dev_close(port_id); > > + ret = rte_eth_dev_close(port_id); > > I guess |= should be used here as well (similar as above). Yes > > -void > > +int > > rte_eth_dev_close(uint16_t port_id) > > { > > struct rte_eth_dev *dev; > > + int ret; > > > > - RTE_ETH_VALID_PORTID_OR_RET(port_id); > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -EINVAL); > > dev = &rte_eth_devices[port_id]; > > > > - RTE_FUNC_PTR_OR_RET(*dev->dev_ops->dev_close); > > - (*dev->dev_ops->dev_close)(dev); > > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_close, -ENOTSUP); > > + ret = (*dev->dev_ops->dev_close)(dev); > > > > rte_ethdev_trace_close(port_id); > > - rte_eth_dev_release_port(dev); > > + ret = rte_eth_dev_release_port(dev); > > It does not look good that it overwrites close return status. Indeed, it seems I did not finish this patch, or maybe I was drunk ;) What do you think is the best strategy? I think we must call rte_eth_dev_release_port() even if dev_close returns an error. Then which error to return? I would return the first non-zero one.