From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet Subject: Re: [PATCH 06/12] net/failsafe: add fail-safe PMD Date: Mon, 6 Mar 2017 15:19:13 +0100 Message-ID: <20170306141912.GC908@bidouze.vm.6wind.com> References: <20170303093811.0e770367@xeon-e3> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: 8bit Cc: dev@dpdk.org To: Stephen Hemminger Return-path: Received: from mail-wr0-f181.google.com (mail-wr0-f181.google.com [209.85.128.181]) by dpdk.org (Postfix) with ESMTP id ADAE56787 for ; Mon, 6 Mar 2017 15:19:21 +0100 (CET) Received: by mail-wr0-f181.google.com with SMTP id l37so117697599wrc.1 for ; Mon, 06 Mar 2017 06:19:21 -0800 (PST) Content-Disposition: inline In-Reply-To: <20170303093811.0e770367@xeon-e3> 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 Fri, Mar 03, 2017 at 09:38:11AM -0800, Stephen Hemminger wrote: >On Fri, 3 Mar 2017 16:40:28 +0100 >Gaetan Rivet wrote: > >> + >> +static struct rte_eth_dev * >> +pci_addr_to_eth_dev(struct rte_pci_addr *addr) >> +{ >> + uint8_t pid; >> + >> + if (addr == NULL) >> + return NULL; >> + for (pid = 0; pid < RTE_MAX_ETHPORTS; pid++) { >> + struct rte_pci_addr *addr2; >> + struct rte_eth_dev *edev; >> + >> + edev = &rte_eth_devices[pid]; >> + if (edev->device == NULL || >> + edev->device->devargs == NULL) >> + continue; >> + addr2 = &edev->device->devargs->pci.addr; >> + if (rte_eal_compare_pci_addr(addr, addr2) == 0) >> + return edev; >> + } >> + return NULL; >> +} >> + >> +static int >> +pci_scan_one(struct sub_device *sdev) >> +{ >> + struct rte_devargs *da; >> + char dirname[PATH_MAX]; >> + >> + da = &sdev->devargs; >> + snprintf(dirname, sizeof(dirname), >> + "%s/" PCI_PRI_FMT, >> + pci_get_sysfs_path(), >> + da->pci.addr.domain, >> + da->pci.addr.bus, >> + da->pci.addr.devid, >> + da->pci.addr.function); >> + errno = 0; >> + if (rte_eal_pci_parse_sysfs_entry(&sdev->pci_device, >> + dirname, &da->pci.addr) < 0) { >> + if (errno == ENOENT) { >> + DEBUG("Could not scan requested device " PCI_PRI_FMT, >> + da->pci.addr.domain, >> + da->pci.addr.bus, >> + da->pci.addr.devid, >> + da->pci.addr.function); >> + } else { >> + ERROR("Error while scanning sysfs entry %s", >> + dirname); >> + return -1; >> + } >> + } else { >> + sdev->state = DEV_SCANNED; >> + } >> + return 0; >> +} > >This needs to be generic and in EAL. >A bigger problem is that it PCI specific and therefore won't work in environments >where devices are attached to different busses (SOC and Hyper-V). > >Please rework to play well with bus model. Yes I agree, I planned to do so in any case for a V2. I saw a few commits from Jan Blunck about a vdev bus[0]. Do you have other series regarding busses in mind that I should rebase upon for a better support? [0]: http://dpdk.org/ml/archives/dev/2017-March/059423.html -- Gaëtan Rivet 6WIND