From: Olivier Matz <olivier.matz@6wind.com>
To: Thomas Monjalon <thomas.monjalon@6wind.com>,
"Wu, Xiaoban" <Xiaoban_Wu@student.uml.edu>
Cc: users@dpdk.org
Subject: Re: [dpdk-users] A minor suggestion to the comment of the rte_eth_tx_burst() of dpdk-16.04
Date: Mon, 13 Jun 2016 15:36:58 +0200 [thread overview]
Message-ID: <575EB6FA.4080002@6wind.com> (raw)
In-Reply-To: <1666418.3LcrSlnKs6@xps13>
Hi,
On 06/10/2016 11:41 PM, Thomas Monjalon wrote:
> 2016-06-10 19:09, Wu, Xiaoban:
>> 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."
>
> Good suggestion. Olivier do you agree?
Yes, I'll send a patch to dev@dpdk.org to enhance the API doc.
Thanks Xiaoban for reporting.
Regards,
Olivier
prev parent reply other threads:[~2016-06-13 13:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-10 19:09 Wu, Xiaoban
2016-06-10 21:41 ` Thomas Monjalon
2016-06-13 13:36 ` Olivier Matz [this message]
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=575EB6FA.4080002@6wind.com \
--to=olivier.matz@6wind.com \
--cc=Xiaoban_Wu@student.uml.edu \
--cc=thomas.monjalon@6wind.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).