get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 134047,
    "url": "http://patches.dpdk.org/api/patches/134047/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20231109231707.25400-2-jspewock@iol.unh.edu/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20231109231707.25400-2-jspewock@iol.unh.edu>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20231109231707.25400-2-jspewock@iol.unh.edu",
    "date": "2023-11-09T23:16:14",
    "name": "[v3,1/1] dts: bind to DPDK driver before running test suites",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "0657e362eb3d78b823f6ce2fe25725fb2c913590",
    "submitter": {
        "id": 2772,
        "url": "http://patches.dpdk.org/api/people/2772/?format=api",
        "name": "Jeremy Spewock",
        "email": "jspewock@iol.unh.edu"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20231109231707.25400-2-jspewock@iol.unh.edu/mbox/",
    "series": [
        {
            "id": 30231,
            "url": "http://patches.dpdk.org/api/series/30231/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=30231",
            "date": "2023-11-09T23:16:13",
            "name": "dts: Add the ability to bind ports to drivers",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/30231/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/134047/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/134047/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-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 E4968432EC;\n\tFri, 10 Nov 2023 00:17:30 +0100 (CET)",
            "from mails.dpdk.org (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id D14FF41151;\n\tFri, 10 Nov 2023 00:17:30 +0100 (CET)",
            "from mail-pj1-f98.google.com (mail-pj1-f98.google.com\n [209.85.216.98]) by mails.dpdk.org (Postfix) with ESMTP id 558FF41143\n for <dev@dpdk.org>; Fri, 10 Nov 2023 00:17:29 +0100 (CET)",
            "by mail-pj1-f98.google.com with SMTP id\n 98e67ed59e1d1-2802e5ae23bso1334203a91.2\n for <dev@dpdk.org>; Thu, 09 Nov 2023 15:17:29 -0800 (PST)",
            "from postal.iol.unh.edu (postal.iol.unh.edu.\n [2606:4100:3880:1234::84]) by smtp-relay.gmail.com with ESMTPS id\n rj12-20020a17090b3e8c00b00281085914cfsm543395pjb.16.2023.11.09.15.17.28\n (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);\n Thu, 09 Nov 2023 15:17:28 -0800 (PST)",
            "from iol.unh.edu (unknown\n [IPv6:2606:4100:3880:1271:90f9:1b64:f6e6:867f])\n by postal.iol.unh.edu (Postfix) with ESMTP id DD214605C318;\n Thu,  9 Nov 2023 18:17:27 -0500 (EST)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=iol.unh.edu; s=unh-iol; t=1699571848; x=1700176648; darn=dpdk.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=BEIVF8pHcyq4mSj1WpBnzLc7iFFhA5bQ+GGIyzZff2E=;\n b=NkNoS97VP9Bn7SlrYxt2voCX7nJAMf8bT/cj+pbyA1a0jHLE3OHMzZjh5B0brHs4bq\n X/AX9VW4WNO6Y/a3dwTtS/xfM1vtROXZhvG3SIuPAqHSE1iehojMbu/tFiXUEJg0y35O\n 8d8OEiwWey1daj8Vrvyu0Ob27YdUXlYJRvrIw=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1699571848; x=1700176648;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc\n :subject:date:message-id:reply-to;\n bh=BEIVF8pHcyq4mSj1WpBnzLc7iFFhA5bQ+GGIyzZff2E=;\n b=RhxHPE2DKr88pDJlcKmiKGrbO7aM2f7gojoIP9WhD3K0tGRK/UHDB1IoAAz2TW67Gg\n PffKPJM665DY/+aFWJ8+8io2qIoxhGN3gMwxJLekHL9yKat6BZUF51FbaJDwf0zLIJgr\n 4+104vxAexwolSUt3OiJLY2hig7yW9dnNww6+T0kyEUYN7b0K1ACqs7in5rm5TC6ucET\n bDF7fW7N8YaKoPscSPtRkimcOjuLLH8lgi3Ti1py3IKvD0oGcSC9P3PzX+A1y6xxupjh\n mz1nwZ7+0PNW8d/dO57HDw31rfIx/zvU9gpvZ1QkCg7fw2wFZSXZyluiAXpCjuNxq13a\n UXqQ==",
        "X-Gm-Message-State": "AOJu0Yw271JjQpxnYoHkgdxjDxs8E+jX6Bj6/EZukizqCG5Fp/Oa8PN+\n Y+oRfQFHxtJD7/OjGkOG3Rl63h3D5KPa1Z0KemV3gXtckuDpVfTQdKbL+gS/+JGdHw==",
        "X-Google-Smtp-Source": "\n AGHT+IGFO4rTBsffxwz2RqKrQPsczZ71V9fPV4bnjXkYIlBn5dH32mflF1/1TOsZv3OOJdLSgUsjWAPLltsO",
        "X-Received": "by 2002:a17:90b:38c4:b0:27c:fc2a:a178 with SMTP id\n nn4-20020a17090b38c400b0027cfc2aa178mr3413456pjb.9.1699571848537;\n Thu, 09 Nov 2023 15:17:28 -0800 (PST)",
        "X-Relaying-Domain": "iol.unh.edu",
        "From": "jspewock@iol.unh.edu",
        "To": "Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech,\n thomas@monjalon.net, wathsala.vithanage@arm.com, probb@iol.unh.edu,\n paul.szczepanek@arm.com, yoan.picchi@foss.arm.com",
        "Cc": "dev@dpdk.org,\n\tJeremy Spewock <jspewock@iol.unh.edu>",
        "Subject": "[PATCH v3 1/1] dts: bind to DPDK driver before running test suites",
        "Date": "Thu,  9 Nov 2023 18:16:14 -0500",
        "Message-ID": "<20231109231707.25400-2-jspewock@iol.unh.edu>",
        "X-Mailer": "git-send-email 2.42.0",
        "In-Reply-To": "<20231109231707.25400-1-jspewock@iol.unh.edu>",
        "References": "<20231109231707.25400-1-jspewock@iol.unh.edu>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org"
    },
    "content": "From: Jeremy Spewock <jspewock@iol.unh.edu>\n\nModifies the current process so that we bind to os_driver_for_dpdk from\nthe configuration file before running test suites and bind back to the\nos_driver afterwards. This allows test suites to assume that the ports\nare bound to a DPDK supported driver or bind to either driver as needed.\n\nSigned-off-by: Jeremy Spewock <jspewock@iol.unh.edu>\n---\n dts/framework/testbed_model/sut_node.py | 33 +++++++++++++++++++++++++\n dts/tests/TestSuite_os_udp.py           |  4 +++\n dts/tests/TestSuite_smoke_tests.py      |  6 ++---\n 3 files changed, 39 insertions(+), 4 deletions(-)",
    "diff": "diff --git a/dts/framework/testbed_model/sut_node.py b/dts/framework/testbed_model/sut_node.py\nindex 202aebfd06..4161d3a4d5 100644\n--- a/dts/framework/testbed_model/sut_node.py\n+++ b/dts/framework/testbed_model/sut_node.py\n@@ -89,6 +89,7 @@ class SutNode(Node):\n     _dpdk_version: str | None\n     _node_info: NodeInfo | None\n     _compiler_version: str | None\n+    _path_to_devbind_script: PurePath | None\n \n     def __init__(self, node_config: SutNodeConfiguration):\n         super(SutNode, self).__init__(node_config)\n@@ -105,6 +106,7 @@ def __init__(self, node_config: SutNodeConfiguration):\n         self._dpdk_version = None\n         self._node_info = None\n         self._compiler_version = None\n+        self._path_to_devbind_script = None\n         self._logger.info(f\"Created node: {self.name}\")\n \n     @property\n@@ -155,6 +157,14 @@ def compiler_version(self) -> str:\n                 return \"\"\n         return self._compiler_version\n \n+    @property\n+    def path_to_devbind_script(self) -> PurePath:\n+        if self._path_to_devbind_script is None:\n+            self._path_to_devbind_script = self.main_session.join_remote_path(\n+                self._remote_dpdk_dir, \"usertools\", \"dpdk-devbind.py\"\n+            )\n+        return self._path_to_devbind_script\n+\n     def get_build_target_info(self) -> BuildTargetInfo:\n         return BuildTargetInfo(\n             dpdk_version=self.dpdk_version, compiler_version=self.compiler_version\n@@ -176,6 +186,14 @@ def _set_up_build_target(\n         self._configure_build_target(build_target_config)\n         self._copy_dpdk_tarball()\n         self._build_dpdk()\n+        self.bind_ports_to_driver()\n+\n+    def _tear_down_build_target(self) -> None:\n+        \"\"\"\n+        This method exists to be optionally overwritten by derived classes and\n+        is not decorated so that the derived class doesn't have to use the decorator.\n+        \"\"\"\n+        self.bind_ports_to_driver(for_dpdk=False)\n \n     def _configure_build_target(\n         self, build_target_config: BuildTargetConfiguration\n@@ -389,3 +407,18 @@ def create_interactive_shell(\n         return super().create_interactive_shell(\n             shell_cls, timeout, privileged, str(eal_parameters)\n         )\n+\n+    def bind_ports_to_driver(self, for_dpdk: bool = True) -> None:\n+        \"\"\"Bind all ports on the SUT to a driver.\n+\n+        Args:\n+            for_dpdk: Boolean that, when True, binds ports to os_driver_for_dpdk\n+            or, when False, binds to os_driver. Defaults to True.\n+        \"\"\"\n+        for port in self.ports:\n+            driver = port.os_driver_for_dpdk if for_dpdk else port.os_driver\n+            self.main_session.send_command(\n+                f\"{self.path_to_devbind_script} -b {driver} --force {port.pci}\",\n+                privileged=True,\n+                verify=True,\n+            )\ndiff --git a/dts/tests/TestSuite_os_udp.py b/dts/tests/TestSuite_os_udp.py\nindex 9b5f39711d..bf6b93deb5 100644\n--- a/dts/tests/TestSuite_os_udp.py\n+++ b/dts/tests/TestSuite_os_udp.py\n@@ -19,6 +19,8 @@ def set_up_suite(self) -> None:\n             Configure SUT ports and SUT to route traffic from if1 to if2.\n         \"\"\"\n \n+        # This test uses kernel drivers\n+        self.sut_node.bind_ports_to_driver(for_dpdk=False)\n         self.configure_testbed_ipv4()\n \n     def test_os_udp(self) -> None:\n@@ -43,3 +45,5 @@ def tear_down_suite(self) -> None:\n             Remove the SUT port configuration configured in setup.\n         \"\"\"\n         self.configure_testbed_ipv4(restore=True)\n+        # Assume other suites will likely need dpdk driver\n+        self.sut_node.bind_ports_to_driver(for_dpdk=True)\ndiff --git a/dts/tests/TestSuite_smoke_tests.py b/dts/tests/TestSuite_smoke_tests.py\nindex 4a269df75b..e8016d1b54 100644\n--- a/dts/tests/TestSuite_smoke_tests.py\n+++ b/dts/tests/TestSuite_smoke_tests.py\n@@ -84,9 +84,7 @@ def test_device_bound_to_driver(self) -> None:\n             Ensure that all drivers listed in the config are bound to the correct\n             driver.\n         \"\"\"\n-        path_to_devbind = self.sut_node.main_session.join_remote_path(\n-            self.sut_node._remote_dpdk_dir, \"usertools\", \"dpdk-devbind.py\"\n-        )\n+        path_to_devbind = self.sut_node.path_to_devbind_script\n \n         all_nics_in_dpdk_devbind = self.sut_node.main_session.send_command(\n             f\"{path_to_devbind} --status | awk '{REGEX_FOR_PCI_ADDRESS}'\",\n@@ -108,7 +106,7 @@ def test_device_bound_to_driver(self) -> None:\n             # We know this isn't None, but mypy doesn't\n             assert devbind_info_for_nic is not None\n             self.verify(\n-                devbind_info_for_nic.group(1) == nic.os_driver,\n+                devbind_info_for_nic.group(1) == nic.os_driver_for_dpdk,\n                 f\"Driver for device {nic.pci} does not match driver listed in \"\n                 f\"configuration (bound to {devbind_info_for_nic.group(1)})\",\n             )\n",
    "prefixes": [
        "v3",
        "1/1"
    ]
}