From: Florian Westphal <fw@strlen.de>
To: Florian Westphal <fw@strlen.de>
Cc: netfilter-devel@vger.kernel.org,
Nadia Pinaeva <n.m.pinaeva@gmail.com>,
Pablo Neira Ayuso <pablo@netfilter.org>
Subject: Re: [PATCH nf-next] netfilter: conntrack: add conntrack event timestamp
Date: Tue, 12 Nov 2024 19:25:53 +0100 [thread overview]
Message-ID: <20241112182553.GC28817@breakpoint.cc> (raw)
In-Reply-To: <20241107194117.32116-1-fw@strlen.de>
Florian Westphal <fw@strlen.de> wrote:
> Nadia Pinaeva writes:
> I am working on a tool that allows collecting network performance
> metrics by using conntrack events.
> Start time of a conntrack entry is used to evaluate seen_reply
> latency, therefore the sooner it is timestamped, the better the
> precision is.
> In particular, when using this tool to compare the performance of the
> same feature implemented using iptables/nftables/OVS it is crucial
> to have the entry timestamped earlier to see any difference.
>
> At this time, conntrack events can only get timestamped at recv time in
> userspace, so there can be some delay between the event being generated
> and the userspace process consuming the message.
>
> There is sys/net/netfilter/nf_conntrack_timestamp, which adds a
> 64bit timestamp (ns resolution) that records start and stop times,
> but its not suited for this either, start time is the 'hashtable insertion
> time', not 'conntrack allocation time'.
>
> There is concern that moving the start-time moment to conntrack
> allocation will add overhead in case of flooding, where conntrack
> entries are allocated and released right away without getting inserted
> into the hashtable.
>
> Also, even if this was changed it would not with events other than
> new (start time) and destroy (stop time).
>
> Pablo suggested to add new CTA_TIMESTAMP_EVENT, this adds this feature.
> The timestamp is recorded in case both events are requested and the
> sys/net/netfilter/nf_conntrack_timestamp toggle is enabled.
I was about to send v2 of this patch, but I found following comment in
ulogd source code (input/flow/ulogd_inpflow_NFCT.c):
* - add nanosecond-accurate packet receive timestamp of event-changing
* packets to {ip,nf}_conntrack_netlink, so we can have accurate IPFIX
* flowStart / flowEnd NanoSeconds.
I'm leaning towards reworking this patch to replace ktime_get_real_ns()
by
ktime_to_ns(skb_tstamp_cond(skb, 1)))
so that the event carries the packet receive timestamp if that was
available or the current clock time as fallback.
Thoughts? Otherwise I can ignore above comment and keep
ktime_get_real_ns() usage.
next prev parent reply other threads:[~2024-11-12 18:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-07 19:41 [PATCH nf-next] netfilter: conntrack: add conntrack event timestamp Florian Westphal
2024-11-08 0:09 ` kernel test robot
2024-11-08 1:33 ` kernel test robot
2024-11-08 6:34 ` kernel test robot
2024-11-12 18:25 ` Florian Westphal [this message]
-- strict thread matches above, loose matches on Subject: below --
2024-11-15 13:46 Florian Westphal
2025-01-07 15:53 ` Florian Westphal
2025-01-08 23:48 ` Pablo Neira Ayuso
2025-01-09 0:31 ` Florian Westphal
2025-01-09 10:25 ` Antonio Ojea
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=20241112182553.GC28817@breakpoint.cc \
--to=fw@strlen.de \
--cc=n.m.pinaeva@gmail.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox