From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id B38385A0278 for ; Wed, 28 Feb 2024 02:52:14 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202312; t=1709085128; bh=sAiiJt8a+hdhlSOOnFZB9taGDCSrsBov+u97DYk0QZM=; h=From:To:Cc:Subject:Date:From; b=MXBqqta8PErl1ot1QYVjhDizv/1wcI6qQQexRXBearXXThxPCxpbYPN6x4JZ0wF6l Nm8Clz/s25v8rzchYVuaclEL9IP213UD0apeCPW7iAr6Nik5WBAO+cOQB4eLjyGplu q48A2cXd0JDL6ioHswzBIjw44qJGkYI/E8t8FRzKEN/64QfOwL1w/zj9pAvhVIhXga n1w9r12aKlqNFW8znLME3PNn1bhWKLUsKPcchp9WjU2MDWdoS5Rzm2jvOdzddaWYr4 /U9PlWHEtSSBvgpLhBNySPKyHOrQlVIxul63j0JkP5nkqDCa5XmNn5iLc5qy/0PDwJ Dwcj/KtcX4DFQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Tky5h5lCGz4wcg; Wed, 28 Feb 2024 12:52:08 +1100 (AEDT) From: David Gibson To: Laurent Vivier , passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 0/7] Allow more use of iovecs in pcap and tap interfaces Date: Wed, 28 Feb 2024 12:51:59 +1100 Message-ID: <20240228015206.1214242-1-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.43.2 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 3KYJSC7SRHQFDAFOV2PY4T5N7ZYXJ22A X-Message-ID-Hash: 3KYJSC7SRHQFDAFOV2PY4T5N7ZYXJ22A X-MailFrom: dgibson@gandalf.ozlabs.org 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: David Gibson 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: While working on other stuff I stumbled across some patches I wrote quite a while back (part of a larger series on indefinite hiatus). These make it easier to use the pcap and tap functions with frames that aren't in a single contiguous buffer. This overlaps with some of the work in Laurent's vhost-user series, so I've included the first of his patches and integrated it with my changes. There will The first two patches have some overlap with the preliminary iovec patches in the vhost-user series (and will certainly conflict). I do think the pcap interface here is slightly better than the one in the vhost-user series, although I did ack that. Stefano, if you've already applied / run tests for Laurent's series then go ahead with it; I'll rework this on top of those. Changes since v1: * Stefano correctly pointed out that my iov_offset() function was unclear in its naming and description. Rename it to iov_skip_bytes() and change the wording around it to improve this. * Incorporate Laurent's iov helper patch, and also use iov_skip_bytes() to slightly simplify its functions. * Fix commit message for write_remainder() so that it correctly describes handling "short writes", not "sort writes", whatever that might mean. * Adjust parameter names and descriptions for pcap_multiple() for clarity. David Gibson (6): iov: Add helper to find skip over first n bytes of an io vector pcap: Update pcap_frame() to take an iovec and offset util: Add write_remainder() helper pcap: Handle short writes in pcap_frame() pcap: Allow pcap_frame() and pcap_multiple() to take multi-buffer frames tap: Use write_remainder() in tap_send_frames_passt() Laurent Vivier (1): iov: add some functions to manage iovec Makefile | 8 +-- iov.c | 198 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ iov.h | 31 +++++++++ pcap.c | 56 ++++++++-------- pcap.h | 3 +- tap.c | 41 +++--------- util.c | 33 ++++++++++ util.h | 1 + 8 files changed, 307 insertions(+), 64 deletions(-) create mode 100644 iov.c create mode 100644 iov.h -- 2.43.2