]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: sched: extract bstats update code into function
authorVlad Buslov <vladbu@mellanox.com>
Wed, 30 Oct 2019 14:09:01 +0000 (16:09 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 31 Oct 2019 01:07:50 +0000 (18:07 -0700)
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>
include/net/act_api.h
net/sched/act_csum.c
net/sched/act_ct.c
net/sched/act_gact.c
net/sched/act_mirred.c
net/sched/act_tunnel_key.c
net/sched/act_vlan.c

index f6f66c692385ecf37ca2f4c9bd3cbb4a4ce096e6..9a32853f77f9c80234e22bb78c1da8ab1bba05a8 100644 (file)
@@ -186,6 +186,13 @@ int tcf_action_dump(struct sk_buff *skb, struct tc_action *actions[], int bind,
                    int ref);
 int tcf_action_dump_old(struct sk_buff *skb, struct tc_action *a, int, int);
 int tcf_action_dump_1(struct sk_buff *skb, struct tc_action *a, int, int);
+
+static inline void tcf_action_update_bstats(struct tc_action *a,
+                                           struct sk_buff *skb)
+{
+       bstats_cpu_update(this_cpu_ptr(a->cpu_bstats), skb);
+}
+
 void tcf_action_update_stats(struct tc_action *a, u64 bytes, u32 packets,
                             bool drop, bool hw);
 int tcf_action_copy_stats(struct sk_buff *, struct tc_action *, int);
index d3cfad88dc3a93368449f2aa179f94c64b7a903c..69747b1860aa4a0aa6ea8689cb21a6c0d83d9951 100644 (file)
@@ -580,7 +580,7 @@ static int tcf_csum_act(struct sk_buff *skb, const struct tc_action *a,
        params = rcu_dereference_bh(p->params);
 
        tcf_lastuse_update(&p->tcf_tm);
-       bstats_cpu_update(this_cpu_ptr(p->common.cpu_bstats), skb);
+       tcf_action_update_bstats(&p->common, skb);
 
        action = READ_ONCE(p->tcf_action);
        if (unlikely(action == TC_ACT_SHOT))
index ba76857754e56d6b670ae7b0df01356be51005ec..f9779907dcf78b3ce9443f402b8f928f25153905 100644 (file)
@@ -465,7 +465,7 @@ out_push:
        skb_push_rcsum(skb, nh_ofs);
 
 out:
-       bstats_cpu_update(this_cpu_ptr(a->cpu_bstats), skb);
+       tcf_action_update_bstats(&c->common, skb);
        return retval;
 
 drop:
index 569cec63d4c39391eccc70f732a56f5796ce668b..a7e3d5621608918e2db1aa39dae37ba93373891b 100644 (file)
@@ -161,7 +161,7 @@ static int tcf_gact_act(struct sk_buff *skb, const struct tc_action *a,
                action = gact_rand[ptype](gact);
        }
 #endif
-       bstats_cpu_update(this_cpu_ptr(gact->common.cpu_bstats), skb);
+       tcf_action_update_bstats(&gact->common, skb);
        if (action == TC_ACT_SHOT)
                qstats_drop_inc(this_cpu_ptr(gact->common.cpu_qstats));
 
index 621686a6b5be90b0c8373625397b7f5e449aef58..e5216f80883b8574bb818970a5b3393f589b8b9e 100644 (file)
@@ -231,7 +231,7 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a,
        }
 
        tcf_lastuse_update(&m->tcf_tm);
-       bstats_cpu_update(this_cpu_ptr(m->common.cpu_bstats), skb);
+       tcf_action_update_bstats(&m->common, skb);
 
        m_mac_header_xmit = READ_ONCE(m->tcfm_mac_header_xmit);
        m_eaction = READ_ONCE(m->tcfm_eaction);
index 2f83a79f76aae656fcea6f2d4a35d45c22e2a501..9ab2d3b4a9fcd9edda57742986bb9bae449a363b 100644 (file)
@@ -31,7 +31,7 @@ static int tunnel_key_act(struct sk_buff *skb, const struct tc_action *a,
        params = rcu_dereference_bh(t->params);
 
        tcf_lastuse_update(&t->tcf_tm);
-       bstats_cpu_update(this_cpu_ptr(t->common.cpu_bstats), skb);
+       tcf_action_update_bstats(&t->common, skb);
        action = READ_ONCE(t->tcf_action);
 
        switch (params->tcft_action) {
index 9e68edb22e5374e32d643b34b688edaecef545fd..f6dccaa29239c40410e16edda55adc1a4d117705 100644 (file)
@@ -29,7 +29,7 @@ static int tcf_vlan_act(struct sk_buff *skb, const struct tc_action *a,
        u16 tci;
 
        tcf_lastuse_update(&v->tcf_tm);
-       bstats_cpu_update(this_cpu_ptr(v->common.cpu_bstats), skb);
+       tcf_action_update_bstats(&v->common, skb);
 
        /* Ensure 'data' points at mac_header prior calling vlan manipulating
         * functions.