Hi i want to change rte_mbuf struct and add some custom struct to it but when i change it and compile again some error related to this line shows up. RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) > OCTEONTX_FPAVF_BUF_OFFSET); What is the correct way to add struct to rte_mbuf ? thanks.
On Wed, Jun 16, 2021 at 8:09 AM mohamad ali <ali64mohammad64@gmail.com> wrote:
> Hi i want to change rte_mbuf struct and add some custom struct to it but
> when i change it and compile again some error related to this line shows up.
> RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) > OCTEONTX_FPAVF_BUF_OFFSET);
>
> What is the correct way to add struct to rte_mbuf ?
The correct way is not to add anything to rte_mbuf :-).
If your application needs some private space per mbuf, you should
instead embed the rte_mbuf struct into a structure of yours.
Create a mempool with a private size accounting for this and make sure
to init this private space per object.
--
David Marchand
On Wed, 16 Jun 2021 08:31:02 +0200
David Marchand <david.marchand@redhat.com> wrote:
> On Wed, Jun 16, 2021 at 8:09 AM mohamad ali <ali64mohammad64@gmail.com> wrote:
> > Hi i want to change rte_mbuf struct and add some custom struct to it but
> > when i change it and compile again some error related to this line shows up.
> > RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) > OCTEONTX_FPAVF_BUF_OFFSET);
> >
> > What is the correct way to add struct to rte_mbuf ?
>
> The correct way is not to add anything to rte_mbuf :-).
>
> If your application needs some private space per mbuf, you should
> instead embed the rte_mbuf struct into a structure of yours.
> Create a mempool with a private size accounting for this and make sure
> to init this private space per object.
>
>
Also after 20.11 use the dynamic field support
Le 15-06-21 à 08:42, mohamad ali a écrit : > Hi i want to change rte_mbuf struct and add some custom struct to it but > when i change it and compile again some error related to this line shows up. > RTE_BUILD_BUG_ON(sizeof(struct rte_mbuf) > OCTEONTX_FPAVF_BUF_OFFSET); > > What is the correct way to add struct to rte_mbuf ? > thanks. > You should use dynamic fields instead (https://doc.dpdk.org/api/rte__mbuf__dyn_8h.html)