{"id":2212660,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2212660/?format=json","web_url":"http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260318134217.1596-1-fw@strlen.de/","project":{"id":26,"url":"http://patchwork.ozlabs.org/api/1.2/projects/26/?format=json","name":"Netfilter Development","link_name":"netfilter-devel","list_id":"netfilter-devel.vger.kernel.org","list_email":"netfilter-devel@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260318134217.1596-1-fw@strlen.de>","list_archive_url":null,"date":"2026-03-18T13:42:12","name":"[nf-next] netfilter: nft_set_pipapo_avx2: remove redundant loop in lookup_slow","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"06f000d1dad6c553b7751bf29b067f9402451583","submitter":{"id":1025,"url":"http://patchwork.ozlabs.org/api/1.2/people/1025/?format=json","name":"Florian Westphal","email":"fw@strlen.de"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/netfilter-devel/patch/20260318134217.1596-1-fw@strlen.de/mbox/","series":[{"id":496466,"url":"http://patchwork.ozlabs.org/api/1.2/series/496466/?format=json","web_url":"http://patchwork.ozlabs.org/project/netfilter-devel/list/?series=496466","date":"2026-03-18T13:42:12","name":"[nf-next] netfilter: nft_set_pipapo_avx2: remove redundant loop in lookup_slow","version":1,"mbox":"http://patchwork.ozlabs.org/series/496466/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2212660/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2212660/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <netfilter-devel+bounces-11271-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","netfilter-devel@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.105.105.114; helo=tor.lore.kernel.org;\n envelope-from=netfilter-devel+bounces-11271-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=91.216.245.30","smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=strlen.de","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fbVPp1474z1xyS\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 19 Mar 2026 00:42:38 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id 67E58301D320\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 18 Mar 2026 13:42:35 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 853A53D88F1;\n\tWed, 18 Mar 2026 13:42:33 +0000 (UTC)","from Chamillionaire.breakpoint.cc (Chamillionaire.breakpoint.cc\n [91.216.245.30])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id EB206397688\n\tfor <netfilter-devel@vger.kernel.org>; Wed, 18 Mar 2026 13:42:31 +0000 (UTC)","by Chamillionaire.breakpoint.cc (Postfix, from userid 1003)\n\tid 510DB605C3; Wed, 18 Mar 2026 14:42:30 +0100 (CET)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1773841353; cv=none;\n b=SqIrDPfLQ/UbHtdjlYzCoHEGBpINs8mWDPjOhpBPqHJZqEveMBpwCwUUYfMZ7WgfqYWGLiCtJhF8sCT5/1IF1SL4LZvB+PNAmys3YQvzt/LJHrtETw5c9UkPK3OVC5jxk8SRdt0sD1ORRZNP0xb/tKsEK9hsRWDlh+YBkc/HZMc=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1773841353; c=relaxed/simple;\n\tbh=T1XzOgibSpPcuohMT0Yc8MEy4n8MMWGvlALcPE0GOl4=;\n\th=From:To:Cc:Subject:Date:Message-ID:MIME-Version;\n b=Rk5l0b1dNoREIKPiFol0IySi9/4tJ8fRS1VzGleiQATFnUU7Vh6+9HqAo4zhWYn4PgsA0tG3WcQnaxwlQi1NPZzb6o17kKAx/ZFeYz7nSoU3lkCX+U+yx+YG53+nXfHZm1L6upKoeGm2wAjhTE7vu37jG4kU/sDWi7iLwr0keD8=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=none (p=none dis=none) header.from=strlen.de;\n spf=pass smtp.mailfrom=Chamillionaire.breakpoint.cc;\n arc=none smtp.client-ip=91.216.245.30","From":"Florian Westphal <fw@strlen.de>","To":"<netfilter-devel@vger.kernel.org>","Cc":"Stefano Brivio <sbrivio@redhat.com>,\n\tFlorian Westphal <fw@strlen.de>","Subject":"[PATCH nf-next] netfilter: nft_set_pipapo_avx2: remove redundant loop\n in lookup_slow","Date":"Wed, 18 Mar 2026 14:42:12 +0100","Message-ID":"<20260318134217.1596-1-fw@strlen.de>","X-Mailer":"git-send-email 2.52.0","Precedence":"bulk","X-Mailing-List":"netfilter-devel@vger.kernel.org","List-Id":"<netfilter-devel.vger.kernel.org>","List-Subscribe":"<mailto:netfilter-devel+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:netfilter-devel+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"nft_pipapo_avx2_lookup_slow will never be used in reality, because the\ncommon sizes are handled by avx2 optimized versions.\n\nHowever, nft_pipapo_avx2_lookup_slow loops over the data just like the\navx2 functions. BUT _slow doesn't need to do that:\n  pipapo_and_field_buckets_() + pipapo_refill() already handle\n  everyhing for us.\n\nAll other iterations boild down to 'x = x & x': Remove the loop.\n\nSigned-off-by: Florian Westphal <fw@strlen.de>\n---\n net/netfilter/nft_set_pipapo_avx2.c | 30 ++++++++---------------------\n 1 file changed, 8 insertions(+), 22 deletions(-)","diff":"diff --git a/net/netfilter/nft_set_pipapo_avx2.c b/net/netfilter/nft_set_pipapo_avx2.c\nindex 7ff90325c97f..025f9ebb1ba2 100644\n--- a/net/netfilter/nft_set_pipapo_avx2.c\n+++ b/net/netfilter/nft_set_pipapo_avx2.c\n@@ -1041,7 +1041,6 @@ static int nft_pipapo_avx2_lookup_8b_16(unsigned long *map, unsigned long *fill,\n  * @map:\tPrevious match result, used as initial bitmap\n  * @fill:\tDestination bitmap to be filled with current match result\n  * @f:\t\tField, containing lookup and mapping tables\n- * @offset:\tIgnore buckets before the given index, no bits are filled there\n  * @pkt:\tPacket data, pointer to input nftables register\n  * @first:\tIf this is the first field, don't source previous result\n  * @last:\tLast field: stop at the first match and return bit index\n@@ -1056,32 +1055,19 @@ static int nft_pipapo_avx2_lookup_8b_16(unsigned long *map, unsigned long *fill,\n static int nft_pipapo_avx2_lookup_slow(const struct nft_pipapo_match *mdata,\n \t\t\t\t\tunsigned long *map, unsigned long *fill,\n \t\t\t\t\tconst struct nft_pipapo_field *f,\n-\t\t\t\t\tint offset, const u8 *pkt,\n+\t\t\t\t\tconst u8 *pkt,\n \t\t\t\t\tbool first, bool last)\n {\n-\tunsigned long bsize = f->bsize;\n-\tint i, ret = -1, b;\n-\n \tif (first)\n \t\tpipapo_resmap_init(mdata, map);\n \n-\tfor (i = offset; i < bsize; i++) {\n-\t\tif (f->bb == 8)\n-\t\t\tpipapo_and_field_buckets_8bit(f, map, pkt);\n-\t\telse\n+\tif (f->bb == 8)\n+\t\tpipapo_and_field_buckets_8bit(f, map, pkt);\n+\telse\n \t\t\tpipapo_and_field_buckets_4bit(f, map, pkt);\n-\t\tNFT_PIPAPO_GROUP_BITS_ARE_8_OR_4;\n-\n-\t\tb = pipapo_refill(map, bsize, f->rules, fill, f->mt, last);\n-\n-\t\tif (last)\n-\t\t\treturn b;\n-\n-\t\tif (ret == -1)\n-\t\t\tret = b / XSAVE_YMM_SIZE;\n-\t}\n+\tNFT_PIPAPO_GROUP_BITS_ARE_8_OR_4;\n \n-\treturn ret;\n+\treturn pipapo_refill(map, f->bsize, f->rules, fill, f->mt, last);\n }\n \n /**\n@@ -1201,7 +1187,7 @@ struct nft_pipapo_elem *pipapo_get_avx2(const struct nft_pipapo_match *m,\n \t\t\t\tNFT_SET_PIPAPO_AVX2_LOOKUP(8, 16);\n \t\t\t} else {\n \t\t\t\tret = nft_pipapo_avx2_lookup_slow(m, res, fill, f,\n-\t\t\t\t\t\t\t\t  ret, data,\n+\t\t\t\t\t\t\t\t  data,\n \t\t\t\t\t\t\t\t  first, last);\n \t\t\t}\n \t\t} else {\n@@ -1217,7 +1203,7 @@ struct nft_pipapo_elem *pipapo_get_avx2(const struct nft_pipapo_match *m,\n \t\t\t\tNFT_SET_PIPAPO_AVX2_LOOKUP(4, 32);\n \t\t\t} else {\n \t\t\t\tret = nft_pipapo_avx2_lookup_slow(m, res, fill, f,\n-\t\t\t\t\t\t\t\t  ret, data,\n+\t\t\t\t\t\t\t\t  data,\n \t\t\t\t\t\t\t\t  first, last);\n \t\t\t}\n \t\t}\n","prefixes":["nf-next"]}