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 D05055A0265 for ; Tue, 18 Oct 2022 14:28:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1666096129; 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=VCCBdpKDG3GiqEGdZN2Gz6okzG6oIapTmqOEJWuiUes=; b=itMXo3KTgCv3sr0OsOPbgMwXZh5U2pfBFFbM3ZVLV0DAPjY8FFuCfo6BdRdD+isRcO00OE NfCHXab8UM2W4pJrDf0JRNn8tAmnkfzk/DONu3FdmHCfK4mQN4pNRqihqgPqgkCLotEPkj wyCW3rTa7Q4gfGfaKtRs0xLp81Do9IM= 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-581-1V9zWrpMP7y-VuvJS9imHg-1; Tue, 18 Oct 2022 08:28:46 -0400 X-MC-Unique: 1V9zWrpMP7y-VuvJS9imHg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2F32C3C01DFE; Tue, 18 Oct 2022 12:28:41 +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 18F0F4081B66; Tue, 18 Oct 2022 12:28:40 +0000 (UTC) Date: Tue, 18 Oct 2022 14:28:10 +0200 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 02/14] Add csum_icmp4() helper for calculating ICMPv4 checksums Message-ID: <20221018142810.2e759da1@elisabeth> In-Reply-To: References: <20221017085807.473470-1-david@gibson.dropbear.id.au> <20221017085807.473470-3-david@gibson.dropbear.id.au> <20221018050151.5739f1ad@elisabeth> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 3PSW3VNGJS22QRGXUOJT2X52QXZBZCIW X-Message-ID-Hash: 3PSW3VNGJS22QRGXUOJT2X52QXZBZCIW 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 Tue, 18 Oct 2022 23:06:11 +1100 David Gibson wrote: > On Tue, Oct 18, 2022 at 05:01:51AM +0200, Stefano Brivio wrote: > > On Mon, 17 Oct 2022 19:57:55 +1100 > > David Gibson wrote: > > > > > Although tap_ip_send() is currently the only place calculating ICMPv4 > > > checksums, create a helper function for symmetry with ICMPv6. For future > > > flexibility it allows the ICMPv6 header and payload to be in separate > > > buffers. > > > > > > Signed-off-by: David Gibson > > > --- > > > checksum.c | 15 +++++++++++++++ > > > checksum.h | 2 ++ > > > tap.c | 4 +--- > > > 3 files changed, 18 insertions(+), 3 deletions(-) > > > > > > diff --git a/checksum.c b/checksum.c > > > index 0e207c8..c8b6b42 100644 > > > --- a/checksum.c > > > +++ b/checksum.c > > > @@ -52,6 +52,7 @@ > > > #include > > > #include > > > > > > +#include > > > #include > > > > > > /** > > > @@ -107,6 +108,20 @@ uint16_t csum_unaligned(const void *buf, size_t len, uint32_t init) > > > return (uint16_t)~csum_fold(sum_16b(buf, len) + init); > > > } > > > > > > +/** > > > + * csum_icmp4() - Calculate checksum for an ICMPv4 packet > > > > "Calculate and set"? > > Done. > > > By the way, there's no such thing as ICMPv4 -- > > it's ICMP. > > Technically, yes, but I kind of wanted to make it clear at a glance > that these are IPv4 specific functions. I'd also like to avoid the > implication that v4 is the "normal" sort. I've changed from "ICMPv4" > to "ICMP" in the comments, but I've left the '4's in the various names Ah, yes, sure, makes sense, as long as we don't refer to "ICMPv4" in the comments I'm fine with it. :) -- Stefano