Skip to content

Commit f0c0a48

Browse files
dmarxIOLkevintraynor
authored andcommitted
dts: add reception check to checksum suite
[ upstream commit 89b634c ] In the current implementation of Checksum Offload, the variables is_L4 and is_IP are not initialized outside of the loop that checks the received packet, so if the packet is dropped these variables cause a NameError in the verification steps. Add a line that sets these variables to None prior to the check, then verifies they are not None directly after. Fixes: 8c9a747 ("dts: add checksum offload test suite") Signed-off-by: Dean Marx <[email protected]> Reviewed-by: Patrick Robb <[email protected]> Reviewed-by: Luca Vizzarro <[email protected]>
1 parent 72c2154 commit f0c0a48

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

dts/tests/TestSuite_checksum_offload.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,17 @@ def send_packet_and_verify_checksum(
8686
testpmd.start()
8787
self.send_packet_and_capture(packet=packet)
8888
verbose_output = testpmd.extract_verbose_output(testpmd.stop())
89+
is_IP = is_L4 = None
8990
for packet in verbose_output:
9091
if packet.dst_mac == id:
91-
isIP = PacketOffloadFlag.RTE_MBUF_F_RX_IP_CKSUM_GOOD in packet.ol_flags
92-
isL4 = PacketOffloadFlag.RTE_MBUF_F_RX_L4_CKSUM_GOOD in packet.ol_flags
93-
self.verify(isL4 == goodL4, "Layer 4 checksum flag did not match expected checksum flag.")
94-
self.verify(isIP == goodIP, "IP checksum flag did not match expected checksum flag.")
92+
is_IP = PacketOffloadFlag.RTE_MBUF_F_RX_IP_CKSUM_GOOD in packet.ol_flags
93+
is_L4 = PacketOffloadFlag.RTE_MBUF_F_RX_L4_CKSUM_GOOD in packet.ol_flags
94+
self.verify(
95+
is_IP is not None and is_L4 is not None,
96+
"Test packet was dropped when it should have been received.",
97+
)
98+
self.verify(is_L4 == goodL4, "Layer 4 checksum flag did not match expected checksum flag.")
99+
self.verify(is_IP == goodIP, "IP checksum flag did not match expected checksum flag.")
95100

96101
def setup_hw_offload(self, testpmd: TestPmdShell) -> None:
97102
"""Sets IP, UDP, and TCP layers to hardware offload.

0 commit comments

Comments
 (0)