Skip to contentSkip to conversation

sched: act_sample: Implement stats_update callback

PATCH Applied Ido Schimmel 2 participants 2 messages Mar 10, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: act_sample: Implement stats_update callback

From: Ido Schimmel <[email protected]>

Implement this callback in order to get the offloaded stats added to the kernel stats.

---
 net/sched/act_sample.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
net/sched/act_sample.c +11 -0
index 3ebf9ede3cf1..db8ee9e5c8c2 100644
@@ -194,6 +194,16 @@ static int tcf_sample_act(struct sk_buff *skb, const struct tc_action *a,
 	return retval;
 }
 
+static void tcf_sample_stats_update(struct tc_action *a, u64 bytes, u64 packets,
+				    u64 drops, u64 lastuse, bool hw)
+{
+	struct tcf_sample *s = to_sample(a);
+	struct tcf_t *tm = &s->tcf_tm;
+
+	tcf_action_update_stats(a, bytes, packets, drops, hw);
+	tm->lastuse = max_t(u64, tm->lastuse, lastuse);
+}
+
 static int tcf_sample_dump(struct sk_buff *skb, struct tc_action *a,
 			   int bind, int ref)
 {
@@ -280,6 +290,7 @@ static struct tc_action_ops act_sample_ops = {
 	.id	  = TCA_ID_SAMPLE,
 	.owner	  = THIS_MODULE,
 	.act	  = tcf_sample_act,
+	.stats_update = tcf_sample_stats_update,
 	.dump	  = tcf_sample_dump,
 	.init	  = tcf_sample_init,
 	.cleanup  = tcf_sample_cleanup,
Signature · 1 line
2.29.2
#1 lore raw
This patch was applied to netdev/net-next.git (refs/heads/master):

Hello:

This patch was applied to netdev/net-next.git (refs/heads/master):

Quoted 10 lines · On Wed, 10 Mar 2021 12:33:20 +0200 you wrote:

From: Ido Schimmel <[email protected]>

Implement this callback in order to get the offloaded stats added to the kernel stats.

[...]

Here is the summary with links:
- [net-next] sched: act_sample: Implement stats_update callback

    https://git.kernel.org/netdev/net-next/c/58c04397f74b

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html