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 C8FD143859; Sun, 7 Jan 2024 18:37:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 94E4D402E0; Sun, 7 Jan 2024 18:37:25 +0100 (CET) Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) by mails.dpdk.org (Postfix) with ESMTP id 1BFA0402B1 for ; Sun, 7 Jan 2024 18:37:24 +0100 (CET) Received: by mail-io1-f41.google.com with SMTP id ca18e2360f4ac-7ba903342c2so125040339f.3 for ; Sun, 07 Jan 2024 09:37:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1704649043; x=1705253843; darn=dpdk.org; h=content-transfer-encoding:mime-version:message-id:subject:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=jj2+DKEPzjuutGRLrgeMG6XYdduS6flGVDUtSfMRGJk=; b=Qk2Ld7SINhAK9bEZGaWepoGVJ3cGyRfv1rvx/WhuUNpajOk71igkP6EeyKJ/bmsRFU kmRokZFvKygIjUW9s8ITBqgc2WgkTYovqxbDVHqKGEgBCYxmFTM4IcjONzfWWMIA3AZ9 7l3tV8ZCFKIdXJNqbPGOAJW6jmJr8/XuV75eVU+szgiyZz4d0EAt+ANMdhwQK1R2oW18 WfdsCuVQA0etjjbSCYz+Eo3rpfcyobZc4sPy7BFpGTRteTas3MSWXKEFy4Eu1ns3NBUI V91IIOrdIDYeqHvx1oTNYzyYyAY+UOMaHvc88YUjm8j0YLaNQDw3ORxei57z9bWNPAPA h2aw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704649043; x=1705253843; h=content-transfer-encoding:mime-version:message-id:subject:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jj2+DKEPzjuutGRLrgeMG6XYdduS6flGVDUtSfMRGJk=; b=a4fNpKRliAkQxr2a8x+0vH/iPn9MM2iqZ/Z7Mi6QNgkmpudeznEOieY05cLCiJ3w6C Hu7OCbVhwp+Bsw+w2H2lGzobRT5OEoqp+vr0yIykanp9fVrMHosEygPpm+Mtx+dDLSQJ RsE82qCwyhCmOqghZoxXVGbPiy2ERi6E3pAtlKoNrflave4GkNSaVoDGoEux6RJ5tpNR X00Yb9G1hKptc8BzlpwP6y2BdrHfsVfXYtWZ78IiPRql+qt3B5utrMVNtc2SEh8IByhi 25ORZdKLuK/YP34IIffFrq95Z0GwHT8Fkus8bLPsZHur73Ri4PaVcl7tvC6jpFBvIbaV kqUA== X-Gm-Message-State: AOJu0YwVuVCM5FQtIxyjsl7X18npLJX1PHCModjpxdVQkh3PRzcLE7NA win2cswc6hxjyeF7VZ2KBbH9Kfs1S3+arwuQqswyrn+GlQ0= X-Google-Smtp-Source: AGHT+IGzwcpZzKeOWm2JD5U2NaAhJu0szxVH6Em4NPTBPSfLuVNh8S3GeAVB/NsNmZVyBvpixbZC4w== X-Received: by 2002:a05:6e02:160c:b0:35f:f1e2:c3c7 with SMTP id t12-20020a056e02160c00b0035ff1e2c3c7mr5394168ilu.123.1704649043202; Sun, 07 Jan 2024 09:37:23 -0800 (PST) Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141]) by smtp.gmail.com with ESMTPSA id t3-20020a17090ae50300b0028d22041d38sm3331929pjy.13.2024.01.07.09.37.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jan 2024 09:37:23 -0800 (PST) Date: Sun, 7 Jan 2024 09:37:21 -0800 From: Stephen Hemminger To: dev@dpdk.org Subject: unnecessary rx callbacks when zero packets Message-ID: <20240107093721.512f1365@hermes.local> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 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. 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