From: Jakub Kicinski <kuba@kernel.org>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org, davem@davemloft.net,
netdev@vger.kernel.org, jiri@resnulli.us, ecree@solarflare.com
Subject: Re: [PATCH net,v2] net: flow_offload: skip hw stats check for FLOW_ACTION_HW_STATS_DONT_CARE
Date: Tue, 5 May 2020 12:43:43 -0700 [thread overview]
Message-ID: <20200505124343.27897ad6@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20200505193145.GA9789@salvia>
On Tue, 5 May 2020 21:31:45 +0200 Pablo Neira Ayuso wrote:
> On Tue, May 05, 2020 at 11:40:10AM -0700, Jakub Kicinski wrote:
> > On Tue, 5 May 2020 19:47:36 +0200 Pablo Neira Ayuso wrote:
> > > This patch adds FLOW_ACTION_HW_STATS_DONT_CARE which tells the driver
> > > that the frontend does not need counters, this hw stats type request
> > > never fails. The FLOW_ACTION_HW_STATS_DISABLED type explicitly requests
> > > the driver to disable the stats, however, if the driver cannot disable
> > > counters, it bails out.
> > >
> > > TCA_ACT_HW_STATS_* maintains the 1:1 mapping with FLOW_ACTION_HW_STATS_*
> > > except by disabled which is mapped to FLOW_ACTION_HW_STATS_DISABLED
> > > (this is 0 in tc). Add tc_act_hw_stats() to perform the mapping between
> > > TCA_ACT_HW_STATS_* and FLOW_ACTION_HW_STATS_*.
> > >
> > > Fixes: 319a1d19471e ("flow_offload: check for basic action hw stats type")
> > > Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> > > ---
> > > v2: define FLOW_ACTION_HW_STATS_DISABLED at the end of the enumeration
> > > as Jiri suggested. Keep the 1:1 mapping between TCA_ACT_HW_STATS_*
> > > and FLOW_ACTION_HW_STATS_* except by the disabled case.
> > >
> > > include/net/flow_offload.h | 9 ++++++++-
> > > net/sched/cls_api.c | 14 ++++++++++++--
> > > 2 files changed, 20 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
> > > index 3619c6acf60f..efc8350b42fb 100644
> > > --- a/include/net/flow_offload.h
> > > +++ b/include/net/flow_offload.h
> > > @@ -166,15 +166,18 @@ enum flow_action_mangle_base {
> > > enum flow_action_hw_stats_bit {
> > > FLOW_ACTION_HW_STATS_IMMEDIATE_BIT,
> > > FLOW_ACTION_HW_STATS_DELAYED_BIT,
> > > + FLOW_ACTION_HW_STATS_DISABLED_BIT,
> > > };
> > >
> > > enum flow_action_hw_stats {
> > > - FLOW_ACTION_HW_STATS_DISABLED = 0,
> > > + FLOW_ACTION_HW_STATS_DONT_CARE = 0,
> >
> > Why not ~0? Or ANY | DISABLED?
> > Otherwise you may confuse drivers which check bit by bit.
>
> I'm confused, you agreed with this behaviour:
I was expecting the 0 to be exposed at UAPI level, and then kernel
would translate that to a full mask internally.
From the other reply:
> I can send a v3 to handle the _DONT_CARE type from the mlxsw.
Seems a little unnecessary for all drivers to cater to the special
case, when we made the argument be a bitfield specifically so that
the drivers can function as long as they match on any of the bits.
next prev parent reply other threads:[~2020-05-05 19:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-05 17:47 [PATCH net,v2] net: flow_offload: skip hw stats check for FLOW_ACTION_HW_STATS_DONT_CARE Pablo Neira Ayuso
2020-05-05 18:36 ` Jiri Pirko
2020-05-05 18:46 ` Jakub Kicinski
2020-05-05 19:36 ` Pablo Neira Ayuso
2020-05-06 5:22 ` Jiri Pirko
2020-05-05 18:40 ` Jakub Kicinski
2020-05-05 19:31 ` Pablo Neira Ayuso
2020-05-05 19:43 ` Jakub Kicinski [this message]
2020-05-05 21:43 ` Pablo Neira Ayuso
2020-05-05 23:29 ` Jakub Kicinski
2020-05-06 11:33 ` Edward Cree
2020-05-06 11:44 ` Jiri Pirko
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=20200505124343.27897ad6@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
--to=kuba@kernel.org \
--cc=davem@davemloft.net \
--cc=ecree@solarflare.com \
--cc=jiri@resnulli.us \
--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).