From patchwork Mon Jul 8 19:30:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dean Marx X-Patchwork-Id: 142234 X-Patchwork-Delegate: thomas@monjalon.net 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 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 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", "") From patchwork Mon Jul 8 19:30:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dean Marx X-Patchwork-Id: 142235 X-Patchwork-Delegate: thomas@monjalon.net 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 CE96E455CA; Mon, 8 Jul 2024 21:30:38 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6BA66427B7; Mon, 8 Jul 2024 21:30:36 +0200 (CEST) Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) by mails.dpdk.org (Postfix) with ESMTP id 30237427A4 for ; Mon, 8 Jul 2024 21:30:34 +0200 (CEST) Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-6b5e4466931so19259306d6.0 for ; Mon, 08 Jul 2024 12:30:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1720467033; x=1721071833; 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=R6yZNZCI86sgnELA0h1NsY77BnYoDKBFGNKRRw5Odr8=; b=XNstWBHSjmGiwGllSUBP3f+y7vSKgl+1DbqRB8STYxhxknlyPtXyV6ug02DxpMSylP 93krbFguMyoyZ16Hmw/Wm0CVbaAXfxtHEQq7FPiyeRQ0VsGeahsownyBo0uPXf3Oal9d XvwhT/JmeTO92YX8GpYQDuSJ2axrM8g3eynns= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720467033; x=1721071833; 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=R6yZNZCI86sgnELA0h1NsY77BnYoDKBFGNKRRw5Odr8=; b=TnP+tW/XV31N98Gyp/nWA2IDeBPhcM/Z9ztITBVnjR+K9r3fMjPOdOeISOmJLiYKgU 2I23i3AhElj1Ts8MkYRIlT9IG0AIhGd0MQlJMzwc0bE2ZHrsPMh/k8ek3AcRRPutJAHC 0emhpctL1o1x6yVrUTp1wZ10bS5TNPR34RssLsIlrGwG9x4XOQ8udNAPeE/Z66QxUsVN ik/sZQUQJPTr1ldTVeN3tQeUpNrrYJtYb67LNQqetwyjGi9b56M3vLPCZjoLUWYch64F Bu4AuDoBddCgB574y/lo5ttBgn0MfFeMvENCorT/RtrTdqct2BvlFA2oLmFx4D85NUhe hjnw== X-Gm-Message-State: AOJu0YxE96X7x1MRrB+9Oxv/lN1t5TA55HiqfFBst4cmrM1t8IqxtDOj vUv7rN48RqvR4Kz8+/dK8M1ZSEXXhrnbPVhdiTLmd3dfYa1SogNgyGVEci+ETw8= X-Google-Smtp-Source: AGHT+IHIyBB2Jm0cGFwGooafkcnHIZHMATSvLADMEVH3n5GkNLKVRTUg5e1oBgT9+e49Sq/DnYzoCQ== X-Received: by 2002:ad4:5fc9:0:b0:6b5:e006:11ae with SMTP id 6a1803df08f44-6b61bccb55dmr9861576d6.22.1720467033473; Mon, 08 Jul 2024 12:30:33 -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.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 12:30:33 -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 2/4] dts: add toggle option to send and capture Date: Mon, 8 Jul 2024 15:30:10 -0400 Message-ID: <20240708193012.5465-2-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240708193012.5465-1-dmarx@iol.unh.edu> References: <20240708191938.32132-1-dmarx@iol.unh.edu> <20240708193012.5465-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 add option to skip _adjust_addresses method in send_packet_and_capture when test cases involve sending packets with a preset MAC address. Signed-off-by: Dean Marx --- dts/framework/test_suite.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/dts/framework/test_suite.py b/dts/framework/test_suite.py index 694b2eba65..551a587525 100644 --- a/dts/framework/test_suite.py +++ b/dts/framework/test_suite.py @@ -185,6 +185,7 @@ def send_packet_and_capture( packet: Packet, filter_config: PacketFilteringConfig = PacketFilteringConfig(), duration: float = 1, + adjust_addresses: bool = True, ) -> list[Packet]: """Send and receive `packet` using the associated TG. @@ -195,11 +196,15 @@ def send_packet_and_capture( packet: The packet to send. filter_config: The filter to use when capturing packets. duration: Capture traffic for this amount of time after sending `packet`. + adjust_addresses: If :data:'True', adjust addresses of the egressing packet with + a default addressing scheme. If :data:'False', do not adjust the addresses of + egressing packet. Returns: A list of received packets. """ - packet = self._adjust_addresses(packet) + if adjust_addresses: + packet = self._adjust_addresses(packet) return self.tg_node.send_packet_and_capture( packet, self._tg_port_egress, From patchwork Mon Jul 8 19:30:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dean Marx X-Patchwork-Id: 142236 X-Patchwork-Delegate: thomas@monjalon.net 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 CBA11455CA; Mon, 8 Jul 2024 21:30:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9930A427C4; Mon, 8 Jul 2024 21:30:37 +0200 (CEST) Received: from mail-qv1-f43.google.com (mail-qv1-f43.google.com [209.85.219.43]) by mails.dpdk.org (Postfix) with ESMTP id 63DAF427B1 for ; Mon, 8 Jul 2024 21:30:35 +0200 (CEST) Received: by mail-qv1-f43.google.com with SMTP id 6a1803df08f44-6b2c6291038so35473906d6.0 for ; Mon, 08 Jul 2024 12:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1720467035; x=1721071835; 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=Bq3lx7l6PcZDswU4+r6pDALdNMSX0X7a9iu9zuf91wc=; b=C0Al2+18Rv6kkstCeaxSmco2E6iQ9TL7ECIdNghUAhzd3/CL+dS7BEjre6c8TEoZl9 LZXypZb5WwwaPjJJaJJBLw3rgjT+54pEg6In/vMlEAc9yLUcVuMgk7lfijbdqyDphxMY KJTwbKcq7bDLyd2J78/1eMtIClM80puLY5GNo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720467035; x=1721071835; 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=Bq3lx7l6PcZDswU4+r6pDALdNMSX0X7a9iu9zuf91wc=; b=k6JFtyhkZvP4YPFCcZ1DYpG8ImHjUbRavvbim9ZrWqpBhtazUXtBAOnu8lc2T11D1L J3UBz0tDDCzGEX2e2v6tkdHB09BcQU8HitFCcr4LpzxUiImTc+4ul8Zoazx2MfThmWL4 oNauZ060NDZF1DD3i5/gIo/m56w4hCMrDMG9yX+6vJxLgWUSqiO4RvbjC1xB+QNE05eA IYxDCEPpeu1OYozsEa2CReyh7W7OZqulyP/V4xklarm9eOHjOBlQspRIxDgTjrSXDLln gSCHsGEhEIOjBdSdNsByR+gU0HBOkPjAHQSENH6R26JbKC803htYuqYefnz6H5OLP2+w ydGA== X-Gm-Message-State: AOJu0Ywwk2870cEm9teBFXbOpUo/5JkYHl0go935/KYsvHIZ9RTaLjLV x5fb/AqiLBlYheQ/H+rU+sZ2yjVf1DdGGC6LUmbojSFkIvGFwrf0WqARA1mGSmo= X-Google-Smtp-Source: AGHT+IGFXsbCBI06BR9EH8NZr/9M12tDRkkEwTGjOHX+9DqczSY85dxIvxT3Th+HkmfVRcgROGqHXA== X-Received: by 2002:a05:6214:262b:b0:6b5:3621:cfde with SMTP id 6a1803df08f44-6b61d69546bmr4241906d6.0.1720467034812; Mon, 08 Jul 2024 12:30:34 -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.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 12:30:34 -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 3/4] dts: dynamic config conf schema Date: Mon, 8 Jul 2024 15:30:11 -0400 Message-ID: <20240708193012.5465-3-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240708193012.5465-1-dmarx@iol.unh.edu> References: <20240708191938.32132-1-dmarx@iol.unh.edu> <20240708193012.5465-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 configuration schema to run dynamic configuration test suite. Signed-off-by: Dean Marx Reviewed-by: Jeremy Spewock --- dts/framework/config/conf_yaml_schema.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dts/framework/config/conf_yaml_schema.json b/dts/framework/config/conf_yaml_schema.json index f02a310bb5..d7b4afed7d 100644 --- a/dts/framework/config/conf_yaml_schema.json +++ b/dts/framework/config/conf_yaml_schema.json @@ -187,7 +187,8 @@ "enum": [ "hello_world", "os_udp", - "pmd_buffer_scatter" + "pmd_buffer_scatter", + "dynamic_config" ] }, "test_target": { From patchwork Mon Jul 8 19:30:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dean Marx X-Patchwork-Id: 142237 X-Patchwork-Delegate: thomas@monjalon.net 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 EC8D8455CA; Mon, 8 Jul 2024 21:30:48 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D1D0F427CA; Mon, 8 Jul 2024 21:30:38 +0200 (CEST) Received: from mail-qt1-f170.google.com (mail-qt1-f170.google.com [209.85.160.170]) by mails.dpdk.org (Postfix) with ESMTP id 3B62F427BE for ; Mon, 8 Jul 2024 21:30:37 +0200 (CEST) Received: by mail-qt1-f170.google.com with SMTP id d75a77b69052e-447e652ce5fso11364751cf.1 for ; Mon, 08 Jul 2024 12:30:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1720467036; x=1721071836; 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=amz+Q6Ay3MQXUhLbdu5lqeSAqv7A6PksyUL5DzN703M=; b=TskDE1uFiDOSHVj/ddWKR94OdUvlT8BsSul0muclgfZuIwl8xZ6sYh0dbyNkYBgfHR G8opd3n8Dh0K9UnLEy7yYRtfWydz2nU4sTM4GJc+KSQmPH2zAEYqDxFpUfSeZ+wj9wsc ZYgc6nXAjCsCiuMuAfobjK4tB6XUSOsR0j95o= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720467036; x=1721071836; 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=amz+Q6Ay3MQXUhLbdu5lqeSAqv7A6PksyUL5DzN703M=; b=IkxNomk1hgAbnfy2s+HwMsmuapnlQPKtfh2/dJbKMhuokCyQzl87w9iL7LPO2UCR4S C0GFygqmqu7UT9rdtItxJp0ApGg89Y+yX8d1xry3D8kffviAlTQuyymAYjaVSVYpXQKJ tgyQNIpn09s7RMMhj9HsbQr8RSBGXoJN+rXiz/WWGrm9YTv655cS9EPRMqRIxCn8XHmN H0azIoQiLrQ+6Wcn87dC+CPE10B9WE/IKQdkuCjIs4/avMhF2+X2Qs7saF2GhBefOGry MwYv33DIdVhreUKdOV2+uQLtNI2Z/cktd0nP4ZNgpwIzn8ck11ngLeefKzy9tAPX8/n/ /+1g== X-Gm-Message-State: AOJu0YwtkaCDmRCLrctdfab9Q1bgF7I8urcSAabL5SW7hNBIbQX6p1kQ jMCkFTCEZwRG4deYfxvIw5cTyIOyE2tEL057hwGOu/eOfVHMpk+7FDD1ytXfQrw= X-Google-Smtp-Source: AGHT+IEz+Nh43zpZi+sI5eU3O8CTjb9nrqwF9sZ3JxsZF71lRMkvrJjYBLubkL8ZwC2jlXhqUYE6ZA== X-Received: by 2002:a05:6214:482:b0:6b5:e5bc:3d42 with SMTP id 6a1803df08f44-6b61bf131d5mr8399026d6.34.1720467036311; Mon, 08 Jul 2024 12:30:36 -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.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 12:30:35 -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 4/4] dts: dynamic config test suite Date: Mon, 8 Jul 2024 15:30:12 -0400 Message-ID: <20240708193012.5465-4-dmarx@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240708193012.5465-1-dmarx@iol.unh.edu> References: <20240708191938.32132-1-dmarx@iol.unh.edu> <20240708193012.5465-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 Suite for testing ability of Poll Mode Driver to turn promiscuous mode on/off, allmulticast mode on/off, and show expected behavior when sending packets with known, unknown, broadcast, and multicast destination MAC addresses. Signed-off-by: Dean Marx --- dts/tests/TestSuite_dynamic_config.py | 149 ++++++++++++++++++++++++++ 1 file changed, 149 insertions(+) create mode 100644 dts/tests/TestSuite_dynamic_config.py diff --git a/dts/tests/TestSuite_dynamic_config.py b/dts/tests/TestSuite_dynamic_config.py new file mode 100644 index 0000000000..a6e5384c50 --- /dev/null +++ b/dts/tests/TestSuite_dynamic_config.py @@ -0,0 +1,149 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2024 University of New Hampshire + +"""Dynamic configuration capabilities test suite. + +This suite checks that it is possible to change the configuration of a port +dynamically. The Poll Mode Driver should be able to enable and disable +promiscuous mode on each port, as well as check the Rx and Tx packets of +each port. + +If packets should be received and forwarded, or received and not forwarded, +depending on the configuration, the port info should match the expected behavior. +""" + +from time import sleep + +from scapy.layers.inet import IP # type: ignore[import-untyped] +from scapy.layers.l2 import Ether # type: ignore[import-untyped] +from scapy.packet import Raw # type: ignore[import-untyped] + +from framework.params.testpmd import SimpleForwardingModes +from framework.remote_session.testpmd_shell import TestPmdShell +from framework.test_suite import TestSuite + + +class TestDynamicConfig(TestSuite): + """Dynamic config suite. + + Use the show port commands to see the MAC address and promisc mode status + of the Rx port on the DUT. The suite will check the Rx and Tx packets + of each port after configuring promiscuous, multicast, and default mode + on the DUT to verify the expected behavior. It consists of four test cases: + + 1. Default mode: verify packets are received and forwarded. + 2. Disable promiscuous mode: verify that packets are received + only for the packet with destination address matching the port address. + 3. Disable promiscuous mode broadcast: verify that packets with destination + MAC address not matching the port are received and not forwarded, and verify + that broadcast packets are received and forwarded. + 4. Disable promiscuous mode multicast: verify that packets with destination + MAC address not matching the port are received and not forwarded, and verify + that multicast packets are received and forwarded. + """ + + def set_up_suite(self) -> None: + """Set up the test suite. + + Setup: + Verify that at least two ports are open for session. + """ + self.verify(len(self._port_links) > 1, "Not enough ports") + + def send_packet_and_verify(self, should_receive: bool, mac_address: str) -> None: + """Generate, send and verify packets. + + Generate a packet and send to the DUT, verify that packet is forwarded from DUT to + traffic generator if that behavior is expected. + + Args: + should_receive: Indicate whether the packet should be received. + mac_address: Destination MAC address to generate in packet. + """ + packet = Ether(dst=mac_address) / IP() / Raw(load="xxxxx") + received = self.send_packet_and_capture(packet=packet, adjust_addresses=False) + contains_packet = any( + packet.haslayer(Raw) and b"xxxxx" in packet.load for packet in received + ) + self.verify( + should_receive == contains_packet, + f"Packet was {'dropped' if should_receive else 'received'}", + ) + + def disable_promisc_setup(self, port_id: int) -> TestPmdShell: + """Sets up testpmd shell config for cases where promisc mode is disabled. + + Args: + port_id: Port number to disable promisc mode on. + + Returns: + shell: interactive testpmd shell object. + """ + shell = TestPmdShell(node=self.sut_node) + shell.start() + shell.set_promisc(port=port_id, on=False) + shell.set_forward_mode(SimpleForwardingModes.io) + return shell + + def test_default_mode(self) -> None: + """Tests default configuration. + + Creates a testpmd shell, verifies that promiscuous mode is enabled by default, + and sends two packets; one matching source MAC address and one unknown. + Verifies that both are received. + """ + testpmd = TestPmdShell(node=self.sut_node) + isPromisc = testpmd.show_port_info(0).is_promiscuous_mode_enabled + self.verify(isPromisc, "Promiscuous mode was not enabled by default.") + testpmd.start() + mac = testpmd.show_port_info(0).mac_address + # send a packet with Rx port mac address + self.send_packet_and_verify(should_receive=True, mac_address=str(mac)) + # send a packet with mismatched mac address + self.send_packet_and_verify(should_receive=True, mac_address="00:00:00:00:00:00") + testpmd.close() + sleep(6) + + def test_disable_promisc(self) -> None: + """Tests disabled promiscuous mode configuration. + + Creates an interactive testpmd shell, disables promiscuous mode, + and sends two packets; one matching source MAC address and one unknown. + Verifies that only the matching address packet is received. + """ + testpmd = self.disable_promisc_setup(port_id=0) + mac = testpmd.show_port_info(0).mac_address + self.send_packet_and_verify(should_receive=True, mac_address=str(mac)) + self.send_packet_and_verify(should_receive=False, mac_address="00:00:00:00:00:00") + testpmd.close() + sleep(6) + + def test_disable_promisc_broadcast(self) -> None: + """Tests broadcast reception with disabled promisc mode config. + + Creates an interactive testpmd shell, disables promiscuous mode, + and sends two packets; one matching source MAC address and one broadcast. + Verifies that both packets are received. + """ + testpmd = self.disable_promisc_setup(port_id=0) + mac = testpmd.show_port_info(0).mac_address + self.send_packet_and_verify(should_receive=True, mac_address=str(mac)) + self.send_packet_and_verify(should_receive=True, mac_address="ff:ff:ff:ff:ff:ff") + testpmd.close() + sleep(6) + + def test_disable_promisc_multicast(self) -> None: + """Tests allmulticast mode with disabled promisc config. + + Creates an interactive testpmd shell, disables promiscuous mode, + and sends two packets; one matching source MAC address and one multicast. + Verifies that the multicast packet is only received once allmulticast mode is enabled. + """ + testpmd = self.disable_promisc_setup(port_id=0) + testpmd.set_multicast_all(on=False) + # 01:00:5E:00:00:01 is the first of the multicast MAC range of addresses + self.send_packet_and_verify(should_receive=False, mac_address="01:00:5E:00:00:01") + testpmd.set_multicast_all(on=True) + self.send_packet_and_verify(should_receive=True, mac_address="01:00:05E:00:00:01") + testpmd.close() + sleep(6)