get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 121425,
    "url": "http://patchwork.dpdk.org/api/patches/121425/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dts/patch/20221228050850.33004-2-ke1.xu@intel.com/",
    "project": {
        "id": 3,
        "url": "http://patchwork.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": "<20221228050850.33004-2-ke1.xu@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dts/20221228050850.33004-2-ke1.xu@intel.com",
    "date": "2022-12-28T05:08:46",
    "name": "[V2,1/5] tests/vf_offload: Improve checksum_validate method.",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "9e2bf29c6bab907a202b13d02fe847e6a863fb30",
    "submitter": {
        "id": 2810,
        "url": "http://patchwork.dpdk.org/api/people/2810/?format=api",
        "name": "Ke Xu",
        "email": "ke1.xu@intel.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.dpdk.org/project/dts/patch/20221228050850.33004-2-ke1.xu@intel.com/mbox/",
    "series": [
        {
            "id": 26302,
            "url": "http://patchwork.dpdk.org/api/series/26302/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dts/list/?series=26302",
            "date": "2022-12-28T05:08:45",
            "name": "Improve checksum validate and tso packet counting.",
            "version": 2,
            "mbox": "http://patchwork.dpdk.org/series/26302/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/121425/comments/",
    "check": "pending",
    "checks": "http://patchwork.dpdk.org/api/patches/121425/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 79E10A0540;\n\tWed, 28 Dec 2022 06:10:24 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 115554161A;\n\tWed, 28 Dec 2022 06:10:24 +0100 (CET)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by mails.dpdk.org (Postfix) with ESMTP id DCA1C40FDF\n for <dts@dpdk.org>; Wed, 28 Dec 2022 06:10:22 +0100 (CET)",
            "from fmsmga002.fm.intel.com ([10.253.24.26])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 27 Dec 2022 21:10:22 -0800",
            "from dpdk-xuke-lab.sh.intel.com ([10.67.119.8])\n by fmsmga002.fm.intel.com with ESMTP; 27 Dec 2022 21:10:20 -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=1672204223; x=1703740223;\n h=from:to:cc:subject:date:message-id:in-reply-to:\n references:mime-version:content-transfer-encoding;\n bh=NO/XTrGHV0LapGI69dz9JKmzVp9xjaeGJlJ1U9xKSrM=;\n b=LhlPj3uxRcBYV52EWs3xRJeNPLxkuBURQPpFkmJn1fQVx2xYoOC41es4\n 77tqvN7+fynmPXCWf9TageD7jVUjLpy2i/nX0biY44E+NsMhthDhXpybj\n 70dOUa9jk4zTNLG8DGGgT+4+NH/XkkkKwalbspJx26efbGlscPFhAn0I2\n jAk9LjaWqyxxcQbUex9FPcUydPSRTK6RNNyq2gkCfDWcm9gCRLx4mA39E\n cqzlFmhNL6NvjojT8pKTzlB9tFi/FO8EkErTy3qqjBmLy6w9x4peYbcd2\n dqxBC8D+VQjigabQbsaLcoyzKnx3tqeGDbx+DJf2peZ8N11Y0Yv7I+e1n A==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6500,9779,10573\"; a=\"300499465\"",
            "E=Sophos;i=\"5.96,280,1665471600\"; d=\"scan'208\";a=\"300499465\"",
            "E=McAfee;i=\"6500,9779,10573\"; a=\"760536347\"",
            "E=Sophos;i=\"5.96,280,1665471600\"; d=\"scan'208\";a=\"760536347\""
        ],
        "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 V2 1/5] tests/vf_offload: Improve checksum_validate\n method.",
        "Date": "Wed, 28 Dec 2022 13:08:46 +0800",
        "Message-Id": "<20221228050850.33004-2-ke1.xu@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "In-Reply-To": "<20221228050850.33004-1-ke1.xu@intel.com>",
        "References": "<20221228050850.33004-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 the packets in a faster, more common and more 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..abe7d752 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[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": [
        "V2",
        "1/5"
    ]
}