From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id C3AC245A12;
	Mon, 23 Sep 2024 20:42:58 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 55FE6402DC;
	Mon, 23 Sep 2024 20:42:54 +0200 (CEST)
Received: from mail-yw1-f226.google.com (mail-yw1-f226.google.com
 [209.85.128.226])
 by mails.dpdk.org (Postfix) with ESMTP id 79AD54027C
 for <dev@dpdk.org>; Mon, 23 Sep 2024 20:42:51 +0200 (CEST)
Received: by mail-yw1-f226.google.com with SMTP id
 00721157ae682-6dbc5db8a31so33813517b3.1
 for <dev@dpdk.org>; Mon, 23 Sep 2024 11:42:51 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=iol.unh.edu; s=unh-iol; t=1727116970; x=1727721770; darn=dpdk.org;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=qG6Qiopb5PuXf59YRD/ZcNnWMp0DKJBzVvK1k2ALL30=;
 b=a5eHiz7ke9TRX8+w67/a7i0Bv/vQU4WBLTIW7FLtDm+gqPHRjZHGIvxDGS1hAhgIvx
 AX4mPmJodqsdyjd8NgBkScRoRYJAovnPmon46HGFdE/GYJebHZXsfZLT72JuVHJx/+eV
 QY7MW7vCD4X24k09xxegMZtMW8Kx8g8XVeWkY=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1727116970; x=1727721770;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=qG6Qiopb5PuXf59YRD/ZcNnWMp0DKJBzVvK1k2ALL30=;
 b=Qf+crunZmjEPYLX3qdpwsx5QmNQmgvTWRHtoQPzei81sO3wCypPWpROaJ39zr+pbrc
 4YzsEHF1dnkbvn0n0bUA1FZSI89ihWdbbsxnv9b9cUG9cQ5l0KFyPosuOa3/XE5Wj6Am
 QCX48xptPQcQymzEjdUjkvkIt2ZoB23Hs4+9+ums6Ba5npGG1z9rNlTGLD4WHMiZas/s
 H7igdfdAtTROEJxZvBWwoaFo4/qdU5Y9trbJttk9ehrRnYNcBvRF4X+wIOpuDwYNduIG
 LBlred7RoxJm4mV69ZLYsiv22xWU5mFnONFNgOzB2W3/OVitUe6rfhHgTcMo7AD8C17i
 mCRw==
X-Gm-Message-State: AOJu0YzFvewc14ufvclRstQdJMW0nX2dJouq+OyDGdc++zMW8iFcg2k+
 PcerZqlJsA9cKMxA4N2eSV1n8WeT7hdLKeTyEqYyeMLzSQYmPRcCPBhF1OXP/Fs8JsxrI2fS7Ml
 taygL0bBBjrbYaDIERgfSdGtppqSH5CWv+ZwquwLpSo+O6sxB
X-Google-Smtp-Source: AGHT+IEwVGRzrsIhp0Gxf2lLka2ElEzd6n+8n9O2TIKRMOWfPLOurt9FieEGly0L2x3xIiOshD0j+2zndcfZ
X-Received: by 2002:a05:690c:2508:b0:652:e900:550a with SMTP id
 00721157ae682-6e20886da73mr5040597b3.19.1727116970620; 
 Mon, 23 Sep 2024 11:42:50 -0700 (PDT)
Received: from postal.iol.unh.edu (postal.iol.unh.edu.
 [2606:4100:3880:1234::84]) by smtp-relay.gmail.com with ESMTPS id
 00721157ae682-6dbe2ed006dsm10273237b3.61.2024.09.23.11.42.50
 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128);
 Mon, 23 Sep 2024 11:42:50 -0700 (PDT)
X-Relaying-Domain: iol.unh.edu
Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1257::1083])
 by postal.iol.unh.edu (Postfix) with ESMTP id BE782605C351;
 Mon, 23 Sep 2024 14:42:49 -0400 (EDT)
From: jspewock@iol.unh.edu
To: npratte@iol.unh.edu, juraj.linkes@pantheon.tech, yoan.picchi@foss.arm.com,
 thomas@monjalon.net, Honnappa.Nagarahalli@arm.com, probb@iol.unh.edu,
 wathsala.vithanage@arm.com, paul.szczepanek@arm.com, Luca.Vizzarro@arm.com,
 alex.chapman@arm.com
Cc: dev@dpdk.org,
	Jeremy Spewock <jspewock@iol.unh.edu>
