[dpdk-users] A question about rte_pktmbuf_init() and alike functions

Wiles, Keith keith.wiles at intel.com
Tue Nov 3 20:27:54 CET 2015

On 11/3/15, 1:23 PM, "users on behalf of Александр Самойлов" <users-bounces at dpdk.org on behalf of cidjey1991 at mail.ru> wrote:

> An update. I decided to try this:
>m = rte_pktmbuf_alloc(mp);
>if(unlikely(m == NULL))
>    RTE_LOG(INFO, USER1, "%s: Couldn't allocate pkt_mbuf\n", __func__);
>    return NULL;
>rte_pktmbuf_init(mp, NULL, m, 0);
>rte_mbuf_refcnt_set(m, 1);
>Well, it worked out. My memory is not dirty anymore and TCP checksum is always OK. Thank you for the input.
>But this raises another question: You said that rte_pktmbuf_alloc() implies resetting the buffer to a "sane state". 
>So why this reset doesn't make my new "m" buffer "sane enough" to keep a new frame while rte_pktmbuf_init does?

You can look at the code, but the reset tries to do the least amount work in touching the mbuf header for performance.
>Alex Samoylov


More information about the users mailing list