[dpdk-users] Using rte_eth_tx_burst in a loop with sleep()

Stephen Hemminger stephen at networkplumber.org
Tue Aug 16 22:54:01 CEST 2016


On Tue, 16 Aug 2016 22:47:06 +0200
Maik Pfeil <maik.pfeil at gmail.com> wrote:

> Hi,
> 
> if I am using rte_eth_tx_burst() in a loop:
> 
>        for(;;) {
>            count_tx = rte_eth_tx_burst(0, 0, frame_burst, 9);
>            sleep(1);
>            ltime=time(NULL);
>            printf("%s", asctime(localtime(&ltime)));
>            printf("`-- Sent %d packets.\n", asctime(localtime(&ltime)),
> count_tx);
>        }
> 
> The array frame_burst[] is filled with 10 packets.
> 
> I would expect to send every 1 second 10 frames.
> 
> But after first 10 packets sent out and 1 second sleep, DPDK starts sending
> out around 10k pps.
> 
> Do you have any idea how to solve?

When you pass frame_burst array to the device driver, the ownership of the mbuf's
changes and after sending, the device driver will free them.

Therefore you need to either:
create a new set of mbufs into frame_burst array for each iteration;
or increase the reference count on each mbuf in the frame_burst array
before sending.


More information about the users mailing list