From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id B7F885A005E for ; Wed, 4 Jan 2023 18:45:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1672854309; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bVkHkp1tQsIDqmzVgFROARZtQMe0kK1wNN6nl/fTjmI=; b=IaZ8E3bCX0ruQ6Rcy/1wc+NUkmUBCFhjACBRyYUSuVPXrs74jePpSZLHJdmdj4RMGJjYKc Fa24i4YmcL/Ihd4eJVT3U/fJAf2PLjgfiP6XLuYpU10YaJTDWU3OiI372yci/Hhi0iJPsk LyZ35YhLj2FKBiLZWiMOL0b0lWeZQ/M= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-577-q-_YikEtMAeCohpEqD_L2A-1; Wed, 04 Jan 2023 12:45:06 -0500 X-MC-Unique: q-_YikEtMAeCohpEqD_L2A-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CCCED1C0A58B; Wed, 4 Jan 2023 17:45:05 +0000 (UTC) Received: from maya.cloud.tilaa.com (ovpn-208-4.brq.redhat.com [10.40.208.4]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 942DD2166B30; Wed, 4 Jan 2023 17:45:05 +0000 (UTC) Date: Wed, 4 Jan 2023 18:45:03 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v2 01/18] pcap: Introduce pcap_frame() helper Message-ID: <20230104184503.2d7d0966@elisabeth> In-Reply-To: <20221209054228.4085990-2-david@gibson.dropbear.id.au> References: <20221209054228.4085990-1-david@gibson.dropbear.id.au> <20221209054228.4085990-2-david@gibson.dropbear.id.au> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: QRD6WGQSA3STFUWLNED73CH4WGIBHEPB X-Message-ID-Hash: QRD6WGQSA3STFUWLNED73CH4WGIBHEPB X-MailFrom: sbrivio@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.3 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri, 9 Dec 2022 16:42:11 +1100 David Gibson wrote: > pcap(), pcapm() and pcapmm() duplicate some code, for the actual writing > to the capture file. The main purpose pf pcapm() and pcampp() not calling > pcap seems to be to avoid repeatedly calling gettimeofday(). We can > accomplish that while still sharing code by adding a new helper which > takes the packet timestamp as a parameter. Another purpose is to avoid logging errors for single messages in batches -- if something goes wrong with the log file, it gets noisy to the point of making passt unusable during throughput tests. Sure, it's quite unlikely to happen during normal operation -- still, should you re-spin, pcap_frame() could return errors and callers could abort early in case. -- Stefano