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=CPc8ZtZe; 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 C9C3F5A004E for ; Fri, 04 Oct 2024 08:56:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1728024978; 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=UCvsVGsfLVJXzpNy1Y9RX7jFTR4yITy/Sgmk76rjl/E=; b=CPc8ZtZerk/SzlQm+5MUDojxzr63kiFwKFtvjGP07Eck7830CTQ9Bm58uM0LafFZY40QiP LCnAMbZ5PzCdXFIpDrSK/uYNreZh2i7S8AN4pRqeY0bJ9kxqdKXXVPT+9ZJYODJDTtzqFp WV3fj+RwODDvbeWvTogUKs443o8BbFw= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-638-5gW2G88oMrGsLE1eMjN4Gw-1; Fri, 04 Oct 2024 02:56:17 -0400 X-MC-Unique: 5gW2G88oMrGsLE1eMjN4Gw-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42ac185e26cso12626775e9.3 for ; Thu, 03 Oct 2024 23:56:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728024975; x=1728629775; 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=UCvsVGsfLVJXzpNy1Y9RX7jFTR4yITy/Sgmk76rjl/E=; b=wBNd9OGitocs7cSgNM2DV8XMWC1kYYarDNeQe55gSsNCvOxrI3l+IljmS/7zqb1aaN l0eWVENTjg9js/jQUBpFAszJeRA3vGqbZ249S8sn+21meM388tE76UyAc0ad6Z4YY+Zi syObvAzD/Pou2HjW3dVoIfG9hiV4D1PYP2DdUPiFKov9sU59RiXSoWm/BaiotxofI/mG m/iVNxnl4cIQUfmR2ysNgri5EDwazOeN8DyAJ/WW9a6IfsVQGIZPgYDUHN/p2gdpSzXc gAZxrUgjFJLSbMZ7VGUWJ5j8QZRdaUeJfv/brlUJkKEll+V5ZmUkY9Q4KgbsBm4sHOv2 4bQA== X-Gm-Message-State: AOJu0YxY2tnfQl8gzSuFriTDeGrd4Ng63oloHILB/yWRoXrc9jgCCps/ n0/2jnkGXzbEqAa4nfoPlePc828ro0l7KsY7KKQ4NoXdiOajpNYcvefzOAtxxfRJVajoSSKu4QR dq5ayCv/YJcrnP2+cvEkZw6SeRQLEZMBGldV7xrQLDHmbpfkhNQXBoWOZbvD0C12jXmC5UyN9dt iWrWen1L4UAOpecaj9nNbS+4oDGWSGtAYt X-Received: by 2002:a05:600c:4f13:b0:42c:bb10:7292 with SMTP id 5b1f17b1804b1-42f85a6d770mr12050195e9.1.1728024975171; Thu, 03 Oct 2024 23:56:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFJOZWQnwL7spnjsgvowDUbgvb9y5O/xaiiB9SzSqcxk1+3lOP6KHMfBX0dKKv4ct4XZ4yDJA== X-Received: by 2002:a05:600c:4f13:b0:42c:bb10:7292 with SMTP id 5b1f17b1804b1-42f85a6d770mr12050055e9.1.1728024974716; Thu, 03 Oct 2024 23:56:14 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42f86b4acddsm7803475e9.44.2024.10.03.23.56.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Oct 2024 23:56:13 -0700 (PDT) Date: Fri, 4 Oct 2024 08:56:12 +0200 From: Stefano Brivio To: Laurent Vivier Subject: Re: [PATCH v6 4/5] tcp: Update TCP checksum using an iovec array Message-ID: <20241004085612.6e82cf0d@elisabeth> In-Reply-To: References: <20241003145108.2227355-1-lvivier@redhat.com> <20241003145108.2227355-5-lvivier@redhat.com> 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-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: WOFVAICBBD5M7DYLGK2QIBXWCP5ZZIAD X-Message-ID-Hash: WOFVAICBBD5M7DYLGK2QIBXWCP5ZZIAD 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 Thu, 3 Oct 2024 16:55:56 +0200 Laurent Vivier wrote: > On 03/10/2024 16:51, Laurent Vivier wrote: > > TCP header and payload are supposed to be in the same buffer, > > and tcp_update_check_tcp4()/tcp_update_check_tcp6() compute > > the checksum from the base address of the header using the > > length of the IP payload. > > > > In the future (for vhost-user) we need to dispatch the TCP header and > > the TCP payload through several buffers. To be able to manage that, we > > provide an iovec array that points to the data of the TCP frame. > > We provide also an offset to be able to provide an array that contains > > the TCP frame embedded in an lower level frame, and this offset points > > to the TCP header inside the iovec array. > > > > Signed-off-by: Laurent Vivier > > --- > > > > Notes: > > v6: > > - fix clang-tidy error with ptr > > - add missing static to tcp_update_check_tcp[4|6] > > > > v5: > > - s/IPv6/IPv4/ > > - reintroduce ip6h and iph to avoid iov_size() > > - check pointer alignment before casting to the type > > > > v4: > > - replace die() by err() in tcp_update_check_tcp6() too > > > > v3: > > - replace die() by err() and return > > - add more information in the error message > > > > v2: > > - s/payload_offset/l4offset/ > > - check memory address of the checksum (alignment, iovec boundaries) > > > > checksum.c | 1 - > > iov.c | 1 - > > tcp.c | 118 +++++++++++++++++++++++++++++++++++++++++++++-------- > > 3 files changed, 100 insertions(+), 20 deletions(-) > > > ... > > diff --git a/iov.c b/iov.c > > index 3f9e229a305f..9116dda94247 100644 > > --- a/iov.c > > +++ b/iov.c > > @@ -25,7 +25,6 @@ > > #include "util.h" > > #include "iov.h" > > > > - > > /* iov_skip_bytes() - Skip leading bytes of an IO vector > > * @iov: IO vector > > * @n: Number of entries in @iov > > This is an unwanted change... could you remove it on merge? Sure. I still have to figure out what causes tests to fail before merging. By applying just this series I haven't seen failures anymore, but I just ran tests twice. It might take a bit. -- Stefano