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 3496D455CA; Mon, 8 Jul 2024 21:30:34 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 24CF7410FB; Mon, 8 Jul 2024 21:30:34 +0200 (CEST) Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) by mails.dpdk.org (Postfix) with ESMTP id E2E6F40ED3 for ; Mon, 8 Jul 2024 21:30:32 +0200 (CEST) Received: by mail-yb1-f175.google.com with SMTP id 3f1490d57ef6-dfdb6122992so3707198276.3 for ; Mon, 08 Jul 2024 12:30:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1720467032; x=1721071832; 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=L62ESWDX7DuJsf8SunvStFvggUMg+cnOUUUTOpOOHAX/b76FrM7fSOM2uc2q/0bAaG eXSNdGP2m5pafGW8AmjX6mK/6XPLbQa+S0eeIYM/D6Z06cjnvQ/2AcwMOcWMvYIfNgj2 twAT7qNSROelbN55VR9ytSidycPf/784oQI6k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720467032; x=1721071832; 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=UlhX20eJc84lbrzdUYxvIZmhuPoBpliIFVtchFvXq3s/8IBNxuk0/kDmnfhhPBKFgG dv4nWR5q5gjC+VUnEh19rq9zvw4FA6IByOeBQSOtJwR36oG1NmMIVNrunoCbmZUavTO7 GbbzNldW165Aco5wuIyAkwnxDDAFErRpqLIVLZdOQkqgpLsD6lZvmsjpkNbi6TEvkplK UmIsLyg06NHx2LY4ozCVfp32k11tpWux1FsCI5ReW1jkanHAxfMX6cfMXKJXQVoh6TBe j03BAKSeplUZfGvFHtW6ursOoWuHtb3VVO93T3jVvaArxgvP7CbyZD6EPVi8skkANbTg jCGg== X-Gm-Message-State: AOJu0YxcpV2mNzqiZdKRaoLfutWfwSJ96wKI9yWN0UxQvFFp+tTndXTG N+wbNcnmfB0MukHq+mYBHSSnnUSNjmnNtXfnhgtXd40DeOCiGRkV3fDD6NIZQ+4= X-Google-Smtp-Source: AGHT+IG1JH8Z6rhNNp0aXZbKD2b7uDuted0TULCPDnnHoDtmX+iCjqWZLwdZoPIiNjnYGRdAjaL9Jw== X-Received: by 2002:a25:26d0:0:b0:dee:7fc3:ad6a with SMTP id 3f1490d57ef6-e041b178773mr705095276.56.1720467032211; Mon, 08 Jul 2024 12:30:32 -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-6b61ba019edsm2178226d6.61.2024.07.08.12.30.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 12:30:31 -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 v3 1/4] dts: add multicast set function to shell Date: Mon, 8 Jul 2024 15:30:09 -0400 Message-ID: <20240708193012.5465-1-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