Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I have a problem with transmitting jumbo packets with DPDK. The code snippets below show how I create a mempool and then how I send the packet. (This is highly simplified - I haven't shown how I allocate the mbuf or assign the packet data). My problem is that this works fine for small mbufs (BUF_SIZE ==
2048), but I need to send jumbo packets (9000 octets). My understanding is that I need to set the mbuf size to accommodate the largest packet I need to send. But as soon as I increase BUF_SIZE beyond 2048 (say to 4096) the pointer returned by rte_pktmbuf_prepend() is invalid - I get a segmentation fault at
the line shown below. I don't know how to fix this.
Am I setting the parameters to rte_mempool_create() incorrectly?
Is the mempool too large?
Any advice would be appreciated.
I am using dpdk-stable-18.11.9.
//================
// Initialisation
//================
#define BUF_SIZE 4096
#define MBUF_SIZE (BUF_SIZE + sizeof(struct rte_mbuf) +
RTE_PKTMBUF_HEADROOM)
#define NB_MBUF 8192
// (I do check the return value of this call)
rte_mempool_create(buf,
NB_MBUF/2,
MBUF_SIZE,
sizeof(struct rte_pktmbuf_pool_private),
rte_pktmbuf_pool_init,
NULL,
rte_pktmbuf_init,
NULL,
//=============
// Send packet
//=============
// Allocate mbuf from mempool and assign to p_mbuf, assign packet data then
set headers ...
struct udp_hdr* p_udp_hdr = (struct udp_hdr*)rte_pktmbuf_prepend(p_mbuf,
(uint16_t)sizeof(struct udp_hdr));
struct ipv4_hdr* p_ip_hdr = (struct ipv4_hdr*)rte_pktmbuf_prepend(p_mbuf,
(uint16_t)sizeof(struct ipv4_hdr));
if (p_ip_hdr != NULL)
p_ip_hdr->version_ihl = 0x45; <=== SEGMENTATION FAULT HERE
–
To transmit packets in DPDK with large buffer one needs to
Option-1: update the port-conf to chaining of smaller mbuf buffer for larger pkt size
static struct rte_eth_conf port_conf = {
.txmode = {
.offloads = DEV_TX_OFFLOAD_MULTI_SEGS,
Option 2: increase the size of mbuf payload area while creating int the pool.
mp = rte_pktmbuf_pool_create(buf, NB_MBUF, 32, 0, [desired payload size], socket);
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.