DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH v1 1/2] dts: fix docstring typo in checksum suite
@ 2025-07-22 17:22 Dean Marx
  2025-07-22 17:22 ` [PATCH v1 2/2] dts: add exception handling to checksum verify method Dean Marx
  2025-07-29 12:31 ` [PATCH v1 1/2] dts: fix docstring typo in checksum suite Luca Vizzarro
  0 siblings, 2 replies; 4+ messages in thread
From: Dean Marx @ 2025-07-22 17:22 UTC (permalink / raw)
  To: probb, luca.vizzarro, yoan.picchi, Honnappa.Nagarahalli, paul.szczepanek
  Cc: dev, Dean Marx

Current test suite docstring for checksum offload suite
says there are 6 test cases when it should say 7.

Fixes: 8c9a7471a0e6 ("dts: add checksum offload test suite")

Signed-off-by: Dean Marx <dmarx@iol.unh.edu>
---
 dts/tests/TestSuite_checksum_offload.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dts/tests/TestSuite_checksum_offload.py b/dts/tests/TestSuite_checksum_offload.py
index c9efdcaa1c..b03c3d46ed 100644
--- a/dts/tests/TestSuite_checksum_offload.py
+++ b/dts/tests/TestSuite_checksum_offload.py
@@ -36,7 +36,7 @@
 class TestChecksumOffload(TestSuite):
     """Checksum offload test suite.
 
-    This suite consists of 6 test cases:
+    This suite consists of 7 test cases:
     1. Insert checksum on transmit packet
     2. Do not insert checksum on transmit packet
     3. Hardware checksum check L4 Rx
-- 
2.50.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v1 2/2] dts: add exception handling to checksum verify method
  2025-07-22 17:22 [PATCH v1 1/2] dts: fix docstring typo in checksum suite Dean Marx
@ 2025-07-22 17:22 ` Dean Marx
  2025-07-29 12:40   ` Luca Vizzarro
  2025-07-29 12:31 ` [PATCH v1 1/2] dts: fix docstring typo in checksum suite Luca Vizzarro
  1 sibling, 1 reply; 4+ messages in thread
From: Dean Marx @ 2025-07-22 17:22 UTC (permalink / raw)
  To: probb, luca.vizzarro, yoan.picchi, Honnappa.Nagarahalli, paul.szczepanek
  Cc: dev, Dean Marx

Current implementation of the checksum offload test suite
contains a section in the verify checksum method
that causes NameError exceptions when the packet is
dropped. Add a try block to encapsulate this section
and handle any errors created.

Fixes: 8c9a7471a0e6 ("dts: add checksum offload test suite")

Signed-off-by: Dean Marx <dmarx@iol.unh.edu>
---
 dts/tests/TestSuite_checksum_offload.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dts/tests/TestSuite_checksum_offload.py b/dts/tests/TestSuite_checksum_offload.py
index b03c3d46ed..9dfbcb8028 100644
--- a/dts/tests/TestSuite_checksum_offload.py
+++ b/dts/tests/TestSuite_checksum_offload.py
@@ -89,8 +89,11 @@ def send_packet_and_verify_checksum(
             if testpmd_packet.l4_dport == id:
                 is_IP = PacketOffloadFlag.RTE_MBUF_F_RX_IP_CKSUM_GOOD in testpmd_packet.ol_flags
                 is_L4 = PacketOffloadFlag.RTE_MBUF_F_RX_L4_CKSUM_GOOD in testpmd_packet.ol_flags
-        self.verify(is_L4 == good_L4, "Layer 4 checksum flag did not match expected checksum flag.")
-        self.verify(is_IP == good_IP, "IP checksum flag did not match expected checksum flag.")
+        try:
+            self.verify(is_L4 == good_L4, "Layer 4 checksum flag did not match expected checksum flag.")
+            self.verify(is_IP == good_IP, "IP checksum flag did not match expected checksum flag.")
+        except NameError:
+            self.verify(False, "Test packet was dropped when it should have been received.")
 
     def setup_hw_offload(self, testpmd: TestPmdShell) -> None:
         """Sets IP, UDP, and TCP layers to hardware offload.
-- 
2.50.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/2] dts: fix docstring typo in checksum suite
  2025-07-22 17:22 [PATCH v1 1/2] dts: fix docstring typo in checksum suite Dean Marx
  2025-07-22 17:22 ` [PATCH v1 2/2] dts: add exception handling to checksum verify method Dean Marx
@ 2025-07-29 12:31 ` Luca Vizzarro
  1 sibling, 0 replies; 4+ messages in thread
From: Luca Vizzarro @ 2025-07-29 12:31 UTC (permalink / raw)
  To: Dean Marx, probb, yoan.picchi, Honnappa.Nagarahalli, paul.szczepanek; +Cc: dev

Reviewed-by: Luca Vizzarro <luca.vizzarro@arm.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 2/2] dts: add exception handling to checksum verify method
  2025-07-22 17:22 ` [PATCH v1 2/2] dts: add exception handling to checksum verify method Dean Marx
@ 2025-07-29 12:40   ` Luca Vizzarro
  0 siblings, 0 replies; 4+ messages in thread
From: Luca Vizzarro @ 2025-07-29 12:40 UTC (permalink / raw)
  To: Dean Marx, probb, yoan.picchi, Honnappa.Nagarahalli, paul.szczepanek; +Cc: dev

On 22/07/2025 18:22, Dean Marx wrote:
> --- a/dts/tests/TestSuite_checksum_offload.py
> +++ b/dts/tests/TestSuite_checksum_offload.py
> @@ -89,8 +89,11 @@ def send_packet_and_verify_checksum(
>               if testpmd_packet.l4_dport == id:
>                   is_IP = PacketOffloadFlag.RTE_MBUF_F_RX_IP_CKSUM_GOOD in testpmd_packet.ol_flags
>                   is_L4 = PacketOffloadFlag.RTE_MBUF_F_RX_L4_CKSUM_GOOD in testpmd_packet.ol_flags
> -        self.verify(is_L4 == good_L4, "Layer 4 checksum flag did not match expected checksum flag.")
> -        self.verify(is_IP == good_IP, "IP checksum flag did not match expected checksum flag.")
> +        try:
> +            self.verify(is_L4 == good_L4, "Layer 4 checksum flag did not match expected checksum flag.")
> +            self.verify(is_IP == good_IP, "IP checksum flag did not match expected checksum flag.")
> +        except NameError:
> +            self.verify(False, "Test packet was dropped when it should have been received.")

Doesn't really look like the right approach. As it stands I can't tell 
from the code at first glance why are we checking for NameError. I am 
guessing this is because is_L4 is_IP weren't set. We shouldn't cause 
Python to fail on their inexistence and then recover. We should rather 
verify that they exist.

I'd propose to set is_L4 and is_IP to None at the beginning of the 
method. Then after the for loop, check that they are not None through 
self.verify. If mypy becomes unhappy because it can't compare bool with 
bool | None, then verify the non-nullness with an if and do 
self.verify(False, ...) as you are doing already. This will guarantee to 
mypy that the variables won't be None afterwards.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-29 12:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-07-22 17:22 [PATCH v1 1/2] dts: fix docstring typo in checksum suite Dean Marx
2025-07-22 17:22 ` [PATCH v1 2/2] dts: add exception handling to checksum verify method Dean Marx
2025-07-29 12:40   ` Luca Vizzarro
2025-07-29 12:31 ` [PATCH v1 1/2] dts: fix docstring typo in checksum suite Luca Vizzarro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).