From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6BB1246102; Sat, 25 Jan 2025 01:13:24 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0A6C340151; Sat, 25 Jan 2025 01:13:24 +0100 (CET) Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by mails.dpdk.org (Postfix) with ESMTP id E30954014F for ; Sat, 25 Jan 2025 01:13:22 +0100 (CET) Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-7be8efa231aso257738385a.2 for ; Fri, 24 Jan 2025 16:13:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1737764002; x=1738368802; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=v6ebxG85e9mhuCjeOxOOV7aKFXLa9AYUHAu0JwQEhfQ=; b=MUzvLIkuCdLy6BFtvYTaV7+TRJgeIO3YpYHOnRzJtP6B+90xKNGzwIM+WpB1a7ybZ8 nWmPsO3vZytq8Dljfd8JIDSy2gXH8GMk2xLtt4QKrz4F/71sYOgrGB/FcZ5Sl0ntG/Vl cCaD3748dYM5ixGm0zen/WGssA7NrRj5j5cT4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737764002; x=1738368802; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=v6ebxG85e9mhuCjeOxOOV7aKFXLa9AYUHAu0JwQEhfQ=; b=BVqJ0CXjCQ0/aDHve4MaFpmyoNRhcuC8jHT6Pz7tirW8OvySdi5QxNwevHuy6jyeW3 b7+uZkiTU/sRrfWFvRZHaH1Ua+V4U57oH83KbJtl3dNA1+mxcPatNFDVR8qwiZll1eLv b/3qSO9gWA8+Ll7IN4M/su7gyYQe/6uYzEMli9n1IonL88X684egUxn76zZ5E+EeQ3C0 pqQN8LVFAapJqvlCsByqfZ1WUQAKCa++afWIWoEcqTKvs/JtMLy9bGWyItWlnaoLGe4g Chr9K7nt6necyUtfy1LfJpWXR7T1L9afEdC1d4lKiY76UmOKZA5eMf2GDnbCTa6mXDar Wv3w== X-Gm-Message-State: AOJu0YzTfPuNiqMfu40zXHIMfdcT481gyVDCOEgT1qXgttJpMoOsehvS i8mjlJY+YkY9TPSfnBSqSCF51fhet+bcVeKszhrSYLUledNwm3syuRT8J/7/+Ck= X-Gm-Gg: ASbGncu6OnLouOsZ/eKyDjlYbjSeOHSuB67t2VcXZ1mOkLsaW5avV5rxmdOtNT1+MNS b1zZrg4dTMzQJP1EybZHRvcoMpXyIGDoARwk5rxTnZtkk0NRdny5p4vx5Bp+Fnl1MpsU2c2Ww36 6uljQ2U9REsaQ7iJWHlo55k42xvZJX6epq3FFZXkm7i3bc3CMzFTRFg+6LyAtcjUS+1vBTXDgon Q5sFmB0vJgeFE+nTJyknJuR0iPOxcMgzvl+Nn2cL3oPemqSRI21OZXPRLIDodTwRAVWStYY6Ww5 7mW9OF+d9ZwC+eg+3k+Jne8AAw== X-Google-Smtp-Source: AGHT+IGM2kOkAyq2dCJJBukOVvvAokUYGeNVLdl7c3IueIqouW/RVVd3CL7qmwKTHKwD1ncrxH1qtA== X-Received: by 2002:a05:620a:601c:b0:7b1:4f5c:6e86 with SMTP id af79cd13be357-7be6321bf1bmr4996470585a.17.1737764002336; Fri, 24 Jan 2025 16:13:22 -0800 (PST) Received: from d121003.iol.unh.edu ([2606:4100:3880:1210::224]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7be9ae8c03csm147892185a.48.2025.01.24.16.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Jan 2025 16:13:21 -0800 (PST) From: Patrick Robb To: paul.szczepanek@arm.com Cc: dev@dpdk.org, luca.vizzarro@arm.com, npratte@iol.unh.edu, dmarx@iol.unh.edu, thomas.wilks@arm.com, Patrick Robb Subject: [PATCH] dts: automatically bring up link on interfaces Date: Fri, 24 Jan 2025 19:10:26 -0500 Message-ID: <20250125001026.681660-1-probb@iol.unh.edu> X-Mailer: git-send-email 2.47.1 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Adds a method to os_session for bringing up port interface links, an implementation for linux_session, and a call to this at node init. This removes the current requirement that users bring up the link on their TG interfaces before running DTS. Tested-by: Patrick Robb Signed-off-by: Patrick Robb --- A couple more things to note: 1. I ran into this after a server reboot, when the NIC interfaces started without the link up. I didn't realize this was the case and was briefly confused about why send_packet_and_capture was returning 0 packets. I think it makes sense to remove this possible point of failure from the user by incorporating automatic link setup. 2. The real requirement that the link be up is on the TG side - not the SUT side. I initially wrote this as something only called from the TG node init, but after discussing with Nick Pratte, we concluded that it is good sense to try to up the link on the SUT ports too - even though this "should" be handled by testpmd at EAL bring up. 3. Legacy DTS did run an ifconfig up on both nodes' interfaces during testsuite setup, and I believe this is a practice which we should copy for the new framework. 4. Why didn't I just throw the ip link command into linux_session update_ports method? Well, initially I did, but I think there may be a separation of concerns reason (gathering port info for Port object vs os port config) for why these should be kept as separate methods. dts/framework/testbed_model/linux_session.py | 5 +++++ dts/framework/testbed_model/node.py | 1 + dts/framework/testbed_model/os_session.py | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/dts/framework/testbed_model/linux_session.py b/dts/framework/testbed_model/linux_session.py index e3732f0827..f507bbf825 100644 --- a/dts/framework/testbed_model/linux_session.py +++ b/dts/framework/testbed_model/linux_session.py @@ -169,6 +169,11 @@ def update_ports(self, ports: list[Port]) -> None: else: self._logger.warning(f"No port at pci address {port.pci} found.") + def bring_up_link(self, ports: list[Port]) -> None: + """Overrides :meth:`~.os_session.OSSession.bring_up_link`.""" + for port in ports: + self.send_command(f"ip link set dev {port.logical_name} up") + def _get_lshw_info(self) -> list[LshwOutput]: output = self.send_command("lshw -quiet -json -C network", verify=True) return json.loads(output.stdout) diff --git a/dts/framework/testbed_model/node.py b/dts/framework/testbed_model/node.py index c6f12319ca..69644dba33 100644 --- a/dts/framework/testbed_model/node.py +++ b/dts/framework/testbed_model/node.py @@ -94,6 +94,7 @@ def __init__(self, node_config: NodeConfiguration): def _init_ports(self) -> None: self.ports = [Port(self.name, port_config) for port_config in self.config.ports] self.main_session.update_ports(self.ports) + self.main_session.bring_up_link(self.ports) def set_up_test_run( self, diff --git a/dts/framework/testbed_model/os_session.py b/dts/framework/testbed_model/os_session.py index 28eccc05ed..45c987ae9e 100644 --- a/dts/framework/testbed_model/os_session.py +++ b/dts/framework/testbed_model/os_session.py @@ -520,6 +520,14 @@ def update_ports(self, ports: list[Port]) -> None: ports: The ports to update. """ + @abstractmethod + def bring_up_link(self, ports: list[Port]) -> None: + """Send operating system specific command for bringing up link on node interfaces. + + Args: + ports: The ports to apply the link up command to. + """ + @abstractmethod def configure_port_mtu(self, mtu: int, port: Port) -> None: """Configure `mtu` on `port`. -- 2.47.1