DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] Changing rte_mbuf
@ 2021-06-15  6:42 mohamad ali
  2021-06-16  6:31 ` David Marchand
  2021-06-18 10:06 ` Tom Barbette
  0 siblings, 2 replies; 4+ messages in thread
From: mohamad ali @ 2021-06-15  6:42 UTC (permalink / raw)
  To: users

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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-users] Changing rte_mbuf
  2021-06-15  6:42 [dpdk-users] Changing rte_mbuf mohamad ali
@ 2021-06-16  6:31 ` David Marchand
  2021-06-16 15:26   ` Stephen Hemminger
  2021-06-18 10:06 ` Tom Barbette
  1 sibling, 1 reply; 4+ messages in thread
From: David Marchand @ 2021-06-16  6:31 UTC (permalink / raw)
  To: mohamad ali; +Cc: users

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-users] Changing rte_mbuf
  2021-06-16  6:31 ` David Marchand
@ 2021-06-16 15:26   ` Stephen Hemminger
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2021-06-16 15:26 UTC (permalink / raw)
  To: David Marchand; +Cc: mohamad ali, users

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [dpdk-users] Changing rte_mbuf
  2021-06-15  6:42 [dpdk-users] Changing rte_mbuf mohamad ali
  2021-06-16  6:31 ` David Marchand
@ 2021-06-18 10:06 ` Tom Barbette
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Barbette @ 2021-06-18 10:06 UTC (permalink / raw)
  To: mohamad ali, users

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)

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-06-18 10:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-15  6:42 [dpdk-users] Changing rte_mbuf mohamad ali
2021-06-16  6:31 ` David Marchand
2021-06-16 15:26   ` Stephen Hemminger
2021-06-18 10:06 ` Tom Barbette

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).