From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 43F2845C17; Wed, 30 Oct 2024 18:08:14 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 137C24345A; Wed, 30 Oct 2024 18:08:14 +0100 (CET) Received: from mail-qv1-f48.google.com (mail-qv1-f48.google.com [209.85.219.48]) by mails.dpdk.org (Postfix) with ESMTP id 19AD34344B for ; Wed, 30 Oct 2024 18:08:13 +0100 (CET) Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-6cbd12de220so120626d6.3 for ; Wed, 30 Oct 2024 10:08:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1730308092; x=1730912892; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=+TB5RK6NvE/pqPKh9pEu1Mif7cn/GjIHDEtDFnvDTuo=; b=W1ruE1sw38nSc/rjPP9D0iErqD19cCASUt5OpZfAOtPn12phXCtvpEKZpc8um+GLiL VTcOeYEaCrZISfmp6Tii3yP2VB+xXe+Hxr7PdfxFqexkCugQ6RNoK9HgA8kiB0N1XYp0 sWruagFN+nS+H8QcyT5atcfY8/ZryQcjXPgOc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730308092; x=1730912892; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=+TB5RK6NvE/pqPKh9pEu1Mif7cn/GjIHDEtDFnvDTuo=; b=g/hcNZfE04QY2swNqQCAQG6c+8LXY/KNO7Qv0rukhrdba6U4BOsFWpqeTFJi2S49Oz UnyRrlGR6oQ/5buM2/8/hd5HmemddhTeMQTXSqxgFbFogDwkcREisg/pbs+Jpy/4+UzZ REN1oBnl130UxK6+Dla9m3Qv+G3rhaUVovNNbpxQ0nfqO3ar22HEE5vhnAHGqvvd99en 1v+I4vGt16b+YSIG6myVBX2aKsRARWufbRhUmIZePvUuugBMgHnKZ40wYWrwZ77ubap5 mXdbN89rjkC4oyj0CRhLIPvkOr+R1vOqlhnqShD205I6nSAzl/aMa+Khh/I9H/3U+y1Z 88lA== X-Gm-Message-State: AOJu0YzGpWu+BJIW0QMpLuZbnqh+ufCmxHriHQ7zpBsQTrloAJ/XOiu8 LuFu+/a9Qjpaiucmb8lm/1aoLeHH2+HJ78iqcJIyxBjfyWwr0ez3ApNcb139lBk= X-Google-Smtp-Source: AGHT+IH0okLKdpfra9w7oT16PnaJuxgBhbGygc2XIV/ccNxLkq9891ibf6DxKhIclF0vQD8omqfF3A== X-Received: by 2002:ad4:4ee2:0:b0:6cb:c67a:efe8 with SMTP id 6a1803df08f44-6d185862608mr109882066d6.12.1730308092220; Wed, 30 Oct 2024 10:08:12 -0700 (PDT) Received: from localhost.unh.edu ([2606:4100:3880:1271:e2f8:4ec3:8bf3:864c]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6d17991e1absm53848226d6.71.2024.10.30.10.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Oct 2024 10:08:11 -0700 (PDT) From: Nicholas Pratte 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 Subject: [PATCH v1] dts: add time delay to async sniffer callback function Date: Wed, 30 Oct 2024 13:08:08 -0400 Message-ID: <20241030170808.29452-1-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 --- 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