Commit 58c04397 authored by Ido Schimmel's avatar Ido Schimmel Committed by David S. Miller
Browse files

sched: act_sample: Implement stats_update callback



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

Signed-off-by: default avatarIdo Schimmel <idosch@nvidia.com>
Reviewed-by: default avatarPetr Machata <petrm@nvidia.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 762c1adb
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -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,