diff options
author | Amir Vadai <amirva@mellanox.com> | 2016-05-13 08:55:36 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-05-16 13:43:50 -0400 |
commit | 9fea47d93bcc98946a6eca0f019ced337564a344 (patch) | |
tree | d236177cc10dce84cd65f6db0269ce12e71c704d /net | |
parent | 3804070235264ea883c3fdccd9ed16fef20b5ccb (diff) |
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 <amirva@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/sched/act_gact.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index 1a6e09fbb2a5..ec5cc8435238 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c | |||
@@ -148,6 +148,20 @@ static int tcf_gact(struct sk_buff *skb, const struct tc_action *a, | |||
148 | return action; | 148 | return action; |
149 | } | 149 | } |
150 | 150 | ||
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 | |||
151 | static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) | 165 | static int tcf_gact_dump(struct sk_buff *skb, struct tc_action *a, int bind, int ref) |
152 | { | 166 | { |
153 | unsigned char *b = skb_tail_pointer(skb); | 167 | unsigned char *b = skb_tail_pointer(skb); |
@@ -207,6 +221,7 @@ static struct tc_action_ops act_gact_ops = { | |||
207 | .type = TCA_ACT_GACT, | 221 | .type = TCA_ACT_GACT, |
208 | .owner = THIS_MODULE, | 222 | .owner = THIS_MODULE, |
209 | .act = tcf_gact, | 223 | .act = tcf_gact, |
224 | .stats_update = tcf_gact_stats_update, | ||
210 | .dump = tcf_gact_dump, | 225 | .dump = tcf_gact_dump, |
211 | .init = tcf_gact_init, | 226 | .init = tcf_gact_init, |
212 | .walk = tcf_gact_walker, | 227 | .walk = tcf_gact_walker, |