[PATCH v4 4/5] node: add error stats for ip4 lookup node

Robin Jarry rjarry at redhat.com
Fri Oct 11 11:48:40 CEST 2024


Hi Pavan,

, Aug 16, 2024 at 17:09:
> From: Pavan Nikhilesh <pbhagavatula at marvell.com>
>
> Add error counters for ip4 LPM lookup failures in
> ip4_lookup node.
>
> Signed-off-by: Pavan Nikhilesh <pbhagavatula at marvell.com>

[snip]

> diff --git a/lib/node/node_private.h b/lib/node/node_private.h
> index 1de7306792..36b2a733db 100644
> --- a/lib/node/node_private.h
> +++ b/lib/node/node_private.h
> @@ -12,6 +12,8 @@
>  #include <rte_mbuf.h>
>  #include <rte_mbuf_dyn.h>
>  
> +#include <rte_graph_worker_common.h>
> +
>  extern int rte_node_logtype;
>  #define RTE_LOGTYPE_NODE rte_node_logtype
>  
> @@ -88,4 +90,10 @@ node_mbuf_priv2(struct rte_mbuf *m)
>  	return (struct node_mbuf_priv2 *)rte_mbuf_to_priv(m);
>  }
>  
> +#define NODE_INCREMENT_ERROR_ID(node, id, cond, cnt)                                               \
> +	{                                                                                          \
> +		if (unlikely(rte_graph_has_stats_feature() && (cond)))                             \
> +			((uint64_t *)RTE_PTR_ADD(node, node->err_off))[id] += (cnt);               \
> +	}

This is private API which is not usable with out-of-tree nodes. Could 
you expose a way to increment a given error stat that does not involve 
a hacky macro?

How about something like this in rte_graph_worker_common.h:

static inline void
rte_node_increment_error(struct rte_node *node, uint16_t err_id, uint64_t value)
{
#ifdef RTE_LIBRTE_GRAPH_STATS
        uint64_t *errors = RTE_PTR_ADD(node, node->err_off);
        errors[err_id] += value;
#else
        RTE_SET_USED(node);
        RTE_SET_USED(err_id);
        RTE_SET_USED(value);
#endif
}

NB: do *not* include a condition in that function. The decision whether 
to increment an error stat or not should remain in the nodes.



More information about the dev mailing list