From patchwork Mon Jul 8 19:19:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dean Marx X-Patchwork-Id: 142230 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 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 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:19:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dean Marx X-Patchwork-Id: 142231 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 F1391455CA; Mon, 8 Jul 2024 21:20:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8FFBB427B2; Mon, 8 Jul 2024 21:20:04 +0200 (CEST) Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by mails.dpdk.org (Postfix) with ESMTP id 34F58427A8 for ; Mon, 8 Jul 2024 21:20:01 +0200 (CEST) Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-6ad86f3cc34so20684336d6.1 for ; Mon, 08 Jul 2024 12:20:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1720466400; x=1721071200; 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=CDLX6HWk+xd31i0sr9akAU4t3hp6aDeAVWUAh7blTEa9Y5oEfrv3KlW47inXRIS+jY TUVZsTZlHOw6hY3Fhrti4kK5S3XOWA51NsVIteOLlnJzlc1rrMxisrGQfgpUBeayhl08 XxWrRplGq9X2fDQpSbnZ2BRwcpelGJNtZ1U7s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720466400; x=1721071200; 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=AjLgN1tn2yFnHyVrBMEx8mSJH/dYdFtVmih9MTWhjbWxLV2Fvx5nL/8BewYw2lfdd1 5u+WdkLBU+mmniUvGmraR4m2xhKTwIHEqYDDFtMqJ5UF6L/OXiyO4LH2E7oQBYDrEQsf /+miayXmefPFOqq9tvgdcDvGzfQYKT+n1xSQIDHM/cuxhdyACE7KF0CmlSo/ekNbjNpJ l1732H9HaKOmxESX3U356T/OENYwiJde7IPhJ4VchMu7Pgyai+dMCrBQU7FIcGjidcsn kz5tE/0OWWQmCgjk9tWFXVFAn/cAVYof4aO4xQ4mB42I4UweXYRN4WdAmtmp1NdPFYnw q8BQ== X-Gm-Message-State: AOJu0YwRvANXJNknf1gxrrNno4jP/PYxZL089JJVe68wDC6EVwfWbV2D 2AMqcvy7dhAycI4tCPVHi8PYqMrHioT9PeKh0UUU9TmfiICMP6RTh6sdoFA15+A= X-Google-Smtp-Source: AGHT+IFJ4haeaZebZHprVYMufNBLesFMHljAjmDZsMNIzz1j44ufta107S+oyTiubTIombXw8T6XQw== X-Received: by 2002:ad4:5c68:0:b0:6b5:e5bc:3d39 with SMTP id 6a1803df08f44-6b61bca3823mr8250536d6.19.1720466400447; Mon, 08 Jul 2024 12:20:00 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 12:20:00 -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 2/4] dts: add toggle option to send and capture Date: Mon, 8 Jul 2024 15:19:36 -0400 Message-ID: <20240708191938.32132-3-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 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:19:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dean Marx X-Patchwork-Id: 142232 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 1D54D455CA; Mon, 8 Jul 2024 21:20:17 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A6474427B7; Mon, 8 Jul 2024 21:20:05 +0200 (CEST) Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by mails.dpdk.org (Postfix) with ESMTP id 80812427AA for ; Mon, 8 Jul 2024 21:20:02 +0200 (CEST) Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-6b5da2730efso26601556d6.2 for ; Mon, 08 Jul 2024 12:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1720466402; x=1721071202; 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=C7gynNti9+VuwEIdAXhJTaFpdBu6s8LHJNRPn+qSv7Ba7q+eiJD6CoiPT44OFVCSrb WkFYWo5yky3sdZdsCcmbZVx1mfQBymze5qPPMATREFHA8hSHIfRwdSafzBx8xoHyDL26 UKb0u9BjNIaKGahJcOQN9VdMHBuOE6jhOn/ik= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720466402; x=1721071202; 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=nayvhmImsSKxaCCVce/2mDQVa5ApeArW7GXOSciMEA4xZwS62TaqfctPb73zKwjaAB WBkfItJfWWaWBcBjTqogKSZP03HI8gYlDtRrvKy+Hq1o8OgHpeOh3rP+4ucJ0hvVoH5L casPSVxF/+M3qE6Xw4wcuvVQNWah1rhjxNOPUi7DZBPpxL4YZyrsu8BBP9r0myVfa6ct zdNSfmW9GAVeBLKyaGYVTf1rrtZywjRUqgHYTMniC773QCL0990gaGg8gLMPdk148eUf 0kBOplnOK7MPMN+vbGZc4MaZTUZUem+77Uz9So262zZH2KBdXv6y/uL8nmZJ9p4j1X2j KBGg== X-Gm-Message-State: AOJu0YyEvBCE+X7cr42DD8s8SZ/GM4hSZyLShuqRGzec5jLHaFSwQlVj T1BoAcjiSlZ4OMDZW4fvQ++C3y5NHqLbjmOjU3IMe3I3MDc4FgdclojRrsHgX44= X-Google-Smtp-Source: AGHT+IGfDXe46xHkNVpCdfy7fmI58x/5hMxtqgSFoA/VrWmWrAa8GKUBdUr4XIcqwQxiZIY3pTch8w== X-Received: by 2002:ad4:5d4c:0:b0:6b5:2b33:5445 with SMTP id 6a1803df08f44-6b61bd0500cmr7056676d6.25.1720466401911; Mon, 08 Jul 2024 12:20:01 -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.20.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 12:20:01 -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 3/4] dts: dynamic config conf schema Date: Mon, 8 Jul 2024 15:19:37 -0400 Message-ID: <20240708191938.32132-4-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 configuration schema to run dynamic configuration test suite. Signed-off-by: Dean Marx --- 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:19:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dean Marx X-Patchwork-Id: 142233 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 9E54C455CA; Mon, 8 Jul 2024 21:20:22 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B9A22427BE; Mon, 8 Jul 2024 21:20:06 +0200 (CEST) Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) by mails.dpdk.org (Postfix) with ESMTP id DD27440E7C for ; Mon, 8 Jul 2024 21:20:03 +0200 (CEST) Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-64b5617ba47so34381267b3.3 for ; Mon, 08 Jul 2024 12:20:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1720466403; x=1721071203; 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=bMPlkJjwqEcU1pRr+c+WEbUyNexS5+LsjSmJDNqS2Ss=; b=Fb7w6MCG2rUhLeuVY7HEJpidBomkh1xx0CPpbArf/cT+l9tIXjbwEZuWrIA2ArsCgE 30GEmUIDQxqeNVit6jPrAWtEbI/1CFxl2GGtyDrYMmWRC0+yaSk0mnBqKoJB5wYm5WDB HMhhniHlZ4RB4SIyWseOOQD7AL66u9ewAtwJI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720466403; x=1721071203; 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=bMPlkJjwqEcU1pRr+c+WEbUyNexS5+LsjSmJDNqS2Ss=; b=nfFxZR4BnjTXTU4i1yTkDqnbUzKfRHqrnbcK7aegerbgIWm/7Kv42OOoAyLc85JouI pLXYKeRxQLWAGZR3ZLv5k9T+XOs+uWCZb8V68qb8Gcf4V5adEeI9jSCI0qJ9VHpf0JeN MqjcNzs6erB8FaTfs9kjOxPFuFGceS21mFNA07gHwzuprUO7BdTcH5eHVFLCWa7+w+2r zUMb3NEstFIS/Ss2U8k47ibzX7/4SP/IXM71rTbONOoE9ry6cuxwGqKrYOoao2CJ3daE b0HiEcPsHZRPAbfXHfzNvFvedbYPxp9kDwGHnwoaFsd2xT/5Y3gIgp6A68cblPTFjPmL ezsQ== X-Gm-Message-State: AOJu0YxP4tXhIUIri8y3bkpoPo0W0Hho2B4bO6QlkjVqMA9n+sIuZikB zIK5FJAD440U2Haz9/QSvPAEV0EyZcs4MD9ZSz8HNQUwqgDSdpmo6mI8U0FvGJo= X-Google-Smtp-Source: AGHT+IECGXnVL74TQe0mxmmmoeO0zYQ9BiMjbSV0uU7b5mTqjXsgL7BfvNzSL5jkJA8NHl49NTIueA== X-Received: by 2002:a0d:e381:0:b0:61b:3364:d193 with SMTP id 00721157ae682-658f07d6b0emr7305567b3.40.1720466403178; Mon, 08 Jul 2024 12:20:03 -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.20.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jul 2024 12:20:02 -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 4/4] dts: dynamic config test suite Date: Mon, 8 Jul 2024 15:19:38 -0400 Message-ID: <20240708191938.32132-5-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 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..326a57d60f --- /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: verfiy 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)