[dpdk-dev] Question regarding multi-segment packet forwarding

Jain, Neeraj 3. (NSN - IN/Bangalore) neeraj.3.jain at nsn.com
Tue Mar 25 13:28:37 CET 2014

I have a question regarding sending of multi-segment packets. I have modified the l2fwd sample application to send a multi-segment packet on tx queue whenever the application receives any packet on Rx queue. Pseudo-code is as below

Function l2fwd_simple_forward(.....)
Allocate new mbuf with "rte_pktmbuf_alloc"
Copy Ethernet, IP and UDP Headers into this new mbuf
Remove the Ethernet, ip and udp header from the beginning of received mbuf by calling rte_pktmbuf_adj api
Join the received buffer with new mbuf as follows:
                new_mbuf->pkt.next = mbuf
                /* accumulate number of segments and total length. */
            new_mbuf ->pkt.nb_segs = new_mbuf->pkt.nb_segs + mbuf->pkt.nb_segs;
            new_mbuf ->pkt.pkt_len += mbuf->pkt.pkt_len;

            /* reset pkt_len and nb_segs for chained fragment. */
            mbuf->pkt.pkt_len = mbuf->pkt.data_len;
            mbuf->pkt.nb_segs = 1;

When I call rte_pktmbuf_dump on the new_mbuf, it shows both the segments. Also l2fwd_send_packet (which eventually calls rte_eth_tx_burst) returns 1 indicating that packet was sent successfully. But I do not receive any packet on the other end.
However, instead of multi-segment packet, if I try sending only the new_mbuf that was created, then the packet is sent successfully.

So, Can you please advice if I am correct in the way multi-segment packets are created or if I am missing something here. Thanks


More information about the dev mailing list