From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3BDAFA00BE; Tue, 29 Oct 2019 13:21:39 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0ABD31BEA8; Tue, 29 Oct 2019 13:21:39 +0100 (CET) Received: from sysclose.org (smtp.sysclose.org [69.164.214.230]) by dpdk.org (Postfix) with ESMTP id 4DFE31BE89 for ; Tue, 29 Oct 2019 13:21:37 +0100 (CET) Received: by sysclose.org (Postfix, from userid 5001) id 6D8C730A7; Tue, 29 Oct 2019 12:21:38 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 sysclose.org 6D8C730A7 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sysclose.org; s=201903; t=1572351698; bh=zhtGv4p/9R0KlCL5BXcmHVuAdcs3xIkaiZzX6Hrhr44=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IDA6corubf/StuXZ/xUJsBzZTaLFzoQCkaz5m70ePuLeZCoVlfyXl8Ai4/h8dKKFQ X9UAh3qVwVXly4FKvGiRDX2MELSFPGRZ0Ch7NzT/VOThoqDDxfXiSNAwaLmfIclW7w 2l2Ia+MU5WZ4Vsq9egemu46vWJ4uCB5jAaif3mVDamwD9Xxdl1xJwEOgtqIs/2OnFm TSQTuyxVAOgp5zpcnJnioXpZxQReeL80uZ/mfq+aPTD/L6wkGanlKNVPcbpYBjjM93 3/Qa0tiFJnw6z0/22wkWxfx2lsag1TqqZGYwg/w4v/XlAPSouPNO9z02deuZYr7lfF yUmhZ8uKDxJuQ== X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.sysclose.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from p50.lan (unknown [177.183.215.210]) by sysclose.org (Postfix) with ESMTPSA id 66B032F9B; Tue, 29 Oct 2019 12:21:36 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 sysclose.org 66B032F9B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sysclose.org; s=201903; t=1572351697; bh=zhtGv4p/9R0KlCL5BXcmHVuAdcs3xIkaiZzX6Hrhr44=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=DJKR5ldOVYj8R7c4V2RZKVCRCuacY6jXo28z7bE3/X7J/D6eOTNabj6pQEOv28Ovb rlk+xDHss4EqTYASD72GF1m5Q65ZNVEh7wmHcvXHedRcZUJv2jQLQp7GZydWbef+I7 2xr+Tv1Ee2nw43pYUrvI1JqHFoSUB+H+mHDUKlH+PqQovhhH5VP/tDxxpnM7hQlJzj HD7J3f4oa5RH+LmlMiTHSUZ4ihD8oHoHACsUUXEvyDT3juK6+sRa1jXh7sDqEy2VC7 0EN/cqej6TdmxCj+Bb/8cQ3XK56Vwj9MXztBoHYM6uZ47Ba33EE6/qSTv0L2KJKw6H YiELBnhKhm7uQ== Date: Tue, 29 Oct 2019 09:21:28 -0300 From: Flavio Leitner To: David Marchand Cc: dev , Ilya Maximets , Maxime Coquelin , Shahaf Shuler , Tiwei Bie , Obrembski MichalX , Stokes Ian Message-ID: <20191029092128.58bb6c9f@p50.lan> In-Reply-To: References: <20191015161727.32570-1-fbl@sysclose.org> <20191015185951.6295-1-fbl@sysclose.org> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH v5] vhost: add support for large buffers X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 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 Tue, 29 Oct 2019 10:02:57 +0100 David Marchand wrote: > On Tue, Oct 15, 2019 at 9:00 PM Flavio Leitner > wrote: > > diff --git a/lib/librte_vhost/virtio_net.c > > b/lib/librte_vhost/virtio_net.c index 5b85b832d..da69ab1db 100644 > > --- a/lib/librte_vhost/virtio_net.c > > +++ b/lib/librte_vhost/virtio_net.c > > @@ -1289,6 +1289,93 @@ get_zmbuf(struct vhost_virtqueue *vq) > > return NULL; > > } > > > > +static void > > +virtio_dev_extbuf_free(void *addr __rte_unused, void *opaque) > > +{ > > + rte_free(opaque); > > +} > > + > > +static int > > +virtio_dev_extbuf_alloc(struct rte_mbuf *pkt, uint32_t size) > > +{ > > + struct rte_mbuf_ext_shared_info *shinfo = NULL; > > + uint32_t total_len = RTE_PKTMBUF_HEADROOM + size; > > + uint16_t buf_len; > > + rte_iova_t iova; > > + void *buf; > > + > > + /* Try to use pkt buffer to store shinfo to reduce the > > amount of memory > > + * required, otherwise store shinfo in the new buffer. > > + */ > > + if (rte_pktmbuf_tailroom(pkt) >= sizeof(*shinfo)) > > + shinfo = rte_pktmbuf_mtod(pkt, > > + struct > > rte_mbuf_ext_shared_info *); > > + else { > > + total_len += sizeof(*shinfo) + sizeof(uintptr_t); > > + total_len = RTE_ALIGN_CEIL(total_len, > > sizeof(uintptr_t)); > > + } > > + > > + if (unlikely(total_len > UINT16_MAX)) > > + return -ENOSPC; > > + > > + buf_len = total_len; > > + buf = rte_malloc(NULL, buf_len, RTE_CACHE_LINE_SIZE); > > Using rte_malloc() means that the allocation can end up on any numa > node. This external buffer might end up on a different node than the > mbuf (which resides on mp->socket_id node). Only if there is no memory in the local socket. It seems better than a failure to me. fbl