get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 84481,
    "url": "http://patches.dpdk.org/api/patches/84481/?format=api",
    "web_url": "http://patches.dpdk.org/project/dts/patch/20201124023551.12624-1-box.c.chen@intel.com/",
    "project": {
        "id": 3,
        "url": "http://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": "<20201124023551.12624-1-box.c.chen@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dts/20201124023551.12624-1-box.c.chen@intel.com",
    "date": "2020-11-24T02:35:51",
    "name": "[V1] tests/checksum_offload: rework l4 tx/rx test case",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "8343b95a71a637bd9007e35ab3bfd15b3cb61b5b",
    "submitter": {
        "id": 1819,
        "url": "http://patches.dpdk.org/api/people/1819/?format=api",
        "name": "Chen, BoX C",
        "email": "box.c.chen@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dts/patch/20201124023551.12624-1-box.c.chen@intel.com/mbox/",
    "series": [
        {
            "id": 14047,
            "url": "http://patches.dpdk.org/api/series/14047/?format=api",
            "web_url": "http://patches.dpdk.org/project/dts/list/?series=14047",
            "date": "2020-11-24T02:35:51",
            "name": "[V1] tests/checksum_offload: rework l4 tx/rx test case",
            "version": 1,
            "mbox": "http://patches.dpdk.org/series/14047/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/84481/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/84481/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 dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id D9265A04B1;\n\tTue, 24 Nov 2020 03:37:23 +0100 (CET)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 8BA41C914;\n\tTue, 24 Nov 2020 03:37:22 +0100 (CET)",
            "from mga18.intel.com (mga18.intel.com [134.134.136.126])\n by dpdk.org (Postfix) with ESMTP id 0D9A1C8FA\n for <dts@dpdk.org>; Tue, 24 Nov 2020 03:37:20 +0100 (CET)",
            "from fmsmga008.fm.intel.com ([10.253.24.58])\n by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 23 Nov 2020 18:37:18 -0800",
            "from unknown (HELO cb-dts.sh.intel.com) ([10.240.183.58])\n by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 23 Nov 2020 18:37:15 -0800"
        ],
        "IronPort-SDR": [
            "\n poRimItyjeE6gGK3uqLhVXS2asFVLYSfwy7cz0mg4ufmFBcaGOxPx/G85LgR7Bwl76aJKgiM1L\n PzRkYWKatMxw==",
            "\n eGPMUJ5HBHfGTu6//nAfXmSfIUwI2YymjqnHHOLnUTHkZ0OXaGaUViHGeGrmrauqHaH83zs4GR\n 406mAVqX3f/g=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9814\"; a=\"159648467\"",
            "E=Sophos;i=\"5.78,364,1599548400\"; d=\"scan'208\";a=\"159648467\"",
            "E=Sophos;i=\"5.78,364,1599548400\"; d=\"scan'208\";a=\"312405253\""
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "From": "ChenBo <box.c.chen@intel.com>",
        "To": "dts@dpdk.org",
        "Cc": "ohilyard@iol.unh.edu,\n\tChenBo <box.c.chen@intel.com>",
        "Date": "Tue, 24 Nov 2020 10:35:51 +0800",
        "Message-Id": "<20201124023551.12624-1-box.c.chen@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "Subject": "[dts] [PATCH V1] tests/checksum_offload: rework l4 tx/rx test case",
        "X-BeenThere": "dts@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "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",
        "Sender": "\"dts\" <dts-bounces@dpdk.org>"
    },
    "content": "1. Fix incorrect payload of SCTP package.\n2. Fix vxlan package errors.\n3. Support for adding FVL network card.\n4. Improve contracting efficiency and add debugging information.\n\nSigned-off-by: ChenBo <box.c.chen@intel.com>\n---\n conf/test_case_supportlist.json     |   6 +\n tests/TestSuite_checksum_offload.py | 187 +++++++++++++---------------\n 2 files changed, 92 insertions(+), 101 deletions(-)",
    "diff": "diff --git a/conf/test_case_supportlist.json b/conf/test_case_supportlist.json\nindex 34f2303..f976248 100644\n--- a/conf/test_case_supportlist.json\n+++ b/conf/test_case_supportlist.json\n@@ -2260,6 +2260,9 @@\n                 \"ALL\"\n             ],\n             \"NIC\": [\n+                \"fortville_eagle\",\n+                \"fortville_25g\",\n+                \"fortville_spirit\",\n                 \"columbiaville_100g\",\n                 \"columbiaville_25g\"\n             ],\n@@ -2276,6 +2279,9 @@\n                 \"ALL\"\n             ],\n             \"NIC\": [\n+                \"fortville_eagle\",\n+                \"fortville_25g\",\n+                \"fortville_spirit\",\n                 \"columbiaville_100g\",\n                 \"columbiaville_25g\"\n             ],\ndiff --git a/tests/TestSuite_checksum_offload.py b/tests/TestSuite_checksum_offload.py\nindex 89abf04..afdeb46 100644\n--- a/tests/TestSuite_checksum_offload.py\n+++ b/tests/TestSuite_checksum_offload.py\n@@ -116,6 +116,7 @@ class TestChecksumOffload(TestCase):\n             cur_path = os.path.dirname(\n                 os.path.dirname(os.path.realpath(__file__)))\n             self.output_path = os.sep.join([cur_path, self.logger.log_path])\n+        self.count = 0\n \n     def set_up(self):\n         \"\"\"\n@@ -277,9 +278,9 @@ class TestChecksumOffload(TestCase):\n         return self.checksum_flags_are_good(\"PKT_RX_IP_CKSUM_\", testpmd_output)\n \n     def send_pkt_expect_good_bad_from_flag(self, pkt_str: str, flag: str, test_name: str, should_pass: bool = True):\n-        self.pmdout.get_output(timeout=5)  # Remove any old output\n+        self.pmdout.get_output(timeout=1)  # Remove any old output\n         self.scapy_exec(f\"sendp({pkt_str}, iface=iface)\")\n-        testpmd_output: str = self.pmdout.get_output(timeout=5)\n+        testpmd_output: str = self.pmdout.get_output(timeout=1)\n         self.verify(flag in testpmd_output,\n                     f\"Flag {flag[:-1]} not found for test {test_name}, please run test_rx_checksum_valid_flags.\")\n         self.verify((flag + \"UNKNOWN\") not in testpmd_output,\n@@ -304,18 +305,37 @@ class TestChecksumOffload(TestCase):\n \n         return None\n \n-    def validate_checksum(self, pkt, layer) -> bool:\n+    def validate_checksum(self, pkt, pkt_type, inner_flag=False) -> bool:\n         \"\"\"\n         @param pkt: The packet to validate the checksum of.\n         @return: Whether the checksum was valid.\n         \"\"\"\n         if pkt is None:\n             return False\n-\n-        csum = pkt[layer].chksum\n-        del pkt[layer].chksum\n-        # Converting it to raw will calculate the checksum\n-        return layer(bytes(Raw(pkt[layer]))).chksum == csum\n+        for i in range(0, len(l3_protos)):\n+            if l3_protos[i] in pkt:\n+                l3 = l3_protos[i]\n+        for j in range(0, len(l4_protos)):\n+            if l4_protos[j] in pkt:\n+                layer = l4_proto_classes[j]\n+                csum = pkt[layer].chksum\n+                if csum is None:\n+                    csum = 0\n+                del pkt[layer].chksum\n+                # Converting it to raw will calculate the checksum\n+                correct_csum = layer(bytes(Raw(pkt[layer]))).chksum\n+                if correct_csum == csum:\n+                    # checksum value is correct\n+                    return False\n+                else:\n+                    if inner_flag:\n+                        print(\"{} pkg[{}] VXLAN/{}/{} inner checksum {} is not correct {}\".format(\n+                            pkt_type, self.count, l3, l4_protos[j],  hex(correct_csum), hex(csum)))\n+                    else:\n+                        print(\"{} pkg[{}] {}/{} outer checksum {} is not correct {}\".format(\n+                            pkt_type, self.count, l3, l4_protos[j], hex(correct_csum), hex(csum)))\n+                    return True\n+        return False\n \n     def scapy_exec(self, cmd: str, timeout=1) -> str:\n         return self.tester.send_expect(cmd, \">>>\", timeout=timeout)\n@@ -330,14 +350,10 @@ class TestChecksumOffload(TestCase):\n                 for chksum in checksum_options:\n                     # The packet's data can be used to identify how the packet was constructed so avoid any issues with\n                     # ordering\n-                    pkt = eth / l3() / l4(**chksum) / (\n-                        f'UNTUNNELED,{l3.__name__},{l4.__name__},{\" \" if len(chksum.values()) == 0 else chksum[\"chksum\"]}'\n-                    )\n-\n+                    pkt = eth / l3() / l4(**chksum) / (b'X' * 48)\n                     # Prevents the default behavior which adds DNS headers\n                     if l4 == UDP:\n                         pkt[UDP].dport, pkt[UDP].sport = 1001, 1001\n-\n                     packets.append(pkt)\n \n         # Tunneled\n@@ -346,104 +362,55 @@ class TestChecksumOffload(TestCase):\n             for l4 in l4_proto_classes:\n                 for outer_arg in checksum_options:\n                     for inner_arg in checksum_options:\n-                        pkt = eth / l3() / UDP(**outer_arg) / VXLAN() / Ether() / l3() / l4(**inner_arg) / (\n-                            f'VXLAN,{l3.__name__},{l4.__name__},'\n-                            f'{\" \" if len(outer_arg.values()) == 0 else outer_arg[\"chksum\"]},'\n-                            f'{\" \" if len(inner_arg.values()) == 0 else inner_arg[\"chksum\"]}'\n-                        )\n+                        pkt = eth / l3() / UDP(**outer_arg) / VXLAN() / Ether() / l3() / l4(**inner_arg) / (b'Y' * 48)\n                         # Prevents the default behavior which adds DNS headers\n                         if l4 == UDP:\n                             pkt[VXLAN][UDP].dport, pkt[VXLAN][UDP].sport = 1001, 1001\n-\n                         packets.append(pkt)\n         # GRE\n         for l3 in l3_proto_classes:\n             for l4 in l4_proto_classes:\n                 for chksum in checksum_options:\n-                    pkt = eth / l3() / GRE() / l3() / l4(**chksum) / (\n-                        f'GRE,{l3.__name__},{l4.__name__},{\" \" if len(chksum.values()) == 0 else chksum[\"chksum\"]}'\n-                    )\n-\n+                    pkt = eth / l3() / GRE() / l3() / l4(**chksum) / (b'Z' * 48)\n                     # Prevents the default behavior which adds DNS headers\n                     if l4 == UDP:\n                         pkt[GRE][UDP].dport, pkt[GRE][UDP].sport = 1001, 1001\n-\n                     packets.append(pkt)\n \n         return packets\n \n-    def replay_pcap_file_on_tester(self, iface, packet_file_path):\n-        self.tester.send_expect(\"scapy\", \">>>\")\n-        self.scapy_exec(f\"packets = rdpcap('{packet_file_path}')\")\n-        self.scapy_exec(f\"sendp(packets, iface='{iface}')\")\n-        self.tester.send_expect(\"quit()\", \"# \")\n+    def replay_pcap_file_on_tester(self, iface, offset, packet_file_path):\n+        self.scapy_exec(f\"packets[{offset}].show\")\n+        self.scapy_exec(f\"sendp(packets[{offset}], iface='{iface}')\")\n \n     def validate_packet_list_checksums(self, packets):\n-        name_to_class_dict = {\n-            'UDP': UDP,\n-            'TCP': TCP,\n-            'SCTP': SCTP,\n-            'IP': IP,\n-            'IPv6': IPv6,\n-            'VXLAN': VXLAN,\n-            'GRE': GRE,\n-        }\n-\n         error_messages = []\n-\n-        untunnelled_error_message = f\"Invalid untunneled checksum state for %s/%s with a %s checksum.\"\n-\n-        vxlan_error_message = f\"Invalid VXLAN tunnelled %s checksum state for %s/%s\" \\\n-                              f\" with a %s inner checksum and a %s outer checksum.\"\n-\n-        gre_error_message = f\"Invalid GRE tunnelled checksum state for %s/%s with a %s checksum.\"\n+        untunnelled_error_message = f\"un-tunneled checksum state for pkg[%s] with a invalid checksum.\"\n+        vxlan_error_message = f\"VXLAN tunnelled checksum state for pkg[%s]  with a invalid checksum.\"\n+        gre_error_message = f\"GRE tunnelled checksum state for pkg[%s] with a invalid checksum.\"\n \n         for packet in packets:\n+            self.count = self.count + 1\n             payload: str\n             # try:\n-            payload = packet[Raw].load.decode('utf-8').split(\",\")\n+            payload = packet[Raw].load.decode('utf-8')\n             # # This error usually happens with tunneling protocols, and means that an additional cast is needed\n             # except UnicodeDecodeError:\n             #     for proto in tunnelling_proto_classes:\n-\n-            l3 = name_to_class_dict[payload[1]]\n-            l4 = name_to_class_dict[payload[2]]\n-            if payload[0] == \"UNTUNNELED\":\n-                chksum_should_be_valid = payload[3] == \" \"\n-                if self.validate_checksum(packet, l4) != chksum_should_be_valid:\n-                    error_messages.append(\n-                        untunnelled_error_message % (\n-                            l3.__name__, l4.__name__, 'valid' if chksum_should_be_valid == '' else 'invalid'\n-                        )\n-                    )\n-            elif payload[0] == \"VXLAN\":\n-                outer_chksum_should_be_valid = payload[3] == \" \"\n-                inner_chksum_should_be_valid = payload[4] == \" \"\n-                if self.validate_checksum(packet[VXLAN], l4) != inner_chksum_should_be_valid:\n-                    error_messages.append(\n-                        vxlan_error_message % (\n-                            \"inner\", l4.__name__, l3.__name__,\n-                            'valid' if inner_chksum_should_be_valid == '' else 'invalid',\n-                            'valid' if outer_chksum_should_be_valid == '' else 'invalid'\n-                        )\n-                    )\n-                if self.validate_checksum(packet, l4) != outer_chksum_should_be_valid:\n-                    error_messages.append(\n-                        vxlan_error_message % (\n-                            \"outer\", l3.__name__, l4.__name__,\n-                            'valid' if inner_chksum_should_be_valid == '' else 'invalid',\n-                            'valid' if outer_chksum_should_be_valid == '' else 'invalid'\n-                        )\n-                    )\n-            elif payload[0] == \"GRE\":\n-                chksum_should_be_valid = payload[3] == \" \"\n-                if self.validate_checksum(packet, l4) != chksum_should_be_valid:\n-                    error_messages.append(\n-                        gre_error_message % (\n-                            l3.__name__, l4.__name__, 'valid' if chksum_should_be_valid == '' else 'invalid'\n-                        )\n-                    )\n-\n+            if 'X' in payload:\n+                if self.validate_checksum(packet, 'un-tunneled'):\n+                    error_messages.append(untunnelled_error_message % self.count)\n+            elif 'Y' in payload:\n+                if self.validate_checksum(packet[VXLAN][Ether], 'VXLAN', inner_flag=True):\n+                    error_messages.append(vxlan_error_message % self.count)\n+                # fortville not support outer udp checksum\n+                if 'fortville' in self.nic:\n+                    continue\n+                if self.validate_checksum(packet, 'VXLAN'):\n+                    error_messages.append(vxlan_error_message % self.count)\n+            elif 'Z' in payload:\n+                if self.validate_checksum(packet, 'GRE'):\n+                    error_messages.append(gre_error_message % self.count)\n         return error_messages\n \n     #\n@@ -783,7 +750,7 @@ class TestChecksumOffload(TestCase):\n             for l4 in l4_protos:\n                 for chksum in \"\", \"chksum=0xf\":\n                     vf = self.send_pkt_expect_good_bad_from_flag_catch_failure(\n-                        f\"eth/{l3}()/{l4}({chksum})/('X'*50)\",\n+                        f\"eth/{l3}()/{l4}({chksum})/('X'*48)\",\n                         \"PKT_RX_L4_CKSUM_\", f\"{l3}/{l4}\",\n                         should_pass=(chksum == \"\"))\n                     if vf is not None:\n@@ -791,20 +758,22 @@ class TestChecksumOffload(TestCase):\n \n         # Tunneled\n         # VXLAN\n-        VXLAN_l4_protos=['UDP']\n         for l3 in l3_protos:\n-            for l4 in VXLAN_l4_protos:\n+            for l4 in l4_protos:\n                 for outer_arg in \"\", \"chksum=0xf\":\n                     for inner_arg in \"\", \"chksum=0xf\":\n                         for flag in \"PKT_RX_L4_CKSUM_\", \"PKT_RX_OUTER_L4_CKSUM_\":\n                             if flag == \"PKT_RX_L4_CKSUM_\":\n                                 should_pass = inner_arg == \"\"\n                             else:  # flag == PKT_RX_OUTER_L4_CKSUM_\n+                                # fortville not support outer checksum\n+                                if 'fortville' in self.nic:\n+                                    continue\n                                 should_pass = outer_arg == \"\"\n                             vf = self.send_pkt_expect_good_bad_from_flag_catch_failure(\n-                                f\"eth/{l3}()/{l4}(dport=4789,{outer_arg})/VXLAN()/eth/{l3}()/\"\n-                                f\"{l4}({inner_arg})/('X'*50)\",\n-                                flag, f\"{l3}/{l4}/VXLAN/{l3}/{l4}\",\n+                                f\"eth/{l3}()/UDP(dport=4789,{outer_arg})/VXLAN()/eth/{l3}()/\"\n+                                f\"{l4}({inner_arg})/('X'*48)\",\n+                                flag, f\"{l3}/UDP/VXLAN/{l3}/{l4}\",\n                                 should_pass=should_pass)\n \n                             if vf is not None:\n@@ -816,7 +785,7 @@ class TestChecksumOffload(TestCase):\n                 for inner_arg in \"\", \"chksum=0xf\":\n                     should_pass: bool = inner_arg == \"\"\n                     vf = self.send_pkt_expect_good_bad_from_flag_catch_failure(\n-                        f\"eth/{l3}()/GRE()/{l3}()/{l4}({inner_arg})/('X'*50)\",\n+                        f\"eth/{l3}()/GRE()/{l3}()/{l4}({inner_arg})/('X'*48)\",\n                         \"PKT_RX_L4_CKSUM_\", f\"{l3}/GRE/{l3}/{l4}\",\n                         should_pass=should_pass)\n \n@@ -854,7 +823,6 @@ class TestChecksumOffload(TestCase):\n             self.logger.error(str(err))\n         self.verify(len(verification_errors) == 0, \"See previous output\")\n \n-\n     def test_hardware_checksum_check_l4_tx(self):\n         self.checksum_enablehw(self.dut_ports[0])\n         self.dut.send_expect(\"start\", \"testpmd>\")\n@@ -872,24 +840,41 @@ class TestChecksumOffload(TestCase):\n         packet_file_path = \"/tmp/test_hardware_checksum_check_l4_tx_packets.pcap\"\n         capture_file_path = \"/tmp/tester/\" + capture_file_name\n \n-        self.tester.send_expect(f\"tcpdump -i '{iface}' -s 65535 -w {capture_file_path} &\", \"# \")\n-\n+        if os.path.isfile(packet_file_path):\n+            os.remove(packet_file_path)\n         wrpcap(packet_file_path, packets)\n         self.tester.session.copy_file_to(packet_file_path, packet_file_path)\n \n-        self.replay_pcap_file_on_tester(iface, packet_file_path)\n+        if os.path.isfile(capture_file_path):\n+            os.remove(capture_file_path)\n+        self.tester.send_expect(f\"tcpdump -i '{iface}' ether src {dut_mac} -s 0 -w {capture_file_path} &\", \"# \")\n \n-        self.tester.session.copy_file_from(packet_file_path, \"output/tmp/pcap/\" + capture_file_name)\n+        # send packet\n+        self.tester.send_expect(\"scapy\", \">>>\")\n+        self.scapy_exec(f\"packets = rdpcap('{packet_file_path}')\")\n+        for i in range(0, len(packets)):\n+            self.replay_pcap_file_on_tester(iface, i, packet_file_path)\n+            self.pmdout.get_output(timeout=0.5)\n+            self.dut.send_expect(\"show port stats {}\".format(self.dut_ports[0]), \"testpmd>\")\n+        self.tester.send_expect(\"quit()\", \"# \")\n+\n+        time.sleep(1)\n+        self.tester.send_expect('killall tcpdump', '#')\n+        time.sleep(1)\n+        self.tester.send_expect('echo \"Cleaning buffer\"', '#')\n+        time.sleep(1)\n+\n+        self.tester.session.copy_file_from(capture_file_path, \"output/tmp/pcap/\" + capture_file_name)\n \n         captured_packets = rdpcap(\"output/tmp/pcap/\" + capture_file_name)\n \n         self.verify(len(packets) == len(captured_packets), \"Not all packets were received\")\n \n-        error_messages = self.validate_packet_list_checksums(captured_packets)\n-\n-        self.tester.send_expect(\"quit\", \"#\")\n         self.dut.send_expect(\"stop\", \"testpmd>\")\n \n+        self.count = 0\n+        error_messages = self.validate_packet_list_checksums(captured_packets)\n+\n         if len(error_messages) != 0:\n             for error_msg in error_messages:\n                 self.logger.error(error_msg)\n",
    "prefixes": [
        "V1"
    ]
}