From: Vlad Buslov <vladbu@mellanox.com>
To: netdev@vger.kernel.org
Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us,
davem@davemloft.net, mleitner@redhat.com, dcaratti@redhat.com,
Vlad Buslov <vladbu@mellanox.com>, Jiri Pirko <jiri@mellanox.com>
Subject: [PATCH net-next 02/13] net: sched: extract bstats update code into function
Date: Tue, 22 Oct 2019 17:17:53 +0300 [thread overview]
Message-ID: <20191022141804.27639-3-vladbu@mellanox.com> (raw)
In-Reply-To: <20191022141804.27639-1-vladbu@mellanox.com>
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>
---
include/net/act_api.h | 7 +++++++
net/sched/act_csum.c | 2 +-
net/sched/act_ct.c | 2 +-
net/sched/act_gact.c | 2 +-
net/sched/act_mirred.c | 2 +-
net/sched/act_tunnel_key.c | 2 +-
net/sched/act_vlan.c | 2 +-
7 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/include/net/act_api.h b/include/net/act_api.h
index f6f66c692385..9a32853f77f9 100644
--- a/include/net/act_api.h
+++ b/include/net/act_api.h
@@ -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);
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index d3cfad88dc3a..69747b1860aa 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -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))
diff --git a/net/sched/act_ct.c b/net/sched/act_ct.c
index ba76857754e5..f9779907dcf7 100644
--- a/net/sched/act_ct.c
+++ b/net/sched/act_ct.c
@@ -465,7 +465,7 @@ static int tcf_ct_act(struct sk_buff *skb, const struct tc_action *a,
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:
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c
index 569cec63d4c3..a7e3d5621608 100644
--- a/net/sched/act_gact.c
+++ b/net/sched/act_gact.c
@@ -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));
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 621686a6b5be..e5216f80883b 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -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);
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index 2f83a79f76aa..9ab2d3b4a9fc 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -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) {
diff --git a/net/sched/act_vlan.c b/net/sched/act_vlan.c
index 9e68edb22e53..f6dccaa29239 100644
--- a/net/sched/act_vlan.c
+++ b/net/sched/act_vlan.c
@@ -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.
--
2.21.0
next prev parent reply other threads:[~2019-10-22 14:19 UTC|newest]
Thread overview: 64+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-22 14:17 [PATCH net-next 00/13] Control action percpu counters allocation by netlink flag Vlad Buslov
2019-10-22 14:17 ` [PATCH net-next 01/13] net: sched: extract common action counters update code into function Vlad Buslov
2019-10-22 14:17 ` Vlad Buslov [this message]
2019-10-22 14:17 ` [PATCH net-next 03/13] net: sched: extract qstats update code into functions Vlad Buslov
2019-10-22 14:17 ` [PATCH net-next 04/13] net: sched: don't expose action qstats to skb_tc_reinsert() Vlad Buslov
2019-10-22 14:17 ` [PATCH net-next 05/13] net: sched: modify stats helper functions to support regular stats Vlad Buslov
2019-10-22 14:17 ` [PATCH net-next 06/13] net: sched: add action fast initialization flag Vlad Buslov
2019-10-22 14:17 ` [PATCH net-next 07/13] net: sched: act_gact: support fast init flag to skip pcpu allocation Vlad Buslov
2019-10-22 14:17 ` [PATCH net-next 08/13] net: sched: act_csum: " Vlad Buslov
2019-10-22 14:18 ` [PATCH net-next 09/13] net: sched: act_mirred: support fast init flag to skip pcpu alloc Vlad Buslov
2019-10-22 14:18 ` [PATCH net-next 10/13] net: sched: tunnel_key: " Vlad Buslov
2019-10-22 14:18 ` [PATCH net-next 11/13] net: sched: act_vlan: support fast init flag to skip pcpu allocation Vlad Buslov
2019-10-22 14:18 ` [PATCH net-next 12/13] net: sched: act_ct: " Vlad Buslov
2019-10-22 14:18 ` [PATCH net-next 13/13] tc-testing: implement tests for new fast_init action flag Vlad Buslov
2019-10-22 14:28 ` [PATCH iproute2-next] tc: implement support for action flags Vlad Buslov
2019-10-22 14:35 ` [PATCH net-next 00/13] Control action percpu counters allocation by netlink flag Marcelo Ricardo Leitner
2019-10-22 14:52 ` Vlad Buslov
2019-10-22 18:17 ` Roman Mashak
2019-10-23 6:38 ` Vlad Buslov
2019-10-23 13:02 ` Jamal Hadi Salim
2019-10-23 13:08 ` Vlad Buslov
2019-10-22 15:15 ` Marcelo Ricardo Leitner
2019-10-22 15:52 ` Vlad Buslov
2019-10-22 17:09 ` Marcelo Ricardo Leitner
2019-10-23 6:42 ` Vlad Buslov
2019-10-24 15:12 ` Roopa Prabhu
2019-10-24 15:18 ` Vlad Buslov
2019-10-24 17:31 ` Marcelo Ricardo Leitner
2019-10-24 18:03 ` Vlad Buslov
2019-10-23 12:49 ` Jamal Hadi Salim
2019-10-23 13:04 ` Vlad Buslov
2019-10-23 14:21 ` Jamal Hadi Salim
2019-10-23 15:04 ` Vlad Buslov
2019-10-24 7:35 ` Jiri Pirko
2019-10-24 15:23 ` Vlad Buslov
2019-10-24 16:12 ` Jamal Hadi Salim
2019-10-24 16:44 ` Vlad Buslov
2019-10-24 17:17 ` Jamal Hadi Salim
2019-10-24 18:05 ` Vlad Buslov
2019-10-25 11:46 ` Jamal Hadi Salim
2019-10-25 11:55 ` Vlad Buslov
2019-10-25 14:26 ` Vlad Buslov
2019-10-25 14:57 ` Jamal Hadi Salim
2019-10-25 15:08 ` Jamal Hadi Salim
2019-10-25 15:18 ` Vlad Buslov
2019-10-25 15:43 ` Jamal Hadi Salim
2019-10-25 16:06 ` Jamal Hadi Salim
2019-10-25 16:10 ` Vlad Buslov
2019-10-25 16:29 ` Jamal Hadi Salim
2019-10-25 16:53 ` Vlad Buslov
2019-10-25 18:17 ` Jamal Hadi Salim
2019-10-25 21:05 ` Jamal Hadi Salim
2019-10-25 21:10 ` Jamal Hadi Salim
2019-10-25 21:52 ` Jamal Hadi Salim
2019-10-26 9:44 ` Vlad Buslov
2019-10-26 12:26 ` Jamal Hadi Salim
2019-10-26 14:52 ` Roman Mashak
2019-10-26 16:06 ` Jamal Hadi Salim
2019-10-26 16:42 ` Vlad Buslov
2019-10-26 18:38 ` Jamal Hadi Salim
2019-10-27 8:31 ` Vlad Buslov
2019-10-27 9:13 ` Jamal Hadi Salim
2019-10-25 16:27 ` Vlad Buslov
2019-10-25 16:08 ` Vlad Buslov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191022141804.27639-3-vladbu@mellanox.com \
--to=vladbu@mellanox.com \
--cc=davem@davemloft.net \
--cc=dcaratti@redhat.com \
--cc=jhs@mojatatu.com \
--cc=jiri@mellanox.com \
--cc=jiri@resnulli.us \
--cc=mleitner@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).