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 4980543A12; Tue, 30 Jan 2024 23:42:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CDE3A402CE; Tue, 30 Jan 2024 23:42:44 +0100 (CET) Received: from NAM04-DM6-obe.outbound.protection.outlook.com (mail-dm6nam04on2077.outbound.protection.outlook.com [40.107.102.77]) by mails.dpdk.org (Postfix) with ESMTP id CE506402CD for ; Tue, 30 Jan 2024 23:42:42 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UBn0SKygWV//QCuvmX0A0XLJ+Xb0z03ZbFCxQaQO66mfGzez949/V0yWpCUP7827NaO42U/sFB7LutcfKuMIwjM0xCIqIl9qt8uD/EVBK1NPMA+b+aiadzYLlLZEUPrVNQYJ9wDwpy7eKjXW9NcTF5jHufXJGrzDdPzaCgpmD41CifLBiC54pkxd8ps0pfO5edf7ph+gqWG3N5XesuPgv7n1L35gzNoGNe25z/AeYJJwmvfoAVkVDyoMEjIPIvnZhGdHvjMl05ZABWwcqsYTvZbUCkWLAEUNLOWVU+tXyPv55pr2Qkgi0jAQWWJiVyYSWpAAIMsqhusQyfD8PzY+ZQ== 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=dQ0eM6+42c4ctODcY7jqEXxSngR53xpxdPuu2e4r2pM=; b=gWUve5jRfR5F3yD20uHxal9JLDkW3fbJ722d96WWvxcq4JhiKnU7Qwx5KyAt50d2izv7QRTyavlp8KLgp2Vov3qLswTM55MvKdiN6O/fjvz6isR3y1B5ANvPk8qjg6QTBgOAmLksNCtd0Y8GLUn+lYKe/vbGfNZJNC7jm8KPRkxFCdWVK6OIfNsG2HngDvUMIJhx5ZIKFC5qfrUWiS0jEvTnxDssiaN/YWjmGFR+VJKigYk1CCP9NHwHn3cVrNHnB+b3VyvyLfIYrVaODH6YSv1pjPkRWKwgGycgSCZ+wW7lHiul1yUEguY7xOToJTTkR0hNrscmtCX7TOI6s1XHsQ== 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=dQ0eM6+42c4ctODcY7jqEXxSngR53xpxdPuu2e4r2pM=; b=ExZiXbx9WYLv9iXZdO8o2GnU1ysb9p75Qj/VDm8Tm0jQg2EYFqpr6y8/zGfuVoPHQ1aJHnW53R6nXDWm48BxPPJrlDnse9wQswBQC6Zmy+6QBaCkHCKJfeXptBN06raFOAUyj2N8VLbVNYSfGkRg4ENtDGXNXi3fb+5HNSNecuw= 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 MN0PR12MB5931.namprd12.prod.outlook.com (2603:10b6:208:37e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7249.22; Tue, 30 Jan 2024 22:42:40 +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.7228.029; Tue, 30 Jan 2024 22:42:40 +0000 Message-ID: Date: Tue, 30 Jan 2024 22:42:36 +0000 User-Agent: Mozilla Thunderbird Subject: Re: [Patch v2] net/mana: use rte_pktmbuf_alloc_bulk for allocating RX WQEs Content-Language: en-US To: Stephen Hemminger Cc: longli@microsoft.com, Andrew Rybchenko , dev@dpdk.org References: <1706150562-23248-1-git-send-email-longli@linuxonhyperv.com> <1706577181-27842-1-git-send-email-longli@linuxonhyperv.com> <20240130084352.56971000@hermes.local> 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/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2YScp9dIV7fsS5tpDwIs7BZNVM1l3NAdK+DLHqNxKuyO 8Zk= In-Reply-To: <20240130084352.56971000@hermes.local> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO6P123CA0043.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:2fe::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_|MN0PR12MB5931:EE_ X-MS-Office365-Filtering-Correlation-Id: a2d39e46-6a51-4061-6514-08dc21e4c3b3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PA40jtsW0lwM0xHKj7QZsCM9xF9V7K6W0BuyoEh90EzaB7rpZfKPcJe+Ylc4yfK4C7kF3Pw6MqzavygfqQlMo6ttXNuP0UzDel918fSUGIhgRCn9LlDZSLQLgafwO/Zfix3int65tn9Orss1LHobjXy8l2JaNq196GTGjsFEKlq9OS7YyrtDibY2YMkjOEeZiYj0U+fKTmRslFb6UEpXAhlNYmgJzfhYl/rhv7qaNDOOYhwRgpKD02gT8imKmZAdcHnYFkDzofF8HKqKhLSN0d5DhVQ0YAJBGOiamm1wIseuZM75NcyvCW/Zb5c2OkLQVaWUZ97r6OFlgk2lJuPE0mU3aKLxTetUzf4w0IfUTucCnL4GNPfTLlQr2Zfv+xYh2bKffz49dMtoRLqccoFHunRW6TBKPdYyszyaAm8CRQVsD/f1ETZacFTW0YOJ2kRDM8B4gX+grp4A36c8GJpX6oF0b46iT8VnzK5URr3OZqb5LAf+KNT+zSPhqFjyQ7cOY+Ww45PjkzHUjwZGIbtwQYTLgagH4Q69hxzbJh7+/qIwzzgDOXwbr7kypZjxhv8CFsE9lRl/Y+DIVrnbGCPoIDsrLXbo4mzZ0ZXyC26w++YLwaIGah+ZuXIYX++6rpMJH4Rp3qB5A+bSnEWW+OtZ5w== 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)(136003)(376002)(346002)(396003)(366004)(39860400002)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(83380400001)(2616005)(6512007)(38100700002)(26005)(8676002)(8936002)(4326008)(44832011)(478600001)(6666004)(6506007)(2906002)(6916009)(5660300002)(66556008)(6486002)(66476007)(53546011)(66946007)(31696002)(316002)(41300700001)(86362001)(36756003)(31686004)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?L1JuZU5DdVlFd1ZvakRSVnJyNmY2dkltWXFNOUZQeVZHS1phaXNicTMxNnhk?= =?utf-8?B?MUF2QStkU2sxWGZ2bEUrZzhjc05jUENFTmxBNTF5Y3o5aGNzNWxnWlhjU2Y5?= =?utf-8?B?STRzK0MzQ1RDU0Vod0psenduUTVYMWRxV2FLaS9kYkEzdW13enM3L2lxeUMw?= =?utf-8?B?NWF1Q00zaHU4Mm93Ly9aRFFQUnlOTlQzWGVINHhicm5vZlBqSzV5a3VnT2xY?= =?utf-8?B?eEE1Rk42RWtlaFErUGIrTGl6ZFprRmdFdXNBdUcrN2owYnZBVzJjaWgyWmVj?= =?utf-8?B?bmtwTkx2V3VmTTNnNUlMQmV5V3FOS0hKQW1uMUtNZTBVc21ydmlENUtEemdo?= =?utf-8?B?Z085MXZad3cvUmxwcStNdFk2ak1IWUU1K1kzeWsvRlFZT2YxamtXN1NqUXR1?= =?utf-8?B?Qm5GNXZ5R005a09IemU0V1oxaHJ6WWFyK0Rmb0JNOXZJY3MyZlYzWWlIQWY0?= =?utf-8?B?enllMDBMY1h4NDlUYmVZMHY5aXdlaUVOZ1RENEhER256L1pxUTFFY1l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VTBka3Z5OGcvL2xuMjNiRUJudjhG?= =?utf-8?B?YnI3UnJlQkw4VmtjZUtrVlRNYUh2OGFRTDBWaEJHYkMvNUdqMFN5UWRzdXZo?= =?utf-8?B?V3ZQL2FjTlRjTVZmbzdQSmE4K3ZGbTdsRG9ZcHRvVEFnSXRDZ1JkV2V0VnRN?= =?utf-8?B?K2lCNGtkUHdDSFd4b3ZxdmZiaXhsbjdORWJidDBuZ1dYcEh1ayt4Zi92M2xv?= =?utf-8?B?ajhGYklOUEJtY3duRjJTU2NvUWZ3OW0ydnRaVWxvSVNnbkdXUEZJSlBuZFRO?= =?utf-8?B?Y2kwSVQwSlduRkMzdzVUYUpvZTRxaDUrQUJUSGQvTHc2RHh2VDF0USs0d3Fk?= =?utf-8?B?VjM0NERqdCtibU1uTnl0OThFQ2UyRWNMRHAybXNiNG15cnp2d3lTeVlqcjJU?= =?utf-8?B?RFl1c1pjd0czWURObXg1UDBzTXJhME9vQjB1UTIvcGhHaDVzZjBadFZnTHVG?= =?utf-8?B?L1JBaU1Ld2J2ZmpFcHd1dHM4cnVlSEZqckFzaENMTlhnZENRYVdBUyt3OVUv?= =?utf-8?B?WXdrelM5cTBoZTlFL1I1VnZ0TEdVZ3ZEQWMxc3hManJTQndQMkJsTmdLaXMx?= =?utf-8?B?ZmIvZk8zdUlPbzhRZTcwdm5HVHMrMjJoa2gxdWI1bkJsWUZsOXZzZ2NYbnhj?= =?utf-8?B?em1pQ1FqNzRQWHM0dmIvbCtOMVZuc1cxVmYrSWd3Wm1Fem9Iem1PdWgrYVU5?= =?utf-8?Q?V3kz1VgHlkLtr8jS04EniVfcR?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: a2d39e46-6a51-4061-6514-08dc21e4c3b3 X-MS-Exchange-CrossTenant-AuthSource: CH2PR12MB4294.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2024 22:42:40.2010 (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: 30QmtxBOkR+gVCCAgbEuxQeUEcftwIFmQECyI2+59pxqCGIA+QxM4cDei+V/BCTW X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR12MB5931 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/30/2024 4:43 PM, Stephen Hemminger wrote: > On Tue, 30 Jan 2024 10:19:32 +0000 > Ferruh Yigit wrote: > >>> -mana_alloc_and_post_rx_wqes(struct mana_rxq *rxq) >>> +mana_alloc_and_post_rx_wqes(struct mana_rxq *rxq, uint32_t count) >>> { >>> int ret; >>> uint32_t i; >>> + struct rte_mbuf **mbufs; >>> + >>> + mbufs = rte_calloc_socket("mana_rx_mbufs", count, sizeof(struct rte_mbuf *), >>> + 0, rxq->mp->socket_id); >>> + if (!mbufs) >>> + return -ENOMEM; >>> >> >> 'mbufs' is temporarily storage for allocated mbuf pointers, why not >> allocate if from stack instead, can be faster and easier to manage: >> "struct rte_mbuf *mbufs[count]" > > That would introduce a variable length array. > VLA's should be removed, they are not supported on Windows and many > security tools flag them. The problem is that it makes the code brittle > if count gets huge. > > But certainly regular calloc() or alloca() would work here. > Most of the existing bulk alloc already uses VLA but I can see the problem it is not being supported by Windows. As this mbuf pointer array is short lived within the function, and being in the fast path, I think continuous alloc and free can be prevented, one option can be to define a fixed size, big enough, array which requires additional loop for the cases 'count' size is bigger than array size, or an array can be allocated by driver init in device specific data ,as we know it will be required continuously in the datapath, and it can be freed during device close()/uninit(). I think an fixed size array from stack is easier and can be preferred.