From: Florian Westphal <fw@strlen.de>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, netdev@vger.kernel.org,
f.fainelli@gmail.com, simon.horman@netronome.com,
ronye@mellanox.com, jiri@mellanox.com, nbd@nbd.name,
john@phrozen.org, kubakici@wp.pl, fw@strlen.de
Subject: Re: [PATCH nf-next RFC,v2 1/6] netfilter: nf_conntrack: add IPS_OFFLOAD status bit
Date: Fri, 8 Dec 2017 07:47:02 +0100 [thread overview]
Message-ID: <20171208064702.GA26061@breakpoint.cc> (raw)
In-Reply-To: <20171207124501.24325-2-pablo@netfilter.org>
Pablo Neira Ayuso <pablo@netfilter.org> wrote:
> diff --git a/include/uapi/linux/netfilter/nf_conntrack_common.h b/include/uapi/linux/netfilter/nf_conntrack_common.h
> index dc947e59d03a..6b463b88182d 100644
> --- a/include/uapi/linux/netfilter/nf_conntrack_common.h
> +++ b/include/uapi/linux/netfilter/nf_conntrack_common.h
> @@ -100,6 +100,10 @@ enum ip_conntrack_status {
> IPS_HELPER_BIT = 13,
> IPS_HELPER = (1 << IPS_HELPER_BIT),
>
> + /* Conntrack has been offloaded to flow table. */
> + IPS_OFFLOAD_BIT = 14,
> + IPS_OFFLOAD = (1 << IPS_OFFLOAD_BIT),
> +
> /* Be careful here, modifying these bits can make things messy,
> * so don't let users modify them directly.
> */
I think this new bit has to be added to the UNCHANGEABLE mask below.
> diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c
> index 01130392b7c0..02e195accd47 100644
> --- a/net/netfilter/nf_conntrack_core.c
> +++ b/net/netfilter/nf_conntrack_core.c
> @@ -901,6 +901,9 @@ static unsigned int early_drop_list(struct net *net,
> hlist_nulls_for_each_entry_rcu(h, n, head, hnnode) {
> tmp = nf_ct_tuplehash_to_ctrack(h);
>
> + if (test_bit(IPS_OFFLOAD_BIT, &tmp->status))
> + continue;
> +
nit: I would move this below the ASSURED bit check, AFAIU most
(all?) offloaded conntracks are not in ASSURED state since they never
see two-way communication but in case we've mixed flows or no offloading
in place then the ASSURED check takes care of skipping earlydrop
already.
> +/* Set an arbitrary timeout large enough not to ever expire, this save
> + * us a check for the IPS_OFFLOAD_BIT from the packet path via
> + * nf_ct_is_expired().
> + */
> +static void nf_ct_offload_timeout(struct nf_conn *ct)
> +{
> + ct->timeout = nfct_time_stamp + DAY;
> +}
Not sure if its worth adding a test to avoid unconditional write,
e.g. something like
> +static void nf_ct_offload_timeout(struct nf_conn *ct)
> +{
if (nf_ct_expires(ct) < DAY/2))
> + ct->timeout = nfct_time_stamp + DAY;
but perhaps not worth it, gc_worker is infrequent.
next prev parent reply other threads:[~2017-12-08 6:48 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-07 12:44 [PATCH nf-next RFC,v2 0/6] Flow offload infrastructure Pablo Neira Ayuso
2017-12-07 12:44 ` [PATCH nf-next RFC,v2 1/6] netfilter: nf_conntrack: add IPS_OFFLOAD status bit Pablo Neira Ayuso
2017-12-08 6:47 ` Florian Westphal [this message]
2017-12-08 21:00 ` Pablo Neira Ayuso
2017-12-07 12:44 ` [PATCH nf-next RFC,v2 2/6] netfilter: nf_tables: add flow table netlink frontend Pablo Neira Ayuso
2017-12-07 12:44 ` [PATCH nf-next RFC,v2 3/6] netfilter: add generic flow table infrastructure Pablo Neira Ayuso
2017-12-07 12:44 ` [PATCH nf-next RFC,v2 4/6] netfilter: flow table support for IPv4 Pablo Neira Ayuso
2017-12-08 10:04 ` Florian Westphal
2017-12-08 21:14 ` Pablo Neira Ayuso
2017-12-07 12:45 ` [PATCH nf-next RFC,v2 5/6] netfilter: nf_tables: flow offload expression Pablo Neira Ayuso
2017-12-07 12:45 ` [PATCH nf-next RFC,v2 6/6] netfilter: nft_flow_offload: add ndo hooks for hardware offload Pablo Neira Ayuso
2017-12-08 10:18 ` Florian Westphal
2017-12-08 21:16 ` Pablo Neira Ayuso
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=20171208064702.GA26061@breakpoint.cc \
--to=fw@strlen.de \
--cc=f.fainelli@gmail.com \
--cc=jiri@mellanox.com \
--cc=john@phrozen.org \
--cc=kubakici@wp.pl \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=ronye@mellanox.com \
--cc=simon.horman@netronome.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).