get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 109313,
    "url": "http://patches.dpdk.org/api/patches/109313/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20220406151903.2916254-15-juraj.linkes@pantheon.tech/",
    "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": "<20220406151903.2916254-15-juraj.linkes@pantheon.tech>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20220406151903.2916254-15-juraj.linkes@pantheon.tech",
    "date": "2022-04-06T15:18:54",
    "name": "[RFC,v1,14/23] dts: merge DTS nics/system_info.py to DPDK",
    "commit_ref": null,
    "pull_url": null,
    "state": "rfc",
    "archived": true,
    "hash": "7371297a330cb4f29cc58444932df5a9e5c8c835",
    "submitter": {
        "id": 1626,
        "url": "http://patches.dpdk.org/api/people/1626/?format=api",
        "name": "Juraj Linkeš",
        "email": "juraj.linkes@pantheon.tech"
    },
    "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/20220406151903.2916254-15-juraj.linkes@pantheon.tech/mbox/",
    "series": [
        {
            "id": 22381,
            "url": "http://patches.dpdk.org/api/series/22381/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=22381",
            "date": "2022-04-06T15:18:40",
            "name": "merge DTS test resource files to DPDK",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/22381/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/109313/comments/",
    "check": "warning",
    "checks": "http://patches.dpdk.org/api/patches/109313/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id AFEDDA0509;\n\tWed,  6 Apr 2022 17:20:53 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 14636428A7;\n\tWed,  6 Apr 2022 17:19:25 +0200 (CEST)",
            "from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20])\n by mails.dpdk.org (Postfix) with ESMTP id B5E5E42939\n for <dev@dpdk.org>; Wed,  6 Apr 2022 17:19:22 +0200 (CEST)",
            "from localhost (localhost [127.0.0.1])\n by lb.pantheon.sk (Postfix) with ESMTP id E0E6F184FF6;\n Wed,  6 Apr 2022 17:19:21 +0200 (CEST)",
            "from lb.pantheon.sk ([127.0.0.1])\n by localhost (lb.pantheon.sk [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id dvqz2xHYIzRv; Wed,  6 Apr 2022 17:19:20 +0200 (CEST)",
            "from entguard.lab.pantheon.local (unknown [46.229.239.141])\n by lb.pantheon.sk (Postfix) with ESMTP id DFE2619E0D8;\n Wed,  6 Apr 2022 17:19:11 +0200 (CEST)"
        ],
        "X-Virus-Scanned": "amavisd-new at siecit.sk",
        "From": "=?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>",
        "To": "thomas@monjalon.net, david.marchand@redhat.com,\n Honnappa.Nagarahalli@arm.com, ohilyard@iol.unh.edu, lijuan.tu@intel.com",
        "Cc": "dev@dpdk.org, =?utf-8?q?Juraj_Linke=C5=A1?= <juraj.linkes@pantheon.tech>",
        "Subject": "[RFC PATCH v1 14/23] dts: merge DTS nics/system_info.py to DPDK",
        "Date": "Wed,  6 Apr 2022 15:18:54 +0000",
        "Message-Id": "<20220406151903.2916254-15-juraj.linkes@pantheon.tech>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20220406151903.2916254-1-juraj.linkes@pantheon.tech>",
        "References": "<20220406151903.2916254-1-juraj.linkes@pantheon.tech>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "---\n dts/nics/system_info.py | 144 ++++++++++++++++++++++++++++++++++++++++\n 1 file changed, 144 insertions(+)\n create mode 100644 dts/nics/system_info.py",
    "diff": "diff --git a/dts/nics/system_info.py b/dts/nics/system_info.py\nnew file mode 100644\nindex 0000000000..5ecdd77dd6\n--- /dev/null\n+++ b/dts/nics/system_info.py\n@@ -0,0 +1,144 @@\n+# BSD LICENSE\n+#\n+# Copyright(c) 2010-2017 Intel Corporation. All rights reserved.\n+# All rights reserved.\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 Intel Corporation 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+import os\n+import re\n+import time\n+from collections import OrderedDict\n+\n+# install GitPython\n+from git import Repo\n+\n+\n+class SystemInfo(object):\n+    def __init__(self, dut, pci_device_id):\n+        self.dut = dut\n+        self.pci_device_id = pci_device_id\n+        self.session = self.dut.session\n+        self.system_info = OrderedDict()\n+        self.nic_info = OrderedDict()\n+\n+    def get_system_info(self):\n+\n+        board = self.session.send_expect(\"dmidecode -s system-product-name\", \"# \")\n+        self.system_info[\"Board\"] = board\n+\n+        processors = self.session.send_expect(\"dmidecode -s processor-version\", \"# \")\n+        processor = processors.split(\"\\r\\n\")[0]\n+        self.system_info[\"CPU\"] = processor\n+\n+        memories = self.session.send_expect(\"dmidecode -t memory\", \"]# \")\n+        channels, size, speed = self._strip_memory(memories)\n+        memory_info = \"Total %d MBs in %d channels @ %s\" % (size, channels, speed)\n+        self.system_info[\"Memory\"] = memory_info\n+\n+        release = self.session.send_expect(\n+            \"lsb_release -d |awk -F':' '{print $2}'\", \"# \"\n+        )\n+        self.system_info[\"Operating system\"] = release\n+\n+        kernel = self.session.send_expect(\"uname -r\", \"# \")\n+        self.system_info[\"Linux kernel version\"] = kernel\n+\n+        gcc_info = self.session.send_expect(\"gcc --version\", \"# \")\n+        gcc = gcc_info.split(\"\\r\\n\")[0]\n+        self.system_info[\"GCC version\"] = gcc\n+\n+        return self.system_info\n+\n+    def _strip_memory(self, memories):\n+        \"\"\"\n+        Size: 8192 MB Locator: DIMM_A1 Speed: 2133 MHz\n+        \"\"\"\n+        s_regex = r\"(\\s+)Size: (\\d+) MB\"\n+        s1_regex = r\"(\\s+)Size: (\\d+) GB\"\n+        l_regex = r\"(\\s+)Locator: .*_(\\w+)\"\n+        speed_regex = r\"(\\s+)Speed: (.*)\"\n+        size = \"\"\n+        locate = \"\"\n+        speed = \"Unknown\"\n+        memory_infos = []\n+        memory_channel = set()\n+        lines = memories.split(\"\\r\\n\")\n+        total_size = 0\n+        for line in lines:\n+            m = re.match(s_regex, line)\n+            m1 = re.match(s1_regex, line)\n+            if m:\n+                size = m.group(2)\n+            if m1:\n+                size = int(m1.group(2)) * 1024\n+            l_m = re.match(l_regex, line)\n+            if l_m:\n+                locate = l_m.group(2)\n+            s_m = re.match(speed_regex, line)\n+            if s_m:\n+                speed = s_m.group(2)\n+            if speed != \"Unknown\":\n+                memory = {\"Size\": size, \"Locate\": locate, \"Speed\": speed}\n+                memory_infos.append(memory)\n+                speed = \"Unknown\"\n+                total_size += int(size)\n+                memory_channel.add(locate[0])\n+\n+        return len(memory_channel), total_size, memory_infos[0][\"Speed\"]\n+\n+    def get_nic_info(self):\n+\n+        cmd = \"cat /sys/bus/pci/devices/%s/vendor\" % self.pci_device_id\n+        vendor = self.session.send_expect(cmd, \"# \")\n+        if \"No such\" in vendor:\n+            return None\n+\n+        cmd = \"cat /sys/bus/pci/devices/%s/device\" % self.pci_device_id\n+        device = self.session.send_expect(cmd, \"# \")\n+        if \"No such\" in device:\n+            return None\n+\n+        cmd = \"ls --color=never /sys/bus/pci/devices/%s/net\" % self.pci_device_id\n+        interface = self.session.send_expect(cmd, \"# \")\n+        if \"No such\" in interface:\n+            return None\n+        cmd = (\n+            \"ethtool -i %s | grep --color=never firmware |awk -F':' '{print $2}'\"\n+            % interface\n+        )\n+        firmware = self.session.send_expect(cmd, \"# \")\n+        if \"No such\" in firmware:\n+            return None\n+        cmd = (\n+            \"lspci -vmmks %s |grep -i ^device |awk -F':' '{print $2}'\"\n+            % self.pci_device_id\n+        )\n+        self.nic_info[\"nic_name\"] = self.session.send_expect(cmd, \"# \")\n+        self.nic_info[\"device_id\"] = vendor[2:] + \":\" + device[2:]\n+        self.nic_info[\"firmware-version\"] = firmware\n+        return self.nic_info\n",
    "prefixes": [
        "RFC",
        "v1",
        "14/23"
    ]
}