From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas Monjalon Subject: Re: [PATCH v3 1/6] ethdev: add devop to check removal status Date: Tue, 19 Dec 2017 21:51:10 +0100 Message-ID: <20459625.d9rBa0iXI8@xps> References: <1513175370-16583-1-git-send-email-matan@mellanox.com> <20171219092017.532d596f@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: Stephen Hemminger , Adrien Mazarguil , Gaetan Rivet , dev@dpdk.org To: Matan Azrad 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) In-Reply-To: List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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)