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 713C043866; Mon, 8 Jan 2024 16:21:00 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09EDE4027E; Mon, 8 Jan 2024 16:21:00 +0100 (CET) Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by mails.dpdk.org (Postfix) with ESMTP id 9626140261 for ; Mon, 8 Jan 2024 16:20:59 +0100 (CET) Received: from mail.maildlp.com (unknown [172.18.186.231]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4T7yQW31jnz6FGX8; Mon, 8 Jan 2024 23:19:15 +0800 (CST) Received: from frapeml500005.china.huawei.com (unknown [7.182.85.13]) by mail.maildlp.com (Postfix) with ESMTPS id E0E351404F5; Mon, 8 Jan 2024 23:20:58 +0800 (CST) Received: from frapeml500007.china.huawei.com (7.182.85.172) by frapeml500005.china.huawei.com (7.182.85.13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Mon, 8 Jan 2024 16:20:58 +0100 Received: from frapeml500007.china.huawei.com ([7.182.85.172]) by frapeml500007.china.huawei.com ([7.182.85.172]) with mapi id 15.01.2507.035; Mon, 8 Jan 2024 16:20:58 +0100 From: Konstantin Ananyev To: Stephen Hemminger , "dev@dpdk.org" Subject: RE: unnecessary rx callbacks when zero packets Thread-Topic: unnecessary rx callbacks when zero packets Thread-Index: AQHaQZA1SvyjeiZtCEmhNpNS5aEiy7DQCQxg Date: Mon, 8 Jan 2024 15:20:58 +0000 Message-ID: References: <20240107093721.512f1365@hermes.local> In-Reply-To: <20240107093721.512f1365@hermes.local> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.206.138.42] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 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 rx callbacks when zero packets >=20 > I noticed while looking at packet capture that currently the receive call= backs > 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 t= hat > an application could be using callbacks as some form of scheduling mechan= ism > which would be broken. As I remember, original idea was to allow callbacks to inject new packets i= f needed. >=20 > The change would be: >=20 >=20 > 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_i= d, > nb_rx =3D p->rx_pkt_burst(qd, rx_pkts, nb_pkts); >=20 > #ifdef RTE_ETHDEV_RXTX_CALLBACKS > - { > + if (nb_rx > 0) { > void *cb; >=20 > /* rte_memory_order_release memory order was used when th= e