From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8D86031AF31 for ; Thu, 13 Nov 2025 19:40:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763062840; cv=none; b=ndjo+AR188gCRhi5D4sGlCDZmdfSGCkj1t0dMWqbJ1W9/7Cq2leeKfarFljdyDSzmViRpIC2ySi9N7nTeWSj4fbzVkoKg66r7Mtb+xNK26HiSLdOXbfd0h09z6O7aVS6AaHxUOKoEeqLh8IdkYPYrw03uwCyyreUqP8BNr6TwSA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763062840; c=relaxed/simple; bh=8D9ndGRNEkl1RqTloTob3duuw/bnmw/Zkg69UnKPhKg=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=A079wPnl+H4rWfbAcAv8IF6ywtrTYqj6gOVlFwjMs4cWr2MegZgDl9M5eK9c7ZnOCeGqNGneVYaC7T0wTc20kJfj2uqwgIAXEwHEqrPDj/+qUaKm8PN5ELf/rei6vfcWffrLkZYnmKfr02K+2Ea29vAI1osA9ZzZJlGMDUFjKf4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=apJt380X; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="apJt380X" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-47789cd2083so9242115e9.2 for ; Thu, 13 Nov 2025 11:40:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763062832; x=1763667632; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=T7/U/QcS+GCOoTMvpa+RqVAEgG1WX6woJ+60ecohtLo=; b=apJt380Xs+H7FeopVNA9UhPu8Rg+lQUkg2rDojqg72WN6Rf4XDrhLVZX++C38ptiL0 9fywEj1xRF42GnDMXZx/EngLCRIOv6Un4TDSUTiF1EH/+rJB+dZNaCYTz9Cti44aeiK4 RgaoKz4Fnzobkh9+b5A9Ahgvc4wElDriccgEJQQmoS5Zh62fbuKe9a5Xd8bXqW6gYbyH XcudTVP3V2dgjtd7+JMUBwRXgL2ykqp8krXYwbv/6n3bS8dZAU+B6u5O8aYTN6w/lxir lFXaOYgZ8zprPG4p4dEyMRaNi0IcuxBxY7I19KrcXq9/liVdYCPeKMhThrP1tCvC6dse BmYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763062832; x=1763667632; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=T7/U/QcS+GCOoTMvpa+RqVAEgG1WX6woJ+60ecohtLo=; b=SpyzQjXNkjHQ2mISGASXKtFlwgFgfFhAX/auu8hEnKMfVhTmN32NmiAFYEcJXHNCYO H/usV9BNy1t5CXGt9qA4q2VHmlhCC7fcdIFaGbjI8VU4gWl8A3KgoWZL4rdA3dWqRebD 73kTxiV6rwyYrYogdvrxNeKEjQo1+L/JKmiLj+TtUDtp7+QLfAaxRRJB+nB6v5EyCRsl 43NWlj8SeiU165H9yiILCa/0c522NNPWiemL+Sm+SVCcivjJdTgf3oJ2YG6xAuO0xfvE bK8KjSWAygORLjy1mnIei+15c0aE2VFJKq8uAgz6nu/U9F93CVoY1xyIA+Qf1ZnGHky3 i2PQ== X-Forwarded-Encrypted: i=1; AJvYcCVBSnKKm/FJ5h9HDiV7EIpf4gnjb6t1pGKgZMHIpPgk6U+ECP9OgRZmieUJ5e01E3lUhrYFgJn25kdnGNs=@vger.kernel.org X-Gm-Message-State: AOJu0Yz4nMAELaOyS+h506/PUiDOB9uyhmyTM7AS1EZVytyeqUkZx+I4 i2GX4iOTEym5qL9W92JGlZ51D/KORiMvGr94WbQgY2aOnTJvMxIgpcCd X-Gm-Gg: ASbGnctfO9ioOcxJZMAnz2LtZOdw2mKdRGAvGlrFRGyYz3eTpofxJHShjDC4g6YYp0Z duZvv8+AEHPJubbw29aw+2DJe1cOwgKPNejOvAt9cd7SaDiETJpSpGhwVC5L4EJxi8o+o+xxte0 9Se/E5Yi+W51Hvg8UQTHCZBfgp4Ny5521VBhNXwxsywCp6kKQaOyQSm7cFJfVuwC7w/gYuPjDtu M3qyrlwtG2r6kG4WVykx3VV5BXBSp6Ct3GxZO/juVB+rzijzVL9OV6G3itvwyr/7d5Lfm0tv0iu BvLl/4ebsIjspuaLZ/+KMV69irNVx4Xbg/dRBOYjcT6oiicoJjr7Bk2WRihTR64GtzECDYf1Wx2 6FxkC+dg0xiq18RARfpCQ6AzxTKpxq72K4J0CVhU3F6iOnkZIs7AzHp8iUkw4dXHEa+IO6d6k17 Rnxya3AD3Mjxp/UsK7L4QFbT2OSIFuYS5XOhU4gkqcf2Arc5IKbXCt X-Google-Smtp-Source: AGHT+IENcCGkJ1HSrwt2e6IXzxZefrC/yqGwehFDalfk59L9dLVxWyncqxmuN4tp8L7WKYVEr6E1qw== X-Received: by 2002:a05:600c:4f93:b0:45d:f81d:eae7 with SMTP id 5b1f17b1804b1-4778fea6decmr7634155e9.28.1763062831746; Thu, 13 Nov 2025 11:40:31 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4778c88c068sm50044105e9.9.2025.11.13.11.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Nov 2025 11:40:31 -0800 (PST) Date: Thu, 13 Nov 2025 19:40:29 +0000 From: David Laight To: Eric Dumazet Cc: Scott Mitchell , pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de, phil@nwl.cc, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, horms@kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Scott Mitchell Subject: Re: [PATCH v2] netfilter: nfnetlink_queue: optimize verdict lookup with hash table Message-ID: <20251113194029.5d4cf9d7@pumpkin> In-Reply-To: References: <20251113092606.91406-1-scott_mitchell@apple.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Thu, 13 Nov 2025 02:25:24 -0800 Eric Dumazet wrote: > On Thu, Nov 13, 2025 at 1:26=E2=80=AFAM Scott Mitchell wrote: .... > I do not think this is an efficient hash function. >=20 > queue->id_sequence is monotonically increasing (controlled by the > kernel : __nfqnl_enqueue_packet(), not user space). If id_sequence is allocated by the kernel, is there any requirement that the values be sequential rather than just unique? If they don't need to be sequential then the kernel can pick an 'id' value such that 'id & mask' is unique for all 'live' id values. Then the hash becomes 'perfect' and degenerates into a simple array lookup. Just needs a bit of housekeeping... David