[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170628182817.13f9d7c7@cakuba.netronome.com>
Date: Wed, 28 Jun 2017 18:28:17 -0700
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: Simon Horman <simon.horman@...ronome.com>
Cc: David Miller <davem@...emloft.net>, netdev@...r.kernel.org,
oss-drivers@...ronome.com,
Pieter Jansen van Vuuren
<pieter.jansenvanvuuren@...ronome.com>
Subject: Re: [PATCH net-next v2 8/9] nfp: add a stats handler for flower
offloads
On Wed, 28 Jun 2017 22:30:01 +0200, Simon Horman wrote:
> @@ -288,7 +292,21 @@ nfp_flower_del_offload(struct nfp_app *app, struct net_device *netdev,
> static int
> nfp_flower_get_stats(struct nfp_app *app, struct tc_cls_flower_offload *flow)
> {
> - return -EOPNOTSUPP;
> + struct nfp_fl_payload *nfp_flow;
> +
> + nfp_flow = nfp_flower_find_in_fl_table(app, flow->cookie);
> + if (!nfp_flow)
> + return -EINVAL;
> +
> + spin_lock(&nfp_flow->lock);
> + tcf_exts_stats_update(flow->exts, nfp_flow->stats.bytes,
> + nfp_flow->stats.pkts, nfp_flow->stats.used);
> +
> + nfp_flow->stats.pkts = 0;
> + nfp_flow->stats.bytes = 0;
> + spin_unlock(&nfp_flow->lock);
> +
> + return 0;
> }
This needs to take spin_lock_bh() to lock out the RX path safely :(
Powered by blists - more mailing lists