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 488F3455CA; Mon, 8 Jul 2024 21:20:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7E3B5427AF; Mon, 8 Jul 2024 21:20:03 +0200 (CEST) Received: from mail-yw1-f170.google.com (mail-yw1-f170.google.com [209.85.128.170]) by mails.dpdk.org (Postfix) with ESMTP id D148340E7C for ; Mon, 8 Jul 2024 21:19:59 +0200 (CEST) Received: by mail-yw1-f170.google.com with SMTP id 00721157ae682-64b29539d87so37986877b3.0 for ; Mon, 08 Jul 2024 12:19:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1720466399; x=1721071199; 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=RsvWREyrs0KnF8DS8kpXi70Kp5BrFlGyj3ouZq6cNmNs+9tM5n1g9ZDzgiJ/k7CAZ7 4jIh7F7Qa9buD7RlQEodATQPYCktJ/l/4hSITK2Tmbr30/sTIlnBWhJGxncbsxUXFg4o hP0MVGg6u4uGZ009re/9vW2tad4lZ4oAh+5C4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720466399; x=1721071199; 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=irYIrUHhzseLh2Sp9r7Xl6oHCbN/NRCGrfXAPN08KGcQfKvurJKbK88KCODsTZmL0H iT5hTqe4pm5Pf9RSmLP+pDj7wnFEUnnDAFpC24b++VjTIyJsFD76E3WXIvTF+QnbNZ50 WbOgwmj7mOb4fFaP/RM965sBgL1L9ZNxnjjZz1THzvMNNfRrPbYpB+unyrYssliVr6TH /hMyxHc0yx837tKVdcCmNa7K8zOcLtr5IXU4l1MYwCPvQj2lKEr2SHM0UZ0jGQUJ6RIG iQfoZIwBpJjJ9zzvQhSnZG+g1Kj9W8ZxmHuFxIQG2BIlft5+BqtmQOhEDlSSslKwEzmO qNpw== X-Gm-Message-State: AOJu0YzGPfNc2kLXYfFmRiAhJuWmp5DNuG7TB8Yx8LjIlAlLXCtbt9v2 67NUCPy+5eMej4LSx7Q8Q0iGm+ein3kLM3apwfWssg+uIUtxA0OlVDrSZUlDVEc= X-Google-Smtp-Source: AGHT+IEmkQ9mnOag6eNW7qocJE4PA2ldvFHNtwm6233guVf6pM1lXXU/bpnKpYKkgQqdA2onopTBtw== X-Received: by 2002:a81:92c4:0:b0:60a:576:7b79 with SMTP id 00721157ae682-658f09c90bcmr6647257b3.41.1720466399147; Mon, 08 Jul 2024 12:19:59 -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-6b61b9d5f89sm2128796d6.34.2024.07.08.12.19.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 12:19:58 -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: [PATCH v2 1/4] dts: add multicast set function to shell Date: Mon, 8 Jul 2024 15:19:35 -0400 Message-ID: <20240708191938.32132-2-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240708191938.32132-1-dmarx@iol.unh.edu> References: <20240708191938.32132-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