- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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,
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for the helpful answer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That is exactly what I was looking for thank you very much for the kind answer
Regards

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page