Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/3116/?format=api
http://patches.dpdk.org/api/patches/3116/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20150210172343.3fb6d3fe@uryu.home.lan/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20150210172343.3fb6d3fe@uryu.home.lan>", "list_archive_url": "https://inbox.dpdk.org/dev/20150210172343.3fb6d3fe@uryu.home.lan", "date": "2015-02-11T01:23:43", "name": "[dpdk-dev,1/4] pci: allow access to PCI config space", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "ddac01f07b3f8769cb8d7d26e2b70de3e52b0278", "submitter": { "id": 27, "url": "http://patches.dpdk.org/api/people/27/?format=api", "name": "Stephen Hemminger", "email": "stephen@networkplumber.org" }, "delegate": null, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20150210172343.3fb6d3fe@uryu.home.lan/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/3116/comments/", "check": "pending", "checks": "http://patches.dpdk.org/api/patches/3116/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@dpdk.org", "Delivered-To": "patchwork@dpdk.org", "Received": [ "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 95F353208;\n\tWed, 11 Feb 2015 02:23:49 +0100 (CET)", "from mail-pa0-f52.google.com (mail-pa0-f52.google.com\n\t[209.85.220.52]) by dpdk.org (Postfix) with ESMTP id 9ABAD903\n\tfor <dev@dpdk.org>; Wed, 11 Feb 2015 02:23:47 +0100 (CET)", "by mail-pa0-f52.google.com with SMTP id ey11so654892pad.11\n\tfor <dev@dpdk.org>; Tue, 10 Feb 2015 17:23:46 -0800 (PST)", "from uryu.home.lan ([144.49.132.22])\n\tby mx.google.com with ESMTPSA id\n\tq4sm20559578pdm.88.2015.02.10.17.23.45\n\t(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tTue, 10 Feb 2015 17:23:46 -0800 (PST)" ], "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to\n\t:references:mime-version:content-type:content-transfer-encoding;\n\tbh=gUT05nTVadqi5mphBmQ0hlgbFPmJrNvwTWwirM6k13A=;\n\tb=IppNTBQQ7VBP8gu3+Ir14IwSxxQ3ivMRdDHPG9/Yo8zsvjID85qc85Kl3xKI6elHcb\n\tyNfWq0uOUHqq3nZ8k2xLjc5iqSdpIJyvm4Y7bFOknNKXh+31/PQs1MpH2PGs5nNTVerg\n\tqSRhp4odaBjkq1arNuOVTG13F267OSb7+XgcLECkqBtpj+MPmobC1jMXaFJtD/Yyi1jl\n\thDazWpmAtnrOS5Ne2p49u133LgBBhBCk3KNMg9EmD19Kk9cPqmq+GRX6lcQrJwow3Qt8\n\tmLF77CyEeSXnadIaK/wnlg2zXHV6ELJQk31d1mI0Itt6emSSAw92n8jv7xa0DZDnsLK+\n\t9a7w==", "X-Gm-Message-State": "ALoCoQmh0s+V/mpHTbIJyJBp/Pkx7Xp5brNjAR6mWMKHjfz5fLHzkcO+kJOeopVR0YhLq5UB1bUG", "X-Received": "by 10.70.22.66 with SMTP id b2mr42553251pdf.9.1423617826493;\n\tTue, 10 Feb 2015 17:23:46 -0800 (PST)", "Date": "Tue, 10 Feb 2015 17:23:43 -0800", "From": "Stephen Hemminger <stephen@networkplumber.org>", "To": "David Marchand <david.marchand@6wind.com>", "Message-ID": "<20150210172343.3fb6d3fe@uryu.home.lan>", "In-Reply-To": "<c058fdefd5564f3f96bd21593c9ea19a@BRMWP-EXMB11.corp.brocade.com>", "References": "<1423247795-22399-1-git-send-email-stephen@networkplumber.org>\n\t<1423247795-22399-2-git-send-email-stephen@networkplumber.org>\n\t<c058fdefd5564f3f96bd21593c9ea19a@BRMWP-EXMB11.corp.brocade.com>", "X-Mailer": "Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu)", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=US-ASCII", "Content-Transfer-Encoding": "7bit", "Cc": "\"dev@dpdk.org\" <dev@dpdk.org>, Stephen Hemminger <shemming@Brocade.com>", "Subject": "Re: [dpdk-dev] [PATCH 1/4] pci: allow access to PCI config space", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.15", "Precedence": "list", "List-Id": "patches and discussions about DPDK <dev.dpdk.org>", "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://dpdk.org/ml/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Here is a revised version that works for both UIO and VFIO.\nThe config access is property of device not the I/O model.\n\nFrom: Stephen Hemminger <stephen@networkplumber.org>\nSubject: [PATCH 1/4] pci: allow access to PCI config space\n\nSome drivers need ability to access PCI config (for example for power\nmanagement). This adds an abstraction to do this; only implemented\non Linux, but should be possible on BSD.\n\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>\n---\n lib/librte_eal/common/include/rte_pci.h | 29 +++++++++++++++++++++++++++++\n lib/librte_eal/linuxapp/eal/eal_pci.c | 15 +++++++++++++++\n lib/librte_eal/linuxapp/eal/eal_pci_uio.c | 10 ++++++++++\n 3 files changed, 54 insertions(+)", "diff": "Index: dpdk/lib/librte_eal/common/include/rte_pci.h\n===================================================================\n--- dpdk.orig/lib/librte_eal/common/include/rte_pci.h\t2015-02-10 15:58:53.915744256 -0800\n+++ dpdk/lib/librte_eal/common/include/rte_pci.h\t2015-02-10 15:58:53.911744221 -0800\n@@ -152,6 +152,7 @@\n \tuint16_t max_vfs; /**< sriov enable if not zero */\n \tint numa_node; /**< NUMA node connection */\n \tstruct rte_devargs *devargs; /**< Device user arguments */\n+\tint config_fd;\t\t\t\t/**< PCI config access */\n };\n \n /** Any PCI device identifier (vendor, device, ...) */\n@@ -304,6 +305,34 @@\n */\n void rte_eal_pci_unregister(struct rte_pci_driver *driver);\n \n+/**\n+ * Read PCI config space.\n+ *\n+ * @param device\n+ * A pointer to a rte_pci_device structure describing the device\n+ * to use\n+ * @param buf\n+ * A data buffer where the bytes should be read into\n+ * @param size\n+ * The length of the data buffer.\n+ */\n+int rte_eal_pci_read_config(const struct rte_pci_device *device,\n+\t\t\t void *buf, size_t len, off_t offset);\n+\n+/**\n+ * Write PCI config space.\n+ *\n+ * @param device\n+ * A pointer to a rte_pci_device structure describing the device\n+ * to use\n+ * @param buf\n+ * A data buffer containing the bytes should be written\n+ * @param size\n+ * The length of the data buffer.\n+ */\n+int rte_eal_pci_write_config(const struct rte_pci_device *device,\n+\t\t\t const void *buf, size_t len, off_t offset);\n+\n #ifdef __cplusplus\n }\n #endif\nIndex: dpdk/lib/librte_eal/linuxapp/eal/eal_pci.c\n===================================================================\n--- dpdk.orig/lib/librte_eal/linuxapp/eal/eal_pci.c\t2015-02-10 15:58:53.915744256 -0800\n+++ dpdk/lib/librte_eal/linuxapp/eal/eal_pci.c\t2015-02-10 15:59:46.564201569 -0800\n@@ -34,6 +34,7 @@\n #include <string.h>\n #include <dirent.h>\n #include <sys/mman.h>\n+#include <sys/fcntl.h>\n \n #include <rte_log.h>\n #include <rte_pci.h>\n@@ -233,6 +234,7 @@\n \tdev->addr.bus = bus;\n \tdev->addr.devid = devid;\n \tdev->addr.function = function;\n+\tdev->config_fd = -1;\n \n \t/* get vendor id */\n \tsnprintf(filename, sizeof(filename), \"%s/vendor\", dirname);\n@@ -498,6 +500,26 @@\n #endif\n \n static int\n+pci_config_open(struct rte_pci_device *dev)\n+{\n+\tstruct rte_pci_addr *loc = &dev->addr;\n+\tchar filename[PATH_MAX];\n+\n+\t/* Open fd for access to PCI config */\n+\tsnprintf(filename, sizeof(filename),\n+\t\t SYSFS_PCI_DEVICES \"/\" PCI_PRI_FMT \"/config\",\n+\t\t loc->domain, loc->bus, loc->devid, loc->function);\n+\tdev->config_fd = open(filename, O_RDWR);\n+\tif (dev->config_fd < 0) {\n+\t\tRTE_LOG(ERR, EAL, \"%s(): cannot open %s: %s\\n\",\n+\t\t\t__func__, filename, strerror(errno));\n+\t\treturn -1;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+static int\n pci_map_device(struct rte_pci_device *dev)\n {\n \tint ret, mapped = 0;\n@@ -518,7 +540,8 @@\n \t\tif (ret != 0)\n \t\t\treturn ret;\n \t}\n-\treturn 0;\n+\n+\treturn pci_config_open(dev);\n }\n \n /*\n@@ -595,6 +618,20 @@\n \treturn 1;\n }\n \n+/* Read PCI config space. */\n+int rte_eal_pci_read_config(const struct rte_pci_device *device,\n+\t\t\t void *buf, size_t len, off_t offset)\n+{\n+\treturn pread(device->config_fd, buf, len, offset);\n+}\n+\n+/* Write PCI config space. */\n+int rte_eal_pci_write_config(const struct rte_pci_device *device,\n+\t\t\t const void *buf, size_t len, off_t offset)\n+{\n+\treturn pwrite(device->config_fd, buf, len, offset);\n+}\n+\n /* Init the PCI EAL subsystem */\n int\n rte_eal_pci_init(void)\n", "prefixes": [ "dpdk-dev", "1/4" ] }{ "id": 3116, "url": "