From mboxrd@z Thu Jan 1 00:00:00 1970 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) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=4pLogdpy7Zm+JwUpzYdYOqGPekjQIUYHEqMQUVgcs60=; b=Ba34hysvDlIh3tQFEdZZUA54RSW3oR2fafm4na3dMQmn5aIRqp4jNrQ0PEPtlnM9Hr yF/YN3kr+72Z5RLBq4BVCiBEBoqu7Pb5EAjFoNqmD/mvd420C40Kmmpq8a0qpqCph4Ea DyuTV5cE4U6Jh+1LIDJg0FghRGJnOE9/Zy8VDo29fz5EGSIv4oFUb/gcJ5XH/R5c9SvB K3+GWLJ829fobrGpn2O71qN5DdN+kapIKeU/mVKFexTGMCDGraKgoPepBAUTyw7rAuRx Auqt4pwl/rhjk8xvULICijpwRHfD9vuaGraKy4eoxiRWTqcxv6xJ+vrI35Nk9wg/Guoe +ywQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=4pLogdpy7Zm+JwUpzYdYOqGPekjQIUYHEqMQUVgcs60=; b=BCbxnbq7z/6XaAG4a6bBtul95NvsT6KCl4wKpm4E3NVFqqciGgrBRtr+4khe0DA1Ig yE6cbfl+Ha38mFghsUu9VpSDaWK/pg1K0nPyNSEarupMVLDZlw8hebhDLddPXpat6OWF iw4568IlHnntcEMSKIHtpCQHd8ayj3idJwRpVX5uvR5XIqqDpFurcu9H0TqQcu6MGz4H pHr3cYqv/PBi+kzazTnEaaDYmffqektdZNOO6Vep6aixBvUVl/Us2hBiqJCpxKCPN9Nb O3PtNU7LeqnewarUFDKuUgYAVQcseKWqjUje+qBVxpZ0LdXPCUHiPlGJsk76lrYM9aRH 5xfQ== X-Gm-Message-State: AMke39mXg/SckwLXnA1WHujmcQKFZlrkiDi1hDWqtOv1wr5CL7qUadfhukr/ljhcIW/CLmMD X-Received: by 10.223.177.207 with SMTP id r15mr16642722wra.127.1488809961453; Mon, 06 Mar 2017 06:19:21 -0800 (PST) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id h75sm27126845wrh.37.2017.03.06.06.19.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Mar 2017 06:19:20 -0800 (PST) Date: Mon, 6 Mar 2017 15:19:13 +0100 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Stephen Hemminger Cc: dev@dpdk.org 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-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170303093811.0e770367@xeon-e3> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH 06/12] net/failsafe: add fail-safe PMD 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: Mon, 06 Mar 2017 14:19:21 -0000 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