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 9AA2345CF9; Wed, 13 Nov 2024 19:56:33 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6CDA640A7F; Wed, 13 Nov 2024 19:56:33 +0100 (CET) Received: from mail-qt1-f169.google.com (mail-qt1-f169.google.com [209.85.160.169]) by mails.dpdk.org (Postfix) with ESMTP id B0DE2406B8 for ; Wed, 13 Nov 2024 19:56:32 +0100 (CET) Received: by mail-qt1-f169.google.com with SMTP id d75a77b69052e-460c27cd8f4so455991cf.2 for ; Wed, 13 Nov 2024 10:56:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iol.unh.edu; s=unh-iol; t=1731524192; x=1732128992; 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=7jOTUyV5EBQgHbXxJVVLRZt3bG8xsM+poAs3VjMbCWI=; b=G0r+KbzgqSj/sriLsozIoXvjeVX68jl5zj2OwuoQLx+m0B5xho0vbdL9q00O3REgNG zy4vbvZ4YMPId5ltmeF215HytGPlHryGtNfS/Q7UL5gvRPprDaDH2GNnVd8M6LVp3vFp A+sAQ1jsvH2/P9iBW7Q19d1o5oY4jkrBEbhpI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731524192; x=1732128992; 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=7jOTUyV5EBQgHbXxJVVLRZt3bG8xsM+poAs3VjMbCWI=; b=XmEQOqg3wveCf0RHv0McCleN1DlpgcviVPwqTSf0nDeUJW+N+a7cLlGtWi6TeEmazV leC0F0bHS91u7lwook4FB8R94cdj5GlOoAJ70sZm/QPirYnPICO61zxa8VYDsoURDufY ZGMNDLiqdPA5DB3idJW+SiaK5nozoZWwbS5T4ci7W0kfa3mviaGdK6uwaB3KgnWkyHFB B40jk0HemgA97aKPUMmcq6jMorcz4/IHJbjs+jp8u3Flalsk1YFeFO4PFleEWbXuE1E1 hOI3RtokTjkIoHdrr+pzOy5Hdd2wKDtHlsKtdLmvJIrws0HCbgWqunfkyuR1FnS8/Rz5 OrNA== X-Gm-Message-State: AOJu0YzWzhw70/lXW3OZDezPDh4LT4YHGd7c92KVa47HOOl3g6i2NZJR ydehUr1nKHhoZFSGDFixv+ajryb/OE5ZbYkyM+v+mtOWs6wFM4PrwWDvxnpd1iU= X-Google-Smtp-Source: AGHT+IEVP750Vum7uUNgoJZlEj3Qvn8VKVeEsO0kan+hAuxz5Dn4PsF6CTyW+EsnHJIlGLDELt/TQA== X-Received: by 2002:a05:622a:1302:b0:460:62a1:70be with SMTP id d75a77b69052e-46309426786mr132340241cf.13.1731524191973; Wed, 13 Nov 2024 10:56:31 -0800 (PST) Received: from localhost.unh.edu ([2606:4100:3880:1271:e2f8:4ec3:8bf3:864c]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-462ff46ce55sm91261591cf.40.2024.11.13.10.56.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Nov 2024 10:56:31 -0800 (PST) From: Nicholas Pratte To: Honnappa.Nagarahalli@arm.com, dmarx@iol.unh.edu, yoan.picchi@foss.arm.com, probb@iol.unh.edu, paul.szczepanek@arm.com, luca.vizzarro@arm.com Cc: dev@dpdk.org, Nicholas Pratte Subject: [PATCH v2] dts: add time delay to async sniffer callback function Date: Wed, 13 Nov 2024 13:56:29 -0500 Message-ID: <20241113185629.14327-1-npratte@iol.unh.edu> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20241030170808.29452-1-npratte@iol.unh.edu> References: <20241030170808.29452-1-npratte@iol.unh.edu> 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 --- .../testbed_model/traffic_generator/scapy.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/dts/framework/testbed_model/traffic_generator/scapy.py b/dts/framework/testbed_model/traffic_generator/scapy.py index be5ae3b895..434c0a231f 100644 --- a/dts/framework/testbed_model/traffic_generator/scapy.py +++ b/dts/framework/testbed_model/traffic_generator/scapy.py @@ -188,22 +188,24 @@ 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}'))," ), ")", ] if filter_config: - sniffer_commands.insert(-1, f"filter='{filter_config}'") + sniffer_commands.insert(-2, f"filter='{filter_config}'") self.send_command(f"\n{self._python_indentation}".join(sniffer_commands)) @@ -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