[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170628195518.3397bab1@cakuba.netronome.com>
Date: Wed, 28 Jun 2017 19:55:18 -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:
> From: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@...ronome.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.
>
> Signed-off-by: Pieter Jansen van Vuuren <pieter.jansenvanvuuren@...ronome.com>
> Signed-off-by: Simon Horman <simon.horman@...ronome.com>
> @@ -334,7 +441,10 @@ int nfp_modify_flow_metadata(struct nfp_app *app,
> /* Update flow payload with mask ids. */
> nfp_flow->unmasked_data[NFP_FL_MASK_ID_LOCATION] = new_mask_id;
>
> - return 0;
> + /* Release the stats ctx id. */
> + temp_ctx_id = be32_to_cpu(nfp_flow->meta.host_ctx_id);
> +
> + return nfp_release_stats_entry(app, temp_ctx_id);
> }
>
> int nfp_flower_metadata_init(struct nfp_app *app)
> @@ -362,6 +472,15 @@ int nfp_flower_metadata_init(struct nfp_app *app)
> return -ENOMEM;
> }
>
> + /* Init ring buffer and unallocated stats_ids. */
> + priv->stats_ids.free_list.buf =
> + vmalloc(NFP_FL_STATS_ENTRY_RS * NFP_FL_STATS_ELEM_RS);
> + if (!priv->stats_ids.free_list.buf) {
> + vfree(priv->mask_ids.mask_id_free_list.buf);
> + return -ENOMEM;
This is hiding a leak, I think. There were 2 things allocate above.
Please add a proper unwind path with goto's - it makes catching bugs
like this much easier.
> + }
> + priv->stats_ids.init_unalloc = NFP_FL_REPEATED_HASH_MAX;
> +
> return 0;
> }
>
Powered by blists - more mailing lists