Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/12135/?format=api
http://patches.dpdk.org/api/patches/12135/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/1461152657-19969-14-git-send-email-david.marchand@6wind.com/", "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": "<1461152657-19969-14-git-send-email-david.marchand@6wind.com>", "list_archive_url": "https://inbox.dpdk.org/dev/1461152657-19969-14-git-send-email-david.marchand@6wind.com", "date": "2016-04-20T11:44:13", "name": "[dpdk-dev,v2,13/17] pci: add a helper to update a device", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "e6db09891f49ade86efac9fcd981908a21dc4787", "submitter": { "id": 3, "url": "http://patches.dpdk.org/api/people/3/?format=api", "name": "David Marchand", "email": "david.marchand@6wind.com" }, "delegate": { "id": 1, "url": "http://patches.dpdk.org/api/users/1/?format=api", "username": "tmonjalo", "first_name": "Thomas", "last_name": "Monjalon", "email": "thomas@monjalon.net" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/1461152657-19969-14-git-send-email-david.marchand@6wind.com/mbox/", "series": [], "comments": "http://patches.dpdk.org/api/patches/12135/comments/", "check": "pending", "checks": "http://patches.dpdk.org/api/patches/12135/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 584375927;\n\tWed, 20 Apr 2016 13:44:42 +0200 (CEST)", "from mail-wm0-f47.google.com (mail-wm0-f47.google.com\n\t[74.125.82.47]) by dpdk.org (Postfix) with ESMTP id 7089C5689\n\tfor <dev@dpdk.org>; Wed, 20 Apr 2016 13:44:36 +0200 (CEST)", "by mail-wm0-f47.google.com with SMTP id u206so76784571wme.1\n\tfor <dev@dpdk.org>; Wed, 20 Apr 2016 04:44:36 -0700 (PDT)", "from gloops.dev.6wind.com (144.77.126.78.rev.sfr.net.\n\t[78.126.77.144]) by smtp.gmail.com with ESMTPSA id\n\tm6sm5195708wje.21.2016.04.20.04.44.35\n\t(version=TLSv1/SSLv3 cipher=OTHER);\n\tWed, 20 Apr 2016 04:44:35 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=6wind-com.20150623.gappssmtp.com; s=20150623;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=AEadDgBmMlYXivw4Y7u73S/6SCKCZ27mMigT0jxx5+A=;\n\tb=fFhXoHQ3A8t+vfRtNHQZsdJfCUhLlfwXTPBhIJw2BEUtKvM5g0nCz5/GLVRvXvLqmR\n\tgLlDbIWodGrwPmsmG4RP1NyhQwz4rV+kn5BzR8b70lm82w92MJnTGgL9Xy5KR6pr7BPV\n\trUuUYL8TER4hIzAFp9kooSeUdRjoxjAc04MuWDRF/HBTUv4IsobaIzFVCEUGWpwK+GTp\n\tVU0pLqYTDXBqXgKhVy08Z+tAlwXZO4vE5OxOYJhTpEtVxcMpSV82TQ63YR4lUVZXw7h7\n\tt9KjFMExWQE7oYuIz2OtYR7U1HuCons0C3q2RzA8WBJFzkOgRJRgImwg29PvBuNTey9a\n\tTGjg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20130820;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=AEadDgBmMlYXivw4Y7u73S/6SCKCZ27mMigT0jxx5+A=;\n\tb=lohGj3kaqte92QsFnk0ulJ++1cFXSHmkyGAiH/trfHUuy79h5G/0ULB5EvlX/rlrYT\n\tXBrlsrImFgLSxXRcR6WaCo+y/OnSiY0xWcI53TPJhiiQHfu1nzXldgL1OzLCQtDyoqi9\n\t/sV/noOusY2+uMAELmiUr6gaz7mgAyehvZjEHg9u+bvLHqE2IoSWes2ATjrAzfKk+hM/\n\t82vUQpp+T2vuFeO/MsQsb3+/rCM7tvFq0vNzHnTyw1UMXzMcqvhBEK4iAQx0R2ufM2PF\n\tQSejwN5q1OBuyjpwe48Unn2n29aeWb/MgZDKJ8SNs27SgEptFC9Q6uf7XopiQyfDoKaz\n\tgZkQ==", "X-Gm-Message-State": "AOPr4FUK01d8jn8Vo8O2yyjVIKOn7nr/UUjVTEctWFpkywS7xFoffcGRBMYuRDfhSbwHHW6I", "X-Received": "by 10.194.21.65 with SMTP id t1mr8353974wje.12.1461152676247;\n\tWed, 20 Apr 2016 04:44:36 -0700 (PDT)", "From": "David Marchand <david.marchand@6wind.com>", "To": "dev@dpdk.org", "Cc": "thomas.monjalon@6wind.com,\n\tviktorin@rehivetech.com", "Date": "Wed, 20 Apr 2016 13:44:13 +0200", "Message-Id": "<1461152657-19969-14-git-send-email-david.marchand@6wind.com>", "X-Mailer": "git-send-email 1.9.1", "In-Reply-To": "<1461152657-19969-1-git-send-email-david.marchand@6wind.com>", "References": "<1454076516-21591-1-git-send-email-david.marchand@6wind.com>\n\t<1461152657-19969-1-git-send-email-david.marchand@6wind.com>", "Subject": "[dpdk-dev] [PATCH v2 13/17] pci: add a helper to update a device", "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": "This helper updates a pci device object with latest information it can\nfind.\nIt will be used mainly for hotplug code.\n\nSigned-off-by: David Marchand <david.marchand@6wind.com>\n---\n lib/librte_eal/bsdapp/eal/eal_pci.c | 49 +++++++++++++++++++++++++++++++++++\n lib/librte_eal/common/eal_private.h | 13 ++++++++++\n lib/librte_eal/linuxapp/eal/eal_pci.c | 13 ++++++++++\n 3 files changed, 75 insertions(+)", "diff": "diff --git a/lib/librte_eal/bsdapp/eal/eal_pci.c b/lib/librte_eal/bsdapp/eal/eal_pci.c\nindex cd8e8d3..85e49f6 100644\n--- a/lib/librte_eal/bsdapp/eal/eal_pci.c\n+++ b/lib/librte_eal/bsdapp/eal/eal_pci.c\n@@ -401,6 +401,55 @@ error:\n \treturn -1;\n }\n \n+int\n+pci_update_device(const struct rte_pci_addr *addr)\n+{\n+\tint fd;\n+\tstruct pci_conf matches[2];\n+\tstruct pci_match_conf match = {\n+\t\t.pc_sel = {\n+\t\t\t.pc_domain = addr->domain,\n+\t\t\t.pc_bus = addr->bus,\n+\t\t\t.pc_dev = addr->devid,\n+\t\t\t.pc_func = addr->function,\n+\t\t},\n+\t};\n+\tstruct pci_conf_io conf_io = {\n+\t\t.pat_buf_len = 0,\n+\t\t.num_patterns = 1,\n+\t\t.patterns = &match,\n+\t\t.match_buf_len = sizeof(matches),\n+\t\t.matches = &matches[0],\n+\t};\n+\n+\tfd = open(\"/dev/pci\", O_RDONLY);\n+\tif (fd < 0) {\n+\t\tRTE_LOG(ERR, EAL, \"%s(): error opening /dev/pci\\n\", __func__);\n+\t\tgoto error;\n+\t}\n+\n+\tif (ioctl(fd, PCIOCGETCONF, &conf_io) < 0) {\n+\t\tRTE_LOG(ERR, EAL, \"%s(): error with ioctl on /dev/pci: %s\\n\",\n+\t\t\t\t__func__, strerror(errno));\n+\t\tgoto error;\n+\t}\n+\n+\tif (conf_io.num_matches != 1)\n+\t\tgoto error;\n+\n+\tif (pci_scan_one(fd, &matches[0]) < 0)\n+\t\tgoto error;\n+\n+\tclose(fd);\n+\n+\treturn 0;\n+\n+error:\n+\tif (fd >= 0)\n+\t\tclose(fd);\n+\treturn -1;\n+}\n+\n /* Read PCI config space. */\n int rte_eal_pci_read_config(const struct rte_pci_device *dev,\n \t\t\t void *buf, size_t len, off_t offset)\ndiff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h\nindex 855fd25..81816a6 100644\n--- a/lib/librte_eal/common/eal_private.h\n+++ b/lib/librte_eal/common/eal_private.h\n@@ -155,6 +155,19 @@ struct rte_pci_driver;\n struct rte_pci_device;\n \n /**\n+ * Update a pci device object by asking the kernel for the latest information.\n+ *\n+ * This function is private to EAL.\n+ *\n+ * @param addr\n+ *\tThe PCI Bus-Device-Function address to look for\n+ * @return\n+ * - 0 on success.\n+ * - negative on error.\n+ */\n+int pci_update_device(const struct rte_pci_addr *addr);\n+\n+/**\n * Unbind kernel driver for this device\n *\n * This function is private to EAL.\ndiff --git a/lib/librte_eal/linuxapp/eal/eal_pci.c b/lib/librte_eal/linuxapp/eal/eal_pci.c\nindex 3fc82b0..61ac21f 100644\n--- a/lib/librte_eal/linuxapp/eal/eal_pci.c\n+++ b/lib/librte_eal/linuxapp/eal/eal_pci.c\n@@ -393,6 +393,19 @@ pci_scan_one(const char *dirname, uint16_t domain, uint8_t bus,\n \treturn 0;\n }\n \n+int\n+pci_update_device(const struct rte_pci_addr *addr)\n+{\n+\tchar filename[PATH_MAX];\n+\n+\tsnprintf(filename, sizeof(filename), \"%s/\" PCI_PRI_FMT,\n+\t\t SYSFS_PCI_DEVICES, addr->domain, addr->bus, addr->devid,\n+\t\t addr->function);\n+\n+\treturn pci_scan_one(filename, addr->domain, addr->bus, addr->devid,\n+\t\t\t addr->function);\n+}\n+\n /*\n * split up a pci address into its constituent parts.\n */\n", "prefixes": [ "dpdk-dev", "v2", "13/17" ] }{ "id": 12135, "url": "