public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	thomas.lendacky@amd.com, f.fainelli@gmail.com,
	ariel.elior@cavium.com, michael.chan@broadcom.com,
	santosh@chelsio.com, madalin.bucur@nxp.com,
	yisen.zhuang@huawei.com, salil.mehta@huawei.com,
	jeffrey.t.kirsher@intel.com, tariqt@mellanox.com,
	saeedm@mellanox.com, jiri@mellanox.com, idosch@mellanox.com,
	peppe.cavallaro@st.com, grygorii.strashko@ti.com, andrew@lunn.ch,
	vivien.didelot@savoirfairelinux.com, alexandre.torgue@st.com,
	joabreu@synopsys.com, linux-net-drivers@solarflare.com,
	ganeshgr@chelsio.com, ogerlitz@mellanox.com,
	Manish.Chopra@cavium.com, marcelo.leitner@gmail.com
Subject: Re: [PATCH net-next,v4 05/12] flow_offload: add statistics retrieval infrastructure and use it
Date: Sat, 1 Dec 2018 10:55:15 +0100	[thread overview]
Message-ID: <20181201095515.j2gmk7ixqww7exi4@salvia> (raw)
In-Reply-To: <20181129124822.178e17a6@cakuba.netronome.com>

Hi Jakub,

On Thu, Nov 29, 2018 at 12:48:22PM -0800, Jakub Kicinski wrote:
> On Thu, 29 Nov 2018 03:22:24 +0100, Pablo Neira Ayuso wrote:
> > This patch provides the flow_stats structure that acts as container for
> > tc_cls_flower_offload, then we can use to restore the statistics on the
> > existing TC actions. Hence, tcf_exts_stats_update() is not used from
> > drivers anymore.
> > 
> > Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
> 
> > diff --git a/include/net/flow_offload.h b/include/net/flow_offload.h
> > index dabc819b6cc9..040c092c000a 100644
> > --- a/include/net/flow_offload.h
> > +++ b/include/net/flow_offload.h
> > @@ -179,4 +179,18 @@ static inline bool flow_rule_match_key(const struct flow_rule *rule,
> >  	return dissector_uses_key(rule->match.dissector, key);
> >  }
> >  
> > +struct flow_stats {
> > +	u64	pkts;
> > +	u64	bytes;
> > +	u64	lastused;
> > +};
> > +
> > +static inline void flow_stats_update(struct flow_stats *flow_stats,
> > +				     u64 pkts, u64 bytes, u64 lastused)
> > +{
> > +	flow_stats->pkts	= pkts;
> > +	flow_stats->bytes	= bytes;
> > +	flow_stats->lastused	= lastused;
> > +}
> > +
> >  #endif /* _NET_FLOW_OFFLOAD_H */
> > diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h
> > index abb035f84321..a08c06e383db 100644
> > --- a/include/net/pkt_cls.h
> > +++ b/include/net/pkt_cls.h
> > @@ -767,6 +767,7 @@ struct tc_cls_flower_offload {
> >  	enum tc_fl_command command;
> >  	unsigned long cookie;
> >  	struct flow_rule *rule;
> > +	struct flow_stats stats;
> >  	struct tcf_exts *exts;
> >  	u32 classid;
> >  };
> > diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
> > index 8898943b8ee6..b88cf29aff7b 100644
> > --- a/net/sched/cls_flower.c
> > +++ b/net/sched/cls_flower.c
> > @@ -432,6 +432,10 @@ static void fl_hw_update_stats(struct tcf_proto *tp, struct cls_fl_filter *f)
> >  
> >  	tc_setup_cb_call(block, &f->exts, TC_SETUP_CLSFLOWER,
> >  			 &cls_flower, false);
> > +
> > +	tcf_exts_stats_update(&f->exts, cls_flower.stats.bytes,
> > +			      cls_flower.stats.pkts,
> > +			      cls_flower.stats.lastused);
> >  }
> >  
> >  static bool __fl_delete(struct tcf_proto *tp, struct cls_fl_filter *f,
> 
> Apart from the bug Venkat mentioned I think this patch exposes a
> potentially strange and unexpected TC-ism through to the abstracted API.
> The stats for TC store the increment in update cycle, so flow->stats
> will be equal to the diff between TC_CLSFLOWER_STATS calls.

Goal of this patch is to stop exposing tcf_exts to drivers, so it is a
preparation patch to remove a dependency. This patch introduces
infrastructure to wheelbarrow the counters back to TC, as a result we
a have centralized tcf_exts_stats_update() call and TC actions are not
exposed anymore. Ethtool does not seem to expose counters, so it does
not need this infrastructure. So you are right, the statistics
interface is very much TC specific at this stage.

  reply	other threads:[~2018-12-01 21:07 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-29  2:22 [PATCH net-next,v4 00/12] add flow_rule infrastructure Pablo Neira Ayuso
2018-11-29  2:22 ` [PATCH net-next,v4 01/12] flow_offload: add flow_rule and flow_match structures and use them Pablo Neira Ayuso
2018-11-29  2:22 ` [PATCH net-next,v4 02/12] net/mlx5e: support for two independent packet edit actions Pablo Neira Ayuso
2018-11-29  2:22 ` [PATCH net-next,v4 03/12] flow_offload: add flow action infrastructure Pablo Neira Ayuso
2018-11-29  2:22 ` [PATCH net-next,v4 04/12] cls_api: add translator to flow_action representation Pablo Neira Ayuso
2018-11-29  2:22 ` [PATCH net-next,v4 05/12] flow_offload: add statistics retrieval infrastructure and use it Pablo Neira Ayuso
2018-11-29 14:06   ` Venkat Duvvuru
2018-11-29 20:48   ` Jakub Kicinski
2018-12-01  9:55     ` Pablo Neira Ayuso [this message]
2018-11-29  2:22 ` [PATCH net-next,v4 06/12] drivers: net: use flow action infrastructure Pablo Neira Ayuso
2018-11-29  2:22 ` [PATCH net-next,v4 07/12] cls_flower: don't expose TC actions to drivers anymore Pablo Neira Ayuso
2018-11-29  2:22 ` [PATCH net-next,v4 08/12] flow_offload: add wake-up-on-lan and queue to flow_action Pablo Neira Ayuso
2018-11-29  2:22 ` [PATCH net-next,v4 09/12] ethtool: add basic ethtool_rx_flow_spec to flow_rule structure translator Pablo Neira Ayuso
2018-11-29 13:12   ` Michal Kubecek
     [not found]     ` <20181205131037.gznwi35tkz7pxmge@salvia>
2018-12-05 13:56       ` Michal Kubecek
2018-11-29  2:22 ` [PATCH net-next,v4 10/12] dsa: bcm_sf2: use flow_rule infrastructure Pablo Neira Ayuso
2018-11-29  2:22 ` [PATCH net-next,v4 11/12] qede: place ethtool_rx_flow_spec after code after TC flower codebase Pablo Neira Ayuso
2018-11-29  2:22 ` [PATCH net-next,v4 12/12] qede: use ethtool_rx_flow_rule() to remove duplicated parser code Pablo Neira Ayuso
2018-12-01 16:19   ` kbuild test robot
2018-11-29 15:47 ` [PATCH net-next,v4 00/12] add flow_rule infrastructure John Fastabend
2018-11-29 16:53   ` 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=20181201095515.j2gmk7ixqww7exi4@salvia \
    --to=pablo@netfilter.org \
    --cc=Manish.Chopra@cavium.com \
    --cc=alexandre.torgue@st.com \
    --cc=andrew@lunn.ch \
    --cc=ariel.elior@cavium.com \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=ganeshgr@chelsio.com \
    --cc=grygorii.strashko@ti.com \
    --cc=idosch@mellanox.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=jeffrey.t.kirsher@intel.com \
    --cc=jiri@mellanox.com \
    --cc=joabreu@synopsys.com \
    --cc=linux-net-drivers@solarflare.com \
    --cc=madalin.bucur@nxp.com \
    --cc=marcelo.leitner@gmail.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=peppe.cavallaro@st.com \
    --cc=saeedm@mellanox.com \
    --cc=salil.mehta@huawei.com \
    --cc=santosh@chelsio.com \
    --cc=tariqt@mellanox.com \
    --cc=thomas.lendacky@amd.com \
    --cc=vivien.didelot@savoirfairelinux.com \
    --cc=yisen.zhuang@huawei.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