From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) by dpdk.org (Postfix) with ESMTP id A84741B255 for ; Tue, 19 Dec 2017 21:51:14 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 3B10E20BCD; Tue, 19 Dec 2017 15:51:12 -0500 (EST) Received: from frontend1 ([10.202.2.160]) by compute1.internal (MEProxy); Tue, 19 Dec 2017 15:51:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=mesmtp; bh=FMZabB+DBRe+7LW2AiZUHK5yYd oZv2dn1hxcc2GNw10=; b=E2drLZUCR+nz7ZhWHkana2LmQHbrV7p+geBbWk3uC3 0JLl9hQAsDNmx50AGcUj3wYWrYGoM/Hxg7iFURsfuuz20Htm/YmR1PevSGFWTKel /4pXU47w4hxug/uoakcYb3uQNEXHX7OgXIhVBFDHw/73fK0b/g2YWwRIyDXXmlv1 4= 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-sender:x-me-sender:x-sasl-enc; s=fm1; bh=FMZabB +DBRe+7LW2AiZUHK5yYdoZv2dn1hxcc2GNw10=; b=KbPnjh7/In79GqeU7hCrJz scuMI/D026vlyUx8SaiP6oZ4SJAmorGCLyL0Fu+5CEv9p663ykcHIt2K+ZcILc+r guufk2YvHv10BIPy4HtGuQF3ZnkFXrR52Kbe1UKFjHC3Z87oirwbjIGBlKAkImoq DjrFLrIwpezQv3gSBmTvqUtJ11metMEbPWmewo0qk52JSKorfGUdpw5SIBWg6eEq r/J0pLYsCPF2EWS9wnSp29cLXB2ZzoUHtJMGXS1sUg2whO9I7Rzdojnfn7QBpSCn eFjezkmvZ2PVU6gQZTcuoFP5aFJprBZWPoO9GUd3k9ZPhOM0uEn/DpAK8IjX2gPw == X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id E9CB27E53A; Tue, 19 Dec 2017 15:51:11 -0500 (EST) From: Thomas Monjalon To: Matan Azrad Cc: Stephen Hemminger , Adrien Mazarguil , Gaetan Rivet , dev@dpdk.org Date: Tue, 19 Dec 2017 21:51:10 +0100 Message-ID: <20459625.d9rBa0iXI8@xps> In-Reply-To: References: <1513175370-16583-1-git-send-email-matan@mellanox.com> <20171219092017.532d596f@xeon-e3> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v3 1/6] ethdev: add devop to check removal status 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: , X-List-Received-Date: Tue, 19 Dec 2017 20:51:14 -0000 19/12/2017 18:24, Matan Azrad: > HI > > > -----Original Message----- > > From: Stephen Hemminger [mailto:stephen@networkplumber.org] > > Sent: Tuesday, December 19, 2017 7:20 PM > > To: Matan Azrad > > Cc: Adrien Mazarguil ; Thomas Monjalon > > ; Gaetan Rivet ; > > dev@dpdk.org > > Subject: Re: [dpdk-dev] [PATCH v3 1/6] ethdev: add devop to check removal > > status > > > > On Tue, 19 Dec 2017 17:10:10 +0000 > > Matan Azrad wrote: > > > > > int > > > +rte_eth_dev_is_removed(uint16_t port_id) { > > > + struct rte_eth_dev *dev; > > > + int ret; > > > + > > > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, 0); > > > + > > > + dev = &rte_eth_devices[port_id]; > > > + > > > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->is_removed, 0); > > > + > > > + if (dev->state == RTE_ETH_DEV_REMOVED) > > > + return 1; > > > + > > > + ret = dev->dev_ops->is_removed(dev); > > > + if (ret != 0) > > > + dev->state = RTE_ETH_DEV_REMOVED; > > > + > > > + return ret; > > > +} > > > + > > > > This looks good. > > May be a candidate to use bool instead of int for return value? > > Yes, I thought about it but didn't see any precedence for bool usage in ethdev APIs. > Guys, what do you think? I think this function can return error, isn't it? (look at macros *_OR_ERR_RET used in the function)