CC lng-odp-dpdk mailing list.

On 26 January 2018 at 04:27, lin huang <mit...@outlook.com> wrote:

> Hi all,
>     I checked the code of odp-dpdk. And I got a problem which confused me
> a lot.
> In the function packet_alloc(), odp tried to alloc a buffer which
> originated from the mbuf at the dpdk memory pool.
> After that, rte_pktmbuf_alloc() got a pointer which ponted to the
> beginning of mbuf structures.
> Then the code just changed the pointer to point to odp_packet_hdr_t type.
> Is there something wrong?? Or rte_mempool_create() has done some magic
> work before alloc the mbuf??
> rte_mbuf: +==============+============================================
> ===========================+============+=======================+
>             |   rte_mbuf    |                   RTE_PKTMBUF_HEADROOM
>                                   | pkt data    | RTE_PKTMBUF_TRAILROOM |
>             +==============+============================================
> ===========================+============+=======================+
>     mbuf = rte_pktmbuf_alloc(pool->s.rte_mempool);
>     if (mbuf == NULL) {
>         rte_errno = ENOMEM;
>         return ODP_PACKET_INVALID;
>     }
>     pkt_hdr = (odp_packet_hdr_t *)mbuf;
>     pkt_hdr->buf_hdr.totsize = mbuf->buf_len;
>

Reply via email to