DPDK usage discussions
 help / color / mirror / Atom feed
From: "Wu, Xiaoban" <Xiaoban_Wu@student.uml.edu>
To: "users@dpdk.org" <users@dpdk.org>
Subject: [dpdk-users] A minor suggestion to the comment of the rte_eth_tx_burst() of dpdk-16.04
Date: Fri, 10 Jun 2016 19:09:03 +0000	[thread overview]
Message-ID: <DM2PR0201MB0832DB2170B295AE1DC7BEF3BC500@DM2PR0201MB0832.namprd02.prod.outlook.com> (raw)

Dear DPDK Users,


I have a very small suggestion to the comment of the rte_eth_tx_burst(). It is not a big deal to the experienced users, but I think this will make the new users know how to use this function more clearly and see the big picture easily.


The comment of "tx_pkts" says:

 * @param tx_pkts
 *   The address of an array of *nb_pkts* pointers to *rte_mbuf* structures
 *   which contain the output packets.


I am a beginner of DPDK. If I see this comment I would probably naively use rte_zmalloc() to construct such pointer array, for each pointer I use rte_malloc() to allocate memory, and finally fill the memory starting from the position (pointed by the macro rte_pktmbuf_mtod()) with real packet content(header and payload).


But I just find that the rte_eth_tx_burst() will call the rte_pktmbuf_free() to free the struct rte_mbuf. In default, "CONFIG_RTE_LIBRTE_MBUF_DEBUG=n", this means it will skip the __rte_mbuf_sanity_check(), and will finally get into rte_mempool_put(). Since above construction process skip the construction of the field "struct rte_mempool", it means the "struct rte_mempool" field is null in each packet "struct rte_mbuf"(of course, all the fields are zero). Hence it will finally cause segmentation fault.


Thus, I have a very small suggestion, please add something like "It is recommended that the tx_pkts is constructed by rte_pktmbuf_pool_create() combined with rte_mempool_get_bulk(), if not please make sure the fields of the struct rte_mbuf are correctly configured."


Thank you,

Xiaoban

             reply	other threads:[~2016-06-10 19:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-10 19:09 Wu, Xiaoban [this message]
2016-06-10 21:41 ` Thomas Monjalon
2016-06-13 13:36   ` Olivier Matz

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=DM2PR0201MB0832DB2170B295AE1DC7BEF3BC500@DM2PR0201MB0832.namprd02.prod.outlook.com \
    --to=xiaoban_wu@student.uml.edu \
    --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).