🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20315

Re: [PATCH net-next 6/9] net: flow_offload: allow drivers to validate and invalidate cached paths

#20315
From: Pablo Neira Ayuso
Date: Sun, 22 Nov 2026 01:00
45 lines
10654 bytes
On Mon, Nov 16, 2026 at 02:25:16PM -0800, Florian Fainelli wrote:
[...]
> +static int nf_flow_offload_validate(unsigned long cookie)
> +{
> +	struct flow_offload *flow = nf_flow_offload_cookie_flow(cookie);
> +	unsigned int dir;
> +
> +	for (dir = 0; dir < FLOW_OFFLOAD_DIR_MAX; dir++) {
> +		struct flow_offload_tuple *tuple = &flow->tuplehash[dir].tuple;
> +		struct flow_offload_tuple *other = &flow->tuplehash[!dir].tuple;
> +		struct dst_entry *dst = tuple->dst_cache;
> +		struct neighbour *neigh;
> +		u8 mac[ETH_ALEN];
> +		bool valid;
> +
> +		if (!dst)
> +			return -EOPNOTSUPP;
> +		/* This is the actual route selected with the packet's policy
> +		 * context, including mark, DSCP and the reverse lookup's oif.
> +		 */
> +		if (!dst_check(dst, tuple->dst_cookie))
> +			return -ESTALE;
> +		if (tuple->xmit_type != FLOW_OFFLOAD_XMIT_DIRECT)
> +			continue;
> +		/* A stacked path may have a different final Ethernet neighbour.
> +		 * Do not mistake that unsupported context for a stale owner.
> +		 */
> +		if (dst->dev->ifindex != tuple->out.ifidx)
> +			return -EOPNOTSUPP;
> +		neigh = dst_neigh_lookup(dst, &other->src_v4);
> +		if (!neigh)
> +			return -ESTALE;
> +		neigh_ha_snapshot(mac, neigh, dst->dev);
> +		valid = (READ_ONCE(neigh->nud_state) & NUD_VALID) &&
> +			ether_addr_equal(mac, tuple->out.h_dest);
> +		neigh_release(neigh);
> +		if (!valid)
> +			return -ESTALE;
> +	}
> +	return 0;

This validation to catch for stale entries looks very similar to what
I'm working on. I guess there is a chance to consolidate all this in
common infrastructure for both software and hardware modes.
Technical Details
Message-ID: <awI-mtwn3ohPw-fF@chamomile>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368552-linux-kernel-netdev=dewy.ru
References: <20261116222519.1416501-1-florian.fainelli@broadcom.com> <20261116222519.1416501-7-florian.fainelli@broadcom.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368552-linux-kernel-netdev=dewy.ru
From: pablo@netfilter.org (Pablo Neira Ayuso)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next 6/9] net: flow_offload: allow drivers to
 validate and invalidate cached paths
Date: Sun, 22 Nov 2026 02:00:10 +0100
Organization: Usenet Network
Message-ID: <awI-mtwn3ohPw-fF@chamomile>
References: <20261116222519.1416501-1-florian.fainelli@broadcom.com>
 <20261116222519.1416501-7-florian.fainelli@broadcom.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Injection-Info: usenet.network;
	logging-data="3535574"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:fe7n58pmONK3AgwKJF9RWXx4kU4= sha256:KJfYRqdMl+5xxf7aA4B7BcuqXRnT7I8ZDFenL/Pb2I8=
	sha1:h5DrOxTaJDqoiBEA8x55rbOBYZ0= sha256:nVLKTtzfk8c18PUzeOYRR0EqLDvJK5QAonU8Qm73y7M=
