DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] Error : dereferencing pointer to incomplete type......
@ 2014-03-17  8:21 sabu kurian
  2014-03-17  8:27 ` sabu kurian
  0 siblings, 1 reply; 4+ messages in thread
From: sabu kurian @ 2014-03-17  8:21 UTC (permalink / raw)
  To: dev

Hello friends,

I get a error like "dereferencing pointer to incomplete type", when I try
to fill in the IPv4 headers.

Below is the code snippet:

struct ether_hdr *ehdr = rte_pktmbuf_mtod(m_pool, struct ether_hdr *);

struct ipv4_hdr *iphdr = (struct ipv4_hdr *)(&ehdr[1]);


iphdr->packet_id = (uint16_t)0x0001; //This gives error.

rte_bswap16(iphdr->packet_id,0x0001); //This format also gives the same
error.

And also what is the best way to copy an 8 bit (1 byte) value for fields
like 'type_of_service' ? will rte_memcpy() work for it ?



Thanks in advance....

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

* Re: [dpdk-dev] Error : dereferencing pointer to incomplete type......
  2014-03-17  8:21 [dpdk-dev] Error : dereferencing pointer to incomplete type sabu kurian
@ 2014-03-17  8:27 ` sabu kurian
  2014-03-17 19:42   ` Daniel Kaminsky
  2014-03-18  9:55   ` Richardson, Bruce
  0 siblings, 2 replies; 4+ messages in thread
From: sabu kurian @ 2014-03-17  8:27 UTC (permalink / raw)
  To: dev

A little bit of correction on the second format:

iphdr->packet_id = rte_bswap16(0x0001); // This one gives error as well....

Any idea on what could be wrong ?

Thanks






On Mon, Mar 17, 2014 at 1:51 PM, sabu kurian <sabu2kurian@gmail.com> wrote:

> Hello friends,
>
> I get a error like "dereferencing pointer to incomplete type", when I try
> to fill in the IPv4 headers.
>
> Below is the code snippet:
>
> struct ether_hdr *ehdr = rte_pktmbuf_mtod(m_pool, struct ether_hdr *);
>
> struct ipv4_hdr *iphdr = (struct ipv4_hdr *)(&ehdr[1]);
>
>
> iphdr->packet_id = (uint16_t)0x0001; //This gives error.
>
> rte_bswap16(iphdr->packet_id,0x0001); //This format also gives the same
> error.
>
> And also what is the best way to copy an 8 bit (1 byte) value for fields
> like 'type_of_service' ? will rte_memcpy() work for it ?
>
>
>
> Thanks in advance....
>
>

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

* Re: [dpdk-dev] Error : dereferencing pointer to incomplete type......
  2014-03-17  8:27 ` sabu kurian
@ 2014-03-17 19:42   ` Daniel Kaminsky
  2014-03-18  9:55   ` Richardson, Bruce
  1 sibling, 0 replies; 4+ messages in thread
From: Daniel Kaminsky @ 2014-03-17 19:42 UTC (permalink / raw)
  To: sabu kurian; +Cc: dev

Hi,

Are you sure that this is the line that gives the error? How did you define
m_pool?

Regarding coping one byte, copy using simple assignment should be the most
efficient way. If you want to make sure it is just 8 bits, do a bit wise
and (& 0xff).

Daniel


On Mon, Mar 17, 2014 at 10:27 AM, sabu kurian <sabu2kurian@gmail.com> wrote:

> A little bit of correction on the second format:
>
> iphdr->packet_id = rte_bswap16(0x0001); // This one gives error as well....
>
> Any idea on what could be wrong ?
>
> Thanks
>
>
>
>
>
>
> On Mon, Mar 17, 2014 at 1:51 PM, sabu kurian <sabu2kurian@gmail.com>
> wrote:
>
> > Hello friends,
> >
> > I get a error like "dereferencing pointer to incomplete type", when I try
> > to fill in the IPv4 headers.
> >
> > Below is the code snippet:
> >
> > struct ether_hdr *ehdr = rte_pktmbuf_mtod(m_pool, struct ether_hdr *);
> >
> > struct ipv4_hdr *iphdr = (struct ipv4_hdr *)(&ehdr[1]);
> >
> >
> > iphdr->packet_id = (uint16_t)0x0001; //This gives error.
> >
> > rte_bswap16(iphdr->packet_id,0x0001); //This format also gives the same
> > error.
> >
> > And also what is the best way to copy an 8 bit (1 byte) value for fields
> > like 'type_of_service' ? will rte_memcpy() work for it ?
> >
> >
> >
> > Thanks in advance....
> >
> >
>

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

* Re: [dpdk-dev] Error : dereferencing pointer to incomplete type......
  2014-03-17  8:27 ` sabu kurian
  2014-03-17 19:42   ` Daniel Kaminsky
@ 2014-03-18  9:55   ` Richardson, Bruce
  1 sibling, 0 replies; 4+ messages in thread
From: Richardson, Bruce @ 2014-03-18  9:55 UTC (permalink / raw)
  To: sabu kurian, dev

Maybe check that you have included the header files with the correct structure definitions.

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of sabu kurian
> Sent: Monday, March 17, 2014 8:28 AM
> To: dev@dpdk.org
> Subject: Re: [dpdk-dev] Error : dereferencing pointer to incomplete type......
> 
> A little bit of correction on the second format:
> 
> iphdr->packet_id = rte_bswap16(0x0001); // This one gives error as well....
> 
> Any idea on what could be wrong ?
> 
> Thanks
> 
> 
> 
> 
> 
> 
> On Mon, Mar 17, 2014 at 1:51 PM, sabu kurian <sabu2kurian@gmail.com>
> wrote:
> 
> > Hello friends,
> >
> > I get a error like "dereferencing pointer to incomplete type", when I
> > try to fill in the IPv4 headers.
> >
> > Below is the code snippet:
> >
> > struct ether_hdr *ehdr = rte_pktmbuf_mtod(m_pool, struct ether_hdr
> *);
> >
> > struct ipv4_hdr *iphdr = (struct ipv4_hdr *)(&ehdr[1]);
> >
> >
> > iphdr->packet_id = (uint16_t)0x0001; //This gives error.
> >
> > rte_bswap16(iphdr->packet_id,0x0001); //This format also gives the
> > same error.
> >
> > And also what is the best way to copy an 8 bit (1 byte) value for
> > fields like 'type_of_service' ? will rte_memcpy() work for it ?
> >
> >
> >
> > Thanks in advance....
> >
> >

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

end of thread, other threads:[~2014-03-18  9:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-17  8:21 [dpdk-dev] Error : dereferencing pointer to incomplete type sabu kurian
2014-03-17  8:27 ` sabu kurian
2014-03-17 19:42   ` Daniel Kaminsky
2014-03-18  9:55   ` Richardson, Bruce

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).