[PATCH v5 06/22] mbuf: add mbuf descriptor accessors

Thomas Monjalon thomas at monjalon.net
Sat Feb 24 12:01:46 CET 2024


24/02/2024 09:21, Tyler Retzlaff:
> Provide inline functions to access rearm data and rx descriptor fields
> in rte_mbuf struct.
[...]
> +static inline
> +uint64_t *
> +rte_mbuf_rearm_data(struct rte_mbuf *m)
> +{
> +	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, ol_flags) !=
> +			 offsetof(struct rte_mbuf, data_off) + 8);
> +	RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, rearm_data) !=
> +			 RTE_ALIGN(offsetof(struct rte_mbuf,
> +					    data_off),
> +					    16));
> +
> +	return (uint64_t *)&m->data_off;
> +}
> +
> +static inline
> +void *
> +rte_mbuf_rx_descriptor_fields1(struct rte_mbuf *m)
> +{
> +	return &m->packet_type;
> +}

We need to enforce usage of these accessors.
Please add these 2 things:
1/ comments in the mbuf structure to encourage using these functions
2/ checkpatch warning if using the markers directly in new code




More information about the dev mailing list