From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f52.google.com (mail-pg0-f52.google.com [74.125.83.52]) by dpdk.org (Postfix) with ESMTP id 125B8FA78 for ; Fri, 3 Mar 2017 18:38:19 +0100 (CET) Received: by mail-pg0-f52.google.com with SMTP id 25so46125564pgy.0 for ; Fri, 03 Mar 2017 09:38:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WmPOy8BTGtEdvMKrubmqTjEbOzhxYrMstD5PB1VeBzc=; b=1ZcDQhoUqgm2dG4HymHnXLCoMzN6y2j2xoW7W17obFdZtn56qEJBpEFDFj8Z//kO/U O8l6OadEXv7hRSAxILCNRQRtHXvvtBAOvyWLaw32Q4YfPnClDEcjXQYCemugmEAaKoUx i/1/3YEZY//73Jy/hWOQxPrFhZ2KBza4tOaYSIjjAUnE5McI5SmbNvb7MfXO0GxtLqKa /JcY249Hf169Mind2RTGh54QlXJ+pZu6p7QQ7mpAlhtaWpT8iQiIZg+46GLteMXOjgED BBbSD3mSj638dPtSHuxnGSZRVXcDFr+Qdcvjq/oVBgBLKEP9AhU+KhMHO/aVEgWV8LyV aUQQ== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=WmPOy8BTGtEdvMKrubmqTjEbOzhxYrMstD5PB1VeBzc=; b=rW/h2rtkP6tWOrL0SQ0SXYQExWzDMGHckvZTxKwz9ibd3r2ngIAzxy3mtYL0Y/XWsu BQo7UCgdW+hebCbLWmwjDmOJu7UgWrChlis26TY6IsibXwjONt2rDCWGMJe09WSL2G0j ctKcfA37sYoLPIyGgeTWyZxCKoG0h0f7BdEEoGYHuipYnwiluihJgwqpvmPS4PcN6RJJ k7jZUBmigYTTGbKXrNJ5APMu2A6iyiSF/MHOgwNwq80wNMj0bwZbMWNDsOqU3GTNwYl6 ujY3v0EJk+EBPTt6T09G7ji6adzm7VQkQh3yye+W3a2VPCTkVZHmQ7Lg7dc0yEi8+vsL vi/Q== X-Gm-Message-State: AMke39n74Mz3ZvCHYxRRyaSMgKjGwRwJXk7Z87irJwp/b0bFjoo9X+GbhBUoTg9XpcY2Eg== X-Received: by 10.99.189.9 with SMTP id a9mr4795348pgf.190.1488562698328; Fri, 03 Mar 2017 09:38:18 -0800 (PST) Received: from xeon-e3 (204-195-18-65.wavecable.com. [204.195.18.65]) by smtp.gmail.com with ESMTPSA id a1sm24744257pgn.51.2017.03.03.09.38.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 03 Mar 2017 09:38:18 -0800 (PST) Date: Fri, 3 Mar 2017 09:38:11 -0800 From: Stephen Hemminger To: Gaetan Rivet Cc: dev@dpdk.org Message-ID: <20170303093811.0e770367@xeon-e3> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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: Fri, 03 Mar 2017 17:38:19 -0000 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.