DPDK usage discussions
 help / color / mirror / Atom feed
* [dpdk-users] Using rte_eth_tx_burst in a loop with sleep()
@ 2016-08-16 20:47 Maik Pfeil
  2016-08-16 20:54 ` Stephen Hemminger
  0 siblings, 1 reply; 2+ messages in thread
From: Maik Pfeil @ 2016-08-16 20:47 UTC (permalink / raw)
  To: users

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?

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-users] Using rte_eth_tx_burst in a loop with sleep()
  2016-08-16 20:47 [dpdk-users] Using rte_eth_tx_burst in a loop with sleep() Maik Pfeil
@ 2016-08-16 20:54 ` Stephen Hemminger
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2016-08-16 20:54 UTC (permalink / raw)
  To: Maik Pfeil; +Cc: users

On Tue, 16 Aug 2016 22:47:06 +0200
Maik Pfeil <maik.pfeil@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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-08-16 20:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-16 20:47 [dpdk-users] Using rte_eth_tx_burst in a loop with sleep() Maik Pfeil
2016-08-16 20:54 ` Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).