From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f52.google.com (mail-wm0-f52.google.com [74.125.82.52]) by dpdk.org (Postfix) with ESMTP id C14FD160 for ; Tue, 19 Dec 2017 23:13:36 +0100 (CET) Received: by mail-wm0-f52.google.com with SMTP id r78so6504104wme.5 for ; Tue, 19 Dec 2017 14:13:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=wZ+kkbmjFm8HiSSTFekEyKH+w2KYyC5kPoD3KcVW7XM=; b=P2Siq41WZANHvpXgWnjyvokdF0ZbfYz8BPrGIdfLherUu88IP76+GndQ9h/vWLRd6t xTkxk9tei4tfcRHVFdOBYNz4ClLlLX6XrjQfI3jV3e2o9TSKUIQ0R3+4RkSd6r/Tfpwa Pz+ik9fVxxXBj7jsi+jqyJ9ZSKaR1VzPw1+EAT4LMMJiZur+bh3P57xRK6HB/JxDEnlM boPz0Qt+i4YRorthBNR1eXw8NyD7iGXLQNZ8i+mb1sMfrxxINQ3NuYochh7jOLwUdPit TyszixPLLL6BI4QmvIT+/5ZBk/rsriV8/5ncSgwJRacDWSXTlAX+Ir7ZLKzdIStQDUcg NQwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=wZ+kkbmjFm8HiSSTFekEyKH+w2KYyC5kPoD3KcVW7XM=; b=WvE3BPBf6n16KZr87X967l8RUw/lUX+kncQDSgFAgj5Vb5ELlO8VqTukJxRJnaaYYB umLtTqWNnpvvv7AKkV9J44xhZqUBGuJan3EmCV4UP5SsYGVVNq1UQ3AfUaj4IooKg+Iw BZHd3Na7O8F5zZ8lGB+8fFMMAyRZUCYawoZN55JvejlTUun1uZMhKf3AqBPd5kvJptSy yZdGeONFnIor+N6jg40YdaSIZBB916LxcSeNF1CeQWW1jTzZYfHeafSS3lm99PHa7SxX hNkk7dJGJCqn/TnnDRXlws+SqDQKyiHcJQbK3hvjJxBG3AMlTVjjPdlmpwDeJx5Dy5ZM mkkA== X-Gm-Message-State: AKGB3mIJhLsxt44NZTPTEZvK688Zw+hnjy8C+7wrJKS9SyfVHjyYWi71 FqYvpj8iOtyLAdPqe9bkrvkn/WGc X-Google-Smtp-Source: ACJfBotIHNiV6SOeCWOeYdAqVHoi/EJWu5xZLV85of/CkXvZQMPKMbUqhz81DVFvKLIAnTZxXKtCGA== X-Received: by 10.80.201.77 with SMTP id p13mr2499672edh.33.1513721616329; Tue, 19 Dec 2017 14:13:36 -0800 (PST) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id h16sm13237599edj.34.2017.12.19.14.13.34 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Dec 2017 14:13:35 -0800 (PST) Date: Tue, 19 Dec 2017 23:13:22 +0100 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Thomas Monjalon Cc: Matan Azrad , Stephen Hemminger , Adrien Mazarguil , dev@dpdk.org Message-ID: <20171219221322.stibgas3ac2yxqjk@bidouze.vm.6wind.com> References: <1513175370-16583-1-git-send-email-matan@mellanox.com> <20171219092017.532d596f@xeon-e3> <20459625.d9rBa0iXI8@xps> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20459625.d9rBa0iXI8@xps> User-Agent: NeoMutt/20170113 (1.7.2) 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 22:13:36 -0000 On Tue, Dec 19, 2017 at 09:51:10PM +0100, Thomas Monjalon wrote: > 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) > But those macros are used to return 0. While I think I see a logic behind it, I think it is surprising the API user, which is not ideal. -- Gaëtan Rivet 6WIND