[dpdk-users] Usage of "rte_pktmbuf_attach"

Nubin Stanley nubinstanley at gmail.com
Tue Dec 20 13:04:13 CET 2016


Hi All

I have a doubt regarding the usage of :

static inline void rte_pktmbuf_attach(struct rte_mbuf **mi*, struct
rte_mbuf **m*)

Say "mi" is a newly allocated buffer. "m" is a multi-segment buffer (say
with 2 segments). Now, within the attach API, I see that "mi->nb_segs" is
always set to 1.

attach_frames(in_pkt)      // in_pkt has 2 segments
{
     pkt_1 = alloc();    // single segment
     pkt_2 = alloc();    // single segment

     rte_pktmbuf_attach(pkt_2, in_pkt);

     <<Update pkt_2 fields so that only part of in_pkt is used>>

     rte_pktmbuf_chain(pkt_1, pkt_2);
}

1) Will the attach ensure that whatever pkt_2 points to has the 2 segments
in in_pkt ? Or should I somehow loop and allocate new buffers and do
multiple attaches ?
2) Say, attach is properly done, the "chain" API should work as usual ?

Regards
Nubin Stanley


More information about the users mailing list