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 C14095A0265 for ; Sat, 22 Oct 2022 10:21:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666426900; 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=g4M66wWMADKzvEEWr2mtFPTISVecA9m3Rp8r0RnpWMI=; b=Th7OoNTPCIYIiKFZKS0i1ECc77vUJdV9EFzvh0Lic0Tzmoyoi/UhmkNbPYgILsWLgco8fq iHJ1KHasa52ghw0UwqwqCpc5hQxpRsfz3jsq1Nb0RDZ9zcHsez96mq5HWY+WGmK005gG62 2O7uul/1DBktl3JSSb0wIdwELRLYIKc= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-314-Pllcr2zMM8O6M17HCNM4BQ-1; Sat, 22 Oct 2022 04:21:36 -0400 X-MC-Unique: Pllcr2zMM8O6M17HCNM4BQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A739F3817A65; Sat, 22 Oct 2022 08:21:36 +0000 (UTC) Received: from maya.cloud.tilaa.com (ovpn-208-31.brq.redhat.com [10.40.208.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 79B91C1908C; Sat, 22 Oct 2022 08:21:36 +0000 (UTC) Date: Sat, 22 Oct 2022 10:21:28 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v2 00/14] Clean up checksum and header generation for inbound packets Message-ID: <20221022102128.32277eb5@elisabeth> In-Reply-To: <20221019004357.1454325-1-david@gibson.dropbear.id.au> References: <20221019004357.1454325-1-david@gibson.dropbear.id.au> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: AYN2ASRMCFSKZT6YCW436OQEQNDD7VXW X-Message-ID-Hash: AYN2ASRMCFSKZT6YCW436OQEQNDD7VXW 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.3 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, 19 Oct 2022 11:43:43 +1100 David Gibson wrote: > The main packet "fast paths" for UDP and TCP mostly just forward > packets rather than generating them from scratch. However the control > paths for ICMP and DHCP sometimes generate packets more or less from > scratch. Because these are relatively rare, it's not performance > critical. > > The paths for sending these packets have some duplication of the > header generation. There's also some layering violation in > tap_ip_send() which both generates IP headers and updates the L4 (UDP > or UCMP) checksum. > > Finally that checksum generation is a little awkward: it temporarily > generates the IP pseudo header (or something close enough to serve) in > the place of the actual header, generates the checksum, then replaces > it with the real IP header. This approach seems to be causing > miscompiles with some LTO optimization, because the stores to the > pseudo header are being moved or elided across the code calculating > the checksum. > > This series addresses all of these. We consolidate and clarify the > packet sending helpers, and use them in some places there was > previously duplicated code. In the process we use new checksum > generation helpers which take a different approach which should avoid > the LTO problems (this aspect I haven't tested yet though). > > Changes since v1: > * Numerous minor style changes > * Rename header generation helpers to make their behaviour clearer > * Added several missing function doc comments > * Corrected some erroneous statements and terms in comments Applied now, thanks, and sorry for the delay. -- Stefano