From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id EFB5D4C6C for ; Fri, 9 Nov 2018 08:35:27 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Nov 2018 23:35:27 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,482,1534834800"; d="scan'208";a="102889606" Received: from jguo15x-mobl.ccr.corp.intel.com (HELO [10.67.68.85]) ([10.67.68.85]) by fmsmga002.fm.intel.com with ESMTP; 08 Nov 2018 23:35:24 -0800 To: Stephen Hemminger Cc: ferruh.yigit@intel.com, konstantin.ananyev@intel.com, anatoly.burakov@intel.com, thomas@monjalon.net, bernard.iremonger@intel.com, dev@dpdk.org, helin.zhang@intel.com, gaetan.rivet@6wind.com, qi.z.zhang@intel.com, arybchenko@solarflare.com, bruce.richardson@intel.com, matan@mellanox.com, shaopeng.he@intel.com References: <1541583691-145432-1-git-send-email-jia.guo@intel.com> <1541583691-145432-2-git-send-email-jia.guo@intel.com> <20181107113229.664d0696@shemminger-XPS-13-9360> From: Jeff Guo Message-ID: <1977cc81-7717-70d5-670b-784c3f8f7a4f@intel.com> Date: Fri, 9 Nov 2018 15:35:24 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20181107113229.664d0696@shemminger-XPS-13-9360> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Subject: Re: [dpdk-dev] [PATCH 1/2] eal: expose device states in rte device 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: Fri, 09 Nov 2018 07:35:28 -0000 On 11/8/2018 3:32 AM, Stephen Hemminger wrote: > On Wed, 7 Nov 2018 17:41:30 +0800 > Jeff Guo wrote: > >> Since the hotplug API and device event API have make public, so in order >> to let applications or driver deal with device directly, it would be >> helpful if the states of device could be exposed, especially for hotplug >> process. >> >> This patch will add some devices states in rte device structure >> to recode the device's current status, such as “RTE_DEV_UNUSED”, >> “RTE_DEV_ATTACHED” and “RTE_DEV_REMOVED”. >> >> Signed-off-by: Jeff Guo > Looks good. > > I did spot a couple of minor nits you might want to address if > resending this. > > >> --- >> lib/librte_eal/common/include/rte_dev.h | 13 +++++++++++++ >> 1 file changed, 13 insertions(+) >> >> diff --git a/lib/librte_eal/common/include/rte_dev.h b/lib/librte_eal/common/include/rte_dev.h >> index cd6c187..1bab0dd 100644 >> --- a/lib/librte_eal/common/include/rte_dev.h >> +++ b/lib/librte_eal/common/include/rte_dev.h >> @@ -151,6 +151,18 @@ struct rte_driver { >> #define RTE_DEV_NAME_MAX_LEN 64 >> >> /** >> + * Possible states of an rte devcie. >> + */ > s/devcie/device/ got it. >> +enum rte_dev_state { >> + /** Device is unused before being hotplug add. */ >> + RTE_DEV_UNUSED = 0, >> + /** Device is attached when allocated in probing. */ >> + RTE_DEV_ATTACHED, >> + /** Device is in removed state when plug-out is detected. */ >> + RTE_DEV_REMOVED, >> +}; >> + >> +/** >> * A structure describing a generic device. >> */ >> struct rte_device { >> @@ -160,6 +172,7 @@ struct rte_device { >> const struct rte_bus *bus; /**< Bus handle assigned on scan */ >> int numa_node; /**< NUMA node connection */ >> struct rte_devargs *devargs; /**< Arguments for latest probing */ >> + enum rte_dev_state state; /**< Flag indicating the device state */ > Why not align comment with other fields here? ok, maybe i could split the line if considerate with the line number limit. >> }; >> >> /**