Skip to content

Commit 9fea47d

Browse files
amirvdavem330
authored andcommitted
net/sched: act_gact: Update statistics when offloaded to hardware
Implement the stats_update callback that will be called by NIC drivers for hardware offloaded filters. Signed-off-by: Amir Vadai <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 3804070 commit 9fea47d

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

net/sched/act_gact.c

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,20 @@ static int tcf_gact(struct sk_buff *skb, const struct tc_action *a,
148148
return action;
149149
}
150150

151+
static void tcf_gact_stats_update(struct tc_action *a, u64 bytes, u32 packets,
152+
u64 lastuse)
153+
{
154+
struct tcf_gact *gact = a->priv;
155+
int action = READ_ONCE(gact->tcf_action);
156+
struct tcf_t *tm = &gact->tcf_tm;
157+
158+
_bstats_cpu_update(this_cpu_ptr(gact->common.cpu_bstats), bytes, packets);
159+
if (action == TC_ACT_SHOT)
160+
this_cpu_ptr(gact->common.cpu_qstats)->drops += packets;
161+
162+
tm->lastuse = lastuse;
163+
}
164+
151165
static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref)
152166
{
153167
unsigned char *b = skb_tail_pointer(skb);
@@ -207,6 +221,7 @@ static struct tc_action_ops act_gact_ops = {
207221
.type = TCA_ACT_GACT,
208222
.owner = THIS_MODULE,
209223
.act = tcf_gact,
224+
.stats_update = tcf_gact_stats_update,
210225
.dump = tcf_gact_dump,
211226
.init = tcf_gact_init,
212227
.walk = tcf_gact_walker,

0 commit comments

Comments
 (0)