get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 110204,
    "url": "https://patches.dpdk.org/api/patches/110204/?format=api",
    "web_url": "https://patches.dpdk.org/project/dts/patch/20220425015719.1573252-1-weix.ling@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": "<20220425015719.1573252-1-weix.ling@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dts/20220425015719.1573252-1-weix.ling@intel.com",
    "date": "2022-04-25T01:57:19",
    "name": "[V1,2/2] tests/vdev_primary_secondary: add automation testcase2 sync with testplan",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "f60bb801b97f0d79b33911dff8390167fd8e3ef1",
    "submitter": {
        "id": 1828,
        "url": "https://patches.dpdk.org/api/people/1828/?format=api",
        "name": "Ling, WeiX",
        "email": "weix.ling@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dts/patch/20220425015719.1573252-1-weix.ling@intel.com/mbox/",
    "series": [
        {
            "id": 22651,
            "url": "https://patches.dpdk.org/api/series/22651/?format=api",
            "web_url": "https://patches.dpdk.org/project/dts/list/?series=22651",
            "date": "2022-04-25T01:56:58",
            "name": "fix testplan issue and add automation",
            "version": 1,
            "mbox": "https://patches.dpdk.org/series/22651/mbox/"
        }
    ],
    "comments": "https://patches.dpdk.org/api/patches/110204/comments/",
    "check": "fail",
    "checks": "https://patches.dpdk.org/api/patches/110204/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 692DEA00BE;\n\tMon, 25 Apr 2022 03:57:29 +0200 (CEST)",
            "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id 63D23410D4;\n\tMon, 25 Apr 2022 03:57:29 +0200 (CEST)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n by mails.dpdk.org (Postfix) with ESMTP id E1C3A4069D\n for <dts@dpdk.org>; Mon, 25 Apr 2022 03:57:26 +0200 (CEST)",
            "from orsmga008.jf.intel.com ([10.7.209.65])\n by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 24 Apr 2022 18:57:26 -0700",
            "from unknown (HELO localhost.localdomain) ([10.239.251.222])\n by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 24 Apr 2022 18:57:24 -0700"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple;\n d=intel.com; i=@intel.com; q=dns/txt; s=Intel;\n t=1650851847; x=1682387847;\n h=from:to:cc:subject:date:message-id:mime-version:\n content-transfer-encoding;\n bh=7B6qGTRWPwGCUL1HNy+6Hk9A24EBwiiMxJ5Z/TKSoa0=;\n b=af0rZ++2Jj1pVK0vpFvSse/zGolvDmVtuWyJ9OYBGjadiXmvMHWkIPD7\n L3NaKa86acOK1Oi1VdSGUlpQVNoZBlXecWVf2DUZ2rErK9okf6TFLCp6W\n FZeeQLQrypq7Zl6VDYMLglgQ2hnfl3SqoGY+vvbyJbXF82c0MigKtLumf\n jBIfL4Rr5c6xs9E5NuS4z8EDd0Z72smTnkpr55JYkEXvTwYogeC//baoR\n 8gY5mJJeeWhgQUVD6ldFUC+0VXdAwhLiuXwMbj2Q4H80LqThd/eoi/FIN\n ucJYo+e1V6SGonrFUpZdiLBbNUg7gsTgWpBUOXEow5/V0eFPMeXhmJKYz Q==;",
        "X-IronPort-AV": [
            "E=McAfee;i=\"6400,9594,10327\"; a=\"245039552\"",
            "E=Sophos;i=\"5.90,287,1643702400\"; d=\"scan'208\";a=\"245039552\"",
            "E=Sophos;i=\"5.90,287,1643702400\"; d=\"scan'208\";a=\"579007863\""
        ],
        "From": "Wei Ling <weix.ling@intel.com>",
        "To": "dts@dpdk.org",
        "Cc": "Wei Ling <weix.ling@intel.com>",
        "Subject": "[dts][PATCH V1 2/2] tests/vdev_primary_secondary: add automation\n testcase2 sync with testplan",
        "Date": "Mon, 25 Apr 2022 09:57:19 +0800",
        "Message-Id": "<20220425015719.1573252-1-weix.ling@intel.com>",
        "X-Mailer": "git-send-email 2.25.1",
        "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": "1. Change testcase1 testpmd fwd mode from `set fwd txonly` and `start`\n   to `set fwd mac` and `start tx_first` take VM and testpmd can loop the traffic.\n2. Add automation testcase2 sync with testplan and optimize code.\n\nSigned-off-by: Wei Ling <weix.ling@intel.com>\n---\n tests/TestSuite_vdev_primary_secondary.py | 148 ++++++++++++++--------\n 1 file changed, 95 insertions(+), 53 deletions(-)",
    "diff": "diff --git a/tests/TestSuite_vdev_primary_secondary.py b/tests/TestSuite_vdev_primary_secondary.py\nindex 7f054cda..4c9dba8e 100644\n--- a/tests/TestSuite_vdev_primary_secondary.py\n+++ b/tests/TestSuite_vdev_primary_secondary.py\n@@ -47,6 +47,7 @@ import time\n import framework.utils as utils\n from framework.test_case import TestCase\n from framework.virt_common import VM\n+from framework.pmd_output import PmdOutput\n \n \n class TestVdevPrimarySecondary(TestCase):\n@@ -59,14 +60,16 @@ class TestVdevPrimarySecondary(TestCase):\n         self.dut_ports = self.dut.get_ports(self.nic)\n         self.verify(len(self.dut_ports) >= 1, \"Insufficient ports for testing\")\n         self.ports_socket = self.dut.get_numa_id(self.dut_ports[0])\n-        cores = self.dut.get_core_list(\"1S/12C/1T\", socket=self.ports_socket)\n-        self.coremask = utils.create_mask(cores)\n-        self.verify(len(self.coremask) >= 6, \"The machine has too few cores.\")\n+        self.cores = self.dut.get_core_list(\"all\", socket=self.ports_socket)\n+        self.vhost_cores = self.cores[0:6]\n+        self.verify(len(self.vhost_cores) >= 6, \"The machine has too few cores.\")\n         self.base_dir = self.dut.base_dir.replace(\"~\", \"/root\")\n-        self.pci_info = self.dut.ports_info[0][\"pci\"]\n         self.app_testpmd_path = self.dut.apps_name[\"test-pmd\"]\n         self.app_symmetric_mp_path = self.dut.apps_name[\"symmetric_mp\"]\n+        self.app_hotplug_mp_path = self.dut.apps_name[\"hotplug_mp\"]\n         self.testpmd_name = self.app_testpmd_path.split(\"/\")[-1]\n+        self.vhost_user = self.dut.create_session(\"vhost-user\")\n+        self.vhost_user_pmd = PmdOutput(self.dut, self.vhost_user)\n \n     def set_up(self):\n         \"\"\"\n@@ -89,7 +92,7 @@ class TestVdevPrimarySecondary(TestCase):\n             vm_params[\"opt_mac\"] = \"%s%d\" % (self.virtio_mac, i + 2)\n             vm_params[\"opt_queue\"] = self.queues\n             vm_params[\"opt_server\"] = \"server\"\n-            vm_params[\"opt_settings\"] = \"mrg_rxbuf=on,mq=on,vectors=%d\" % (\n+            vm_params[\"opt_settings\"] = \"mrg_rxbuf=on,csum=on,mq=on,vectors=%d\" % (\n                 2 * self.queues + 2\n             )\n             self.vm.set_vm_device(**vm_params)\n@@ -103,33 +106,14 @@ class TestVdevPrimarySecondary(TestCase):\n \n         return True\n \n-    def launch_testpmd(self):\n+    def launch_testpmd(self, param, eal_param):\n         \"\"\"\n         launch testpmd\n         \"\"\"\n-        testcmd = self.app_testpmd_path + \" \"\n-        vdev1 = \" --vdev 'net_vhost0,iface=%s/vhost-net0,queues=%d,client=1'\" % (\n-            self.base_dir,\n-            self.queues,\n-        )\n-        vdev2 = \" --vdev 'net_vhost1,iface=%s/vhost-net1,queues=%d,client=1'\" % (\n-            self.base_dir,\n-            self.queues,\n-        )\n-        eal_params = self.dut.create_eal_parameters(\n-            cores=\"1S/12C/1T\", prefix=\"vhost\", ports=[self.pci_info]\n-        )\n-        para = \" -- -i --nb-cores=4 --rxq=%d --txq=%d --txd=1024 --rxd=1024\" % (\n-            self.queues,\n-            self.queues,\n-        )\n-        start_cmd = testcmd + eal_params + vdev1 + vdev2 + para\n-        self.dut.send_expect(start_cmd, \"testpmd> \", 120)\n-        self.dut.send_expect(\"set fwd txonly\", \"testpmd> \", 120)\n-        self.dut.send_expect(\"start\", \"testpmd> \", 120)\n+        self.vhost_user_pmd.start_testpmd(cores=self.vhost_cores, param=param, eal_param=eal_param, prefix='vhost', fixed_prefix=True, no_pci=True)\n \n-    def launch_examples(self):\n-        example_cmd_auto = (\n+    def launch_symmetric_mp(self):\n+        example_cmd_primary = (\n             self.app_symmetric_mp_path\n             + \" -l 0 -n %d --proc-type=auto -- -p 3 --num-procs=%d --proc-id=0\"\n         )\n@@ -137,53 +121,111 @@ class TestVdevPrimarySecondary(TestCase):\n             self.app_symmetric_mp_path\n             + \" -l 1 -n %d --proc-type=secondary -- -p 3 --num-procs=%d --proc-id=1\"\n         )\n-        final_cmd_first = example_cmd_auto % (self.mem_channels, self.queues)\n+        final_cmd_primary = example_cmd_primary % (self.mem_channels, self.queues)\n+        final_cmd_secondary = example_cmd_secondary % (self.mem_channels, self.queues)\n+        self.vm_primary.send_expect(final_cmd_primary, \"Lcore\", 120)\n+        time.sleep(3)\n+        self.vm_secondary.send_expect(final_cmd_secondary, \"Lcore\", 120)\n+\n+    def launch_hotplug_mp(self):\n+        example_cmd_primary = (\n+            self.app_hotplug_mp_path\n+            + \" -l 0 -n %d --proc-type=auto -- -p 3 --num-procs=%d --proc-id=0\"\n+        )\n+        example_cmd_secondary = (\n+            self.app_hotplug_mp_path\n+            + \" -l 1 -n %d --proc-type=secondary -- -p 3 --num-procs=%d --proc-id=1\"\n+        )\n+        final_cmd_primary = example_cmd_primary % (self.mem_channels, self.queues)\n         final_cmd_secondary = example_cmd_secondary % (self.mem_channels, self.queues)\n-        self.vhost_first.send_expect(final_cmd_first, \"Lcore\", 120)\n+        self.vm_primary.send_expect(final_cmd_primary, \"example>\", 120)\n         time.sleep(3)\n-        self.vhost_secondary.send_expect(final_cmd_secondary, \"Lcore\", 120)\n+        self.vm_secondary.send_expect(final_cmd_secondary, \"example>\", 120)\n+\n+    def check_etherdev(self, dev_list):\n+        primary_out = self.vm_primary.send_expect(\"list\", \"example\", 120)\n+        for dev in dev_list:\n+            self.verify(dev in primary_out, \"dev {} not in the list\")\n+        secondary_out = self.vm_secondary.send_expect(\"list\", \"example\", 120)\n+        for dev in dev_list:\n+            self.verify(dev in secondary_out, \"dev {} not in the list\")\n+\n+    def detach_etherdev_from_primary(self, dev_pci):\n+        self.vm_primary.send_expect(\"detach {}\".format(dev_pci), \"example\", 120)\n+\n+    def attach_etherdev_from_secondary(self, dev_pci):\n+        self.vm_secondary.send_expect(\"attach {}\".format(dev_pci), \"example\", 120)\n \n     def prepare_symmetric_mp(self):\n         out = self.vm_dut.build_dpdk_apps(\"./examples/multi_process/symmetric_mp\")\n         self.verify(\"Error\" not in out, \"compilation symmetric_mp error\")\n \n-    def close_session(self):\n-        self.vm_dut.close_session(self.vhost_first)\n-        self.vm_dut.close_session(self.vhost_secondary)\n+    def prepare_hotplug_mp(self):\n+        out = self.vm_dut.build_dpdk_apps(\"./examples/multi_process/hotplug_mp\")\n+        self.verify(\"Error\" not in out, \"compilation hotplug_mp error\")\n \n-    def test_Virtio_primary_and_secondary_process(self):\n-        # start testpmd\n-        self.launch_testpmd()\n+    def close_session(self):\n+        self.vm_dut.close_session(self.vm_primary)\n+        self.vm_dut.close_session(self.vm_secondary)\n+        self.dut.close_session(self.vhost_user)\n+\n+    def test_virtio_primary_and_secondary_process(self):\n+        vhost_eal_param = \"--vdev 'net_vhost,iface=vhost-net0,queues=2,client=1' --vdev 'net_vhost1,iface=vhost-net1,queues=2,client=1'\"\n+        vhost_param = \"--nb-cores=4 --rxq=2 --txq=2 --txd=1024 --rxd=1024\"\n+        self.launch_testpmd(param=vhost_param, eal_param=vhost_eal_param)\n         self.setup_vm_env()\n-        # Modify code\n         self.prepare_symmetric_mp()\n-        # create 2 new session\n-        self.vhost_first = self.vm_dut.new_session(suite=\"vhost_first\")\n-        self.vhost_secondary = self.vm_dut.new_session(suite=\"vhsot_secondary\")\n-        # start symmetric_mp\n-        self.launch_examples()\n+        self.vm_primary = self.vm_dut.new_session(suite=\"vm_primary\")\n+        self.vm_secondary = self.vm_dut.new_session(suite=\"vm_secondary\")\n+        self.launch_symmetric_mp()\n+        self.vhost_user_pmd.execute_cmd(\"set fwd mac\")\n+        self.vhost_user_pmd.execute_cmd(\"start tx_first\")\n         time.sleep(3)\n-        vhost_first_out = self.vhost_first.send_expect(\"^c\", \"#\", 15)\n-        print(vhost_first_out)\n+        vm_primary_out = self.vm_primary.send_expect(\"^c\", \"#\", 15)\n+        print(vm_primary_out)\n         time.sleep(3)\n-        vhost_secondary_out = self.vhost_secondary.send_expect(\"^c\", \"#\", 15)\n-        print(vhost_secondary_out)\n-        result_first = re.findall(r\"Port \\d: RX - (\\w+)\", vhost_first_out)\n-        result_secondary = re.findall(r\"Port \\d: RX - (\\w+)\", vhost_secondary_out)\n+        vm_secondary_out = self.vm_secondary.send_expect(\"^c\", \"#\", 15)\n+        print(vm_secondary_out)\n+        result_primary = re.findall(r\"Port \\d: RX - (\\w+)\", vm_primary_out)\n+        result_secondary = re.findall(r\"Port \\d: RX - (\\w+)\", vm_secondary_out)\n         self.verify(\n-            len(result_first[0]) != 0\n-            and len(result_first[1]) != 0\n+            len(result_primary[0]) != 0\n+            and len(result_primary[1]) != 0\n             and len(result_secondary[0]) != 0\n             and len(result_secondary[1]) != 0,\n             \"RX no data\",\n         )\n         self.dut.send_expect(\"quit\", \"#\", 15)\n \n+    def test_virtio_primay_and_secondary_process_hotplug(self):\n+        vhost_eal_param = \"--vdev 'net_vhost0,iface=vhost-net0,queues=2,client=1' --vdev 'net_vhost1,iface=vhost-net1,queues=2,client=1'\"\n+        vhost_param = \"--nb-cores=4 --rxq=2 --txq=2 --txd=1024 --rxd=1024\"\n+        self.launch_testpmd(param=vhost_param, eal_param=vhost_eal_param)\n+        self.vhost_user_pmd.execute_cmd(\"set fwd txonly\")\n+        self.vhost_user_pmd.execute_cmd(\"start\")\n+        self.setup_vm_env()\n+        self.prepare_hotplug_mp()\n+        self.vm_primary = self.vm_dut.new_session(suite=\"vm_primary\")\n+        self.vm_secondary = self.vm_dut.new_session(suite=\"vm_secondary\")\n+        self.launch_hotplug_mp()\n+        vm_ports = []\n+        for pci_info in self.vm_dut.ports_info:\n+            vm_ports.append(pci_info['pci'])\n+        self.check_etherdev(dev_list=vm_ports)\n+        detach_pci = vm_ports[0]\n+        for _ in range(2):\n+            self.detach_etherdev_from_primary(dev_pci=detach_pci)\n+            vm_ports.remove(detach_pci)\n+            self.check_etherdev(dev_list=vm_ports)\n+            self.attach_etherdev_from_secondary(dev_pci=detach_pci)\n+            vm_ports.append(detach_pci)\n+            self.check_etherdev(dev_list=vm_ports)\n+        self.dut.send_expect(\"quit\", \"#\", 15)\n+\n     def tear_down(self):\n         \"\"\"\n         Run after each test case.\n         \"\"\"\n-        self.close_session()\n         self.vm_dut.kill_all()\n         self.dut.kill_all()\n         self.vm.stop()\n@@ -195,4 +237,4 @@ class TestVdevPrimarySecondary(TestCase):\n         \"\"\"\n         Run after each test suite.\n         \"\"\"\n-        pass\n+        self.close_session()\n",
    "prefixes": [
        "V1",
        "2/2"
    ]
}