Thread (41 messages) 41 messages, 5 authors, 2017-06-29

Re: [PATCH net-next v2 8/9] nfp: add a stats handler for flower offloads

flat view

From: Or Gerlitz <hidden>
Date: 2017-06-29 15:16:42

On Wed, Jun 28, 2017 at 11:30 PM, Simon Horman
[off-list ref] wrote:
From: Pieter Jansen van Vuuren <redacted>

Previously there was no way of updating flow rule stats after they
have been offloaded to hardware. This is solved by keeping track of
stats received from hardware and providing this to the TC handler
on request.
quoted hunk ↗ jump to hunk
+static void
+nfp_flower_update_stats(struct nfp_app *app, struct nfp_fl_stats_frame *stats)
+{
+       struct nfp_fl_payload *nfp_flow;
+       unsigned long flower_cookie;
+
+       flower_cookie = be64_to_cpu(stats->stats_cookie);
+
+       rcu_read_lock();
+       nfp_flow = nfp_flower_find_in_fl_table(app, flower_cookie);
+       if (!nfp_flow)
+               goto exit_rcu_unlock;
+
+       if (nfp_flow->meta.host_ctx_id != stats->stats_con_id)
+               goto exit_rcu_unlock;
+
+       spin_lock(&nfp_flow->lock);
+       nfp_flow->stats.pkts += be32_to_cpu(stats->pkt_count);
+       nfp_flow->stats.bytes += be64_to_cpu(stats->byte_count);
you're using += with the values you get form the fw, are they incremental?
+       nfp_flow->stats.used = jiffies;
if nothing was changed since your last reading, it's wrong to say that
used == NOW
+       spin_unlock(&nfp_flow->lock);
if indeed you need to keep a clone of earlier calls to correctly
compute the (last)used value,
maybe you can get rid of the locking?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help