get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/12152/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 12152,
    "url": "https://patches.dpdk.org/api/patches/12152/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1461156236-25349-14-git-send-email-david.marchand@6wind.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1461156236-25349-14-git-send-email-david.marchand@6wind.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1461156236-25349-14-git-send-email-david.marchand@6wind.com",
    "date": "2016-04-20T12:43:56",
    "name": "[dpdk-dev,v3,13/13] app: introduce dpdk-obj-info tool",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "d960839663171d848581ce5b07624fd9eda2023f",
    "submitter": {
        "id": 3,
        "url": "https://patches.dpdk.org/api/people/3/?format=api",
        "name": "David Marchand",
        "email": "david.marchand@6wind.com"
    },
    "delegate": {
        "id": 1,
        "url": "https://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1461156236-25349-14-git-send-email-david.marchand@6wind.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/12152/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/12152/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 75E5D590F;\n\tWed, 20 Apr 2016 14:44:21 +0200 (CEST)",
            "from mail-wm0-f43.google.com (mail-wm0-f43.google.com\n\t[74.125.82.43]) by dpdk.org (Postfix) with ESMTP id 96EF9569A\n\tfor <dev@dpdk.org>; Wed, 20 Apr 2016 14:44:17 +0200 (CEST)",
            "by mail-wm0-f43.google.com with SMTP id n3so79805650wmn.0\n\tfor <dev@dpdk.org>; Wed, 20 Apr 2016 05:44:17 -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\tj10sm5428135wjb.46.2016.04.20.05.44.16\n\t(version=TLSv1/SSLv3 cipher=OTHER);\n\tWed, 20 Apr 2016 05:44:16 -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=84IIs5Nr9Hfucab4TxS62g4YtSJn1J0Dx+gH8YHEMYk=;\n\tb=nZjjckmrCrHcGwuA7jnKiTxDqdrHOMHeRcK+ep+8EdV8WZms0neyu6hzJKpDmUbt+M\n\tpwbB3wcWwRnrJJl3MaWeE+vLe4eLACK5dW5FRgRh9SOaa7V0ANittYP5roRcyUpO2HNV\n\tyWy9Fl5VbpBr2IrgDqF6FODKUsOuZng9S5e/zpZZAN2Fy2f94HIt+FvO9KSzd4vgpVYW\n\tTu1OnmnBKprK8SfAjXGqgOEleUyRZ8rHlvuQe/R/RaklogtfpUZ6Jsn5aI6VjBcisGkW\n\tAj2VI4bl0POyRsWvPhRz4vJS/HDU/AOOPGOuqh2E/v027tUTndIsueg/VOnTgCwD0iMv\n\tx7Iw==",
        "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=84IIs5Nr9Hfucab4TxS62g4YtSJn1J0Dx+gH8YHEMYk=;\n\tb=cIqrqmdQr8YfFj5re6rOil2oybNwzoheXVNj8KC8PUHPyy7nyUK6TvT9FwrQw6IlfJ\n\tMzHG/yurWeOBZBXGdRwiT7eja3tFQkyQUEVa8VVCnYHcq+QxT1qjddpKDKTZ8VwAJ15M\n\tMK49SAPL89lFr1gCAPlikF1Xah1DGaO2TgaEjBR0n1rP+cwDRm7ecrU40xC1Exc8BzqX\n\thy9INt8Oazm9IGWMq25KaCX5taKYH0doxYninw4F525FFnV6/dXjFg0+qormcqxsM/jN\n\tVkBxntdLHFouTLVerCvUOh7DsbtmCR20uuadftJszlSVdar0j3FmSgED3YTDGTrl0sxI\n\tAk2Q==",
        "X-Gm-Message-State": "AOPr4FXrr4dt/i8PH3g0tJvIj9FLZ3AVFfQjFnLdHwWSWDUQ7QrEn3gCUMszz6ybTZrlLjcs",
        "X-Received": "by 10.194.57.100 with SMTP id h4mr8697158wjq.18.1461156257409;\n\tWed, 20 Apr 2016 05:44:17 -0700 (PDT)",
        "From": "David Marchand <david.marchand@6wind.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas.monjalon@6wind.com, stephen@networkplumber.org,\n\tbruce.richardson@intel.com, nhorman@tuxdriver.com, pmatilai@redhat.com,\n\tchristian.ehrhardt@canonical.com",
        "Date": "Wed, 20 Apr 2016 14:43:56 +0200",
        "Message-Id": "<1461156236-25349-14-git-send-email-david.marchand@6wind.com>",
        "X-Mailer": "git-send-email 1.9.1",
        "In-Reply-To": "<1461156236-25349-1-git-send-email-david.marchand@6wind.com>",
        "References": "<1453120248-28274-1-git-send-email-david.marchand@6wind.com>\n\t<1461156236-25349-1-git-send-email-david.marchand@6wind.com>",
        "Subject": "[dpdk-dev] [PATCH v3 13/13] app: introduce dpdk-obj-info tool",
        "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": "Export some useful information for startup scripts and debug.\nFor now, only pci drivers are handled.\n\nExample for a static binary:\nmarchand@gloops:~/git/dpdk$ ./build/app/dpdk-obj-info ./build/app/testpmd\npci:driver=cxgbe,flags=needmapping,lsc\npci:driver=cxgbe,id=vendor=1425,device=5400,subvendor=ffff,subdevice=ffff\npci:driver=cxgbe,id=vendor=1425,device=5401,subvendor=ffff,subdevice=ffff\npci:driver=cxgbe,id=vendor=1425,device=5402,subvendor=ffff,subdevice=ffff\n\nExample for a dso:\nmarchand@gloops:~/git/dpdk$ ./build/app/dpdk-obj-info ./build/lib/librte_pmd_ixgbe.so\npci:driver=ixgbe,flags=needmapping,lsc,detachable\npci:driver=ixgbe,id=vendor=8086,device=10b6,subvendor=ffff,subdevice=ffff\npci:driver=ixgbe,id=vendor=8086,device=1508,subvendor=ffff,subdevice=ffff\npci:driver=ixgbe,id=vendor=8086,device=10c6,subvendor=ffff,subdevice=ffff\n\nSigned-off-by: David Marchand <david.marchand@6wind.com>\n---\n app/Makefile                      |   1 +\n app/dpdk-obj-info/Makefile        |  45 +++++++++\n app/dpdk-obj-info/dpdk-obj-info.c | 188 ++++++++++++++++++++++++++++++++++++++\n 3 files changed, 234 insertions(+)\n create mode 100644 app/dpdk-obj-info/Makefile\n create mode 100644 app/dpdk-obj-info/dpdk-obj-info.c",
    "diff": "diff --git a/app/Makefile b/app/Makefile\nindex 1151e09..0461a35 100644\n--- a/app/Makefile\n+++ b/app/Makefile\n@@ -37,5 +37,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_PIPELINE) += test-pipeline\n DIRS-$(CONFIG_RTE_TEST_PMD) += test-pmd\n DIRS-$(CONFIG_RTE_LIBRTE_CMDLINE) += cmdline_test\n DIRS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += proc_info\n+DIRS-y += dpdk-obj-info\n \n include $(RTE_SDK)/mk/rte.subdir.mk\ndiff --git a/app/dpdk-obj-info/Makefile b/app/dpdk-obj-info/Makefile\nnew file mode 100644\nindex 0000000..b0f4bc7\n--- /dev/null\n+++ b/app/dpdk-obj-info/Makefile\n@@ -0,0 +1,45 @@\n+#   BSD LICENSE\n+#\n+#   Copyright 2016 6WIND S.A.\n+#\n+#   Redistribution and use in source and binary forms, with or without\n+#   modification, are permitted provided that the following conditions\n+#   are met:\n+#\n+#     * Redistributions of source code must retain the above copyright\n+#       notice, this list of conditions and the following disclaimer.\n+#     * Redistributions in binary form must reproduce the above copyright\n+#       notice, this list of conditions and the following disclaimer in\n+#       the documentation and/or other materials provided with the\n+#       distribution.\n+#     * Neither the name of 6WIND S.A. nor the names of its\n+#       contributors may be used to endorse or promote products derived\n+#       from this software without specific prior written permission.\n+#\n+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+#   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+\n+include $(RTE_SDK)/mk/rte.vars.mk\n+\n+\n+APP = dpdk-obj-info\n+\n+SRCS-y += dpdk-obj-info.c\n+\n+CFLAGS += -O3\n+CFLAGS += $(WERROR_FLAGS)\n+\n+LDLIBS += -lbfd --as-needed\n+\n+DEPDIRS-y += lib\n+\n+include $(RTE_SDK)/mk/rte.app.mk\ndiff --git a/app/dpdk-obj-info/dpdk-obj-info.c b/app/dpdk-obj-info/dpdk-obj-info.c\nnew file mode 100644\nindex 0000000..23c183d\n--- /dev/null\n+++ b/app/dpdk-obj-info/dpdk-obj-info.c\n@@ -0,0 +1,188 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright 2016 6WIND S.A.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of 6WIND S.A. nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+#include <stdio.h>\n+#include <sys/types.h>\n+#include <sys/stat.h>\n+#include <sys/mman.h>\n+#include <fcntl.h>\n+#include <stdint.h>\n+#include <stdlib.h>\n+#include <string.h>\n+#include <errno.h>\n+#include <bfd.h>\n+\n+#include <rte_pci.h>\n+\n+static char *\n+dump_flags(uint32_t flags)\n+{\n+\tstatic char buffer[sizeof(\"needmapping,lsc,detachable,\")];\n+\tint written = 0;\n+\n+\tbuffer[0] = '\\0';\n+\n+\tif (flags & RTE_PCI_DRV_NEED_MAPPING)\n+\t\twritten += snprintf(&buffer[written], sizeof(buffer) - written,\n+\t\t\t\t    \"%s,\", \"needmapping\");\n+\tif (flags & RTE_PCI_DRV_INTR_LSC)\n+\t\twritten += snprintf(&buffer[written], sizeof(buffer) - written,\n+\t\t\t\t    \"%s,\", \"lsc\");\n+\tif (flags & RTE_PCI_DRV_DETACHABLE)\n+\t\twritten += snprintf(&buffer[written], sizeof(buffer) - written,\n+\t\t\t\t    \"%s,\", \"detachable\");\n+\tif (written)\n+\t\tbuffer[written-1] = '\\0';\n+\n+\treturn buffer;\n+}\n+\n+static bfd *cur_bfd;\n+static void *bin_start;\n+static asymbol **sym_table;\n+static long sym_number;\n+\n+static asymbol *\n+find_symbol(const uintptr_t p)\n+{\n+\tint i;\n+\n+\tfor (i = 0; i < sym_number; i++) {\n+\t\tasymbol *sym = sym_table[i];\n+\n+\t\tif (bfd_asymbol_value(sym) == p)\n+\t\t\treturn sym;\n+\t}\n+\n+\treturn NULL;\n+}\n+\n+static off_t\n+get_sec_vma_offset(const asection *sec)\n+{\n+\treturn (uintptr_t) bin_start + sec->filepos\n+\t\t\t\t- bfd_get_section_vma(cur_bfd, sec);\n+}\n+\n+static uintptr_t\n+get_value(const asymbol *sym)\n+{\n+\tasection *sec = bfd_get_section(sym);\n+\toff_t sec_vma_offset = get_sec_vma_offset(sec);\n+\treturn bfd_asymbol_value(sym) + sec_vma_offset;\n+}\n+\n+int main(int argc, char *argv[])\n+{\n+\tint fd;\n+\tstruct stat st;\n+\tlong sym_table_size;\n+\tlong i;\n+\tconst char *filename;\n+\tconst char *filter = NULL;\n+\n+\t/* for now, handle one file, and an optional driver name */\n+\tif (argc < 2 || argc > 3)\n+\t\treturn -1;\n+\n+\tfilename = argv[1];\n+\tif (argc > 2)\n+\t\tfilter = argv[2];\n+\n+\tfd = open(filename, O_RDONLY);\n+\tif (fd < 0)\n+\t\treturn -1;\n+\tif (fstat(fd, &st) < 0)\n+\t\treturn -1;\n+\n+\tbin_start = mmap(NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0);\n+\tif (bin_start == MAP_FAILED)\n+\t\treturn -1;\n+\n+\tbfd_init();\n+\n+\tcur_bfd = bfd_fdopenr(filename, NULL, fd);\n+\tif (!cur_bfd) {\n+\t\tprintf(\"could not init bfd: %s\\n\", strerror(errno));\n+\t\treturn -1;\n+\t}\n+\n+\tif (!bfd_check_format(cur_bfd, bfd_object))\n+\t\treturn -1;\n+\n+\tsym_table_size = bfd_get_symtab_upper_bound(cur_bfd);\n+\tif (sym_table_size <= 0)\n+\t\treturn -1;\n+\n+\tsym_table = malloc(sym_table_size);\n+\tif (!sym_table)\n+\t\treturn -1;\n+\n+\tsym_number = bfd_canonicalize_symtab(cur_bfd, sym_table);\n+\tif (sym_number < 0)\n+\t\treturn -1;\n+\n+\tfor (i = 0; i < sym_number; i++) {\n+\t\tasymbol *sym = sym_table[i];\n+\t\tconst struct rte_pci_driver *dr;\n+\t\tasymbol *symid;\n+\t\tconst struct rte_pci_id *id;\n+\t\tconst char *name;\n+\n+\t\tif (strncmp(sym->name, RTE_EAL_PCI_DRIVER_PREFIX,\n+\t\t\t    strlen(RTE_EAL_PCI_DRIVER_PREFIX)))\n+\t\t\tcontinue;\n+\n+\t\tname = sym->name + strlen(RTE_EAL_PCI_DRIVER_PREFIX);\n+\t\tif (filter && strcmp(name, filter))\n+\t\t\tcontinue;\n+\n+\t\t/* pcidriver_* symbols are pointers to real symbol */\n+\t\tdr = (typeof(dr))get_value(find_symbol(*(uintptr_t *)get_value(sym)));\n+\t\tsymid = find_symbol((uintptr_t)dr->id_table);\n+\t\tid = (typeof(id))get_value(symid);\n+\n+\t\tprintf(\"pci:driver=%s,\", name);\n+\t\tprintf(\"flags=%s\\n\", dump_flags(dr->drv_flags));\n+\n+\t\twhile (id->vendor_id) {\n+\t\t\tprintf(\"pci:driver=%s,\", name);\n+\t\t\tprintf(\"id=\");\n+\t\t\tprintf(\"vendor=%4.4x,\", id->vendor_id);\n+\t\t\tprintf(\"device=%4.4x,\", id->device_id);\n+\t\t\tprintf(\"subvendor=%4.4x,\", id->subsystem_vendor_id);\n+\t\t\tprintf(\"subdevice=%4.4x\\n\", id->subsystem_device_id);\n+\t\t\tid++;\n+\t\t}\n+\t}\n+\n+\treturn 0;\n+}\n",
    "prefixes": [
        "dpdk-dev",
        "v3",
        "13/13"
    ]
}