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 4A8FC43872; Tue, 9 Jan 2024 12:28:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 188AD402C6; Tue, 9 Jan 2024 12:28:21 +0100 (CET) Received: from NAM12-DM6-obe.outbound.protection.outlook.com (mail-dm6nam12on2087.outbound.protection.outlook.com [40.107.243.87]) by mails.dpdk.org (Postfix) with ESMTP id 2E4F04021F for ; Tue, 9 Jan 2024 12:28:19 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hjFimdYv0ohf0fPgSLzi1x1NzuCeln1pbqAD+iZyC5AumUsqIwn9vszo5JVbJgmOugiBJXC3NOeNquFPT3eV1HGw+sEGcYZgEB5oXOUhrzms93IIt2dn6DQxfZJewHPx1jCy1OHRkMezAwqzuV8KWCz8wcyt9XJZXR8qTRhH7AWHi7qgvEMs6DSTzTc+5Dd0M77+bpmbAhzciliWe4Q8afkkusFMPh7hwEgVccgODOMJUbCshh8M7k+pkqAh9vvuaBIriSO5aHppUGp2E7weMlzq8LVd2vV2z1voC9Bayt73N+HIMOwIgl+1GlgGw1L5LveKg1Y3t/SxVprA9GuBvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=l6M0/i15pfiFNvCGXa94XmXuKL3/iXU05LvCrMMmW2g=; b=MObB9ZrwE5x9PQZ6d1kwgzMjUXfdD9Twbcvckq6g/MtflbfHRlHsbZI3YI1sg5eqN1AlXn5yKjJzF5nUF5RGmMTLFzFJDjsje0y4EcAU51J35SC+zk2hfZunhDQ1T/bpd3Ptoi8gvdXCp2ejYXOZ3PNilvo3al/iepvt9bxfLbpO1+PrmxfS3fmEA1Uyt97YoJQ3hNNivEhk/um1/lEMoKNutURR3twnLQqQ2KpIjW7aptSXyzjZLtsLI/x9NwF3uKh8a6KDJvjBcpFhzRts9mQZrIb6xi2ITYocH3nYxuBlC4VT0bARtVK77BnAPHM0zlx3BTWh/+w/J2fJEtSv7g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=l6M0/i15pfiFNvCGXa94XmXuKL3/iXU05LvCrMMmW2g=; b=3XgpPZAqH2xtOSquYJ42pbA0sjHlaiWev2l/9cwquk5HkZdoVxqQdJDs78UXJ90xYEttVzpLLwod/rTOGZaZfc8HzhSOq+OqqAcNcasuz7JiEhTzUKXLFKlnH1adYWVdSA7Qh5LUgwoAnwauqGoyhsx96YsDzOvyCWuGs9pXabg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) by SA1PR12MB9003.namprd12.prod.outlook.com (2603:10b6:806:389::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Tue, 9 Jan 2024 11:28:16 +0000 Received: from CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::815a:45e6:cf5e:479f]) by CH2PR12MB4294.namprd12.prod.outlook.com ([fe80::815a:45e6:cf5e:479f%4]) with mapi id 15.20.7159.020; Tue, 9 Jan 2024 11:28:16 +0000 Message-ID: <65b0a54a-a1fc-44a4-be15-04194b478b8c@amd.com> Date: Tue, 9 Jan 2024 11:28:10 +0000 User-Agent: Mozilla Thunderbird Subject: Re: unnecessary rx callbacks when zero packets Content-Language: en-US To: Konstantin Ananyev , Stephen Hemminger , "dev@dpdk.org" References: <20240107093721.512f1365@hermes.local> Cc: Honnappa Nagarahalli , =?UTF-8?Q?Morten_Br=C3=B8rup?= From: Ferruh Yigit Autocrypt: addr=ferruh.yigit@amd.com; keydata= xsFNBGJDD3EBEAC/M7Tk/DfQSmP1K96vyzdhfSBzlCaGtcxNXorq4fALruqVsD3oi0yfyEz9 4YN8x7py0o9EL8ZdpOX0skc0AMCDAaw033uWhCn0GLMeGRKUbfOAPvL6ecSDvGD7CJIO9j0J eZUvasBgPdM/435PEr9DmC6Ggzdzt8IuG4PoLi5jpFSfcqxZFCCxLUDEo/w0nuguk2FTuYJg B2zEZ4JTBZrw7hIHiFh8D8hr6YA6a5uTofq1tr+l048lbtdFUl8TR0aIExVzE4Z8qKZlcE+9 RQaewjK5Al1jLE4sHdmd3GN+IvgDF3D/fLsi25SKJDeGSdeHkOmaX0qGeM4WKIfU6iARRCiQ N3AmBIxZ/A7UXBKLaOyZ+/i3sE6Wb53nrO4i8+0K2Qwyh6LjTeiJAIjYKN43ppxz3DaI+QwQ vI+uyHr4Gg0Da9EPPz/YyKauSeOZCfCB5gIfICO0j6x0SCl8uQ2nLpjxcZkf0gjcwUzP3h+S 3x6NfDji9YEij0zczW/dcSpGgZ6vsFpPrtnP9ZXy6J53yp0kJtOJoOlkEFFdU2yCZnCDseum CoudmGLZVvS0/DzHDJejq+3kK3FDGktZBOxZIIpal+nFqS7lVgOZc4+huVv3jyhzoAUOEyXA XK5j6o7g8STUY+z33QNnHpdLvecMwuzmvqy0jR54yAbZ64mB9QARAQABzSNGZXJydWggWWln aXQgPGZlcnJ1aC55aWdpdEBhbWQuY29tPsLBlwQTAQgAQQIbAwULCQgHAgYVCgkICwIEFgID AQIeAQIXgAIZARYhBEm7aYjps5XGsPHCElRTPtCKKm/6BQJkdyEEBQkE3meNAAoJEFRT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M1l3NAdK+DLHqNxKuyO 8Zk= In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: FRYP281CA0007.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10::17) To CH2PR12MB4294.namprd12.prod.outlook.com (2603:10b6:610:a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CH2PR12MB4294:EE_|SA1PR12MB9003:EE_ X-MS-Office365-Filtering-Correlation-Id: 0230ca5c-538f-41f3-b808-08dc110612dd X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: YbDs7WVxiC4mN9RUWFG+8Du6xaKQLMLCzGnG1uwlZnH2wl3m933sKTDcz36xHTEobECmMr5/DcWR5UmuhsNmOaBMdtSHs20I8sq95nmWy6tpME2AB0lgL/BJZtl9GoSRAKd4cW6cJXND5LC/1h3lXwq/hNCVTZtbZ84bA/JCZA89P5PT7nSbVCy61JjQwoOanyXuj3ZtzwUOUZQzwEkA7dfyvBx7YiG3zBK04Y32JlucSkvUEZg7973XysL4y+7AxvVrRbW3vS78HtRLr2EyxWmJxES+PZ7sUH2JOfnEX67XDuvWX3gaXSsbalp1Mb6VPbvwl0YPnUj4y/UHinuK/m0OKfGoDlGK79PH4BX7KBgIM+/i5bXfK8o8UuMt489u8mIDpQoKUZqWjINmedh7gLYLhgDZGHt/wVBZdGrvsKP7vE2nH1G7IhqX/+NjEn6/WricUMoti3fTF0jjl2fMWyt8ZYWJW0PtshEeZZqAKSDcw3DqDHzlyqAK0Z/akGKxX+ZR/jJomlO9DakdT4jYYK9t25FXpZRp/zBwL3X37Kob8MxYvYjmjgrcU6OHMsxeVFS2Ac5ixXn3wrWPDUB8cL/ULDubcwMjiqQlgz/P3yXhYz3QQC0mQUFFeOF2l0SjkkZ5vngO0uw476P6HdyTdw== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CH2PR12MB4294.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(39860400002)(366004)(346002)(396003)(376002)(136003)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(31686004)(6506007)(6486002)(2616005)(53546011)(6666004)(478600001)(6512007)(26005)(38100700002)(36756003)(31696002)(5660300002)(41300700001)(66476007)(83380400001)(86362001)(2906002)(316002)(54906003)(110136005)(66556008)(4326008)(8936002)(66946007)(8676002)(44832011)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bzFqbE84akNLZ1NsbWhwMjhOUXcvdmI1WXU0M05Jb3BSeWVud0hMeXhmN0hN?= =?utf-8?B?Ymx0VXRjWkVrSm5pWUdZTmRJcFJKM1VVNThYL3I5WFNYeTZBcXBpaUNIcVZs?= =?utf-8?B?czJiL2FRcmpkMWZlTUsyRDRVa0cxL3c3VERTa1ovZ1F3MHJad25KZ0NTN3Bk?= =?utf-8?B?cVR2eERWT0R2c3RGN3YvNkxDSjd4ZWtrR1hBRllvakxzaFBvMTRhZ2Q3a0s2?= =?utf-8?B?UTF6cVZwSjljRUp6aVE0Sk1CTW5LR2dHRFRaVzJNUFVveDJyb3RiMVJiMzN3?= =?utf-8?B?RFNGc21WaWFBTG5JQklKL3RXVFBmZnIvMUs3RlpqaGhidHAxSFhCclZ6alo2?= =?utf-8?B?V0hCNkpxTlgwdkU5OW1SSlVxWUI3MmtocEpoUS9saGZyVmo2WHB0eUtwZ3B4?= =?utf-8?B?RVhBeitUTGthQUpDSEZrNnMxbkZMNm01VDBmUzF5Z1ZKc0QvZHFDR2hSdjd6?= =?utf-8?B?VFZOWVh6aGxHbkFwYzlYZ05oRmI0WExvYjVKMnZ0Sjd5blpnUVJPL3IzMWlG?= =?utf-8?B?dEY2SGU4ZHdnbUto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mQ4?= =?utf-8?B?eXZJVHhDTWRVcU4zUzlodFY5bFNzUUdkbUZBV0lSQmZ5K3YveHQ1ZWF5clFn?= =?utf-8?B?UFVuOHM4dER2aVNJWElUL0x0WXVTcDhtWnA0WmlJQVg0V0JRMzAvTFVxVXQx?= =?utf-8?B?M3JTcUVwcFlLTTVFeU5SNWN5Nnk2UzlGeHBCdlVMZzJXb1Vpekw4c2pPZVZl?= =?utf-8?B?Rzlwa29zSUs4TkRBT2NMR0FaaU52OHpiU2RFVU1ZSU5ub00rYTN2bmdUZ2g1?= =?utf-8?B?YVdySGR5SzRldEFOZE5rU2N0ZDdZc0YyMDNzZFFscEMvaHZZdm1DOEFEYWdU?= =?utf-8?B?c1dXZURjUDRubEUrTG1OZUpmUk45Qmo0N3NSYkFZcS82R3I5OE4wMDc2VjNu?= =?utf-8?B?UW9SSlNTOXpXcmMyb3p4eDFIUzN5S0lMc1NDR3YrR0JBeEJQMjF0a2lwUkZ4?= =?utf-8?B?WndyM2ZmaTVHWVNvNm9Sc3RqQ0N6NUVFOC9zWmkyN0pEaFFSUHlTUThLR2dy?= =?utf-8?B?U2N0QXN4M2lvN0VaUk0yQk9rOVFYQi9YSWF4SkthcVJkRUpZV04yYlJ5bHVU?= =?utf-8?B?cTBmanhIYm8yc3Jpa1ZnMnNUaGZRYW5Pd3RVSTVFZHRQOHUwako2STlMeUow?= =?utf-8?B?ZC80eUQzV3FZVm14OWI1UG9QZzNyY2MvMWxWTjBqRFdTaDVGbkdYVXBaZi9M?= =?utf-8?Q?2yko=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0230ca5c-538f-41f3-b808-08dc110612dd X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jan 2024 11:28:16.7315 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ExeyyPPP53aTNl8Blzef5U5ik7dbpkC+pK5QThXV9Gv1TP5iEkR89Ho/K1EPo/Q3 X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB9003 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 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