From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH v3 1/6] ethdev: add devop to check removal status Date: Tue, 19 Dec 2017 09:20:17 -0800 Message-ID: <20171219092017.532d596f@xeon-e3> References: <1513175370-16583-1-git-send-email-matan@mellanox.com> <1513703415-29145-1-git-send-email-matan@mellanox.com> <1513703415-29145-2-git-send-email-matan@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: Adrien Mazarguil , Thomas Monjalon , Gaetan Rivet , dev@dpdk.org To: Matan Azrad Return-path: Received: from mail-pl0-f46.google.com (mail-pl0-f46.google.com [209.85.160.46]) by dpdk.org (Postfix) with ESMTP id E20CF1B03D for ; Tue, 19 Dec 2017 18:20:20 +0100 (CET) Received: by mail-pl0-f46.google.com with SMTP id i6so7363167plt.13 for ; Tue, 19 Dec 2017 09:20:20 -0800 (PST) In-Reply-To: <1513703415-29145-2-git-send-email-matan@mellanox.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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?