DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] How to fix segmentation fault with large mempool (to support jumbo packets) ?
@ 2020-08-06 17:35 David Aldrich
  0 siblings, 0 replies; only message in thread
From: David Aldrich @ 2020-08-06 17:35 UTC (permalink / raw)
  To: users

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-08-06 17:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-06 17:35 [dpdk-users] How to fix segmentation fault with large mempool (to support jumbo packets) ? David Aldrich

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).