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 78D5143A0F; Tue, 30 Jan 2024 19:05:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6897F402CD; Tue, 30 Jan 2024 19:05:38 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 57229402A8 for ; Tue, 30 Jan 2024 19:05:37 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1086) id 82EBF2057C07; Tue, 30 Jan 2024 10:05:36 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 82EBF2057C07 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1706637936; bh=vVuL7/2YTZI5fDlNZtNvyjj4+nSfPwD5RjIsJe10aSs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mq7m2mDJOWSGerpnYZK9j6pdnfetcPw54BTVfwVTphhJm2IqlR4lDuhz+z7lbZPGd QH5JLInmC5RKGnmMPZwH+PUVbfz1JnUOXvrjcRlv1SQq35l+cGD+lh0zR+ejcY9BU7 5xwNBz2X7KlvEpBKN4Xhjk3k/U3+FmwFfypVQwUk= Date: Tue, 30 Jan 2024 10:05:36 -0800 From: Tyler Retzlaff To: Stephen Hemminger Cc: Ferruh Yigit , longli@microsoft.com, Andrew Rybchenko , dev@dpdk.org Subject: Re: [Patch v2] net/mana: use rte_pktmbuf_alloc_bulk for allocating RX WQEs Message-ID: <20240130180536.GA10167@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1706150562-23248-1-git-send-email-longli@linuxonhyperv.com> <1706577181-27842-1-git-send-email-longli@linuxonhyperv.com> <20240130084352.56971000@hermes.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240130084352.56971000@hermes.local> User-Agent: Mutt/1.5.21 (2010-09-15) 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 Tue, Jan 30, 2024 at 08:43:52AM -0800, 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. +1 > > But certainly regular calloc() or alloca() would work here.