From: Edward Cree <ecree@solarflare.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: <netdev@vger.kernel.org>, <davem@davemloft.net>,
<netfilter-devel@vger.kernel.org>, <jiri@resnulli.us>,
<kuba@kernel.org>
Subject: Re: [RFC PATCH net] net: flow_offload: simplify hw stats check handling
Date: Thu, 7 May 2020 16:49:15 +0100 [thread overview]
Message-ID: <9000b990-9a25-936e-6063-0034429256f0@solarflare.com> (raw)
In-Reply-To: <20200507153231.GA10250@salvia>
On 07/05/2020 16:32, Pablo Neira Ayuso wrote:
> On Thu, May 07, 2020 at 03:59:09PM +0100, Edward Cree wrote:
>> Make FLOW_ACTION_HW_STATS_DONT_CARE be all bits, rather than none, so that
>> drivers and __flow_action_hw_stats_check can use simple bitwise checks.
>
> You have have to explain why this makes sense in terms of semantics.
>
> _DISABLED and _ANY are contradicting each other.
No, they aren't. The DISABLED bit means "I will accept disabled", it doesn't
mean "I insist on disabled". What _does_ mean "I insist on disabled" is if
the DISABLED bit is set and no other bits are.
So DISABLED | ANY means "I accept disabled; I also accept immediate or
delayed". A.k.a. "I don't care, do what you like".
>> In mlxsw we check for DISABLED first, because we'd rather save the counter
>> resources in the DONT_CARE case.
>
> And this also is breaking netfilter again.
>
> Turning DONT_CARE gives us nothing back at all.
If you set DONT_CARE, then because that includes the DISABLED bit, you will
get no counter on mlxsw. I thought that was what netfilter wanted (no
counters by default)?
On 07/05/2020 16:36, Pablo Neira Ayuso wrote:
> What if the driver does not support to disable counters?
>
> It will have to check for _DONT_CARE here.
No, it would just go
if (hw_stats & _IMMEDIATE) {
configure_me_a_counter();
} else {
error("Only hw_stats_type immediate supported");
}
And this will work fine, because _DONT_CARE & _IMMEDIATE == _IMMEDIATE,
whereas _DISABLED & _IMMEDIATE == 0.
> And _DISABLED implies "bail out if you cannot disable".
See above; with the new semantics, the "bail out" condition is "if you
cannot satisfy any of the bits that were set". Which means if
_DISABLED is the only bit set, and you cannot disable, you bail out;
but if _DISABLED and (say) _IMMEDIATE are both set, that means "bail
out if you don't support _IMMEDIATE *and* cannot disable" (i.e. if you
only support _DELAYED).
-ed
next prev parent reply other threads:[~2020-05-07 15:49 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-07 14:59 [RFC PATCH net] net: flow_offload: simplify hw stats check handling Edward Cree
2020-05-07 15:32 ` Pablo Neira Ayuso
2020-05-07 15:49 ` Edward Cree [this message]
2020-05-07 16:46 ` Pablo Neira Ayuso
2020-05-07 23:48 ` Jakub Kicinski
2020-05-11 5:33 ` Jiri Pirko
2020-05-11 10:09 ` Edward Cree
2020-05-07 15:36 ` 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=9000b990-9a25-936e-6063-0034429256f0@solarflare.com \
--to=ecree@solarflare.com \
--cc=davem@davemloft.net \
--cc=jiri@resnulli.us \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--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;
as well as URLs for NNTP newsgroup(s).