Subject: [PATCH v4 1/5] dts: allow binding only a single port to a different
 driver
Date: Mon, 23 Sep 2024 14:42:31 -0400
Message-ID: <20240923184235.22582-2-jspewock@iol.unh.edu>
X-Mailer: git-send-email 2.46.0
In-Reply-To: <20240923184235.22582-1-jspewock@iol.unh.edu>
References: <20240821191557.18744-1-jspewock@iol.unh.edu>
 <20240923184235.22582-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>,
 <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>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

From: Jeremy Spewock <jspewock@iol.unh.edu>

Previously the DTS framework only included methods that bind all ports
that the test run was aware of to either the DPDK driver or the OS
driver. There are however some cases, like creating virtual functions,
where you would want some ports bound to the OS driver and others bound
to their DPDK driver. This patch adds the ability to bind individual
ports to their respective drviers to solve this problem.

Depends-on: patch-144318 ("dts: add binding to different drivers to TG
node")

Signed-off-by: Jeremy Spewock <jspewock@iol.unh.edu>
---
 dts/framework/testbed_model/node.py | 21 ++++++++++++---------
 dts/tests/TestSuite_os_udp.py       |  4 ++--
 2 files changed, 14 insertions(+), 11 deletions(-)

diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py
index 6484e16a0f..106e189ce3 100644
--- a/dts/framework/testbed_model/node.py
+++ b/dts/framework/testbed_model/node.py
@@ -138,11 +138,11 @@ def set_up_build_target(self, build_target_config: BuildTargetConfiguration) ->
                 the setup steps will be taken. This is unused in this method, but subclasses that
                 extend this method may need it.
         """
-        self.bind_ports_to_driver()
+        self.bind_all_ports_to_driver()
 
     def tear_down_build_target(self) -> None:
         """Bind ports to their OS drivers."""
-        self.bind_ports_to_driver(for_dpdk=False)
+        self.bind_all_ports_to_driver(for_dpdk=False)
 
     def create_session(self, name: str) -> OSSession:
         """Create and return a new OS-aware remote session.
@@ -258,7 +258,7 @@ def skip_setup(func: Callable[..., Any]) -> Callable[..., Any]:
         else:
             return func
 
-    def bind_ports_to_driver(self, for_dpdk: bool = True) -> None:
+    def bind_all_ports_to_driver(self, for_dpdk: bool = True) -> None:
         """Bind all ports on the node to a driver.
 
         Args:
@@ -266,12 +266,15 @@ def bind_ports_to_driver(self, for_dpdk: bool = True) -> None:
                 If :data:`False`, binds to os_driver.
         """
         for port in self.ports:
-            driver = port.os_driver_for_dpdk if for_dpdk else port.os_driver
-            self.main_session.send_command(
-                f"{self.path_to_devbind_script} -b {driver} --force {port.pci}",
-                privileged=True,
-                verify=True,
-            )
+            self._bind_port_to_driver(port, for_dpdk)
+
+    def _bind_port_to_driver(self, port: Port, for_dpdk: bool = True) -> None:
+        driver = port.os_driver_for_dpdk if for_dpdk else port.os_driver
+        self.main_session.send_command(
+            f"{self.path_to_devbind_script} -b {driver} --force {port.pci}",
+            privileged=True,
+            verify=True,
+        )
 
 
 def create_session(node_config: NodeConfiguration, name: str, logger: DTSLogger) -> OSSession:
diff --git a/dts/tests/TestSuite_os_udp.py b/dts/tests/TestSuite_os_udp.py
index a78bd74139..5e9469bbac 100644
--- a/dts/tests/TestSuite_os_udp.py
+++ b/dts/tests/TestSuite_os_udp.py
@@ -23,7 +23,7 @@ def set_up_suite(self) -> None:
             Bind the SUT ports to the OS driver, configure the ports and configure the SUT
             to route traffic from if1 to if2.
         """
-        self.sut_node.bind_ports_to_driver(for_dpdk=False)
+        self.sut_node.bind_all_ports_to_driver(for_dpdk=False)
         self.configure_testbed_ipv4()
 
     def test_os_udp(self) -> None:
@@ -50,4 +50,4 @@ def tear_down_suite(self) -> None:
         """
         self.configure_testbed_ipv4(restore=True)
         # Assume other suites will likely need dpdk driver
-        self.sut_node.bind_ports_to_driver(for_dpdk=True)
+        self.sut_node.bind_all_ports_to_driver(for_dpdk=True)
-- 
2.46.0