From patchwork Mon Dec 18 17:22:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Spewock X-Patchwork-Id: 135292 Return-Path: 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]) by inbox.dpdk.org (Postfix) with ESMTP id 89AA54373D; Mon, 18 Dec 2023 18:24:15 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C6F6242DD7; Mon, 18 Dec 2023 18:23:42 +0100 (CET) Received: from mail-pl1-f228.google.com (mail-pl1-f228.google.com [209.85.214.228]) by mails.dpdk.org (Postfix) with ESMTP id 9850242DB6 for ; Mon, 18 Dec 2023 18:23:38 +0100 (CET) Received: by mail-pl1-f228.google.com with SMTP id d9443c01a7336-1d045097b4cso13053855ad.0 for ; Mon, 18 Dec 2023 09:23:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1702920218; x=1703525018; 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=LWy5yLdKpzUDzJB70ubur9uEm4/JCOHh/XV+76RBED4=; b=HlUQkArzqkzRA5XlJ0w9TByzC5nkpvQcgmPqaxFi9whQF2lt30bjPwf+hwytWdkkJR ef82rHbJefCVNeiLEYQnmkDAOh3kF8Di1D/wEia0IfztzfZIj4ym4+S9dufG1U6jeK/J pQD9+ak6yJ6VpdqCdg/oMVv6srHpBaiArT9tY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702920218; x=1703525018; 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=LWy5yLdKpzUDzJB70ubur9uEm4/JCOHh/XV+76RBED4=; b=X/whJnIiVtR0JjY8c/3FTXD7jFFHPSAHr1wGRfs59uJozcg49oy8KMmaKSApEYK+/2 9YfHf5lWvTB2VXOpE6h4YOR8lcXZTlibqRr/icwnbJDo2OHT5+4RZTGPQ8Urk0dlsmQJ UkiNR8RCdrCX3HW7nDMxKN8xPLdtRY+ZojF4UW1Aw/Un7dqpwglSD5VAa2tDLISckvf5 C7WsNuVJ3m/abHt054zivW9qJHQGlWQCy5kDsw+KW0WTRsB6xXU8cKW8BbHPVxUA/3QJ szLSi/xCHPy5EsEPcCg6xWRGEoWn0O9FNP4pPKHmolib0ws54hARYD2X6Q+2nd18sijq 4rpw== X-Gm-Message-State: AOJu0YyEfgNL+G9jEia4DHHSDpcfbCEy+r8N0kv6VRUyeGwyplo2Eeqg koh98SkY1Iv5UrBEcxFukS5UkxWWD7MTjMU3OH7F2FLqlxQspXcSe121gB1fzRvCnw== X-Google-Smtp-Source: AGHT+IE2xDJ7PMzThZ224OEVnWhKjhHuRwj2zb9luuKS0NNi9EoGPWMnjkZdRMadmHAphqzDFvo1mBy7siVk X-Received: by 2002:a17:902:ab84:b0:1d0:c445:801b with SMTP id f4-20020a170902ab8400b001d0c445801bmr7553287plr.71.1702920217843; Mon, 18 Dec 2023 09:23:37 -0800 (PST) Received: from postal.iol.unh.edu (postal.iol.unh.edu. [2606:4100:3880:1234::84]) by smtp-relay.gmail.com with ESMTPS id bg1-20020a1709028e8100b001c74d16646asm1076726plb.28.2023.12.18.09.23.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2023 09:23:37 -0800 (PST) X-Relaying-Domain: iol.unh.edu Received: from iol.unh.edu (unknown [IPv6:2606:4100:3880:1271:90f9:1b64:f6e6:867f]) by postal.iol.unh.edu (Postfix) with ESMTP id 1F4FE605C312; Mon, 18 Dec 2023 12:23:36 -0500 (EST) From: jspewock@iol.unh.edu To: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, thomas@monjalon.net, wathsala.vithanage@arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, ferruh.yigit@amd.com, andrew.rybchenko@oktetlabs.ru Cc: dev@dpdk.org, Jeremy Spewock Subject: [PATCH v4 5/7] dts: allow configuring MTU of ports Date: Mon, 18 Dec 2023 12:22:05 -0500 Message-ID: <20231218172206.8488-7-jspewock@iol.unh.edu> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231113202833.12900-1-jspewock@iol.unh.edu> References: <20231113202833.12900-1-jspewock@iol.unh.edu> MIME-Version: 1.0 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 From: Jeremy Spewock Adds methods in both os_session and linux session to allow for setting MTU of port interfaces in an OS agnostic way. Signed-off-by: Jeremy Spewock --- dts/framework/remote_session/linux_session.py | 8 ++++++++ dts/framework/remote_session/os_session.py | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/dts/framework/remote_session/linux_session.py b/dts/framework/remote_session/linux_session.py index fd877fbfae..aaa4d57a36 100644 --- a/dts/framework/remote_session/linux_session.py +++ b/dts/framework/remote_session/linux_session.py @@ -177,6 +177,14 @@ def configure_port_ip_address( verify=True, ) + def configure_port_mtu(self, mtu: int, port: Port) -> None: + """Overrides :meth:`~.os_session.OSSession.configure_port_mtu`.""" + self.send_command( + f"ip link set dev {port.logical_name} mtu {mtu}", + privileged=True, + verify=True, + ) + def configure_ipv4_forwarding(self, enable: bool) -> None: state = 1 if enable else 0 self.send_command(f"sysctl -w net.ipv4.ip_forward={state}", privileged=True) diff --git a/dts/framework/remote_session/os_session.py b/dts/framework/remote_session/os_session.py index 8a709eac1c..cd073f5774 100644 --- a/dts/framework/remote_session/os_session.py +++ b/dts/framework/remote_session/os_session.py @@ -277,6 +277,15 @@ def configure_port_ip_address( Configure (add or delete) an IP address of the input port. """ + @abstractmethod + def configure_port_mtu(self, mtu: int, port: Port) -> None: + """Configure `mtu` on `port`. + + Args: + mtu: Desired MTU value. + port: Port to set `mtu` on. + """ + @abstractmethod def configure_ipv4_forwarding(self, enable: bool) -> None: """