From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hc/Jgwxs; dkim-atps=neutral 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 F17355A004C for ; Fri, 08 Nov 2024 10:23:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1731057831; 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=iqPj3x+d3IAfgK2eB8iBH4trzf6yJvJGpdxa0ee+hwo=; b=hc/JgwxsyXKwz8h1H4t7rB4xp1iXjVN+MIjZpz8+ZzDxArAsOyNAPCW14N0wMRq6VPA4S9 Co+iviZKGB8IqxT7C5CJX4TxXKTKrfSb8CVCVkWnpA2ujubMOIdd2mHSA+d15wlubuxWBz JcPcZ0lkusO8oDy1NfMJOOJPLGjQSg4= Received: from mail-wr1-f72.google.com (mail-wr1-f72.google.com [209.85.221.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-370-212YPa27NmSVGCAc4pKVfA-1; Fri, 08 Nov 2024 04:23:49 -0500 X-MC-Unique: 212YPa27NmSVGCAc4pKVfA-1 X-Mimecast-MFC-AGG-ID: 212YPa27NmSVGCAc4pKVfA Received: by mail-wr1-f72.google.com with SMTP id ffacd0b85a97d-37d43e7acd9so950685f8f.2 for ; Fri, 08 Nov 2024 01:23:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731057828; x=1731662628; 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=iqPj3x+d3IAfgK2eB8iBH4trzf6yJvJGpdxa0ee+hwo=; b=l6zxM2cCFwL4VPwymAhFrbvSl+E5EjiQ2jHengLiWnfkJMTmaFMXMaq0nQ+7LVky77 nCsDBCdYhNkehzzpd2wKEcztCotDWjlafgwkLj0WZJsQOoujXz9XK+lObCHgNFslRjOU HaeY98bZrTOF/p+j4zazMFjyF0vs/e1eUhh9Oa3WqJeL/sfHxyeFCjOkut5ERUuZs+ha gKsKJ4VuZyKv2m+Av+kgFlWmFUa5UWaiztExLJ7qDYX1jhNbLSP9XE6Wl0bNyuCf0jUN q5lTOt7tgi/yICWk4AcXaZwqDQb92Yl7zykkmKG9aMEGnpqECWbOkbREhotoR2anHDio T0sQ== X-Gm-Message-State: AOJu0Yxy7Wjd0ta4cQ9JYBNvegs/gbehZQ7BnixBzcyVFKzLWwhIAHnB 9pFKRMC86P8H2D/msfq1ZY7vDNRY8gDx2Vyn8mJC3q3VNwbkG0ZaXWEqf/mf9Kf2K7DvgjprZSU XELUNdbZEDNUz+XW0bXw2YHNt0vWNn2jRy2B7SWpRStRBV0Q2x3KiKQf7Yw== X-Received: by 2002:a05:6000:78a:b0:37d:3def:2a82 with SMTP id ffacd0b85a97d-381f188587fmr1782182f8f.36.1731057827786; Fri, 08 Nov 2024 01:23:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IE6CphqGjTmsKlo0iPLq4dnhw3/51Vcc0P0Wo14kKM+tr4GtXclaRqu9zDH5CxqodBSpytpPg== X-Received: by 2002:a05:6000:78a:b0:37d:3def:2a82 with SMTP id ffacd0b85a97d-381f188587fmr1782153f8f.36.1731057827173; Fri, 08 Nov 2024 01:23:47 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [176.103.220.4]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-381ed970f85sm4117215f8f.6.2024.11.08.01.23.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Nov 2024 01:23:46 -0800 (PST) Date: Fri, 8 Nov 2024 10:23:44 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v2 1/1] iov: iov tail helpers Message-ID: <20241108102344.7f83b589@elisabeth> In-Reply-To: <20241108041930.3191345-2-david@gibson.dropbear.id.au> References: <20241108041930.3191345-1-david@gibson.dropbear.id.au> <20241108041930.3191345-2-david@gibson.dropbear.id.au> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: -bDPwvAS-Fr5ZrzHEP_1LBioU861jNGvqyH5upEwyis_1731057828 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: HXA53QGFSTILTS3GBPS6UH3E67KU3HNV X-Message-ID-Hash: HXA53QGFSTILTS3GBPS6UH3E67KU3HNV 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 Fri, 8 Nov 2024 15:19:30 +1100 David Gibson wrote: > In the vhost-user code we have a number of places where we need to locate > a particular header within the guest-supplied IO vector. We need to work > out which buffer the header is in, and verify that it's contiguous and > aligned as we need. At the moment this is open-coded, but introduce a > helper to make this more straightforward. > > We add a new datatype 'struct iov_tail' representing an IO vector from > which we've logically consumed some number of headers. The IOV_PULL_HEADER > macro consumes a new header from the vector, returning a pointer and > updating the iov_tail. > > Signed-off-by: David Gibson > --- > iov.c | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ > iov.h | 76 ++++++++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 169 insertions(+) This looks good to me now. Should I apply this, or wait until it's actually used? -- Stefano