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 C215BA0C3F; Thu, 15 Apr 2021 17:45:22 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9345816237C; Thu, 15 Apr 2021 17:45:22 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id D075216237B for ; Thu, 15 Apr 2021 17:45:20 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618501520; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=fxPvx3JqU+3XDu3Ur6GAuT1eLtO1q941peZv9w/Sh/o=; b=L2GbHHLhm/L+TLi9//5bepo/gdKno/6/1ibU0oyxevaw13OZ9mMAd+RE9Dr0REVWuLP+vw s9W6ekgHZAUilLea6Rbnu5a6WOtbu5Z3K4qkueAa5kIxSI8qQ/P0Ddt9CJ8o83wZ0oWVyE /EfV9u7zJ679ukTQ2nvtqw/WBzACZEY= Received: from mail-vk1-f198.google.com (mail-vk1-f198.google.com [209.85.221.198]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-595-i4cRH1emNfGXY4Y_30Cnlg-1; Thu, 15 Apr 2021 11:45:18 -0400 X-MC-Unique: i4cRH1emNfGXY4Y_30Cnlg-1 Received: by mail-vk1-f198.google.com with SMTP id y70-20020a1f32490000b02901df8c87c514so898317vky.4 for ; Thu, 15 Apr 2021 08:45:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fxPvx3JqU+3XDu3Ur6GAuT1eLtO1q941peZv9w/Sh/o=; b=djNWlgGkEaLhvgf6XsQ2Ikbt3IecRhHYTItnNXx96HoDFeWVoCTlLsR/kCmznZUxy3 BQhWCIOz3FOY6M/rlsoWo3xLm42I7teNvXG19TS7mvQzbzmrjbfNXvdZ6ZWHJ60mb88P 8uKrQQooYrxvp447AKAsuLV7MYpWMwf+GgwYbzBJQghtC/dMZdi/70a++FYpaf6nyDnj 9yKziXZB2Po1I3svlJGYk9EC6IG2v/kF96KSfxHglKjciwu4MvxI7R8aGuKOwXWN3aQU c/VavAsHy1cI6Br9NAPa+wqB1DxI2gBWIIRTFq0CL2QbLp9AjDSX0VVWDCbjLsuILToc za+A== X-Gm-Message-State: AOAM530VaY4dWWEQOjSFhsdg3gRCBNZEylhqmHZIaQsPpJ9FKpTrwvqC kvde+F7UUjItzr9VbdTO0y1wy6cY0E66di10yA07JK5zrw0qYW0hygcFtPCG64OjIk71ltOMLOa MmI15w4lD3wQXS0HcM6M= X-Received: by 2002:a1f:d283:: with SMTP id j125mr2743487vkg.9.1618501517913; Thu, 15 Apr 2021 08:45:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNXJoQysAQJiOQRi6ogLSE4n+2uY4+4r0YvaqzN1uGi+z1qh9XpCRhkI0gjuOGrbZEH/faP/zOWFurhFz0R8k= X-Received: by 2002:a1f:d283:: with SMTP id j125mr2743454vkg.9.1618501517589; Thu, 15 Apr 2021 08:45:17 -0700 (PDT) MIME-Version: 1.0 References: <87be741c28c8d93a4cf93dc1af556cd4ead687ed.1617790501.git.bnemeth@redhat.com> In-Reply-To: From: David Marchand Date: Thu, 15 Apr 2021 17:45:06 +0200 Message-ID: To: Maxime Coquelin , Balazs Nemeth Cc: dev Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v2 3/4] vhost: allocate and free packets in bulk 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 Sender: "dev" On Thu, Apr 15, 2021 at 5:33 PM Maxime Coquelin wrote: > On 4/7/21 12:17 PM, Balazs Nemeth wrote: > > Now that all allocation and freeing has been moved together, use the > > faster bulk versions instead of handling packets one by one. > > > > Signed-off-by: Balazs Nemeth > > --- > > lib/librte_vhost/virtio_net.c | 11 ++++++----- > > 1 file changed, 6 insertions(+), 5 deletions(-) > > > > diff --git a/lib/librte_vhost/virtio_net.c b/lib/librte_vhost/virtio_net.c > > index 496f750e3..2f0c97b91 100644 > > --- a/lib/librte_vhost/virtio_net.c > > +++ b/lib/librte_vhost/virtio_net.c > > @@ -2469,10 +2469,10 @@ virtio_dev_tx_packed(struct virtio_net *dev, > > { > > uint32_t pkt_idx = 0; > > uint32_t remained = count; > > - uint16_t i; > > > > - for (i = 0; i < count; ++i) > > - pkts[i] = rte_pktmbuf_alloc(mbuf_pool); > > + if (rte_pktmbuf_alloc_bulk(mbuf_pool, pkts, count)) { > > + return 0; > > + } > > OK, get it now :) > Maybe just add a comment in previous patches that it is going to be > handled when moving to bulk allocation. Looking at the whole series, it is easy to read and understand as a single patch. And it avoids this intermediate issue. -- David Marchand