From: David Aldrich <david.aldrich.ntml@gmail.com>
To: users <users@dpdk.org>
Subject: [dpdk-users] How to fix segmentation fault with large mempool (to support jumbo packets) ?
Date: Thu, 6 Aug 2020 18:35:26 +0100 [thread overview]
Message-ID: <CAJK_ieiUzoXpcf9a5+NwAu+RPYZS2qNOLswVuVKsGrK3sEo9Gg@mail.gmail.com> (raw)
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
reply other threads:[~2020-08-06 17:35 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJK_ieiUzoXpcf9a5+NwAu+RPYZS2qNOLswVuVKsGrK3sEo9Gg@mail.gmail.com \
--to=david.aldrich.ntml@gmail.com \
--cc=users@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).