get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 90932,
    "url": "http://patches.dpdk.org/api/patches/90932/?format=api",
    "web_url": "http://patches.dpdk.org/project/dts/patch/20210409124932.31720-2-qinx.sun@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": "<20210409124932.31720-2-qinx.sun@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dts/20210409124932.31720-2-qinx.sun@intel.com",
    "date": "2021-04-09T12:49:31",
    "name": "[V2,1/2] tests/cvl_limit_value_test: adapt to chapman beach",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": false,
    "hash": "6708071d296b5e14d3093bc1bfc37511fa72eff6",
    "submitter": {
        "id": 1956,
        "url": "http://patches.dpdk.org/api/people/1956/?format=api",
        "name": "Sun, QinX",
        "email": "qinx.sun@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dts/patch/20210409124932.31720-2-qinx.sun@intel.com/mbox/",
    "series": [
        {
            "id": 16225,
            "url": "http://patches.dpdk.org/api/series/16225/?format=api",
            "web_url": "http://patches.dpdk.org/project/dts/list/?series=16225",
            "date": "2021-04-09T12:49:30",
            "name": "adapt to chapman beach platform",
            "version": 2,
            "mbox": "http://patches.dpdk.org/series/16225/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/90932/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/90932/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 557E2A0579;\n\tFri,  9 Apr 2021 06:14:23 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 486921412FB;\n\tFri,  9 Apr 2021 06:14:23 +0200 (CEST)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n by mails.dpdk.org (Postfix) with ESMTP id D34B04068E\n for <dts@dpdk.org>; Fri,  9 Apr 2021 06:14:20 +0200 (CEST)",
            "from fmsmga005.fm.intel.com ([10.253.24.32])\n by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 Apr 2021 21:14:19 -0700",
            "from unknown (HELO localhost.localdomain) ([10.240.183.105])\n by fmsmga005-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 08 Apr 2021 21:14:18 -0700"
        ],
        "IronPort-SDR": [
            "\n 85QoucydxOFAL6G3pJJkVT4sZxCSq7VDWISk/ktdgPV3IwRxeA8u+vomg2Bue/b3AVjb/k8cNH\n iYTnaizaiKbw==",
            "\n RrBmpBcOSSBKYYLGR2g2n3yOBAp+//h4E5EglIpxuUj4t4gDbFtk8aNpoe9NHpqxTMyEc8gANA\n sX8x+5B86AzQ=="
        ],
        "X-IronPort-AV": [
            "E=McAfee;i=\"6000,8403,9948\"; a=\"193724806\"",
            "E=Sophos;i=\"5.82,208,1613462400\"; d=\"scan'208\";a=\"193724806\"",
            "E=Sophos;i=\"5.82,208,1613462400\"; d=\"scan'208\";a=\"613587680\""
        ],
        "From": "sunqin <qinx.sun@intel.com>",
        "To": "dts@dpdk.org",
        "Cc": "sunqin <qinx.sun@intel.com>",
        "Date": "Fri,  9 Apr 2021 12:49:31 +0000",
        "Message-Id": "<20210409124932.31720-2-qinx.sun@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20210409124932.31720-1-qinx.sun@intel.com>",
        "References": "<20210409124932.31720-1-qinx.sun@intel.com>",
        "Subject": "[dts] [PATCH V2 1/2] tests/cvl_limit_value_test: adapt to chapman\n beach",
        "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",
        "Sender": "\"dts\" <dts-bounces@dpdk.org>"
    },
    "content": "modify 2 related cases in this suite\ntest_maxnum_rules_2vf\ntest_maxnum_rules_1pf_2vf\n\nSigned-off-by: sunqin <qinx.sun@intel.com>\n---\n v1: identify card type by start testpmd, test maximum rules for single port\n v2: identify card type by product name, test maximum rules for whole card\n\n tests/TestSuite_cvl_limit_value_test.py | 418 +++++++++++++++---------\n 1 file changed, 258 insertions(+), 160 deletions(-)",
    "diff": "diff --git a/tests/TestSuite_cvl_limit_value_test.py b/tests/TestSuite_cvl_limit_value_test.py\nindex b8064744..2d0ad412 100644\n--- a/tests/TestSuite_cvl_limit_value_test.py\n+++ b/tests/TestSuite_cvl_limit_value_test.py\n@@ -94,6 +94,7 @@ class TestCvlLimitValue(TestCase):\n         localPort = self.tester.get_local_port(self.dut_ports[0])\n         self.__tx_iface = self.tester.get_interface(localPort)\n         self.pkt = Packet()\n+        self.is_chapman = self.is_chapman_beach()\n \n     def set_up_for_iavf_dir(self):\n         \"\"\"\n@@ -120,11 +121,9 @@ class TestCvlLimitValue(TestCase):\n         self.dut.generate_sriov_vfs_by_port(self.used_dut_port_1, 2, driver=driver)\n         self.sriov_vfs_pf0 = self.dut.ports_info[self.used_dut_port_0]['vfs_port']\n         self.sriov_vfs_pf1 = self.dut.ports_info[self.used_dut_port_1]['vfs_port']\n-\n-        self.dut.send_expect('ip link set %s vf 0 mac 00:11:22:33:44:55' % self.pf0_intf, '#')\n-        self.dut.send_expect('ip link set %s vf 1 mac 00:11:22:33:44:66' % self.pf0_intf, '#')\n-        self.dut.send_expect('ip link set %s vf 0 mac 00:11:22:33:44:77' % self.pf1_intf, '#')\n-        self.dut.send_expect('ip link set %s vf 1 mac 00:11:22:33:44:88' % self.pf1_intf, '#')\n+        self.mac_list = [f'00:11:22:33:44:{mac}' for mac in [55,66,77,88]]\n+        for i in range(0,4):\n+            self.dut.send_expect('ip link set {} vf {} mac {}'.format(eval(f'self.pf{i//2}_intf'),i%2,self.mac_list[i]), '#')\n \n         # bind VF0 and VF1 to dpdk driver\n         try:\n@@ -213,7 +212,7 @@ class TestCvlLimitValue(TestCase):\n     def launch_testpmd(self):\n         self.pmd_output.start_testpmd(cores=\"1S/4C/1T\",\n                                       param=\"--rxq={} --txq={}\".format(self.cvlq_num, self.cvlq_num),\n-                                      eal_param=\"-w %s -w %s\" % (\n+                                      eal_param=\"-a %s -a %s\" % (\n                                           self.sriov_vfs_pf0[0].pci, self.sriov_vfs_pf0[1].pci),\n                                       socket=self.ports_socket)\n         self.config_testpmd()\n@@ -311,6 +310,13 @@ class TestCvlLimitValue(TestCase):\n             self.verify(len(li) == num, \"the amount of rules is wrong.\")\n         return out\n \n+    def get_rule_number(self, port_id=0):\n+        out = self.dut.send_command(\"flow list %s\" % port_id, timeout=300)\n+        result_scanner = r'\\d*.*?\\d*.*?\\d*.*?=>*'\n+        scanner = re.compile(result_scanner, re.DOTALL)\n+        li = scanner.findall(out)\n+        return len(li)\n+\n     def send_and_check_packets(self, dic, session_name=\"\", tx_iface=\"\"):\n         \"\"\"\n         general packets processing workflow.\n@@ -328,9 +334,26 @@ class TestCvlLimitValue(TestCase):\n         out = session_name.send_expect(\"stop\", \"testpmd> \", 15)\n         dic[\"check_func\"][\"func\"](out, dic[\"check_func\"][\"param\"], dic[\"expect_results\"])\n \n-    def test_maxnum_14336rules_1vf(self):\n+    def get_nic_product_name(self,port_id=0):\n+        pf_pci = self.dut.ports_info[port_id]['pci']\n+        out = self.dut.send_expect('lspci -s {} -vvv |grep \"Product Name\"'.format(pf_pci), '#')\n+        res = re.search(r\"Network Adapter\\s+(?P<product_name>E810-.*)\", out)\n+        self.verify(res, \"product name not found'\")\n+        return res.group('product_name')\n+\n+    def is_chapman_beach(self,port_id=0):\n+        if 'E810-2CQDA2' in self.get_nic_product_name(port_id):\n+            return True\n+        return False\n+\n+    def test_maxnum_rules_1vf(self):\n         \"\"\"\n         vfs share 14336 rules table\n+        maximum number of rules varies with NIC, it can be identified by product name as below:\n+        product name   NIC type           rule maximum\n+        E810-XXVDA4   cvl25g*4             14336\n+        E810-CQDA2    cvl100g*2            14336\n+        E810-2CQDA2   chapmanbeach100g*2   14336 (1 vf)\n         \"\"\"\n         dut_file_dir = '/tmp/'\n         self.set_up_for_iavf_dir()\n@@ -348,7 +371,7 @@ class TestCvlLimitValue(TestCase):\n         self.verify(count == 14336, \"failed to create 14336 fdir rules on vf.\")\n         self.dut.session.copy_file_to(self.src_file_dir + src_file, dut_file_dir)\n \n-        eal_param = \"-c f -n 6 -w %s -w %s\" % (self.sriov_vfs_pf0[0].pci, self.sriov_vfs_pf0[1].pci)\n+        eal_param = \"-c f -n 6 -a %s -a %s\" % (self.sriov_vfs_pf0[0].pci, self.sriov_vfs_pf0[1].pci)\n         command = self.path + eal_param + \" -- -i --rxq=%s --txq=%s\" % (\n         self.cvlq_num, self.cvlq_num) + \" --cmdline-file=%s\" % (dut_file_dir + src_file)\n         self.dut.send_expect(command, \"testpmd> \", 300)\n@@ -400,215 +423,284 @@ class TestCvlLimitValue(TestCase):\n         out_14336 = self.send_pkts_getouput(pkts=pkt_14336, pf_id=0)\n         rfc.check_iavf_fdir_mark(out_14336, pkt_num=1, check_param={\"port_id\": 0, \"mark_id\": 0, \"queue\": 5}, stats=True)\n \n-    def test_maxnum_14336rules_2vf(self):\n+    def test_maxnum_rules_2vf(self):\n         \"\"\"\n-        vfs share 14336 rules table\n+        maximum number of rules varies with NIC, it can be identified by product name as below:\n+        product name   NIC type           rule maximum\n+        E810-XXVDA4   cvl25g*4             14336\n+        E810-CQDA2    cvl100g*2            14336\n+        E810-2CQDA2   chapmanbeach100g*2   14336*2 (if vfs generated by 2 pf port, each can create 14336 rules at most)\n         \"\"\"\n         dut_file_dir = '/tmp/'\n         self.dut.kill_all()\n         self.set_up_for_iavf_dir()\n         self.session_secondary = self.dut.new_session()\n-        src_file = 'create_14336_rules_2vf'\n-        flows = open(self.src_file_dir + src_file, mode='w')\n-        flows.write(\n-            'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.0 / end actions queue index 5 / mark / end \\n')\n-        count = 1\n-        for i in range(55):\n-            for j in range(256):\n-                flows.write(\n-                    'flow create 1 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.%d.%d / end actions queue index 5 / mark / end \\n' % (\n-                    i, j))\n-                count = count + 1\n-        for j in range(255):\n-            flows.write(\n-                'flow create 1 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.55.%d / end actions queue index 5 / mark / end \\n' % j)\n-            count = count + 1\n-        flows.close()\n-        self.verify(count == 14336, \"failed to create 14336 fdir rules on 2 vfs.\")\n-        self.dut.session.copy_file_to(self.src_file_dir + src_file, dut_file_dir)\n-\n-        eal_param = \"-c f -n 6 -w %s -w %s\" % (self.sriov_vfs_pf0[0].pci, self.sriov_vfs_pf1[0].pci)\n-        command = self.path + eal_param + \" -- -i --rxq=%s --txq=%s\" % (\n-        self.cvlq_num, self.cvlq_num) + \" --cmdline-file=%s\" % (dut_file_dir + src_file)\n-        self.dut.send_expect(command, \"testpmd> \", 1200)\n-\n+        #create one rule on vf0 and 14335 rules on vf1, if card is chapman beach100g*2,needs to create one rule on\n+        # vf2 and 14335 rules on vf3 in addition\n+        max_rules = 14336\n+        ports = [self.sriov_vfs_pf0[0].pci, self.sriov_vfs_pf1[0].pci]\n+        if self.is_chapman:\n+            max_rules *= 2\n+            ports.extend([self.sriov_vfs_pf0[1].pci, self.sriov_vfs_pf1[1].pci])\n+        file_name = 'create_maxnum_{}rules_2vf'.format(max_rules)\n+        src_file = os.path.join(self.src_file_dir,file_name)\n+        rule = 'flow create {} ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.{}.{} / end actions queue index 5 / mark / end \\n'\n+        k,n = 0,2\n+        with open(src_file,'w') as file_handle:\n+            for i in range(56):\n+                for j in range(256):\n+                    if self.is_chapman:\n+                        if i != 0 or j != 0:\n+                            k,n = 1,3\n+                        file_handle.write(rule.format(k, i, j))\n+                        file_handle.write(rule.format(n, i, j))\n+                    else:\n+                        if i != 0 or j != 0:\n+                            k = 1\n+                        file_handle.write(rule.format(k, i, j))\n+        self.dut.session.copy_file_to(src_file, dut_file_dir)\n+        param = \"--rxq={} --txq={} --cmdline-file={}\".format(self.cvlq_num, self.cvlq_num, os.path.join(dut_file_dir,file_name))\n+        self.pmd_output.start_testpmd(param=param, ports=ports,timeout=1200)\n         self.config_testpmd()\n         self.check_fdir_rule(port_id=0, rule_list=['0'])\n \n         # can't create more than 14336 rules on 2vf\n-        rule_14335_vf1 = \"flow create 1 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.56.0 / end actions queue index 5 / mark / end\"\n-        self.create_fdir_rule(rule_14335_vf1, check_stats=False)\n-        # check there are 14336 rules created.\n-        out = self.check_rule_number(port_id=1, num=14335)\n-        self.verify(\"14335\" not in out, \"more than 14336 rules are created on 2vf\")\n+        rule_14336_vf = \"flow create {} ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.56.0 / end actions queue index 5 / mark / end\"\n+        self.create_fdir_rule(rule_14336_vf.format(1), check_stats=False)\n \n-        # can't create new rule on vf0\n-        rule_1_vf0 = \"flow create 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.56.0 / end actions queue index 5 / mark / end\"\n-        self.create_fdir_rule(rule_1_vf0, check_stats=False)\n-        self.check_rule_number(port_id=0, num=1)\n+        # check there are 14336 rules created.\n+        vf_num = 0\n+        for i in range(0,len(ports)):\n+            vf_num += self.get_rule_number(port_id=i)\n \n-        pkt_0 = 'Ether(dst=\"00:11:22:33:44:55\")/IP(src=\"192.168.0.20\",dst=\"192.168.0.0\")/Raw(\"x\" * 80)'\n-        pkt_1 = 'Ether(dst=\"00:11:22:33:44:77\")/IP(src=\"192.168.0.20\",dst=\"192.168.0.0\")/Raw(\"x\" * 80)'\n-        pkt_14335 = 'Ether(dst=\"00:11:22:33:44:77\")/IP(src=\"192.168.0.20\",dst=\"192.168.55.254\")/Raw(\"x\" * 80)'\n-        pkt_14336 = 'Ether(dst=\"00:11:22:33:44:77\")/IP(src=\"192.168.0.20\",dst=\"192.168.56.0\")/Raw(\"x\" * 80)'\n+        self.verify(vf_num == max_rules, f\"rules number is {vf_num} not match expected {max_rules}\")\n \n+        pkt = 'Ether(dst=\"{}\")/IP(src=\"192.168.0.20\",dst=\"{}\")/Raw(\"x\" * 80)'\n+        dst_list = [[self.mac_list[0],'192.168.0.0'],[self.mac_list[1 if self.is_chapman else 2],'192.168.55.254']]\n+        packet_list = [pkt.format(dst_mac,dst_ip)for dst_mac,dst_ip in dst_list]\n         self.session_secondary.send_expect(\"ifconfig %s up\" % self.pf0_intf, \"# \", 15)\n         self.session_secondary.send_expect(\"ifconfig %s up\" % self.pf1_intf, \"# \", 15)\n-        time.sleep(1)\n+        time.sleep(0.5)\n \n         # check packet match rule 0 and rule 14335 can be redirected to expected queue\n-        out_0 = self.send_pkts_getouput(pkts=pkt_0, pf_id=0)\n-        rfc.check_iavf_fdir_mark(out_0, pkt_num=1, check_param={\"port_id\": 0, \"mark_id\": 0, \"queue\": 5}, stats=True)\n-        out_1 = self.send_pkts_getouput(pkts=pkt_1, pf_id=1)\n-        rfc.check_iavf_fdir_mark(out_1, pkt_num=1, check_param={\"port_id\": 1, \"mark_id\": 0, \"queue\": 5}, stats=True)\n+        for i,_pkt in enumerate(packet_list):\n+            out = self.send_pkts_getouput(pkts=_pkt, pf_id=0 if self.is_chapman else i)\n+            rfc.check_iavf_fdir_mark(out, pkt_num=1, check_param={\"port_id\": i, \"mark_id\": 0, \"queue\": 5}, stats=True)\n \n-        out_14335 = self.send_pkts_getouput(pkts=pkt_14335, pf_id=1)\n-        rfc.check_iavf_fdir_mark(out_14335, pkt_num=1, check_param={\"port_id\": 1, \"mark_id\": 0, \"queue\": 5}, stats=True)\n-        # check packet match rule 14336 can't be redirected to expected queue.\n-        out_14336 = self.send_pkts_getouput(pkts=pkt_14336, pf_id=1)\n+        # check packet match rule 14336 can't be redirected to expected queue\n+        packet_list1 = [pkt.format(self.mac_list[1 if self.is_chapman else 2],'192.168.56.0')]\n+        out_14336 = self.send_pkts_getouput(pkts=packet_list1[0], pf_id=0 if self.is_chapman else 1)\n         rfc.check_iavf_fdir_mark(out_14336, pkt_num=1, check_param={\"port_id\": 1, \"queue\": 5}, stats=False)\n \n-        # destroy rule 0 on vf0, then create a new rule on vf1 successfully.\n+        #destroy one rule of vf0 and create a new rule on vf1\n         self.dut.send_expect(\"flow flush 0\", \"testpmd> \")\n-        self.create_fdir_rule(rule_14335_vf1, check_stats=True)\n-        out_14336 = self.send_pkts_getouput(pkts=pkt_14336, pf_id=1)\n-        rfc.check_iavf_fdir_mark(out_14336, pkt_num=1, check_param={\"port_id\": 1, \"mark_id\": 0, \"queue\": 5}, stats=True)\n-\n-        self.dut.send_expect(\"flow flush 1\", \"testpmd> \", timeout=300)\n+        self.create_fdir_rule(rule_14336_vf.format(1), check_stats=True)\n \n-        self.check_fdir_rule(port_id=0, stats=False)\n-        self.check_fdir_rule(port_id=1, stats=False)\n+        #send matched packet for new rule of vf1\n+        out_14336 = self.send_pkts_getouput(pkts=packet_list1[0], pf_id=0 if self.is_chapman else 1)\n+        rfc.check_iavf_fdir_mark(out_14336, pkt_num=1, check_param={\"port_id\": 1, \"mark_id\": 0, \"queue\": 5}, stats=True)\n \n-        out_0 = self.send_pkts_getouput(pkts=pkt_0, pf_id=0)\n-        out_1 = self.send_pkts_getouput(pkts=pkt_1, pf_id=1)\n-        out_14335 = self.send_pkts_getouput(pkts=pkt_14335, pf_id=1)\n-        rfc.check_iavf_fdir_mark(out_0, pkt_num=1, check_param={\"port_id\": 0, \"mark_id\": 0, \"queue\": 5}, stats=False)\n-        rfc.check_iavf_fdir_mark(out_1, pkt_num=1, check_param={\"port_id\": 1, \"mark_id\": 0, \"queue\": 5}, stats=False)\n-        rfc.check_iavf_fdir_mark(out_14335, pkt_num=1, check_param={\"port_id\": 1, \"mark_id\": 0, \"queue\": 5},\n-                                 stats=False)\n+        if self.is_chapman:\n+            #repeat above steps for vf2 and vf3\n+            packet_list.extend([pkt.format(dst_mac,dst_ip)for dst_mac,dst_ip in [[self.mac_list[2], '192.168.0.0'],\n+                                                                                [self.mac_list[3], '192.168.55.254']]])\n+\n+            # check packet match rule 0 and rule 14335 can be redirected to expected queue for vf2 and vf3\n+            for j in range(2,4):\n+                out = self.send_pkts_getouput(pkts=packet_list[j], pf_id=1)\n+                rfc.check_iavf_fdir_mark(out, pkt_num=1, check_param={\"port_id\": j, \"mark_id\": 0, \"queue\": 5}, stats=True)\n+\n+            packet_list1.extend([pkt.format(self.mac_list[3],'192.168.56.0')])\n+\n+            # check packet match rule 14336 for vf3 can't be redirected to expected queue\n+            out_14336 = self.send_pkts_getouput(pkts=packet_list1[1], pf_id=1)\n+            rfc.check_iavf_fdir_mark(out_14336, pkt_num=1, check_param={\"port_id\": 3, \"queue\": 5}, stats=False)\n+\n+            # destroy one rule of vf2 and create a new rule on vf3\n+            self.dut.send_expect(\"flow flush 2\", \"testpmd> \")\n+            self.create_fdir_rule(rule_14336_vf.format(3), check_stats=True)\n+\n+            # send matched packet for new rule of vf3\n+            out_14336 = self.send_pkts_getouput(pkts=packet_list1[1], pf_id=1)\n+            rfc.check_iavf_fdir_mark(out_14336, pkt_num=1, check_param={\"port_id\": 3, \"mark_id\": 0, \"queue\": 5},stats=True)\n+\n+        #flush all the rules and check the rule list,no rule listed\n+        for i in range(len(ports)):\n+            self.dut.send_expect(f\"flow flush {i}\", \"testpmd> \", timeout=500)\n+            self.check_fdir_rule(port_id=i, stats=False)\n+\n+        #verify matched packet received without FDIR matched ID\n+        for k, _pkt in enumerate(packet_list):\n+            pf_id = k\n+            if self.is_chapman:\n+                if k <= 1:\n+                    pf_id = 0\n+                else:\n+                    pf_id = 1\n+            out = self.send_pkts_getouput(pkts=_pkt, pf_id=pf_id)\n+            rfc.check_iavf_fdir_mark(out, pkt_num=1, check_param={\"port_id\": k, \"mark_id\": 0, \"queue\": 5}, stats=False)\n         self.dut.close_session(self.session_secondary)\n \n-    def test_maxnum_15360rules_1pf_2vf(self):\n+    def test_maxnum_rules_1pf_2vf(self):\n         \"\"\"\n         2*100G NIC, each pf can create 1024 rules at least, vfs share 14336 rules table\n         4*25G NIC, each pf can create 512 rules at least, vfs share 14336 rules table\n         so if 2*25G NIC, max number is 14848 on 1pf and 2vfs.\n+        if hardware is chapman beach 100g*2, 1 pf can create 2048 rules,vfs generated by the same pf share 14336 rules,\n+        so this card can create (2048 + 14336)*2=32768 rules\n         \"\"\"\n         dut_file_dir = '/tmp/'\n         self.dut.kill_all()\n         self.set_up_for_iavf_dir()\n         self.session_secondary = self.dut.new_session()\n-        # create 1025 rules on pf1\n-        src_file = 'create_1025_kernel_rules'\n-        flows = open(self.src_file_dir + src_file, mode='w')\n-        count = 0\n+        # create kernel rules on pf1\n+        rule = 'ethtool -N {} flow-type tcp4 src-ip 192.168.{}.{} dst-ip 192.168.100.2 src-port 32 dst-port 33 action 8 \\n'\n         if self.nic in [\"columbiaville_100g\"]:\n-            for i in range(4):\n-                for j in range(256):\n-                    flows.write(\n-                        'ethtool -N %s flow-type tcp4 src-ip 192.168.%d.%d dst-ip 192.168.100.2 src-port 32 dst-port 33 action 8 \\n' % (\n-                        self.pf1_intf, i, j))\n-                    count = count + 1\n-            flows.write(\n-                'ethtool -N %s flow-type tcp4 src-ip 192.168.100.0 dst-ip 192.168.100.2 src-port 32 dst-port 33 action 8 \\n' % self.pf1_intf)\n-            count = count + 1\n-            flows.close()\n-            self.verify(count == 1025, \"failed to create 1025 fdir rules on pf.\")\n-        elif self.nic in [\"columbiaville_25g\"]:\n-            for i in range(2):\n-                for j in range(256):\n-                    flows.write(\n-                        'ethtool -N %s flow-type tcp4 src-ip 192.168.%d.%d dst-ip 192.168.100.2 src-port 32 dst-port 33 action 8 \\n' % (\n-                        self.pf1_intf, i, j))\n-                    count = count + 1\n-            flows.write(\n-                'ethtool -N %s flow-type tcp4 src-ip 192.168.100.0 dst-ip 192.168.100.2 src-port 32 dst-port 33 action 8 \\n' % self.pf1_intf)\n-            count = count + 1\n-            flows.close()\n-            self.verify(count == 513, \"failed to create 1025 fdir rules on pf.\")\n-        self.dut.session.copy_file_to(self.src_file_dir + src_file, dut_file_dir)\n-        # create 1025 rules on pf1\n-        fkr = open(self.src_file_dir + src_file, \"r+\")\n-        kernel_rules = fkr.read()\n-        fkr.close()\n-        self.dut.send_expect(kernel_rules, \"# \")\n-        time.sleep(15)\n-        # create 1 rule on vf00, and 14334 rules on vf01\n-        src_file_vf = 'create_14335_rules_on_2vfs'\n-        flows = open(self.src_file_dir + src_file_vf, mode='w')\n-        flows.write(\n-            'flow create 0 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.0.0 / end actions queue index 5 / mark / end \\n')\n-        count = 1\n-        for i in range(55):\n+            num = 4\n+            if self.is_chapman:\n+                num = 8\n+        if self.nic in [\"columbiaville_25g\"]:\n+            num = 2\n+        for i in range(num):\n             for j in range(256):\n-                flows.write(\n-                    'flow create 1 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.%d.%d / end actions queue index 5 / mark / end \\n' % (\n-                    i, j))\n-                count = count + 1\n-        for j in range(254):\n-            flows.write(\n-                'flow create 1 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.55.%d / end actions queue index 5 / mark / end \\n' % j)\n-            count = count + 1\n-        flows.close()\n-        self.verify(count == 14335, \"failed to create 14335 fdir rules on vfs.\")\n-        self.dut.session.copy_file_to(self.src_file_dir + src_file_vf, dut_file_dir)\n-        # start testpmd with creating rules in commandline\n-        eal_param = \"-c f -n 6 -w %s -w %s\" % (self.sriov_vfs_pf0[0].pci, self.sriov_vfs_pf0[1].pci)\n-        command = self.path + eal_param + \" -- -i --rxq=%s --txq=%s\" % (\n-        self.cvlq_num, self.cvlq_num) + \" --cmdline-file=%s\" % (dut_file_dir + src_file_vf)\n-        fdw = open(\"15360_rules_vf_result.txt\", \"w\")\n-        fdw.write(self.dut.send_expect(command, \"testpmd> \", 360))\n-        fdw.close()\n+                self.dut.send_expect(rule.format(self.pf0_intf,i,j),'#')\n+                if self.is_chapman:\n+                    self.dut.send_expect(rule.format(self.pf1_intf,i,j),'#')\n+\n+        self.dut.send_expect(rule.format(self.pf0_intf,'100','0'),'#')\n+        if self.is_chapman:\n+            self.dut.send_expect(rule.format(self.pf1_intf, '100', '0'),'#')\n+\n+        # create 1 rule on vf0, and 14334 rules on vf1, if card is chapman beach100g*2,needs to create 1 rule on\n+        # vf2 and 14334 rules on vf3 in addition\n+        rules_num = 14335\n+        ports = [self.sriov_vfs_pf0[0].pci, self.sriov_vfs_pf1[0].pci]\n+        if self.is_chapman:\n+            rules_num *= 2\n+            ports.extend([self.sriov_vfs_pf0[1].pci, self.sriov_vfs_pf1[1].pci])\n+        file_name = 'create_14335_rules_on_2vfs'\n+        src_file = os.path.join(self.src_file_dir,file_name)\n+        rule = 'flow create {} ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.{}.{} / end actions queue index 5 / mark / end \\n'\n+        k,n = 0,2\n+        with open(src_file,'w') as file_handle:\n+            for i in range(56):\n+                for j in range(256):\n+                    if i == j == 255: break\n+                    if self.is_chapman:\n+                        if i != 0 or j != 0:\n+                            k,n = 1,3\n+                        file_handle.write(rule.format(k, i, j))\n+                        file_handle.write(rule.format(n, i, j))\n+                    else:\n+                        if i != 0 or j != 0:\n+                            k = 1\n+                        file_handle.write(rule.format(k, i, j))\n+        self.dut.session.copy_file_to(src_file, dut_file_dir)\n+        param = \"--rxq={} --txq={} --cmdline-file={}\".format(self.cvlq_num, self.cvlq_num, os.path.join(dut_file_dir,file_name))\n+        self.pmd_output.start_testpmd(param=param, ports=ports,timeout=1200)\n         self.config_testpmd()\n-        # check there is 1 rule created on vf00\n+\n+        # check there is 1 rule created on vf0\n         self.check_fdir_rule(port_id=0, rule_list=['0'])\n-        # can't create more than 14335 rules on 2vf, the rule index is from 0\n-        rule_14334_vf1 = \"flow create 1 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.56.0 / end actions queue index 5 / mark / end\"\n-        pkt_14334 = 'Ether(dst=\"00:11:22:33:44:66\")/IP(src=\"192.168.0.20\",dst=\"192.168.56.0\")/Raw(\"x\" * 80)'\n-        self.create_fdir_rule(rule_14334_vf1, check_stats=False)\n-        # check there are 14334 rules created on vf01\n+\n+        # can't create more than 14335 rules on vf1, the rule index is from 0\n+        rule_14334 = \"flow create {} ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.56.0 / end actions queue index 5 / mark / end\"\n+        self.create_fdir_rule(rule_14334.format(1), check_stats=False)\n+\n+        # check there are 14334 rules created on vf1\n         out = self.check_rule_number(port_id=1, num=14334)\n-        self.verify(\"14334\" not in out, \"more than 15360 rules are created on 2vf\")\n+        self.verify(\"14334\" not in out, \"more than 14335 rules are created on 2vf\")\n+\n+        #send match rule0 and rule14333 packet,packets redirected to expected queue\n+        pkt = 'Ether(dst=\"{}\")/IP(src=\"192.168.0.20\",dst=\"{}\")/Raw(\"x\" * 80)'\n+        dst_list = [[self.mac_list[0],'192.168.0.0'],[self.mac_list[1 if self.is_chapman else 2],'192.168.55.254']]\n+        packet_list = [pkt.format(dst_mac,dst_ip)for dst_mac,dst_ip in dst_list]\n+        for i,_pkt in enumerate(packet_list):\n+            out = self.send_pkts_getouput(pkts=_pkt, pf_id=0 if self.is_chapman else i)\n+            rfc.check_iavf_fdir_mark(out, pkt_num=1, check_param={\"port_id\": i, \"mark_id\": 0, \"queue\": 5}, stats=True)\n+\n         # delete a rule on pf0\n-        self.session_secondary.send_expect(\"ethtool -N %s delete 14847\" % self.pf1_intf, \"# \")\n-        # then can create one more rule on vf01\n-        self.create_fdir_rule(rule_14334_vf1, check_stats=True)\n-        out_14334 = self.send_pkts_getouput(pkts=pkt_14334, pf_id=0)\n+        self.session_secondary.send_expect(\"ethtool -N %s delete 14847\" % self.pf0_intf, \"# \")\n+\n+        #then can create one rule on vf1 and send matched packet, it can be redirected to expected queue\n+        pkt_14334 = 'Ether(dst=\"{}\")/IP(src=\"192.168.0.20\",dst=\"192.168.56.0\")/Raw(\"x\" * 80)'\n+        self.create_fdir_rule(rule_14334.format(1), check_stats=True)\n+        out_14334 = self.send_pkts_getouput(pkts=pkt_14334.format(self.mac_list[1 if self.is_chapman else 2]), pf_id=0 if self.is_chapman else 1)\n         rfc.check_iavf_fdir_mark(out_14334, pkt_num=1, check_param={\"port_id\": 1, \"mark_id\": 0, \"queue\": 5}, stats=True)\n-        self.dut.send_expect(\"flow flush 0\", \"testpmd> \", timeout=600)\n-        self.dut.send_expect(\"flow flush 1\", \"testpmd> \", timeout=600)\n-        self.check_fdir_rule(port_id=0, stats=False)\n-        self.check_fdir_rule(port_id=1, stats=False)\n-        out_14334 = self.send_pkts_getouput(pkts=pkt_14334, pf_id=0)\n-        rfc.check_iavf_fdir_mark(out_14334, pkt_num=1, check_param={\"port_id\": 1, \"mark_id\": 0, \"queue\": 5},\n-                                 stats=False)\n-        self.dut.send_expect(\"quit\", \"# \")\n+\n+        # if hardware is chapman beach100g*2 repeat above steps on vf2,vf3 and pf1\n+        if self.is_chapman:\n+\n+            # check there is 1 rule created on vf2\n+            self.check_fdir_rule(port_id=2, rule_list=['0'])\n+            # can't create more than 14335 rules on vf3\n+            self.create_fdir_rule(rule_14334.format(3), check_stats=False)\n+            # check there are 14334 rules created on vf3\n+            out = self.check_rule_number(port_id=3, num=14334)\n+            self.verify(\"14334\" not in out, \"more than 14335 rules are created on 2vf\")\n+\n+            packet_list.extend([pkt.format(dst_mac,dst_ip)for dst_mac,dst_ip in [[self.mac_list[2], '192.168.0.0'],\n+                                                                                [self.mac_list[3], '192.168.55.254']]])\n+            # check packet match rule 0 and rule 14335 can be redirected to expected queue for vf2 and vf3\n+            for j in range(2,4):\n+                out = self.send_pkts_getouput(pkts=packet_list[j], pf_id=1)\n+                rfc.check_iavf_fdir_mark(out, pkt_num=1, check_param={\"port_id\": j, \"mark_id\": 0, \"queue\": 5}, stats=True)\n+\n+            # delete a rule on pf1\n+            self.session_secondary.send_expect(\"ethtool -N %s delete 14847\" % self.pf1_intf, \"# \")\n+\n+            #then can create one rule on vf3 and send matched packet, it can be redirected to expected queue\n+            pkt_14334 = 'Ether(dst=\"{}\")/IP(src=\"192.168.0.20\",dst=\"192.168.56.0\")/Raw(\"x\" * 80)'\n+            self.create_fdir_rule(rule_14334.format(3), check_stats=True)\n+            out_14334 = self.send_pkts_getouput(pkts=pkt_14334.format(self.mac_list[3]), pf_id=1)\n+            rfc.check_iavf_fdir_mark(out_14334, pkt_num=1, check_param={\"port_id\": 3, \"mark_id\": 0, \"queue\": 5}, stats=True)\n+\n+        #flush all the rules and check the rule list,no rule listed\n+        for i in range(len(ports)):\n+            self.dut.send_expect(f\"flow flush {i}\", \"testpmd> \", timeout=500)\n+            self.check_fdir_rule(port_id=i, stats=False)\n+\n+        #verify matched packet received without FDIR matched ID\n+        for k, _pkt in enumerate(packet_list):\n+            pf_id = k\n+            if self.is_chapman:\n+                if k <= 1:\n+                    pf_id = 0\n+                else:\n+                    pf_id = 1\n+            out = self.send_pkts_getouput(pkts=_pkt, pf_id=pf_id)\n+            rfc.check_iavf_fdir_mark(out, pkt_num=1, check_param={\"port_id\": k, \"mark_id\": 0, \"queue\": 5}, stats=False)\n         self.dut.close_session(self.session_secondary)\n \n-    def test_maxnum_15360rules_1pf_0_rules_vf(self):\n+    def test_maxnum_rules_1pf_0_rules_vf(self):\n         \"\"\"\n         2*100G NIC, each pf can create 1024 rules at least, vfs share 14336 rules table\n         4*25G NIC, each pf can create 512 rules at least, vfs share 14336 rules table\n         so if 2*25G NIC, max number is 14848 on 1pf and vfs.\n         create 15360/14848 rules on pf1, check failed to create rule on vf00 and vf10\n+        if hardware is chapman beach 100g*2, 1 pf can create 2048 rules,vfs generated by the same pf share 14336 rules,\n+        so if create 14386 rules on pf1,check failed to create rule on vf00 and vf10(vf00 and vf10 generated by pf1)\n         \"\"\"\n         dut_file_dir = '/tmp/'\n         self.dut.kill_all()\n         self.set_up_for_iavf_dir()\n         self.session_secondary = self.dut.new_session()\n-        # create 15360 rules on pf1\n+        # create maxinum rules on pf1\n         src_file = 'create_15360_kernel_rules'\n         flows = open(self.src_file_dir + src_file, mode='w')\n         count = 0\n+        num = 60\n+        if self.is_chapman:\n+            num = 64\n         if self.nic in [\"columbiaville_100g\"]:\n-            for i in range(60):\n+            for i in range(num):\n                 for j in range(256):\n                     flows.write(\n                         'ethtool -N %s flow-type tcp4 src-ip 192.168.%d.%d dst-ip 192.168.100.2 src-port 32 dst-port 33 action 8 \\n' % (\n                         self.pf1_intf, i, j))\n                     count = count + 1\n             flows.close()\n-            self.verify(count == 15360, \"failed to create 15360 fdir rules on pf.\")\n+            self.verify(count == num*256, \"failed to create %s fdir rules on pf.\"%(num*256))\n         elif self.nic in [\"columbiaville_25g\"]:\n             for i in range(58):\n                 for j in range(256):\n@@ -619,7 +711,7 @@ class TestCvlLimitValue(TestCase):\n             flows.close()\n             self.verify(count == 14848, \"failed to create 14848 fdir rules on pf.\")\n         self.dut.session.copy_file_to(self.src_file_dir + src_file, dut_file_dir)\n-        # create 15360 rules on pf1\n+        # create maxinum rules on pf1\n         fkr = open(self.src_file_dir + src_file, \"r+\")\n         kernel_rules = fkr.read()\n         fkr.close()\n@@ -630,7 +722,9 @@ class TestCvlLimitValue(TestCase):\n             \"ethtool -N %s flow-type tcp4 src-ip 192.168.100.0 dst-ip 192.168.100.2 src-port 32 dst-port 33 action 8\" % self.pf1_intf,\n             \"Cannot insert RX class rule: No space left on device\")\n         # start testpmd with creating rules in commandline\n-        eal_param = \"-c f -n 6 -w %s -w %s\" % (self.sriov_vfs_pf0[0].pci, self.sriov_vfs_pf1[0].pci)\n+        eal_param = \"-c f -n 6 -a %s -a %s\" % (self.sriov_vfs_pf0[0].pci, self.sriov_vfs_pf1[0].pci)\n+        if self.is_chapman:\n+            eal_param = \"-c f -n 6 -a %s -a %s\" % (self.sriov_vfs_pf1[0].pci, self.sriov_vfs_pf1[1].pci)\n         command = self.path + eal_param + \" -- -i --rxq=%s --txq=%s\" % (self.cvlq_num, self.cvlq_num)\n         self.dut.send_expect(command, \"testpmd> \", 20)\n \n@@ -639,6 +733,9 @@ class TestCvlLimitValue(TestCase):\n         pkt_0_vf00 = 'Ether(dst=\"00:11:22:33:44:55\")/IP(src=\"192.168.0.20\",dst=\"192.168.56.0\")/Raw(\"x\" * 80)'\n         rule_0_vf10 = \"flow create 1 ingress pattern eth / ipv4 src is 192.168.0.20 dst is 192.168.56.0 / end actions queue index 5 / mark / end\"\n         pkt_0_vf10 = 'Ether(dst=\"00:11:22:33:44:77\")/IP(src=\"192.168.0.20\",dst=\"192.168.56.0\")/Raw(\"x\" * 80)'\n+        if self.is_chapman:\n+            pkt_0_vf00 = 'Ether(dst=\"00:11:22:33:44:77\")/IP(src=\"192.168.0.20\",dst=\"192.168.56.0\")/Raw(\"x\" * 80)'\n+            pkt_0_vf10 = 'Ether(dst=\"00:11:22:33:44:88\")/IP(src=\"192.168.0.20\",dst=\"192.168.56.0\")/Raw(\"x\" * 80)'\n \n         # failed to create rule on vf00 and vf10\n         self.create_fdir_rule(rule_0_vf00, check_stats=False)\n@@ -662,7 +759,7 @@ class TestCvlLimitValue(TestCase):\n         self.create_fdir_rule(rule_0_vf10, check_stats=True)\n         self.check_rule_number(port_id=1, num=1)\n \n-        out_0_vf00 = self.send_pkts_getouput(pkts=pkt_0_vf00, pf_id=0)\n+        out_0_vf00 = self.send_pkts_getouput(pkts=pkt_0_vf00, pf_id=1 if self.is_chapman else 0)\n         rfc.check_iavf_fdir_mark(out_0_vf00, pkt_num=1, check_param={\"port_id\": 0, \"mark_id\": 0, \"queue\": 5},\n                                  stats=True)\n \n@@ -698,7 +795,7 @@ class TestCvlLimitValue(TestCase):\n         self.verify(count == 14336, \"failed to add/delete 14336 times of fdir rules on vf.\")\n         self.dut.session.copy_file_to(self.src_file_dir + src_file, dut_file_dir)\n \n-        eal_param = \"-c f -n 6 -w %s -w %s\" % (self.sriov_vfs_pf0[0].pci, self.sriov_vfs_pf0[1].pci)\n+        eal_param = \"-c f -n 6 -a %s -a %s\" % (self.sriov_vfs_pf0[0].pci, self.sriov_vfs_pf0[1].pci)\n         command = self.path + eal_param + \" -- -i --rxq=%s --txq=%s\" % (\n         self.cvlq_num, self.cvlq_num) + \" --cmdline-file=%s\" % (dut_file_dir + src_file)\n         self.dut.send_expect(command, \"testpmd> \", 900)\n@@ -737,7 +834,7 @@ class TestCvlLimitValue(TestCase):\n         self.verify(count == 14336, \"failed to add/delete 14336 times of fdir rules on 2 vfs.\")\n         self.dut.session.copy_file_to(self.src_file_dir + src_file, dut_file_dir)\n \n-        eal_param = \"-c f -n 6 -w %s -w %s\" % (self.sriov_vfs_pf0[0].pci, self.sriov_vfs_pf0[1].pci)\n+        eal_param = \"-c f -n 6 -a %s -a %s\" % (self.sriov_vfs_pf0[0].pci, self.sriov_vfs_pf0[1].pci)\n         command = self.path + eal_param + \" -- -i --rxq=%s --txq=%s\" % (\n         self.cvlq_num, self.cvlq_num) + \" --cmdline-file=%s\" % (dut_file_dir + src_file)\n         self.dut.send_expect(command, \"testpmd> \", 900)\n@@ -755,7 +852,7 @@ class TestCvlLimitValue(TestCase):\n         self.pmd_output.start_testpmd(cores=\"1S/4C/1T\",\n                                       param=\"--portmask=%s --rxq=%d --txq=%d --port-topology=loop\" % (\n                                           self.portMask, rxq, txq),\n-                                      eal_param=\"-w %s -w %s --log-level=ice,7\" % (\n+                                      eal_param=\"-a %s -a %s --log-level=ice,7\" % (\n                                           self.pci0, self.pci1), socket=self.ports_socket)\n         self.config_testpmd_cvl_fidr()\n \n@@ -859,6 +956,7 @@ class TestCvlLimitValue(TestCase):\n                 matched_packet = 'Ether(dst=\"68:05:ca:8d:ed:a8\")/IP(src=\"192.168.%d.%d\")/TCP(sport=25,dport=23)/Raw(\"X\"*480)' % (\n                 i, j)\n                 out = self.dut.send_expect(rule, \"testpmd> \", timeout=2)  # create a rule\n+                time.sleep(0.5)\n                 m1 = p.search(out)\n                 if m1:\n                     rule_list.append(m1.group(1))\n",
    "prefixes": [
        "V2",
        "1/2"
    ]
}