get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 121415,
    "url": "https://patches.dpdk.org/api/patches/121415/?format=api",
    "web_url": "https://patches.dpdk.org/project/dts/patch/20221227102131.529684-2-ke1.xu@intel.com/",
    "project": {
        "id": 3,
        "url": "https://patches.dpdk.org/api/projects/3/?format=api",
        "name": "DTS",
        "link_name": "dts",
        "list_id": "dts.dpdk.org",
        "list_email": "dts@dpdk.org",
        "web_url": "",
        "scm_url": "git://dpdk.org/tools/dts",
        "webscm_url": "http://git.dpdk.org/tools/dts/",
        "list_archive_url": "https://inbox.dpdk.org/dts",
        "list_archive_url_format": "https://inbox.dpdk.org/dts/{}",
        "commit_url_format": ""
    },
    "msgid": "<20221227102131.529684-2-ke1.xu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dts/20221227102131.529684-2-ke1.xu@intel.com",
    "date": "2022-12-27T10:21:29",
    "name": "[V1,1/5] tests/vf_offload: Improve checksum_validate method.",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "f29d9454f9143d132399d9c97b55e60a148a77d0",
    "submitter": {
        "id": 2810,
        "url": "https://patches.dpdk.org/api/people/2810/?format=api",
        "name": "Ke Xu",
        "email": "ke1.xu@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dts/patch/20221227102131.529684-2-ke1.xu@intel.com/mbox/",
    "series": [
        {
            "id": 26297,
            "url": "https://patches.dpdk.org/api/series/26297/?format=api",
            "web_url": "https://patches.dpdk.org/project/dts/list/?series=26297",
            "date": "2022-12-27T10:21:27",
            "name": "Improve checksum validate and tso packet counting.",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/26297/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/121415/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/121415/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dts-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 5A7C6A04FD;\n\tTue, 27 Dec 2022 11:24:32 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 50FAF410FC;\n\tTue, 27 Dec 2022 11:24:32 +0100 (CET)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n by mails.dpdk.org (Postfix) with ESMTP id DD2BC40E2D\n for <dts@dpdk.org>; Tue, 27 Dec 2022 11:24:30 +0100 (CET)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 27 Dec 2022 02:24:29 -0800",
            "from dpdk-xuke-lab.sh.intel.com ([10.67.119.8])\n by fmsmga002.fm.intel.com with ESMTP; 27 Dec 2022 02:24:27 -0800"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1672136671; x=1703672671;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=QnYSzv1qAly3QG9EW2rFSU8frqj/EAVuPxevsuOYUXo=;\n b=axBtif6+HlPGzB16xmh3U6kIlNAht2KWxoZ4AhxyzCZmX8p+1kfcLZAN\n hLjodnWhNSoGsaSyfBR+qUlVarnECps07uO9+OtgNB+bfaN/99JG3eWjY\n Q4xVJfOgi1M7YVAqcDxSE9h3OagDtaaDQYAX0yj1FZY/bs5rzv4jxC8eA\n 944zgofdRgbXxzGhaK/ZdyOpnyOTY4rwYQYLp8XNx/LLhSFF6lBm2UId+\n SJRIxpEDNZJcNVfACdeOoOIY4xshBsTaUxSBgVJMZRL4tXzZJZ6xm6/k4\n PwyerWh623f9dZfcek4ziQUDwSK2m1Ll20kAZgjPXS4OfKP2GlqfvGw45 Q==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10572\"; a=\"322656413\"",
            "E=Sophos;i=\"5.96,278,1665471600\"; d=\"scan'208\";a=\"322656413\"",
            "E=McAfee;i=\"6500,9779,10572\"; a=\"760292028\"",
            "E=Sophos;i=\"5.96,278,1665471600\"; d=\"scan'208\";a=\"760292028\""
        ],
        "X-ExtLoop1": "1",
        "From": "Ke Xu <ke1.xu@intel.com>",
        "To": "dts@dpdk.org",
        "Cc": "qi.fu@intel.com, weiyuanx.li@intel.com, lijuan.tu@intel.com,\n ke1.xu@intel.com",
        "Subject": "[DTS][PATCH V1 1/5] tests/vf_offload: Improve checksum_validate\n method.",
        "Date": "Tue, 27 Dec 2022 18:21:29 +0800",
        "Message-Id": "<20221227102131.529684-2-ke1.xu@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20221227102131.529684-1-ke1.xu@intel.com>",
        "References": "<20221227102131.529684-1-ke1.xu@intel.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dts@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "test suite reviews and discussions <dts.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dts>,\n <mailto:dts-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dts/>",
        "List-Post": "<mailto:dts@dpdk.org>",
        "List-Help": "<mailto:dts-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dts>,\n <mailto:dts-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dts-bounces@dpdk.org"
    },
    "content": "Use packet.show(dump) methods and packet reading to\n validate packets in a faster, more common and more\n stable way.\n\nThis allows packets other than the plain packets can\n be verified by this method checksum_validate.\n\nSigned-off-by: Ke Xu <ke1.xu@intel.com>\n---\n tests/TestSuite_vf_offload.py | 89 +++++++++++++----------------------\n 1 file changed, 34 insertions(+), 55 deletions(-)",
    "diff": "diff --git a/tests/TestSuite_vf_offload.py b/tests/TestSuite_vf_offload.py\nindex 62e74c33..009da148 100644\n--- a/tests/TestSuite_vf_offload.py\n+++ b/tests/TestSuite_vf_offload.py\n@@ -253,6 +253,16 @@ class TestVfOffload(TestCase):\n         dut.send_expect(\"tunnel_tso set 800 %d\" % port, \"testpmd>\")\n         dut.send_expect(\"port start %d\" % port, \"testpmd>\")\n \n+    def filter_packets(self, packets):\n+        return [\n+            p\n+            for p in packets\n+            if len(p.layers()) >= 3\n+            and p.layers()[1] in {IP, IPv6}\n+            and p.layers()[2] in {IP, IPv6, UDP, TCP, SCTP, GRE, MPLS}\n+            and Raw in p\n+        ]\n+    \n     def checksum_validate(self, packets_sent, packets_expected):\n         \"\"\"\n         Validate the checksum.\n@@ -266,17 +276,16 @@ class TestVfOffload(TestCase):\n         sniff_src = self.vm0_testpmd.get_port_mac(0)\n         checksum_pattern = re.compile(\"chksum.*=.*(0x[0-9a-z]+)\")\n         sniff_src = \"52:00:00:00:00:00\"\n-        chksum = dict()\n+        expected_chksum_list = dict()\n         result = dict()\n-\n         self.tester.send_expect(\"scapy\", \">>> \")\n-\n+        self.tester.send_expect(\"from scapy.contrib.gtp import GTP_U_Header\", \">>>\")\n         for packet_type in list(packets_expected.keys()):\n             self.tester.send_expect(\"p = %s\" % packets_expected[packet_type], \">>>\")\n             out = self.tester.send_expect(\"p.show2()\", \">>>\")\n-            chksums = checksum_pattern.findall(out)\n-            chksum[packet_type] = chksums\n-            print(packet_type, \": \", chksums)\n+            chksum = checksum_pattern.findall(out)\n+            expected_chksum_list[packet_type] = chksum\n+            print(packet_type, \": \", chksum)\n \n         self.tester.send_expect(\"exit()\", \"#\")\n \n@@ -289,7 +298,7 @@ class TestVfOffload(TestCase):\n \n         # Send packet.\n         self.tester.scapy_foreground()\n-\n+        self.tester.scapy_append(\"from scapy.contrib.gtp import GTP_U_Header\")\n         for packet_type in list(packets_sent.keys()):\n             self.tester.scapy_append(\n                 'sendp([%s], iface=\"%s\")' % (packets_sent[packet_type], tx_interface)\n@@ -297,58 +306,28 @@ class TestVfOffload(TestCase):\n \n         self.tester.scapy_execute()\n         out = self.tester.scapy_get_result()\n-\n-        p = self.tester.load_tcpdump_sniff_packets(inst)\n-        nr_packets = len(p)\n-        print(p)\n-        packets_received = [\n-            p[i].sprintf(\"%IP.chksum%;%TCP.chksum%;%UDP.chksum%;%SCTP.chksum%\")\n-            for i in range(nr_packets)\n-        ]\n+        packets_received = self.filter_packets(self.tester.load_tcpdump_sniff_packets(inst))\n+        print(list(packets_received))\n \n         self.verify(\n             len(packets_sent) == len(packets_received), \"Unexpected Packets Drop\"\n         )\n-\n-        for packet_received in packets_received:\n-            (\n-                ip_checksum,\n-                tcp_checksum,\n-                udp_checksum,\n-                sctp_checksum,\n-            ) = packet_received.split(\";\")\n-            print(\n-                \"ip_checksum: \",\n-                ip_checksum,\n-                \"tcp_checksum:, \",\n-                tcp_checksum,\n-                \"udp_checksum: \",\n-                udp_checksum,\n-                \"sctp_checksum: \",\n-                sctp_checksum,\n-            )\n-\n-            packet_type = \"\"\n-            l4_checksum = \"\"\n-            if tcp_checksum != \"??\":\n-                packet_type = \"TCP\"\n-                l4_checksum = tcp_checksum\n-            elif udp_checksum != \"??\":\n-                packet_type = \"UDP\"\n-                l4_checksum = udp_checksum\n-            elif sctp_checksum != \"??\":\n-                packet_type = \"SCTP\"\n-                l4_checksum = sctp_checksum\n-\n-            if ip_checksum != \"??\":\n-                packet_type = \"IP/\" + packet_type\n-                if chksum[packet_type] != [ip_checksum, l4_checksum]:\n-                    result[packet_type] = packet_type + \" checksum error\"\n-            else:\n-                packet_type = \"IPv6/\" + packet_type\n-                if chksum[packet_type] != [l4_checksum]:\n-                    result[packet_type] = packet_type + \" checksum error\"\n-\n+        for i in range(len(packets_sent)):\n+            packet_type = list(packets_sent.keys())[i]\n+            checksum_received = checksum_pattern.findall(packets_received[i].show2(dump=True))\n+            checksum_expected = expected_chksum_list[packets_sent.keys()[i]]\n+            self.logger.debug(f\"checksum_received: {checksum_received}\")\n+            self.logger.debug(f\"checksum_expected: {checksum_expected}\")\n+            if not len(checksum_expected) == len(checksum_received):\n+                result[packet_type] = (\n+                    packet_type + \" Failed:\"\n+                    + f\"The chksum type {packet_type} length of the actual result is inconsistent with the expected length!\"\n+                )\n+            elif not (checksum_received == checksum_expected):\n+                result[packet_type] = (\n+                    packet_type + \" Failed:\"\n+                    + f\"The actually received chksum {packet_type} is inconsistent with the expectation\"\n+                )\n         return result\n \n     def test_checksum_offload_enable(self):\n",
    "prefixes": [
        "V1",
        "1/5"
    ]
}