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.133.124]) by passt.top (Postfix) with ESMTP id CE0DA5A027B for ; Fri, 16 Feb 2024 06:30:46 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708061445; 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=Dq4uAn5NCp+6mCmqwdV97T7VlWsS/4DZ5KrwQXoXJaE=; b=WsyDcwHKR365kkK44Lp5psR/i8NMBwkcCqUZPf4RI7DJOeXT+sPiC5Rq/EwnyZtljCscYQ 6HH0A8t0v86vKFGNgXBJHdIiwFBR/09NBbXJuSwW1qaSRD0FZtcGDAzzxmRJ9Pb/XU0A3C eqQbV4IpJkPXqdbMItxjCWQWanThUCU= Received: from mail-ej1-f69.google.com (mail-ej1-f69.google.com [209.85.218.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-122-jUN7qDR8NsikzGkcMe7hUA-1; Fri, 16 Feb 2024 00:30:43 -0500 X-MC-Unique: jUN7qDR8NsikzGkcMe7hUA-1 Received: by mail-ej1-f69.google.com with SMTP id a640c23a62f3a-a3158fbb375so20886266b.3 for ; Thu, 15 Feb 2024 21:30:43 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708061442; x=1708666242; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Dq4uAn5NCp+6mCmqwdV97T7VlWsS/4DZ5KrwQXoXJaE=; b=LrzqoOq7lFv21/mSoz+Jgebj/8HMu+mT6GDAabBEIQKk9ssG0DFppGwg+yxIAnpuKq hGVb/a0hEh5W3r/JMV8pebbGcKBMlovPFn+gegHNX54bxemgUyflCmWVJE+VntDAXzTb p2j1nGGpJY1cj4SG4QHhXytwP5R5XrqI5iEVPzLl8NZT9z3TkspuGRcJ+EQHX8fPQJae OwmTiTfEnh9H0OIOTTKN0hZvnKj6vOWgQX70OWEyAr+hoCqlaZyc7oKvetIJAd7SW9Dt yOG0KYHyJIknI8BTPuqp+E3lFITvxv2lW+uI+n8+VRji0iDFqDcj8/XoebZOfIUguH9F +Qxg== X-Gm-Message-State: AOJu0YyLeoayCipV6Pd1T7avRibK5H61dvBxqNv1SNykgxUlA3e4LImv IPR8lJYILK4eJmUdUb8TIiuHMvWg3LxjeJYteNqvLUspRdLF3SZRFJRXQFhAmnwx19jXzs9vQ5M 3BHyYxnvTQeiN/cGbIFKjC3Okb4d4lrNGER3tmpX/sW5YBGqyN8NMp2g3wbjCKSx+ny1ej2oYm6 wQs4xYLvEbyS6RdIx/5aU/cweAtKCIEM391xk= X-Received: by 2002:a17:906:645:b0:a3d:9ed3:dd1f with SMTP id t5-20020a170906064500b00a3d9ed3dd1fmr2337424ejb.18.1708061441961; Thu, 15 Feb 2024 21:30:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IEBr/16t5lF+A7EIpbPij3d4jdPb7OSoqB5gQPzga5LNCsU/4m+KKeKhQcrjwuW8AjZURodJw== X-Received: by 2002:a17:906:645:b0:a3d:9ed3:dd1f with SMTP id t5-20020a170906064500b00a3d9ed3dd1fmr2337412ejb.18.1708061441620; Thu, 15 Feb 2024 21:30:41 -0800 (PST) Received: from maya.cloud.tilaa.com (maya.cloud.tilaa.com. [164.138.29.33]) by smtp.gmail.com with ESMTPSA id i26-20020a170906251a00b00a3ce36ce4f9sm1201272ejb.83.2024.02.15.21.30.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Feb 2024 21:30:41 -0800 (PST) Date: Fri, 16 Feb 2024 06:30:07 +0100 From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH v2 2/8] pcap: add pcap_iov() Message-ID: <20240216063007.0bb68ed9@elisabeth> In-Reply-To: <20240214085628.210783-3-lvivier@redhat.com> References: <20240214085628.210783-1-lvivier@redhat.com> <20240214085628.210783-3-lvivier@redhat.com> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.36; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: LMC7OIZUVQHWEPM5PNU5XIDZPDEM4TSI X-Message-ID-Hash: LMC7OIZUVQHWEPM5PNU5XIDZPDEM4TSI 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.8 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 Wed, 14 Feb 2024 09:56:22 +0100 Laurent Vivier wrote: > Signed-off-by: Laurent Vivier > --- > > Notes: > v2: > - introduce pcap_header(), a common helper to write > packet header > - use writev() rather than write() in a loop > - add functions comment > > pcap.c | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++------- > pcap.h | 1 + > 2 files changed, 55 insertions(+), 7 deletions(-) > > diff --git a/pcap.c b/pcap.c > index 501d52d4992b..3869a403dd0f 100644 > --- a/pcap.c > +++ b/pcap.c > @@ -20,6 +20,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -31,6 +32,7 @@ > #include "util.h" > #include "passt.h" > #include "log.h" > +#include "iov.h" > > #define PCAP_VERSION_MINOR 4 > > @@ -65,6 +67,28 @@ struct pcap_pkthdr { > uint32_t len; > }; > > +/* > + * pcap_header - Write a pcap packet header to the pcap file descriptor (pcap_fd). Nit: pcap_header(). And "(pcap_fd)" doesn't seem to be a valid reference (anymore?). > + * > + * @len: Length of the packet data. > + * @tv: Pointer to a timeval struct containing the timestamp for the packet. > + * > + * Returns; -1 in case of error, otherwise, 0 to indicate success. "Return: -1" ...I know, it's wrong in pcap_frame(). -- Stefano