From: Florian Westphal <fw@strlen.de>
To: Stefano Brivio <sbrivio@redhat.com>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH nf-next 1/2] netfilter: nft_set_pipapo_avx2: split lookup function in two parts
Date: Mon, 18 Aug 2025 20:23:49 +0200 [thread overview]
Message-ID: <aKNvtcCzJD8xnF3q@strlen.de> (raw)
In-Reply-To: <20250818182931.1dcaf62a@elisabeth>
Stefano Brivio <sbrivio@redhat.com> wrote:
> > - * nft_pipapo_avx2_lookup() - Lookup function for AVX2 implementation
> > - * @net: Network namespace
> > - * @set: nftables API set representation
> > - * @key: nftables API element representation containing key data
> > + * pipapo_get_avx2() - Lookup function for AVX2 implementation
> > + * @m: storage containing the set elements
> > + * @data: Key data to be matched against existing elements
> > + * @genmask: If set, check that element is active in given genmask
> > + * @tstamp: timestamp to check for expired elements
>
> Nits: Storage, Timestamp (or all lowercase, for consistency with the
> other ones).
Note that there is no consistency whatsoever in the kernel.
Some use upper case, some lower, some indent on same level (like done
here), some don't.
So, I don't care anymore since it will never be right.
In case i have to mangle it anyway i will "fix" it.
> > + e = f->mt[ret].e;
> > + if (unlikely(__nft_set_elem_expired(&e->ext, tstamp) ||
>
> Here's the actual concern, even if I haven't tested this: I guess you now
> pass the timestamp to this function instead of getting it with each
> nft_set_elem_expired() call for either correctness (it should be done at
> the beginning of the insertion?) or as an optimisation (if BITS_PER_LONG < 64
> the overhead isn't necessarily trivial).
Its done because during insertion time should be frozen to avoid
elements timing out while transaction is in progress.
(this is unrelated to this patchset).
But in order to use this snippet from both control and data path
this has to be passed in so it can either be 'now' or 'time at
start of transaction'.
> But with 2/2, you need to call get_jiffies_64() as a result, from non-AVX2
> code, even for sets without a timeout (without NFT_SET_EXT_TIMEOUT
> extension).
>
> Does that risk causing a regression on non-AVX2? If it's for correctness,
> I think we shouldn't care, but if it's done as an optimisation, perhaps
> it's not a universal one.
Its not an optimisation. I could pass a 'is_control_plane' or
'is_packetpath' but I considered it too verbose and not needed for
correctness.
next prev parent reply other threads:[~2025-08-18 18:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-15 14:36 [PATCH nf-next 0/2] netfilter: nft_set_pipapo: speed up insertions Florian Westphal
2025-08-15 14:36 ` [PATCH nf-next 1/2] netfilter: nft_set_pipapo_avx2: split lookup function in two parts Florian Westphal
2025-08-18 16:29 ` Stefano Brivio
2025-08-18 18:23 ` Florian Westphal [this message]
2025-08-18 18:56 ` Stefano Brivio
2025-08-15 14:36 ` [PATCH nf-next 2/2] netfilter: nft_set_pipapo: use avx2 algorithm for insertions too Florian Westphal
2025-08-18 16:32 ` Stefano Brivio
2025-08-18 18:25 ` Florian Westphal
2025-08-18 18:56 ` Stefano Brivio
2025-08-18 21:41 ` Florian Westphal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aKNvtcCzJD8xnF3q@strlen.de \
--to=fw@strlen.de \
--cc=netfilter-devel@vger.kernel.org \
--cc=sbrivio@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.