From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202502 header.b=cSQX2N2W; dkim-atps=neutral Received: from mail.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 238005A9C31 for ; Wed, 05 Mar 2025 05:32:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202502; t=1741149153; bh=TOm9xSKBBZyE4XoEJ2VNh7ZDcGssVP82w4PP3CkKXVg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cSQX2N2WowRJ0Pc3ap9W4yW0768y2EY4UMoQkkMiVbQxCee6VEM3VrDBMrYFfROGW dMeonrGy4Dy33jUXE0n4ILJUs31mECuP7f6NJrsh0J0vMwvbgEywS65fai/x9BljGW vGAzYMbi7lCHmkHaBwwevFCBLH2DCIW7JFXck7N0pwy53A1hB8ohpsptVyrL/qigkm /t83NsW3vzf0YD6QSY+Et0JqlLuwD6GFKvrk/c/GHFd+oGENOSkKKYugJNy2FA5BVi nDzAhJXdUMMIz+Vkv/0uBE5u2po5HjBEDHNrGmHklMFqvMyE2T19CupuVmH5hrGoSd XsW9prnyTxMjQ== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Z705Y07Vcz4x2g; Wed, 5 Mar 2025 15:32:33 +1100 (AEDT) From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v2 2/3] tap: Consider IPv6 flow label when building packet sequences Date: Wed, 5 Mar 2025 15:32:29 +1100 Message-ID: <20250305043230.1576131-3-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250305043230.1576131-1-david@gibson.dropbear.id.au> References: <20250305043230.1576131-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: SKFIHFRQ26KHE7GJXN2ZIWPHHTLT4LWU X-Message-ID-Hash: SKFIHFRQ26KHE7GJXN2ZIWPHHTLT4LWU X-MailFrom: dgibson@gandalf.ozlabs.org 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: David Gibson 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: To allow more batching, we group together related packets into "seqs" in the tap layer, before passing them to the L4 protocol layers. Currently we consider the IP protocol, both IP addresses and also the L4 ports when grouping things into seqs. We ignore the IPv6 flow label. We have some future cases where we want to consider the the flow label in the L4 code, which is awkward if we could be given a single batch with multiple labels. Add the flow label to tap6_l4_t and group by it as well as the other criteria. In future we could possibly use the flow label _instead_ of peeking into the L4 header for the ports, but we don't do so for now. The guest should use the same flow label for all packets in a low, but if it doesn't this change won't break anything, it just means we'll batch things a bit sub-optimally. Signed-off-by: David Gibson --- ip.h | 1 - tap.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ip.h b/ip.h index 5edb7e77..c82431e9 100644 --- a/ip.h +++ b/ip.h @@ -108,7 +108,6 @@ static inline void ip6_set_flow_lbl(struct ipv6hdr *ip6h, uint32_t flow) * * Return: flow label from @ip6h as an integer (<= 20 bits) */ -/* cppcheck-suppress unusedFunction */ static inline uint32_t ip6_get_flow_lbl(const struct ipv6hdr *ip6h) { return (ip6h->flow_lbl[0] & 0xf) << 16 | diff --git a/tap.c b/tap.c index 39082627..202abae9 100644 --- a/tap.c +++ b/tap.c @@ -489,6 +489,7 @@ static struct tap4_l4_t { * struct l4_seq6_t - Message sequence for one protocol handler call, IPv6 * @msgs: Count of messages in sequence * @protocol: Protocol number + * @flow_lbl: IPv6 flow label * @source: Source port * @dest: Destination port * @saddr: Source address @@ -497,6 +498,7 @@ static struct tap4_l4_t { */ static struct tap6_l4_t { uint8_t protocol; + uint32_t flow_lbl :20; uint16_t source; uint16_t dest; @@ -870,6 +872,7 @@ resume: ((seq)->protocol == (proto) && \ (seq)->source == (uh)->source && \ (seq)->dest == (uh)->dest && \ + (seq)->flow_lbl == ip6_get_flow_lbl(ip6h) && \ IN6_ARE_ADDR_EQUAL(&(seq)->saddr, saddr) && \ IN6_ARE_ADDR_EQUAL(&(seq)->daddr, daddr)) @@ -878,6 +881,7 @@ resume: (seq)->protocol = (proto); \ (seq)->source = (uh)->source; \ (seq)->dest = (uh)->dest; \ + (seq)->flow_lbl = ip6_get_flow_lbl(ip6h); \ (seq)->saddr = *saddr; \ (seq)->daddr = *daddr; \ } while (0) -- 2.48.1