From: Nicholas Pratte <npratte@iol.unh.edu>
To: yoan.picchi@foss.arm.com, dmarx@iol.unh.edu,
paul.szczepanek@arm.com, Honnappa.Nagarahalli@arm.com,
luca.vizzarro@arm.com, probb@iol.unh.edu
Cc: dev@dpdk.org, Nicholas Pratte <npratte@iol.unh.edu>
Subject: [PATCH v1] dts: add time delay to async sniffer callback function
Date: Wed, 30 Oct 2024 13:08:08 -0400 [thread overview]
Message-ID: <20241030170808.29452-1-npratte@iol.unh.edu> (raw)
There exists a bug within i40e NICs in which the async sniffer does not
catch send packets as a result of the callback function sending packets
too quickly before the NICs are ready to start capturing.
There could be a multitude of reasons why this happens on these NICs, but
for the time being, inserting a one second delay in the callback function
will suffice.
Bugzilla ID: 1573
Signed-off-by: Nicholas Pratte <npratte@iol.unh.edu>
---
dts/framework/testbed_model/traffic_generator/scapy.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/dts/framework/testbed_model/traffic_generator/scapy.py b/dts/framework/testbed_model/traffic_generator/scapy.py
index be5ae3b895..9fa9feaf47 100644
--- a/dts/framework/testbed_model/traffic_generator/scapy.py
+++ b/dts/framework/testbed_model/traffic_generator/scapy.py
@@ -188,17 +188,19 @@ def _shell_create_sniffer(
when set to an empty string.
"""
self._shell_set_packet_list(packets_to_send)
+ # We need to introduce a short delay in the sniffer sendp() for i40e NICs.
+ self.send_command("import time")
sniffer_commands = [
f"{self._sniffer_name} = AsyncSniffer(",
f"iface='{recv_port.logical_name}',",
"store=True,",
# *args is used in the arguments of the lambda since Scapy sends parameters to the
# callback function which we do not need for our purposes.
- "started_callback=lambda *args: sendp(",
+ "started_callback=lambda *args: (time.sleep(1), sendp(",
(
# Additional indentation is added to this line only for readability of the logs.
f"{self._python_indentation}{self._send_packet_list_name},"
- f" iface='{send_port.logical_name}'),"
+ f" iface='{send_port.logical_name}')),"
),
")",
]
@@ -223,7 +225,8 @@ def _shell_start_and_stop_sniffing(self, duration: float) -> list[Packet]:
"""
sniffed_packets_name = "gathered_packets"
self.send_command(f"{self._sniffer_name}.start()")
- time.sleep(duration)
+ # Insert a one second delay to prevent timeout errors from occurring
+ time.sleep(duration + 1)
self.send_command(f"{sniffed_packets_name} = {self._sniffer_name}.stop(join=True)")
# An extra newline is required here due to the nature of interactive Python shells
packet_strs = self.send_command(
--
2.44.0
reply other threads:[~2024-10-30 17:08 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241030170808.29452-1-npratte@iol.unh.edu \
--to=npratte@iol.unh.edu \
--cc=Honnappa.Nagarahalli@arm.com \
--cc=dev@dpdk.org \
--cc=dmarx@iol.unh.edu \
--cc=luca.vizzarro@arm.com \
--cc=paul.szczepanek@arm.com \
--cc=probb@iol.unh.edu \
--cc=yoan.picchi@foss.arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).