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.129.124]) by passt.top (Postfix) with ESMTP id 7981F5A0082 for ; Wed, 19 Oct 2022 11:07:35 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666170454; 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=IgkTpofpYuZNWVNaxyY4NrCMAbo03JntrH7hYcA1XRY=; b=YOMrzePFU0V9Eg1oNta++U5hDDz98qsm4xyzYeqn5vQUZH4r6ITsmWjT5kU3CjoauSNfRK mHgtFyAvxiRcOI0fnIS9y9KxCxTXDMstysSWcmclINZ589jyD0qGQ3wf+r+fbSplV3Iex8 aWpaZfJ6HTI8nFnFIrOZvUSi4WMhYIQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-613-asohjd-jN9CP-gvYEainAQ-1; Wed, 19 Oct 2022 05:07:31 -0400 X-MC-Unique: asohjd-jN9CP-gvYEainAQ-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A6E0C185A78B; Wed, 19 Oct 2022 09:07:30 +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 5DA3447505E; Wed, 19 Oct 2022 09:07:30 +0000 (UTC) Date: Wed, 19 Oct 2022 11:07:18 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v2 00/14] Clean up checksum and header generation for inbound packets Message-ID: <20221019110718.56167132@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.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: XJQHZUN2CWPYSTBUQOGXZBS2LG2K6BAM X-Message-ID-Hash: XJQHZUN2CWPYSTBUQOGXZBS2LG2K6BAM 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 Thanks, it looks good to me! I'm travelling, I'll apply in a bit. -- Stefano