Commit 837cb17d authored by Petr Machata's avatar Petr Machata Committed by David S. Miller
Browse files

sched: act_skbedit: Implement stats_update callback



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

Reported-by: default avatarAlexander Petrovskiy <alexpe@mellanox.com>
Signed-off-by: default avatarPetr Machata <petrm@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 92b7e62e
Loading
Loading
Loading
Loading
+11 −0
Original line number Original line Diff line number Diff line
@@ -73,6 +73,16 @@ err:
	return TC_ACT_SHOT;
	return TC_ACT_SHOT;
}
}


static void tcf_skbedit_stats_update(struct tc_action *a, u64 bytes,
				     u32 packets, u64 lastuse, bool hw)
{
	struct tcf_skbedit *d = to_skbedit(a);
	struct tcf_t *tm = &d->tcf_tm;

	tcf_action_update_stats(a, bytes, packets, false, hw);
	tm->lastuse = max_t(u64, tm->lastuse, lastuse);
}

static const struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = {
static const struct nla_policy skbedit_policy[TCA_SKBEDIT_MAX + 1] = {
	[TCA_SKBEDIT_PARMS]		= { .len = sizeof(struct tc_skbedit) },
	[TCA_SKBEDIT_PARMS]		= { .len = sizeof(struct tc_skbedit) },
	[TCA_SKBEDIT_PRIORITY]		= { .len = sizeof(u32) },
	[TCA_SKBEDIT_PRIORITY]		= { .len = sizeof(u32) },
@@ -323,6 +333,7 @@ static struct tc_action_ops act_skbedit_ops = {
	.id		=	TCA_ID_SKBEDIT,
	.id		=	TCA_ID_SKBEDIT,
	.owner		=	THIS_MODULE,
	.owner		=	THIS_MODULE,
	.act		=	tcf_skbedit_act,
	.act		=	tcf_skbedit_act,
	.stats_update	=	tcf_skbedit_stats_update,
	.dump		=	tcf_skbedit_dump,
	.dump		=	tcf_skbedit_dump,
	.init		=	tcf_skbedit_init,
	.init		=	tcf_skbedit_init,
	.cleanup	=	tcf_skbedit_cleanup,
	.cleanup	=	tcf_skbedit_cleanup,