All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <simon.horman@netronome.com>
To: Or Gerlitz <gerlitz.or@gmail.com>
Cc: David Miller <davem@davemloft.net>,
	Jakub Kicinski <jakub.kicinski@netronome.com>,
	Linux Netdev List <netdev@vger.kernel.org>,
	oss-drivers@netronome.com,
	Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
Subject: Re: [PATCH net-next v2 8/9] nfp: add a stats handler for flower offloads
Date: Thu, 29 Jun 2017 17:27:52 +0200	[thread overview]
Message-ID: <20170629152750.GD6215@vergenet.net> (raw)
In-Reply-To: <CAJ3xEMg6Eu+wo=P0kUDHCs_N2K=-qDeZ02sMX2wE+48snr9i2Q@mail.gmail.com>

On Thu, Jun 29, 2017 at 06:16:41PM +0300, Or Gerlitz wrote:
> On Wed, Jun 28, 2017 at 11:30 PM, Simon Horman
> <simon.horman@netronome.com> wrote:
> > From: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@netronome.com>
> >
> > 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.
> 
> > +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?

Yes, they are incremental.

> 
> > +       nfp_flow->stats.used = jiffies;
> 
> if nothing was changed since your last reading, it's wrong to say that
> used == NOW

This function is called on receipt of a message from the firmware.
And the firmware will only send a message if there is a change in
the counters.

> 
> > +       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?

  reply	other threads:[~2017-06-29 15:28 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28 20:29 [PATCH net-next v2 0/9] introduce flower offload capabilities Simon Horman
2017-06-28 20:29 ` [PATCH net-next v2 1/9] net: switchdev: add SET_SWITCHDEV_OPS helper Simon Horman
2017-06-28 20:29 ` [PATCH net-next v2 2/9] nfp: add phys_switch_id support Simon Horman
2017-06-28 20:29 ` [PATCH net-next v2 3/9] nfp: provide infrastructure for offloading flower based TC filters Simon Horman
2017-06-29  1:35   ` Jakub Kicinski
2017-06-29  5:41     ` Simon Horman
2017-06-29  1:53   ` Jakub Kicinski
2017-06-29  8:16     ` Simon Horman
2017-06-29 13:56   ` Or Gerlitz
2017-06-29 14:31     ` Simon Horman
2017-06-28 20:29 ` [PATCH net-next v2 4/9] nfp: extend flower add flow offload Simon Horman
2017-06-29  6:18   ` Yunsheng Lin
2017-06-29  6:48     ` Jakub Kicinski
2017-06-29 13:47       ` David Laight
2017-06-28 20:29 ` [PATCH net-next v2 5/9] nfp: extend flower matching capabilities Simon Horman
2017-06-29 14:31   ` Or Gerlitz
2017-06-29 15:01     ` Simon Horman
2017-06-29 14:33   ` Or Gerlitz
2017-06-29 15:00     ` Simon Horman
2017-06-28 20:29 ` [PATCH net-next v2 6/9] nfp: add basic action capabilities to flower offloads Simon Horman
2017-06-28 20:30 ` [PATCH net-next v2 7/9] nfp: add metadata to each flow offload Simon Horman
2017-06-29  2:33   ` Jakub Kicinski
2017-06-29  8:14     ` [oss-drivers] " Simon Horman
2017-06-29  8:42       ` Jakub Kicinski
2017-06-29 11:22         ` Simon Horman
2017-06-28 20:30 ` [PATCH net-next v2 8/9] nfp: add a stats handler for flower offloads Simon Horman
2017-06-29  1:28   ` Jakub Kicinski
2017-06-29  8:14     ` [oss-drivers] " Simon Horman
2017-06-29  2:55   ` Jakub Kicinski
2017-06-29  8:15     ` [oss-drivers] " Simon Horman
2017-06-29 14:39   ` Or Gerlitz
2017-06-29 14:53     ` Simon Horman
2017-06-29 15:16   ` Or Gerlitz
2017-06-29 15:27     ` Simon Horman [this message]
2017-06-28 20:30 ` [PATCH net-next v2 9/9] nfp: add control message passing capabilities to " Simon Horman
2017-06-29 13:46   ` Or Gerlitz
2017-06-29 14:45     ` David Laight
2017-06-29 15:21   ` Or Gerlitz
2017-06-29 15:30     ` Simon Horman
2017-06-29 15:59       ` Or Gerlitz
2017-06-29 17:35         ` Simon Horman

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=20170629152750.GD6215@vergenet.net \
    --to=simon.horman@netronome.com \
    --cc=davem@davemloft.net \
    --cc=gerlitz.or@gmail.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=netdev@vger.kernel.org \
    --cc=oss-drivers@netronome.com \
    --cc=pieter.jansenvanvuuren@netronome.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.