Content-Disposition: inline
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 72ED4116025; Sun, 22 Nov 2026 04:00:35 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=netfilter.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id w9fuyQTjBcf1;
	Sun, 22 Nov 2026 04:00:32 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-368552-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=netfilter.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id B09A2DFFA1; Sun, 22 Nov 2026 04:00:22 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id B45292F692; Sun, 22 Nov 2026 01:00:21 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=fail;
	t=1795309221;
	b=m0wiHvajn0U5FlWmOjSlog5FHuF3fXlrjjkp5LXVC9k3XD5mQbahJ7rGfzLB6nlp/4uk
	 lwy4Zfm0myTTXcrYQIM7ZLvwxGxQUgDZsUgbl1+Wz1/o0NLkUnvQIYA8aK7JoFS4st1WM
	 eNSb0AKTDhPTflJWCJ8aoX47aFtWs4UrfPAtOYalYq6IKoNYEXAhG5IKmi7E9V+EJwTwO
	 c6Z5VH+JADbfjkIWpbfCY74C6eUT07y6nIz31BiyL4tYdCEeos86TTQ/peZ3pYm7qPIZy
	 q87od4Ykeu3IF3Lf6+fWrJadBLQ5+FutOXTXpT/qEGFoDZvjHKxjwAwCKrfxU9YmLtA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795309221;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date:
	 From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=yiOSm1bkyAMQFGBb+Y0A4VMMiKXTGYYH6qcBe1qvEcQ=;
	b=Sj/I4908U9QrRUTYwuxetkdi2wxg+9tpXAPBIEotEQgFgaXdaayHzI11PfuobZfyHBFn
	 pxdlNEzq/vxNyTQ+LJwegyrE860yJe8o4f8680LV1dMc8PUwN6z+AfMpDMcF0/DFeRRUF
	 bIXpwUN5/Axxgfwx/kBvjUkNjbg4RMlJyD1znMmQTESySMN5NQF7G3/UMlKWDg6sP4Jqs
	 XN72jwnMaaf5+nPQ0Sc0lw3vl80s4XhWQcbd5/QR48ncfUl2uNi/NiAh+29Ocr1WCjyLj
	 cXrsDCp4mBcO8Sv22aiah2PljZJYLnhlZyLGOjgDg09VfBdDEO5z7HNMiOAqL/e8fZA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=idLo7FDd;
	dmarc=none header.from=netfilter.org;
	spf=pass smtp.mailfrom=netfilter.org;
	arc=fail smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 50DF8606A32C;
	Sun, 22 Nov 2026 01:00:21 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=idLo7FDd
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.70.190.124
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795309215;
	b=Sa16TlAGq3qz689TdMkJlMtQzv8B6sKJkpB5bH/R9APPF7Lqd1duJGCgjNL9XknO1vmS
	 xbFiAx/6sYBlpd+sSl16q6RyjMEzshuGTylbYyvnSGL0v6wkSECALABkESVLIzAqZSuhQ
	 6TDXxzCQco+mowK40RQkFT1BysFEqkoUpZkTcHo2MHPHt0Bhbw1m8gfGCqkhOpWZZqfvx
	 YXEVCbswJJovwIth+2j4cv98po23sjTZgF2RJ3I0TRAuue9An74kjgeu1cRjhAFX6SvIJ
	 VsqIDkY7p3qkuwkglX0jQbZ3+AUklS4wc7X2a2DQbtZ+c9qaYOJia2h8VDMDu3QyNgQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795309215;
	h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject:
	 Message-ID:References:MIME-Version:Content-Type:Content-Disposition:
	 In-Reply-To:X-Spam-Status:X-Spam-Checker-Version;
	bh=yiOSm1bkyAMQFGBb+Y0A4VMMiKXTGYYH6qcBe1qvEcQ=;
	b=3JyVqxXhvD7cbJo/NndODm/98ICvQs+K5oEtSKuqlsOYM0hAtEzoHTbjX2wBcMight7b
	 y3d1tuzU+6Opc3FXkvc03P/rkEoBR8Q0NU0Uvw6pc1slm5woneWNgvCPhE5zRlkvhTE49
	 MNXc5OvCTVpTTOfsz9kwD298btYQyaUxSOBpIdfuDs3F+3p/HmAsPynmTGveeJink0UOW
	 8w6y+ciOuQZ282fYXkviOmpsiAbSnw3ndsJrWKgStjUL2GuUpVDmwV3161SwTeDa0ZQ7x
	 PCYLNjiB+hv4nCB27EiMLoogBm4XaospFSJRfPN8PnHPHIvZV794YEHa6pNDHUq8QdQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=netfilter.org;
	spf=pass smtp.mailfrom=netfilter.org;
	dkim=pass header.d=netfilter.org header.i=@netfilter.org header.a=rsa-sha256 header.s=2025 header.b=idLo7FDd;
	arc=none smtp.remote-ip=217.70.190.124
X-Received: from mail.netfilter.org (mail.netfilter.org [217.70.190.124])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with UTF8SMTPS id F053F606A32A;
	Sun, 22 Nov 2026 01:00:14 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org F053F606A32A
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=netfilter.org
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netfilter.org
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netfilter.org;
	s=2025; t=1795309212;
	bh=yiOSm1bkyAMQFGBb+Y0A4VMMiKXTGYYH6qcBe1qvEcQ=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
	b=idLo7FDdCW2WIP2s6cJFayiTrWkOe0sP+zL5IHZnpWk1cVN7hsAEhxuxXuB7b3TGC
	 F6+4HON7HbgtUFSuFl4xIzAmTfaDdMR1SEyzTQHES28vx8mUkCnKHUGqNGYvkKpoeK
	 eT9/B6DGS1mApyF7xppRNJFbCXD/RhGkRzbjQ+6zAIlAnmRGcp09ez6cHlCfN+iyxR
	 SwHd6v3NW9oqPDmiZNPJQdXAXrOxI4wm3dgAbzam9FIzJ4p9x3ZHlv9Z74mx+OhLJU
	 e+5fbAtCqI7WRLfbr+P/pKOxdktk2BSrxh5lyqfpMU0jbppHw+pfZdGC7DTilQMzgT
	 WuTn/oRkQ6+0Q==
X-Received: from netfilter.org (mail-agni [217.70.190.124])
	by mail.netfilter.org (Postfix) with UTF8SMTPSA id 7883A6005B;
	Sun, 22 Nov 2026 02:00:12 +0100 (CET)
X-Cc: netdev@vger.kernel.org,
	Rafał Miłecki <rafal@milecki.pl>,
	Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>, Simon Horman <horms@kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Jonas Gorski <jonas.gorski@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
	"open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" <devicetree@vger.kernel.org>,
	open list <linux-kernel@vger.kernel.org>,
	"open list:DOCUMENTATION" <linux-doc@vger.kernel.org>,
	"open list:NETFILTER" <netfilter-devel@vger.kernel.org>,
	"open list:NETFILTER" <coreteam@netfilter.org>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261116222519.1416501-7-florian.fainelli@broadcom.com>