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 C934843347; Thu, 16 Nov 2023 19:05:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9F62F402E8; Thu, 16 Nov 2023 19:05:49 +0100 (CET) Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) by mails.dpdk.org (Postfix) with ESMTP id 3A8EF402CD for ; Thu, 16 Nov 2023 19:05:48 +0100 (CET) Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-53e751aeb3cso1658212a12.2 for ; Thu, 16 Nov 2023 10:05:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pantheon.tech; s=google; t=1700157948; x=1700762748; darn=dpdk.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=h4ALgxfDO8EFiaP2XpWI9vjTbpvuJSQPZ09DJRF5jqU=; b=iMILd3HvqqZDZA7u4b5+zPtVtwQi66tTQ3uq+THOtBxCBvRI60ZkNxDno/iqfWjr++ ylID6TnKMb70aV4rdl1AGmcUYaxXOl7qk9NG6AWgevSv3FcKGjz+EbFw1HTzM7Us0f0/ u9ggX1DbXgaCItxsSEs4YVwR4tVSWUQHQc3AiNq43o+gC+RH/QCZE+xWhugrQ+8/JLKF P/3eOUgO899LOr/nbam72hbc9ziIdfCTcP+otcZiQLq6NyBAhFCUsSwhV+S/hTtiyLj3 hKd/C00aZorcwUo0/AX5ev5fLu5ZBq0ByepPQH83uS4QVX4HFkxxtDA5Q70m5w9NmQon aQZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700157948; x=1700762748; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=h4ALgxfDO8EFiaP2XpWI9vjTbpvuJSQPZ09DJRF5jqU=; b=kkg6FFsD65+wuxiFD/oC4ZRnVNX85exAgG7qEPP5obccRhyiAcESgmc0Al+BUWmfbB F6fI1z/ioTsZE2S93mcojih1B4Ijm57VpFUifh+Eh7YV5iZrDBVXD/Zp6kSuxJYN3RA0 no8vtIGUcHEAOPlM1wX7SF4YDsY0M8JGR/bfVnw8oqxpTlS3r+lQtXvVPqZQKjtPl99E U6iswvELfSrtK4q0z2jtzT/IJNbS1/ROfr8oqQ/bSexJBnvoUrP5taMWjO3+oIIATgHY WjUVIMv67TK90smZ/RiuoSaF00cdPNEygSjcpfPKroDdZ5VQ/Ps5fhyiDR6LeQFHExO0 aVPw== X-Gm-Message-State: AOJu0Ywqa7qpD9vgxUQh0IP25yrQ9qBCws+duG5+5hNMFccn5zAMrr0Z 3Kxre+/2NQj4LSDM0UP26GW1bm5V7eujQcT2XM4FIg== X-Google-Smtp-Source: AGHT+IFPGjyr8qYWy4VpfCQUzJtQlwUtktgxyBUL+Rj3wZeTrUCktZ9UanJyZAjSjc7oUGRt2Edmi0K/GIXkNtSlZI0= X-Received: by 2002:a17:906:ca4e:b0:9bf:4e0b:fb05 with SMTP id jx14-20020a170906ca4e00b009bf4e0bfb05mr11496032ejb.11.1700157947787; Thu, 16 Nov 2023 10:05:47 -0800 (PST) MIME-Version: 1.0 References: <20231113202833.12900-1-jspewock@iol.unh.edu> <20231113202833.12900-8-jspewock@iol.unh.edu> In-Reply-To: <20231113202833.12900-8-jspewock@iol.unh.edu> From: =?UTF-8?Q?Juraj_Linke=C5=A1?= Date: Thu, 16 Nov 2023 19:05:36 +0100 Message-ID: Subject: Re: [PATCH v3 7/7] dts: allow configuring MTU of ports To: jspewock@iol.unh.edu Cc: Honnappa.Nagarahalli@arm.com, 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, dev@dpdk.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 On Mon, Nov 13, 2023 at 9:28=E2=80=AFPM wrote: > > 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 | 7 +++++++ > dts/framework/remote_session/os_session.py | 9 +++++++++ > 2 files changed, 16 insertions(+) > > diff --git a/dts/framework/remote_session/linux_session.py b/dts/framewor= k/remote_session/linux_session.py > index a3f1a6bf3b..dab68d41b1 100644 > --- a/dts/framework/remote_session/linux_session.py > +++ b/dts/framework/remote_session/linux_session.py > @@ -196,6 +196,13 @@ def configure_port_ip_address( > verify=3DTrue, > ) > > + def configure_port_mtu(self, mtu: int, port: Port) -> None: This is missing a docstring. The way I've decided to document these overridden abstract methods is to just to link to the superclass's method, used heavily in https://patches.dpdk.org/project/dpdk/patch/20231115130959.39420-17-juraj.l= inkes@pantheon.tech/: """Overrides :meth:`~.os_session.OSSession.configure_port_mtu`.""" The docstring checker complains if the docstring is missing. There may be better ways, such as with @typing.override (but that requires Python 3.12 or typing_extensions, but there's a bug in Pylama that prevents us from using that solution: https://github.com/klen/pylama/pull/247). > + self.send_command( > + f"ip link set dev {port.logical_name} mtu {mtu}", > + privileged=3DTrue, > + verify=3DTrue, > + ) > + > def configure_ipv4_forwarding(self, enable: bool) -> None: > state =3D 1 if enable else 0 > self.send_command(f"sysctl -w net.ipv4.ip_forward=3D{state}", pr= ivileged=3DTrue) > diff --git a/dts/framework/remote_session/os_session.py b/dts/framework/r= emote_session/os_session.py > index 8a709eac1c..c038f78b79 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 a given port. > + > + Args: > + mtu: Desired MTU value. > + port: Port to set the MTU on. > + """ I've compiled the rules for composing docstrings here: https://patches.dpdk.org/project/dpdk/patch/20231115130959.39420-4-juraj.li= nkes@pantheon.tech/. The relevant part here is: When referencing a parameter of a function or a method in their docstring, don't use any articles and put the parameter into single backticks. This mimics the style of `Python's documentation `_. Both the mtu and the port parameters are mentioned, so they should be without articles and in backticks. > + > @abstractmethod > def configure_ipv4_forwarding(self, enable: bool) -> None: > """ > -- > 2.42.0 >