Ok thanks a lot Richardson. I got your point. What confused me was that the size of MBUF and the maximum size are all passed to 'rte_mempool_create' . rte_pktmbuf_alloc has only one parameter , a pointer to the mbuf pool. I got it cleared now. Thanks for your valuable time. Can you answer my other question ?... like I get a segmentation fault when I try to print the ether_type for a packet. This is the print statement: printf("\n Type is %" PRIu16 , *((uint16_t *)eth_type));
Regards On Fri, Mar 14, 2014 at 5:19 PM, Richardson, Bruce < bruce.richardson at intel.com> wrote: > > > From: sabu kurian [mailto:sabu2kurian at gmail.com] > > Sent: Friday, March 14, 2014 11:38 AM > > To: Richardson, Bruce > > Cc: dev at dpdk.org > > Subject: Re: [dpdk-dev] Packet crafting.... > > > > Thanks on the reply Richardson. You did mention something like "Don't > forget that when you get the mbuf from > > rte_pktmbuf_alloc, you also need to set the length value to the > appropriate size." . > > > > Like I'm allocating the mbuf using rte_mbuf . The rte_mempool_create has > already set the maximum packet size > > for a mbuf and the number of mbuf's and all. So do I really need to > use rte_pktmbuf_alloc ? > > How are you getting an mbuf from the pool, if not using rte_pktmbuf_alloc? > When you have an mbuf, that buffer has a maximum size, generally around > 2k. However, the packet inside that buffer is generally smaller than the > overall buffer size and you must configure that size, otherwise the PMD, > and therefore the NIC, has no idea how much data out of that 2k buffer > needs to be transmitted. >