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 147EBA04B7; Tue, 13 Oct 2020 12:45:24 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DF3C31DAD9; Tue, 13 Oct 2020 12:44:10 +0200 (CEST) Received: from new3-smtp.messagingengine.com (new3-smtp.messagingengine.com [66.111.4.229]) by dpdk.org (Postfix) with ESMTP id 263731DAD7 for ; Tue, 13 Oct 2020 12:44:08 +0200 (CEST) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailnew.nyi.internal (Postfix) with ESMTP id C83775803C5; Tue, 13 Oct 2020 06:44:06 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Tue, 13 Oct 2020 06:44:06 -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= f0DE5ma4ZkXIxp6uYV6nov4GHy866uBKZxokovpvBvQ=; b=WLc0SS5AGqPWryjq u9mrhF7KU4RZfllqQRSz1vw7hHa/w+P92S6b5D/4KB2gWdmIVcZMoTaW0+QDLEUJ kGZKlansfZ5vdbH9rPtezi0XfjOWfgYNmlynn9A7cKy2jzxiyCUSFlxY8YhYDZ/X aZpXYr3uvGLIXcYiXXUiKIopYyYicMs2x3ftqtP/0NP9tr3CIjWAHSlQWNWbGdGh zCdo/f+V8OAKNgoOgwTZfX+21KbrUpjnweTzqSehbXlCRiCH9y02KIVlRSyTVrTH 1Y+gWilHkHuLzE+hvlvRrEWLoeTe71BaRqpPVuJq3cdu2dT4x1QudP1RCXAVpIGw et0a6g== 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=fm1; bh=f0DE5ma4ZkXIxp6uYV6nov4GHy866uBKZxokovpvB vQ=; b=nvxUMRp/eb4k9DuZBe6ILNMDbGLl9wxfS5LCFecvpK9aTtl9j2yrIW3Ha Ze++zMf5nKqJcG/6pWLVi1X7Wi8YW/isTz2cH37RTybIrKb9ABwpwF27ejmaFgcu pIViMR4T6/fTkwGCMHEV02NPt+789EyS4R4kGZ15zq+/MfHfvXCAVc14QykSbZuc EuLWMLA8F3YxcQk5K9ZiM1r/2GIyyqQOhCsju37t0iyOOHFkERYa57g04jRb0Zve k2gCNjf52DhIAUlnhmVsCSKivRrEHL6Jm7BPXiwY32L2n4qen0WYaqF9enZUMW11 T9ETMd5mcgb9DcgfHiDtY1DFGNfgg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrheelgdefudcutefuodetggdotefrodftvf 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 3718C3280063; Tue, 13 Oct 2020 06:44:01 -0400 (EDT) From: Thomas Monjalon To: Andrew Rybchenko Cc: dev@dpdk.org, ferruh.yigit@intel.com, Liron Himi , Stephen Hemminger , 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, 13 Oct 2020 12:43:59 +0200 Message-ID: <3835123.uaJnP6neN2@thomas> In-Reply-To: References: <20200913220711.3768597-1-thomas@monjalon.net> <20201013100634.2482593-4-thomas@monjalon.net> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v5 3/3] 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" 13/10/2020 12:41, Andrew Rybchenko: > On 10/13/20 1:06 PM, 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. > > > > Signed-off-by: Thomas Monjalon > > Reviewed-by: Liron Himi > > Acked-by: Stephen Hemminger > > Acked-by: Andrew Rybchenko > > [snip] > > > diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c > > index 73c3d6f7fe..ad12d4f07a 100644 > > --- a/lib/librte_ethdev/rte_ethdev.c > > +++ b/lib/librte_ethdev/rte_ethdev.c > > @@ -1716,19 +1716,25 @@ rte_eth_dev_set_link_down(uint16_t port_id) > > return eth_err(port_id, (*dev->dev_ops->dev_set_link_down)(dev)); > > } > > > > -void > > +int > > rte_eth_dev_close(uint16_t port_id) > > { > > struct rte_eth_dev *dev; > > + int firsterr, binerr; > > + int *lasterr = &firsterr; > > > > - RTE_ETH_VALID_PORTID_OR_RET(port_id); > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > > 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); > > + *lasterr = (*dev->dev_ops->dev_close)(dev); > > + if (*lasterr != 0) > > + lasterr = &binerr; > > > > rte_ethdev_trace_close(port_id); > > - rte_eth_dev_release_port(dev); > > + *lasterr = rte_eth_dev_release_port(dev); > > + > > + return firsterr; > > Shouldn't eth_err() be used here? Yes you're right (again) Will do a v6, thanks for the review.