From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f65.google.com (mail-wm0-f65.google.com [74.125.82.65]) by dpdk.org (Postfix) with ESMTP id A485C9E7 for ; Wed, 15 Feb 2017 12:39:59 +0100 (CET) Received: by mail-wm0-f65.google.com with SMTP id r18so7757757wmd.3 for ; Wed, 15 Feb 2017 03:39:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=dO3cvaN+aFONAnp2OBBxvfeTSsW5VAKnWkQpXp/JD2Q=; b=kLPULvIaR5tgADeXqupMdC6qw4WIARpauIfwKrPqiP6o+s7StWiKz33Iqxkc4fwEei 4Xz+UXwYUZzZD1fURFw7RebVsWoKbLPZP7SrqBngxoN1mqBBi89MSMCcH0QpJPYXs4QN FF1KCxRUapiCN5ejhW6ovVE9Ihm6nd5t3Djfdnlezq97Dvqf1LNzU4b69r4qvLp4FjUh x5NLv+t+byKxv2rnbeMYRY4IQJxxIcnrOlW44W0ejsTwAR5AxS6UNRVljudcvc4TxDj/ jpoFcdZVAinlesMI8y+kPiPfiD5EA9xmVFHx36QDVNDAjXff67DegFunPEoMIQ8i4cOb m3ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=dO3cvaN+aFONAnp2OBBxvfeTSsW5VAKnWkQpXp/JD2Q=; b=WELUDSMnYu3j9NzY4bxyctQ5HGG4RW1FCgUhwnEulGTSCo3FTpCJZnLb/T++g+ByN4 FzxAdqV+HxMRiKFW+srcghOXQsRvm/Sk9rIgS2ewadaAM3tsNUi446oNL/1ABfCyEbTN WTb/50714VcpIoiuCB2icx2GtbWj7+X7ga5K0mkxeHqP+XhjfLpyp9xdJh2b6LPtjP+s zXUAXnrTuD7LrZAQXBXt/9D1qPd6QCuWfInDYaeQG73c5ce2sGqsBUhQjOBZUqeWVYxV DBjchKOTYADO+zsOx8TqV8b8+h0c3shP6PfwJYNZ2y1P9G7BV+irxKbMdWa76TVXjPtS vWSQ== X-Gm-Message-State: AMke39nmdSYHes5YNSbTCR6c3Rg/ivNzQP2u7o4hcrn+UIvVdlL9ybywTnXN2c9hUFaPcpmFPB2MvV6SMNtLrA== X-Received: by 10.28.102.67 with SMTP id a64mr7961442wmc.140.1487158799463; Wed, 15 Feb 2017 03:39:59 -0800 (PST) MIME-Version: 1.0 Sender: jblunck@gmail.com Received: by 10.28.211.20 with HTTP; Wed, 15 Feb 2017 03:39:58 -0800 (PST) In-Reply-To: <4461200.YtTWm2ltHQ@xps13> References: <1484748329-5418-1-git-send-email-shreyansh.jain@nxp.com> <1484801117-779-13-git-send-email-thomas.monjalon@6wind.com> <4461200.YtTWm2ltHQ@xps13> From: Jan Blunck Date: Wed, 15 Feb 2017 12:39:58 +0100 X-Google-Sender-Auth: Gr7dznmkXYpFomnfEl2WxuCxQCg Message-ID: To: Thomas Monjalon Cc: Shreyansh Jain , dev Content-Type: text/plain; charset=UTF-8 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:39:59 -0000 On Wed, Feb 15, 2017 at 12:26 PM, Thomas Monjalon wrote: > 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. Which raises the question of which separator to use. There are some buses like "xen" and "xen-backend" that might clash with a simple prefix. Also it makes is awkward to use for the case where the user is iterating over OS filesystem data structures (directories and files): the user probably has busname and device identification already separate and needs to snprintf() into another buffer for our API just for us to call sscanf() to extract the busname ... > How do you imagine the full devargs? I'll send a patch.