[PATCH v7 1/2] node: add global node mbuf dynfield

Stephen Hemminger stephen at networkplumber.org
Thu Jun 26 15:59:01 CEST 2025


On Thu, 19 Jun 2025 21:14:49 +0530
Nitin Saxena <nsaxena at marvell.com> wrote:

> +#ifndef RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE
> +/** Size of persistent mbuf fields */
> +#define RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE          (0)
> +#endif /* RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE */
> +
> +#ifndef RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE
> +/** Size of overloadable mbuf fields */
> +#define RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE        (8)
> +#endif /* RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE */
> +
> +/** Size of node mbuf dynamic field */
> +#define RTE_NODE_MBUF_DYNFIELD_SIZE     \
> +	(RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE + RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE)
> +
> +/**
> + * Node mbuf overloadable data.
> + *
> + * Out-of-tree nodes can repurpose overloadable fields via
> + * rte_node_mbuf_overload_fields_get(mbuf). Overloadable fields are not
> + * preserved and typically can be used with-in two adjacent nodes in the graph.
> + */
> +typedef struct rte_node_mbuf_overload_fields {
> +	union {
> +		uint8_t data[RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE];
> +	};
> +} rte_node_mbuf_overload_fields_t;

Having a blank scratchpad rather than a real defined structure means you
lose any type checking or potential overflow checking.


More information about the dev mailing list