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 E3A51455CA; Mon, 8 Jul 2024 21:09:26 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7854A40E0F; Mon, 8 Jul 2024 21:09:21 +0200 (CEST) Received: from mail-oi1-f177.google.com (mail-oi1-f177.google.com [209.85.167.177]) by mails.dpdk.org (Postfix) with ESMTP id 7CDF340A71 for ; Mon, 8 Jul 2024 21:09:20 +0200 (CEST) Received: by mail-oi1-f177.google.com with SMTP id 5614622812f47-3d92645883cso1561103b6e.2 for ; Mon, 08 Jul 2024 12:09:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1720465760; x=1721070560; 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=J0MY/4PRf8RS3DEkIQtsJfqVtKxjkPaPNqBU5yfDBfg=; b=TdGpGJWXsApA1v7H7JB1nu3pB/BVZLWnEAx3PIDJNa+Ib7sBD/Tu7KRRMnW7zeIXtk NrFNxTAaycwQe3KOUv3kRxSII2i/7WsI+PO68xsGAoI+uzAePXsdwLT079rc7L2IXpF5 nG4+jlVdrOFn4tS5gsgktRaOYJ222b3w1P2Ao= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720465760; x=1721070560; 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=J0MY/4PRf8RS3DEkIQtsJfqVtKxjkPaPNqBU5yfDBfg=; b=CW7jrvtFT9nTr88BC/LUDrTJpUS04srmukl9tbCGAuW04qEvbzqZNUHQZ8LVAcbB81 QS20tLF1IicH+3SWyJObMX38ATwUe5eJrbqI1ZK6gEF2HS0evP6Zxjudp6idcY1+daJF jnVzsyg2+vMvLvUOxAc9sxueh4bP/GvR0LlGetyaMXjlWuzMWb5ktT+G80UGr2NTQV2N arMF9eN6AmoLlvTk9Ot9blJ7jIfed150XDbxJMn8i106qIa98LG1afT0DEsiJUZ1Fz3O 8Y42iQeiAmsId2y+pyMLwzLEDUJfcN1Bsqxe9NLebI+9m2tyDkL33gyco9rE3eEyqizl hMhw== X-Gm-Message-State: AOJu0Yx/s6YYGRLRd9/Nz8blwdFIb5TVnNL+8v5EHuZT5nYXEHkxgPf+ N85my9jObW7794CQaneC3SULzgyA7PzQ3pY0zEn/UqhArkkLs0qW8cvQcEdbCNc= X-Google-Smtp-Source: AGHT+IH2va4NOQ6qaAxqNvqXmgqwQFuRi2l18c62ni575JuIsjCxfqnU8+jiAFJgBFKtBPTAmpQMDw== X-Received: by 2002:a05:6808:1795:b0:3d9:2a77:b81b with SMTP id 5614622812f47-3d93c0405fbmr366109b6e.34.1720465759620; Mon, 08 Jul 2024 12:09:19 -0700 (PDT) Received: from dean-laptop.iol.unh.edu ([2606:4100:3880:1271:f9bd:24da:464d:6294]) by smtp.gmail.com with ESMTPSA id af79cd13be357-79f18ff6762sm19655885a.10.2024.07.08.12.09.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 12:09:19 -0700 (PDT) From: Dean Marx To: Honnappa.Nagarahalli@arm.com, juraj.linkes@pantheon.tech, probb@iol.unh.edu, paul.szczepanek@arm.com, yoan.picchi@foss.arm.com, jspewock@iol.unh.edu, bruce.richardson@intel.com, luca.vizzarro@arm.com Cc: dev@dpdk.org, Dean Marx Subject: dts: add multicast set function to shell Date: Mon, 8 Jul 2024 15:08:55 -0400 Message-ID: <20240708190858.26583-2-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240708190858.26583-1-dmarx@iol.unh.edu> References: <20240708190858.26583-1-dmarx@iol.unh.edu> 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 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 ec22f72221..a0be0bd09d 100644 --- a/dts/framework/remote_session/testpmd_shell.py +++ b/dts/framework/remote_session/testpmd_shell.py @@ -806,6 +806,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.send_command("quit", "") -- 2.44.0