From patchwork Wed Aug 7 19:18:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dean Marx X-Patchwork-Id: 143003 X-Patchwork-Delegate: juraj.linkes@pantheon.tech 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 541AD45760; Wed, 7 Aug 2024 21:18:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BD47E40E27; Wed, 7 Aug 2024 21:18:11 +0200 (CEST) Received: from mail-qv1-f51.google.com (mail-qv1-f51.google.com [209.85.219.51]) by mails.dpdk.org (Postfix) with ESMTP id 7CF62402D3 for ; Wed, 7 Aug 2024 21:18:10 +0200 (CEST) Received: by mail-qv1-f51.google.com with SMTP id 6a1803df08f44-6b7a3b75133so1570826d6.2 for ; Wed, 07 Aug 2024 12:18:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1723058290; x=1723663090; 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=S+uEdwGGBPA+um5aZwyI/r1/i0fA2HJ0Psbc0e62X+0=; b=AbEdUn8xesFNA8MQvneolrFzd6+/wjzZd3dD/CZ5vkP/E2JqP3q8QiJHD7MwXyGCU7 6eSHsjyazrVPwMe+2QHwc/nrAHhp69gdpjt7Aw0U+azJC+AZb1QI4hzfJWD+fsgbMa9v 6HoLqEMmmIRSjtV/qSWdQWWHxT+nePCYbwlyQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723058290; x=1723663090; 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=S+uEdwGGBPA+um5aZwyI/r1/i0fA2HJ0Psbc0e62X+0=; b=VrE24TMGDXhYa/gXEaC3cQAWMgNeWpTPi9hGFcXBWUUpZuyilenXBrasp1LK7w6mYn fFMylqHhRm5ztOngXD6qaIsuuqytVqvI0akfxlX+AOLRZTJ1t9ipqhlpFh0kdMPZZEUX D68zwbUoM+QHmBt7YmjIn3apWilckFJQ3hlN1+tz7nzXKSVBCJNYQK422UpBpahzTVtn GZ/RRijSSh2J/gJZ5pBdXF9hO+kuEAYCKERZBDVQtghr/Zpk3ckAyAkB6/eXv5bDnWfe cp5dAmLLG2IaL5mugwE0yC+fFvVFTNZXzktGar76uBEhpCeVbgWJrysmXQV0ISgXmsp0 7wHg== X-Gm-Message-State: AOJu0YyQVJtRhD6iH6QMe3hCu0Y3Bbml+TmVfB4sxrNdAnQl+zsF8GmC HLOjHgGw/81GrfjO1nZAF0vUX04pZYAYlOqu/TmNA1SaooEx+c0eaQyWE8OG538= X-Google-Smtp-Source: AGHT+IHoxnK8WDDBxVPR94oAkAIoPQXt1y0mfBHVErukzHHyxfXXqMVJ7c7BX/BgLANd1Xzd69DnEA== X-Received: by 2002:a05:6214:c4d:b0:6bb:9b66:f262 with SMTP id 6a1803df08f44-6bb9b66f6f1mr253622156d6.41.1723058289553; Wed, 07 Aug 2024 12:18:09 -0700 (PDT) Received: from dean-laptop.iol.unh.edu ([2606:4100:3880:1271:f9bd:24da:464d:6294]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6bb9c79744esm58839396d6.40.2024.08.07.12.18.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Aug 2024 12:18:08 -0700 (PDT) From: Dean Marx To: probb@iol.unh.edu, npratte@iol.unh.edu, jspewock@iol.unh.edu, luca.vizzarro@arm.com, yoan.picchi@foss.arm.com, Honnappa.Nagarahalli@arm.com, paul.szczepanek@arm.com, juraj.linkes@pantheon.tech Cc: dev@dpdk.org, Dean Marx Subject: [PATCH v6 1/2] dts: add multicast set function to shell Date: Wed, 7 Aug 2024 15:18:17 -0400 Message-ID: <20240807191818.15978-2-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240807191818.15978-1-dmarx@iol.unh.edu> References: <20240724192129.29721-1-dmarx@iol.unh.edu> <20240807191818.15978-1-dmarx@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 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) + 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()