DPDK usage discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Lokesh Chakka <lvenkatakumarchakka@gmail.com>
Cc: users <users@dpdk.org>
Subject: Re: reuse the packets after tx burst
Date: Mon, 12 Aug 2024 07:52:16 -0700	[thread overview]
Message-ID: <20240812075216.534be9db@hermes.local> (raw)
In-Reply-To: <CACh--sgRhG5kwpyA+7ucs9u9H8ZV4ngT_4KTx9=CNz=G2vsQNQ@mail.gmail.com>

On Mon, 12 Aug 2024 15:55:50 +0530
Lokesh Chakka <lvenkatakumarchakka@gmail.com> wrote:

> hello,
> 
> Here is a small piece of code :
> 
> while( condition )
> {
> 
> 	if( rte_eth_tx_burst( port_id, 0, mbuf, num_of_pkts_per_queue ) !=
> num_of_pkts_per_queue )
> 	{
> 		fprintf( stderr, "%d %s\n", rte_errno, rte_strerror(rte_errno) );
> 		rte_exit( EXIT_FAILURE, "%s %d rte_eth_tx_burst port id: %u\n",
> __func__, __LINE__, port_id );//second iteration failing.
> 	}
> 	fprintf( stderr, "%s %d port: %u packet: %c sent %u packets\n",
> __func__, __LINE__, port_id, argv[3][0], num_of_pkts_per_queue
> );//printing once
> 	for( pkt_count=0; pkt_count<num_of_pkts_per_queue; pkt_count++ )
> 	{//want to send same data again...!!!
> 		mbuf[pkt_count]->pkt_len = mbuf[pkt_count]->data_len = dev_info.max_mtu;
> 
> 	}
> 
> }
> 
> Can someone help me understand how to reuse the packets again to send the
> same data ?
> 

When packet is passed to tx_burst, the ownership of that mbuf is passed
to the driver. The driver will free it after it is sent.

One option would be to increase the reference count on the packet before sending.
Using rte_mbuf_refcnt_update() function to add one to refcount.
Then the driver will decrement refcount and the refcount will still be one (not freed).

Assume this is some kind of packet generator.

  reply	other threads:[~2024-08-12 14:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-12 10:25 Lokesh Chakka
2024-08-12 14:52 ` Stephen Hemminger [this message]
2024-08-14 12:27   ` Lokesh Chakka
2024-08-14 14:59     ` Stephen Hemminger
2024-08-15 16:18       ` Lokesh Chakka
2024-08-16  7:12         ` Lokesh Chakka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240812075216.534be9db@hermes.local \
    --to=stephen@networkplumber.org \
    --cc=lvenkatakumarchakka@gmail.com \
    --cc=users@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).