[dpdk-users] How to fix segmentation fault with large mempool (to support jumbo packets) ?

David Aldrich david.aldrich.ntml at gmail.com
Thu Aug 6 19:35:26 CEST 2020


Hi

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,
                   0,
                   sizeof(struct rte_pktmbuf_pool_private),
                   rte_pktmbuf_pool_init,
                   NULL,
                   rte_pktmbuf_init,
                   NULL,
                   4,
                   0);

//=============
// 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

Best regards
David


More information about the users mailing list