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 D5EBF456A2; Wed, 24 Jul 2024 21:21:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4CC024337A; Wed, 24 Jul 2024 21:21:42 +0200 (CEST) Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) by mails.dpdk.org (Postfix) with ESMTP id 6AB0E43370 for ; Wed, 24 Jul 2024 21:21:40 +0200 (CEST) Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-44930ea05b8so894061cf.1 for ; Wed, 24 Jul 2024 12:21:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1721848900; x=1722453700; 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=M1NZcVqJKNeEGUkL0h5TT3jA4+fFG8XrsEiUJZpeqDIE9r9saxVew5t3BNCLKQ3Cia lu1LCss0A5uAZvZtEgiqGZf3ji39lO4WnzcM8gpp05KOPXCJFyio69OzchNFV063shnd xNE495a7jaTermq543EM75KcFgm3Wp3wO8mKo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721848900; x=1722453700; 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=mwxLVi/tXT/erRY8vW4bab6gcOLfEu3p2kXP5VCQjZoaqGKVGPybwaxQt9rjppgR6t yC45yKVyAenXr9UP9NOCGf+NHJrRgbYR99cbjYvqfky4We2S/EpRq3Mf6TdVJDeu7uuo jyL94PrHKgXrNnJ9MnrP5kwF3bsyMPiMNx6F8XhZZelyO+oJEc1IiBG2yG0x8swCim8e wcPsQQtYW61IKswwVHh6JP0J02RHn1GwPOrkANXQhdoDQ4zx8farVjzSLaq010nVt68Q 7ef9wpplWCbG6hVAjDoDsWNzdjSd6lLPWz7VSfoRDsQ2nPaHHn/jOZATUHQNWDOkNlHu IvoQ== X-Gm-Message-State: AOJu0Ywp94OUQTaSW8ugkokKjV1M3YmC3pfeB9uKIp3dGqTVbj5vj+Yh KjEBfKHIg3IHwr6FD7dGMl8FWNtymq1P4I1ldLr1PI/RYAKJ3SeH8VdvPgHIrr5TDjknNipNGjX F X-Google-Smtp-Source: AGHT+IHU+CeGhTen8vwz9f7PtHU8Ipr0y3W8q+CQaGOQ7lj7gh5p/KMFV8ZQ/cL/sYRtqUhdsvJ8pA== X-Received: by 2002:ac8:7fc5:0:b0:446:5d83:7335 with SMTP id d75a77b69052e-44fe30e8189mr7738081cf.0.1721848899633; Wed, 24 Jul 2024 12:21:39 -0700 (PDT) Received: from dean-laptop.iol.unh.edu ([2606:4100:3880:1271:f9bd:24da:464d:6294]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-44fe542f8b6sm1150331cf.67.2024.07.24.12.21.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jul 2024 12:21:38 -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 v5 1/3] dts: add multicast set function to shell Date: Wed, 24 Jul 2024 15:21:27 -0400 Message-ID: <20240724192129.29721-2-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240724192129.29721-1-dmarx@iol.unh.edu> References: <20240708191938.32132-1-dmarx@iol.unh.edu> <20240724192129.29721-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 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() -- 2.44.0