From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yahui Cao Subject: Re: [PATCH] bus/vdev: add warning for duplicated vdev name Date: Fri, 21 Dec 2018 14:57:57 +0800 Message-ID: <20181221065757.GA24082@jim-aorus> References: <20181129071608.20820-1-yahui.cao@intel.com> <1682296.hbgUrQPOuL@xps> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org, ferruh.yigit@intel.com, tiwei.bie@intel.com To: Thomas Monjalon Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 2226F1BD41 for ; Fri, 21 Dec 2018 07:59:49 +0100 (CET) Content-Disposition: inline In-Reply-To: <1682296.hbgUrQPOuL@xps> 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 Wed, Dec 19, 2018 at 03:26:36AM +0100, Thomas Monjalon wrote: > 29/11/2018 08:16, Yahui Cao: > > If duplicated vdev name is detected, print out a warning message. > > > > Signed-off-by: Yahui Cao > > --- > > drivers/bus/vdev/vdev.c | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c > > index 9c66bdc78..ff2db7d3f 100644 > > --- a/drivers/bus/vdev/vdev.c > > +++ b/drivers/bus/vdev/vdev.c > > @@ -462,6 +462,8 @@ vdev_scan(void) > > if (find_vdev(devargs->name)) { > > rte_spinlock_recursive_unlock(&vdev_device_list_lock); > > free(dev); > > + VDEV_LOG(WARNING, "duplicated vdev name %s detected!", > > + devargs->name); > > continue; > > } > > I'm surprised there is nothing to prevent from creating 2 vdevs > with the same name. It should be considered as an error > and reject the vdev creation. > > Actually it does skip the creation of vdev with the same name. Is it enough to return error from vdev_scan(), or even return error from rte_bus_scan()? Please give some advice.