On Wed, 28 Jun 2017 22:30:01 +0200, Simon Horman wrote:
> From: Pieter Jansen van Vuuren <[email protected]>
>
> 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 <[email protected]>
> Signed-off-by: Simon Horman <[email protected]>
> @@ -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;
> }
>