From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9454543863; Mon, 8 Jan 2024 11:19:48 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 668C240263; Mon, 8 Jan 2024 11:19:48 +0100 (CET) Received: from dkmailrelay1.smartsharesystems.com (smartserver.smartsharesystems.com [77.243.40.215]) by mails.dpdk.org (Postfix) with ESMTP id 41D8240261 for ; Mon, 8 Jan 2024 11:19:47 +0100 (CET) Received: from smartserver.smartsharesystems.com (smartserver.smartsharesys.local [192.168.4.10]) by dkmailrelay1.smartsharesystems.com (Postfix) with ESMTP id 186B12049C; Mon, 8 Jan 2024 11:19:47 +0100 (CET) Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: unnecessary rx callbacks when zero packets X-MimeOLE: Produced By Microsoft Exchange V6.5 Date: Mon, 8 Jan 2024 11:19:42 +0100 Message-ID: <98CBD80474FA8B44BF855DF32C47DC35E9F118@smartserver.smartshare.dk> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: unnecessary rx callbacks when zero packets Thread-Index: AQHaQZA0T4QMxPSltEOfXqesiIHfc7DO1MUwgADd/fA= References: <20240107093721.512f1365@hermes.local> From: =?iso-8859-1?Q?Morten_Br=F8rup?= To: "Honnappa Nagarahalli" , "Stephen Hemminger" , Cc: "nd" , "nd" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org > From: Honnappa Nagarahalli [mailto:Honnappa.Nagarahalli@arm.com] > Sent: Sunday, 7 January 2024 21.57 >=20 > > From: Stephen Hemminger > > Sent: Sunday, January 7, 2024 11:37 AM > > > > 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. > Is it possible that the call back functions are maintaining statistics > on zero packet polls? I agree with this concern. The primary argument for introducing the = callbacks (instead of the application simply calling the same functions = at RX and TX time) was to provide instrumentation outside of the = application itself. And for instrumentation purposes, zero-packet calls = may be relevant. TX also calls its callback with zero packets. The callbacks treatment = should be the same for both RX and TX: Either always call, or only call = if non-zero packets. So: NAK. Perhaps the packet capture library can be optimized for zero packets = instead. >=20 > > > > 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 =3D 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