From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202412 header.b=EcqaLExi; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 2F4CE5A026F for ; Wed, 29 Jan 2025 06:08:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202412; t=1738127299; bh=ECdpiEOxNDn/Sojc8HZ5ofuExrq7c6sXPRSzLrBRJWI=; h=Date:From:To:Cc:Subject:From; b=EcqaLExiGPGvt6dUuRL7MC66/4qb2hZS4f9S+9+sXd/4+V0rqnkgSBGeTdOS8Flxe 84h5uJHHZFiEGOKy8CYrskK5UacSoVCz3P/T5AFA/q5PEC/jiaQbttYVUeo8PbFoN0 oJv9k+QRuLaoEdwfojrgnsr+CmyPn7npbWMdkcajOfmYk42+twMxa2fowlqtNkA5mX KekehpiFFsRMP7hIYP6QApBfnXHibtS0rIPe8qBhGdfby4lg5UnLt4H3o4bViJHMDE B7OZyYE4sqhMvU0AAuK40eerKbPMjzSPA5d0dIp2mVVyI04/E6OO+jE4kc3jdZC6tN P9uyTOktqJWRQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4YjVXz4gN6z4x0t; Wed, 29 Jan 2025 16:08:19 +1100 (AEDT) Date: Wed, 29 Jan 2025 16:08:20 +1100 From: David Gibson To: Laurent Vivier Subject: Handling discontinuous packet buffers Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="M7nKbo9h9nH1WMEK" Content-Disposition: inline Message-ID-Hash: SK6IM5DXITEZ3K65ZXL7O7WO3UDDZW3H X-Message-ID-Hash: SK6IM5DXITEZ3K65ZXL7O7WO3UDDZW3H 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: Stefano Brivio , 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: --M7nKbo9h9nH1WMEK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Laurent, I had a closer look at extending IOV_REMOVE_HEADER() and the rest to handle discontinuous buffers, but I realised it's a bit more complex than I thought. What we need to do is a bit different depending on whether we're sending or receiving. The single current user of IOV_REMOVE_HEADER() is sending (guest Rx), as are the places I had been thinking about using it. For the send path, obviously, it's not helpful to linearise the section from the IOV, instead we need to write things into the IOV, maybe discontiguously. The IOV_REMOVE_HEADER() interface doesn't really work for this. I was wondering about a sort of "reserve/set" interface. You "reserve" the header region, which gives you either a pointer directly into the iov, or a pointer to a temporary buffer. Then you "set", which is a no-op if you had a direct pointer, but if you had the temp buffer, then it copies back with iov_from_buf(). I don't love this interface; it's pretty easy to forget the "set" stage, and not notice (if the kernel is usually giving contiguous buffers, the tests won't catch it). Not sure what else to do at this stage, though. IIUC, the problems you're grappling with right now are on this path. However, I suspect we could hit this problem on the other path (guest Tx) as well: that would be if the guest gives us an outbound frame in multiple discontiguous buffers. For that case we do want to linearise the sections we need to parse, but extending IOV_REMOVE_HEADER() isn't enough. To handle this case we need to extend the packet pool stuff to cope with discontiguous frames. It would be nice, of course, if we can share at least some of the logic between the two paths, but how to make an interface that works for that isn't really clear to me yet. --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --M7nKbo9h9nH1WMEK Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmeZt8MACgkQzQJF27ox 2GeEww/+Pqst815sbttue3jHT+AZhyf/N8casV1dXMTeYPV/KTiZaqqZPUrB0AwU 57ETirhMJ5ukNLVioURFEgy2lbM0USuwWQpvX10eTQynxJgHIKEVrjvgu6hDNX3r 2GeY7vWq85roiVRLPlznY5pNh6izw1+G/GD2W78p/aHKg5r4h8IZJiv3cjE07MjS /NxeO8jsOKaKFMIYcfo7/71vNzgneyFyUijNI+jp/kidYjoHbQJiIUmkE+ERQJZQ LHXp//7worD76Fv5O2hnYJJAnxK7lET5tkm0lHvZ33kPxkPmlJWdePAxmL5YnmiE 8eZtkwKEdynOPggUmJKL6tlWCb3gMnhad1I6rOXz5wT9IVybl3KnF2vASwBxE12v MgJxQqWrUVDlAb7BslKVrLScYWb/QqgkzDKq/5qJ9KTotkQF9v3SuUWkzpOwl8wN 7QTNCnxUqR/Bc2/KBNl+MdIX0J9Hb3sfBdUe1lxfamht5rUASIqrC/9SUezsEaC/ KdKkZqmk25WhyVtJkrMmKD39TeVACY3pmzJYf1agh69dsklyIKbtu/TM+GNle1H9 t5y1n4Uj3Ez0hRS/VqdtOsPMpswDGoSMDS9BJqXg8XoyaBogtglH2EepS47Rkhga hCO9wJtFH34GI8pj7d/TexCfmsKnX9UCEZb6NZCv2jAlBzlhkE8= =N3If -----END PGP SIGNATURE----- --M7nKbo9h9nH1WMEK--