From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pablo Neira Ayuso Subject: Re: [PATCH net-next,v2 05/12] cls_flower: add statistics retrieval infrastructure and use it Date: Mon, 19 Nov 2018 15:48:50 +0100 Message-ID: <20181119144850.wfl22tlcvdlkddl4@salvia> References: <20181119001519.12124-1-pablo@netfilter.org> <20181119001519.12124-6-pablo@netfilter.org> <20181119135705.GG2223@nanopsycho.orion> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii 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, jakub.kicinski@netronome.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 To: Jiri Pirko Return-path: Received: from mail.us.es ([193.147.175.20]:39876 "EHLO mail.us.es" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729398AbeKTBMp (ORCPT ); Mon, 19 Nov 2018 20:12:45 -0500 Received: from antivirus1-rhel7.int (unknown [192.168.2.11]) by mail.us.es (Postfix) with ESMTP id 7C409130E51 for ; Mon, 19 Nov 2018 15:48:53 +0100 (CET) Received: from antivirus1-rhel7.int (localhost [127.0.0.1]) by antivirus1-rhel7.int (Postfix) with ESMTP id 68AC5DA73F for ; Mon, 19 Nov 2018 15:48:53 +0100 (CET) Content-Disposition: inline In-Reply-To: <20181119135705.GG2223@nanopsycho.orion> Sender: netdev-owner@vger.kernel.org List-ID: On Mon, Nov 19, 2018 at 02:57:05PM +0100, Jiri Pirko wrote: > Mon, Nov 19, 2018 at 01:15:12AM CET, pablo@netfilter.org wrote: [...] > >diff --git a/include/net/pkt_cls.h b/include/net/pkt_cls.h > >index 7d7aefa5fcd2..7f9a8d5ca945 100644 > >--- a/include/net/pkt_cls.h > >+++ b/include/net/pkt_cls.h > >@@ -758,6 +758,12 @@ enum tc_fl_command { > > TC_CLSFLOWER_TMPLT_DESTROY, > > }; > > > >+struct tc_cls_flower_stats { > >+ u64 pkts; > >+ u64 bytes; > >+ u64 lastused; > >+}; > >+ > > struct tc_cls_flower_offload { > > struct tc_cls_common_offload common; > > enum tc_fl_command command; > >@@ -765,6 +771,7 @@ struct tc_cls_flower_offload { > > struct flow_rule rule; > > struct tcf_exts *exts; > > u32 classid; > >+ struct tc_cls_flower_stats stats; > > }; > > > > static inline struct flow_rule * > >@@ -773,6 +780,14 @@ tc_cls_flower_offload_flow_rule(struct tc_cls_flower_offload *tc_flow_cmd) > > return &tc_flow_cmd->rule; > > } > > > >+static inline void tc_cls_flower_stats_update(struct tc_cls_flower_offload *cls_flower, > >+ u64 pkts, u64 bytes, u64 lastused) > >+{ > >+ cls_flower->stats.pkts = pkts; > >+ cls_flower->stats.bytes = bytes; > >+ cls_flower->stats.lastused = lastused; > > Why do you need to store the values here in struct tc_cls_flower_offload? > Why don't you just call tcf_exts_stats_update()? Basically, > tc_cls_flower_stats_update() should be just wrapper around > tcf_exts_stats_update() so that drivers wouldn't use ->exts directly, as > you will remove them in follow-up patches, no? Patch 07/12 stops exposing tc action exts to drivers, so we need a structure (struct tc_cls_flower_stats) to convey this statistics back to the cls_flower frontend.