[dpdk-dev] Client Server Application using DPDK API

Bruce Richardson bruce.richardson at intel.com
Tue Mar 15 11:41:33 CET 2016


On Tue, Mar 15, 2016 at 09:06:12AM +0000, Vivek Gupta wrote:
> Hi
> 
> I am developing a network program using DPDK API. I want to extract the data which is there is rte_mbuf structure.
> 
> Referred to rte_mbuf structure manual but confused with fields 
> 
> uint16_t buf_len;         /**< Length of segment buffer. */
> uint16_t data_len;        /**< Amount of data in segment buffer. */
> 
> 
> Can someone help me to understand how to extract data from buffer?

The first value is the size of the buffer, the second is the amount of data
in the buffer. When working with a packet in an mbuf, the data_len is the value
you want.

/Bruce

> 
> Thanks & regards
> Vivek Gupta
> 
> -----Original Message-----
> From: Remy Horton [mailto:remy.horton at intel.com] 
> Sent: Wednesday, March 09, 2016 10:14 PM
> To: Vivek Gupta
> Cc: dev at dpdk.org
> Subject: Re: [dpdk-dev] Client Server Application using DPDK API
> 
> 'noon,
> 
> On 09/03/2016 08:45, Vivek Gupta wrote:
> > Hi
> >
> > I want to write a Client Server application using DPDK API on a single 
> > machine. What are the basic building block for that. How can we write 
> > such application?
> 
> examples/l2fwd/main.c and examples/ethtool/ethtool-app/main.c are probably the easier examples to follow. In terms of function calls, it is pretty much:
> 
> rte_eal_init(..);
> for (each port) {
> 	rte_pktmbuf_pool_create(..);
> 	rte_eth_dev_configure(..);
> 	rte_eth_dev_rx_queue_setup(..);
> 	rte_eth_dev_tx_queue_setup(..);
> 	rte_eth_dev_start(..);
> }
> while(1) {
> 	rte_eth_rx_burst(..); /* incoming frames */
> 	rte_eth_tx_burst(..); /* outgoing frames */ }
> 
> Bear in mind that DPDK deals with MAC frames rather than higher level IP packets, which may be an issue if you intend to use TCP/IP based application protocols.
> 
> 
> > ::DISCLAIMER::
> 
> Avoid using confidentality disclaimers on mailing list emails. It tends to "annoy" people.. :)
> 
> Regards,
> 
> ..Remy
> 
> 
> ::DISCLAIMER::
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> 
> The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
> E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted,
> lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents
> (with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates.
> Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the
> views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification,
> distribution and / or publication of this message without the prior written consent of authorized representative of
> HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately.
> Before opening any email and/or attachments, please check them for viruses and other defects.
> 
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> 


More information about the dev mailing list