Embedded Intel® Core™ Processors
Communicate Intel® Core™ Hardware, Software, Firmware, Graphics Concerns

Dpdk packet processing

MKour
Novice
4,605 Views

Hello everyone,

I am currently new to the DPDK library, so my questions are a bit basic.

I would like to know how could someone read a received packet's data using the dpdk functions.

To be more specific a packet we have just captured from running the l3fwd example.

Thank you for your time

1 Solution
CChon
Beginner
1,539 Views

By parsing the packet headers, you can access the UDP payload of course.

About about this,

eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);

if (m->ol_flags & PKT_RX_IPV4_HDR) {

/* Handle IPv4 headers.*/

ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(m, unsigned char *) + sizeof(struct ether_hdr));

udp_hdr = (struct udp_hdr *)(struct (ipv4_hdr + 1);

udp_payload = (uint8_t *)(udp_hdr + 1);

 

Regards,

View solution in original post

0 Kudos
6 Replies
Muthurajan_J_Intel
1,539 Views

Dear customer,

Thanks for using Intel(R)DPDK

If you see in l3fwd_simple_forward function, you will see rte_pktmbuf_mtod used.

Can I please request you to find if that usage is useful to you.

For example, below the usage - eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);

For detailed information about the API, kindly refer to API Document http://www.intel.com/content/www/us/en/intelligent-systems/intel-technology/intel-dpdk-api-reference.html http://www.intel.com/content/www/us/en/intelligent-systems/intel-technology/intel-dpdk-api-reference.html

l3fwd_simple_forward(struct rte_mbuf *m, uint8_t portid, struct lcore_conf *qconf)

{

struct ether_hdr *eth_hdr;

struct ipv4_hdr *ipv4_hdr;

void *d_addr_bytes;

uint8_t dst_port;

eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);

if (m->ol_flags & PKT_RX_IPV4_HDR) {

/* Handle IPv4 headers.*/

ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(m, unsigned char *) +

sizeof(struct ether_hdr));

Thank you

MKour
Novice
1,539 Views
0 Kudos
MKour
Novice
1,539 Views

Regarding your answer, is it possible to use the API to read the UDP payload of a packet?

Thank you for your time and sorry about the beginner questions

0 Kudos
Muthurajan_J_Intel
1,538 Views

Dear customer

DPDK offers high performance Polled mode driver and infrastructure for high performance memory allocation and pinning cores to thread.

UDP layer is something you can definitely develop on top of that.

Currently, below find UDP header defined as http://dpdk.org/doc/api/structudp__hdr.html http://dpdk.org/doc/api/structudp__hdr.html

Also, you are familiar with the pktmbuf [defined in] http://dpdk.org/doc/api/structrte__pktmbuf.html http://dpdk.org/doc/api/structrte__pktmbuf.html

Please find the list of eco systems that provide higher level stack on top of Intel DPDK

https://www-ssl.intel.com/content/www/us/en/intelligent-systems/intel-technology/packet-processing-is-enhanced-with-software-from-intel-dpdk.html https://www-ssl.intel.com/content/www/us/en/intelligent-systems/intel-technology/packet-processing-is-enhanced-with-software-from-intel-dpdk.html?

Thank you very much

0 Kudos
CChon
Beginner
1,540 Views

By parsing the packet headers, you can access the UDP payload of course.

About about this,

eth_hdr = rte_pktmbuf_mtod(m, struct ether_hdr *);

if (m->ol_flags & PKT_RX_IPV4_HDR) {

/* Handle IPv4 headers.*/

ipv4_hdr = (struct ipv4_hdr *)(rte_pktmbuf_mtod(m, unsigned char *) + sizeof(struct ether_hdr));

udp_hdr = (struct udp_hdr *)(struct (ipv4_hdr + 1);

udp_payload = (uint8_t *)(udp_hdr + 1);

 

Regards,

0 Kudos
MKour
Novice
1,538 Views

That is exactly what I was looking for thank you very much for the kind answer

Regards

0 Kudos
Reply