DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@amd.com>
To: Konstantin Ananyev <konstantin.ananyev@huawei.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	"dev@dpdk.org" <dev@dpdk.org>
Cc: "Honnappa Nagarahalli" <Honnappa.Nagarahalli@arm.com>,
	"Morten Brørup" <mb@smartsharesystems.com>
Subject: Re: unnecessary rx callbacks when zero packets
Date: Tue, 9 Jan 2024 11:28:10 +0000	[thread overview]
Message-ID: <65b0a54a-a1fc-44a4-be15-04194b478b8c@amd.com> (raw)
In-Reply-To: <e1cf039bea144cf0bc642d05ab5f7626@huawei.com>

On 1/8/2024 3:20 PM, Konstantin Ananyev wrote:
> 
> rx callbacks when zero packets
>>
>> I noticed while looking at packet capture that currently the receive callbacks
>> get called even if there are no packets. This seems unnecessary since if
>> nb_rx is zero, then there are no packets to look at.  My one concern is that
>> an application could be using callbacks as some form of scheduling mechanism
>> which would be broken.
> 
> As I remember, original idea was to allow callbacks to inject new packets if needed.
> 

Right, callback function updating 'nb_rx' enables this.

Also Honnappa has a good point that callback can be used to calculate
zero packet polls.

These points are not documented and not obvious from the code,
@Stephen does it make sense to document that callback function called
with zero packet intentionally, in the 'rte_eth_rx_burst()' function
comment?

>>
>> The change would be:
>>
>>
>> diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
>> index 21e3a21903ec..f64bf977c46e 100644
>> --- a/lib/ethdev/rte_ethdev.h
>> +++ b/lib/ethdev/rte_ethdev.h
>> @@ -6077,7 +6077,7 @@ rte_eth_rx_burst(uint16_t port_id, uint16_t queue_id,
>>         nb_rx = p->rx_pkt_burst(qd, rx_pkts, nb_pkts);
>>
>>  #ifdef RTE_ETHDEV_RXTX_CALLBACKS
>> -       {
>> +       if (nb_rx > 0) {
>>                 void *cb;
>>
>>                 /* rte_memory_order_release memory order was used when the


      reply	other threads:[~2024-01-09 11:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-07 17:37 Stephen Hemminger
2024-01-07 20:57 ` Honnappa Nagarahalli
2024-01-08 10:19   ` Morten Brørup
2024-01-08 15:20 ` Konstantin Ananyev
2024-01-09 11:28   ` Ferruh Yigit [this message]

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=65b0a54a-a1fc-44a4-be15-04194b478b8c@amd.com \
    --to=ferruh.yigit@amd.com \
    --cc=Honnappa.Nagarahalli@arm.com \
    --cc=dev@dpdk.org \
    --cc=konstantin.ananyev@huawei.com \
    --cc=mb@smartsharesystems.com \
    --cc=stephen@networkplumber.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).