Skip to content

Commit 5e1ad95

Browse files
w1ldptrdavem330
authored andcommitted
net: sched: extract bstats update code into function
Extract common code that increments cpu_bstats counter into standalone act API function. Change hardware offloaded actions that use percpu counter allocation to use the new function instead of incrementing cpu_bstats directly. This commit doesn't change functionality. Signed-off-by: Vlad Buslov <vladbu@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c8ecebd commit 5e1ad95

7 files changed

Lines changed: 13 additions & 6 deletions

File tree

‎include/net/act_api.h‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,13 @@ int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[], int bind,
186186
int ref);
187187
int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int);
188188
int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int);
189+
190+
static inline void tcf_action_update_bstats(struct tc_action *a,
191+
struct sk_buff *skb)
192+
{
193+
bstats_cpu_update(this_cpu_ptr(a->cpu_bstats), skb);
194+
}
195+
189196
void tcf_action_update_stats(struct tc_action *a, u64 bytes, u32 packets,
190197
bool drop, bool hw);
191198
int tcf_action_copy_stats(struct sk_buff *, struct tc_action *, int);

‎net/sched/act_csum.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ static int tcf_csum_act(struct sk_buff *skb, const struct tc_action *a,
580580
params = rcu_dereference_bh(p->params);
581581

582582
tcf_lastuse_update(&p->tcf_tm);
583-
bstats_cpu_update(this_cpu_ptr(p->common.cpu_bstats), skb);
583+
tcf_action_update_bstats(&p->common, skb);
584584

585585
action = READ_ONCE(p->tcf_action);
586586
if (unlikely(action == TC_ACT_SHOT))

‎net/sched/act_ct.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a,
465465
skb_push_rcsum(skb, nh_ofs);
466466

467467
out:
468-
bstats_cpu_update(this_cpu_ptr(a->cpu_bstats), skb);
468+
tcf_action_update_bstats(&c->common, skb);
469469
return retval;
470470

471471
drop:

‎net/sched/act_gact.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static int tcf_gact_act(struct sk_buff *skb, const struct tc_action *a,
161161
action = gact_rand[ptype](gact);
162162
}
163163
#endif
164-
bstats_cpu_update(this_cpu_ptr(gact->common.cpu_bstats), skb);
164+
tcf_action_update_bstats(&gact->common, skb);
165165
if (action == TC_ACT_SHOT)
166166
qstats_drop_inc(this_cpu_ptr(gact->common.cpu_qstats));
167167

‎net/sched/act_mirred.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a,
231231
}
232232

233233
tcf_lastuse_update(&m->tcf_tm);
234-
bstats_cpu_update(this_cpu_ptr(m->common.cpu_bstats), skb);
234+
tcf_action_update_bstats(&m->common, skb);
235235

236236
m_mac_header_xmit = READ_ONCE(m->tcfm_mac_header_xmit);
237237
m_eaction = READ_ONCE(m->tcfm_eaction);

‎net/sched/act_tunnel_key.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ static int tunnel_key_act(struct sk_buff *skb, const struct tc_action *a,
3131
params = rcu_dereference_bh(t->params);
3232

3333
tcf_lastuse_update(&t->tcf_tm);
34-
bstats_cpu_update(this_cpu_ptr(t->common.cpu_bstats), skb);
34+
tcf_action_update_bstats(&t->common, skb);
3535
action = READ_ONCE(t->tcf_action);
3636

3737
switch (params->tcft_action) {

‎net/sched/act_vlan.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ static int tcf_vlan_act(struct sk_buff *skb, const struct tc_action *a,
2929
u16 tci;
3030

3131
tcf_lastuse_update(&v->tcf_tm);
32-
bstats_cpu_update(this_cpu_ptr(v->common.cpu_bstats), skb);
32+
tcf_action_update_bstats(&v->common, skb);
3333

3434
/* Ensure 'data' points at mac_header prior calling vlan manipulating
3535
* functions.

0 commit comments

Comments
 (0)