netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oz Shlomo <ozsh@nvidia.com>
To: <netdev@vger.kernel.org>
Cc: Jiri Pirko <jiri@nvidia.com>, Jamal Hadi Salim <jhs@mojatatu.com>,
	"Simon Horman" <simon.horman@corigine.com>,
	Baowen Zheng <baowen.zheng@corigine.com>,
	Vlad Buslov <vladbu@nvidia.com>, Ido Schimmel <idosch@nvidia.com>,
	Roi Dayan <roid@nvidia.com>, Oz Shlomo <ozsh@nvidia.com>
Subject: [ RFC  net-next 3/3] net/sched: act_api: update hw stats for tc action list
Date: Tue, 16 Aug 2022 12:23:38 +0300	[thread overview]
Message-ID: <20220816092338.12613-4-ozsh@nvidia.com> (raw)
In-Reply-To: <20220816092338.12613-1-ozsh@nvidia.com>

Currently action hw stats are updated during the tc filter dump sequence.
HW actions are also updated during the tc action dump sequence.
However, tc action dump does not update the hw stats for actions created
during filter instantiation.

Use the existing hw action api to update hw stats during tc action dump.

Signed-off-by: Oz Shlomo <ozsh@nvidia.com>

---
 net/sched/act_api.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/net/sched/act_api.c b/net/sched/act_api.c
index 817065aa2833..5d7b6e438085 100644
--- a/net/sched/act_api.c
+++ b/net/sched/act_api.c
@@ -301,14 +301,11 @@ static int tcf_action_offload_add(struct tc_action *action,
 	return tcf_action_offload_add_ex(action, extack, NULL, NULL);
 }
 
-int tcf_action_update_hw_stats(struct tc_action *action)
+static int tcf_action_set_hw_stats(struct tc_action *action)
 {
 	struct flow_offload_action fl_act = {};
 	int err;
 
-	if (!tc_act_in_hw(action))
-		return -EOPNOTSUPP;
-
 	err = offload_action_init(&fl_act, action, FLOW_ACT_STATS, NULL);
 	if (err)
 		return err;
@@ -330,6 +327,14 @@ int tcf_action_update_hw_stats(struct tc_action *action)
 
 	return 0;
 }
+
+int tcf_action_update_hw_stats(struct tc_action *action)
+{
+	if (!tc_act_in_hw(action))
+		return -EOPNOTSUPP;
+
+	return tcf_action_set_hw_stats(action);
+}
 EXPORT_SYMBOL(tcf_action_update_hw_stats);
 
 static int tcf_action_offload_del_ex(struct tc_action *action,
@@ -543,6 +548,8 @@ static int tcf_dump_walker(struct tcf_idrinfo *idrinfo, struct sk_buff *skb,
 			index--;
 			goto nla_put_failure;
 		}
+		tcf_action_set_hw_stats(p);
+
 		err = (act_flags & TCA_ACT_FLAG_TERSE_DUMP) ?
 			tcf_action_dump_terse(skb, p, true) :
 			tcf_action_dump_1(skb, p, 0, 0);
-- 
1.8.3.1


  parent reply	other threads:[~2022-08-16  9:49 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16  9:23 [ RFC net-next 0/3] net: flow_offload: add support for per action hw stats Oz Shlomo
2022-08-16  9:23 ` [ RFC net-next 1/3] net: sched: Pass flow_stats instead of multiple stats args Oz Shlomo
2022-08-16  9:23 ` [ RFC net-next 2/3] net: flow_offload: add action stats api Oz Shlomo
2022-08-16 13:42   ` Edward Cree
2022-08-17 14:43     ` Oz Shlomo
2022-09-28 15:19       ` Oz Shlomo
2022-08-16  9:23 ` Oz Shlomo [this message]
2022-08-16 18:19 ` [ RFC net-next 0/3] net: flow_offload: add support for per action hw stats Jakub Kicinski
2022-08-17 14:46   ` Oz Shlomo
2022-08-17 16:02     ` Jakub Kicinski

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=20220816092338.12613-4-ozsh@nvidia.com \
    --to=ozsh@nvidia.com \
    --cc=baowen.zheng@corigine.com \
    --cc=idosch@nvidia.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=roid@nvidia.com \
    --cc=simon.horman@corigine.com \
    --cc=vladbu@nvidia.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).