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 EC3934575E; Wed, 7 Aug 2024 17:50:55 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B560340696; Wed, 7 Aug 2024 17:50:55 +0200 (CEST) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mails.dpdk.org (Postfix) with ESMTP id 10197402D3 for ; Wed, 7 Aug 2024 17:50:54 +0200 (CEST) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 26832FEC; Wed, 7 Aug 2024 08:51:19 -0700 (PDT) Received: from [10.1.39.35] (JR4XG4HTQC.cambridge.arm.com [10.1.39.35]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 44FE43F766; Wed, 7 Aug 2024 08:50:52 -0700 (PDT) Message-ID: <511d0640-c8a8-4301-b026-a822aede3edd@arm.com> Date: Wed, 7 Aug 2024 16:50:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 1/3] dts: add multicast set function to shell Content-Language: en-GB To: Dean Marx , probb@iol.unh.edu, npratte@iol.unh.edu, jspewock@iol.unh.edu, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech Cc: dev@dpdk.org References: <20240708191938.32132-1-dmarx@iol.unh.edu> <20240724192129.29721-1-dmarx@iol.unh.edu> <20240724192129.29721-2-dmarx@iol.unh.edu> From: Luca Vizzarro In-Reply-To: <20240724192129.29721-2-dmarx@iol.unh.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 Hi Dean, Apologies again for having replied to the wrong email thread. I'll copy my comments here. And thank you again for your contribution On 24/07/2024 20:21, Dean Marx wrote: > added set multicast function for changing allmulticast mode within testpmd. > > Signed-off-by: Dean Marx > --- > dts/framework/remote_session/testpmd_shell.py | 46 +++++++++++++++++++ > 1 file changed, 46 insertions(+) > > diff --git a/dts/framework/remote_session/testpmd_shell.py b/dts/framework/remote_session/testpmd_shell.py > index eda6eb320f..b7af2adb14 100644 > --- a/dts/framework/remote_session/testpmd_shell.py > +++ b/dts/framework/remote_session/testpmd_shell.py > @@ -804,6 +804,52 @@ def show_port_stats(self, port_id: int) -> TestPmdPortStats: > > return TestPmdPortStats.parse(output) > > + def set_promisc(self, port: int, on: bool, verify: bool = True): > + """Turns promiscuous mode on/off for the specified port. > + > + Args: > + port: Port number to use, should be within 0-32. > + on: If :data:`True`, turn promisc mode on, otherwise turn off. > + verify: If :data:`True` an additional command will be sent to verify that promisc mode > + is properly set. Defaults to :data:`True`. > + > + Raises: > + InteractiveCommandExecutionError: If `verify` is :data:`True` and promisc mode > + is not correctly set. > + """ > + promisc_output = self.send_command(f"set promisc {port} {'on' if on else 'off'}") > + if verify: > + stats = self.show_port_info(port_id=port) > + if on ^ stats.is_promiscuous_mode_enabled: > + self._logger.debug(f"Failed to set promisc mode on port {port}: \n{promisc_output}") > + raise InteractiveCommandExecutionError( > + f"Testpmd failed to set promisc mode on port {port}." > + ) > + > + def set_multicast_all(self, on: bool, verify: bool = True): > + """Turns multicast mode on/off for the specified port. > + > + Args: > + on: If :data:`True`, turns multicast mode on, otherwise turns off. > + verify: If :data:`True` an additional command will be sent to verify > + that multicast mode is properly set. Defaults to :data:`True`. > + > + Raises: > + InteractiveCommandExecutionError: If `verify` is :data:`True` and multicast > + mode is not properly set. > + """ > + multicast_output = self.send_command(f"set allmulti all {'on' if on else 'off'}") > + if verify: > + stats0 = self.show_port_info(port_id=0) > + stats1 = self.show_port_info(port_id=1) This assumes that we have port 0 and 1, but *technically* we shouldn't be making assumptions about the environment in the framework. I'd rather use show_port_info_all and sample from there what's available. > + if on ^ (stats0.is_allmulticast_mode_enabled and stats1.is_allmulticast_mode_enabled): > + self._logger.debug( > + f"Failed to set multicast mode on all ports.: \n{multicast_output}" > + ) > + raise InteractiveCommandExecutionError( > + "Testpmd failed to set multicast mode on all ports." > + ) > + > def _close(self) -> None: > """Overrides :meth:`~.interactive_shell.close`.""" > self.stop()