From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f178.google.com (mail-wr0-f178.google.com [209.85.128.178]) by dpdk.org (Postfix) with ESMTP id 827DC37B0 for ; Wed, 15 Feb 2017 12:26:10 +0100 (CET) Received: by mail-wr0-f178.google.com with SMTP id c4so30903106wrd.2 for ; Wed, 15 Feb 2017 03:26:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:user-agent:in-reply-to :references:mime-version:content-transfer-encoding; bh=Cxpbgrb72Y1EHV1J8P5+eam8kCBCIwWH5cYKt5sU+hk=; b=Gq/GCMBNHmY8/V3Tq8lRaX28e1hAxQTMN7vNf8yhE7P1TXHdEBQcPC62J17nBw9YGV LinUJuOaTkR6grgfE1jco2IRFh5AfBqHZTtsU8vomi6uhs02E+HoUVaJIBTklpzCzFye kZd/3N8UVesZZykWmJjB7uTMEBk7Mpq3mpEZ+1m9OW57egLugWhRWNWy2WVYY4MqI2+c AhDGc1paTlQx+zHqzSRRuU6PhZv7jEAZOtBOpOuV4KeOIzUxvlshafL3/ggp92L3bvSZ o5X3rJ+N/ioGY5qmHlJHLCDrU34brpemoDzBXzxGh9T4oKxPBzUVxhf7buEUz4UBM/0t oKeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:user-agent :in-reply-to:references:mime-version:content-transfer-encoding; bh=Cxpbgrb72Y1EHV1J8P5+eam8kCBCIwWH5cYKt5sU+hk=; b=bq8SAn5bXyuch+Gj5ITql9WtGvfuuiRJ4p6DMoDlfELrf9bYA+rHgTT0uO2nsmCJkI FzOb6NjubYJ7X5Il4Rl8DztHTrLRpBc37wZi8oQFhbIzKs79CPMtNAp/55nWO7mT4daD mPJTu3qVZHbuAzxbngtXwj4OlqyE2CJtOt2fFgxBDl65HvbTSC5c2rL7lho2WQ8Wuyc4 5KstA3Dj90m9TWNDRNTFejSXGD6OMFQpBJzEoxo7dMvhbclZ5YSkw5THgV8gjAJP0xw6 HQ/9I1DswusoaVolRvpW7RhUP2SNC2lt2L4/HWY4PqMsICEwJL0SafHTx6xHaMC3CR8M p9bg== X-Gm-Message-State: AMke39mTva2gs2Sx9A7/tOp79p8VziXdcZ/LlxMBBKZQAyjpnPHmcctOF1G9nlSJA9o0LjQh X-Received: by 10.223.151.138 with SMTP id s10mr28545965wrb.65.1487157970260; Wed, 15 Feb 2017 03:26:10 -0800 (PST) Received: from xps13.localnet (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id n13sm4497239wrn.40.2017.02.15.03.26.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Feb 2017 03:26:09 -0800 (PST) From: Thomas Monjalon To: Jan Blunck Cc: Shreyansh Jain , dev@dpdk.org Date: Wed, 15 Feb 2017 12:26:08 +0100 Message-ID: <4461200.YtTWm2ltHQ@xps13> User-Agent: KMail/4.14.10 (Linux/4.5.4-1-ARCH; KDE/4.14.11; x86_64; ; ) In-Reply-To: References: <1484748329-5418-1-git-send-email-shreyansh.jain@nxp.com> <1484801117-779-13-git-send-email-thomas.monjalon@6wind.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-dev] [PATCH v11 12/13] pci: use bus driver for attach/detach 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: Wed, 15 Feb 2017 11:26:10 -0000 2017-02-15 12:08, Jan Blunck: > > int rte_eal_dev_attach(const char *name, const char *devargs) > > { > > - struct rte_pci_addr addr; > > + int ret = 1; > > + struct rte_bus *bus; > > > > if (name == NULL || devargs == NULL) { > > RTE_LOG(ERR, EAL, "Invalid device or arguments provided\n"); > > return -EINVAL; > > } > > > > - if (eal_parse_pci_DomBDF(name, &addr) == 0) { > > - if (rte_eal_pci_probe_one(&addr) < 0) > > + FOREACH_BUS(bus) { > > + if (!bus->attach) { > > + RTE_LOG(DEBUG, EAL, "Bus (%s) doesn't implement" > > + " attach.\n", bus->name); > > + continue; > > + } > > + ret = bus->attach(name); > > Enforcing a globally unique naming scheme for the low-level device > makes this complicated for users. There are buses that enumerate the > devices just by an integer so we will have conflicts. > > I think it is better to change the signature of rte_eal_dev_attach() > instead and find the correct bus based on its name. Also I believe the > API is more user friendly if we pass the complete (raw) devargs string > instead of the name/args pair. I thought we could have a bus prefix in the name so there is no conflict. How do you imagine the full devargs? > > + if (!ret) /* device successfully attached */ > > + return ret; > > + if (ret > 0) /* device not found on bus */ > > + continue; > > + else > > goto err; > > + } >